|
@@ -46,78 +46,94 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
|
|
|
<div class="row">
|
|
|
<div class="col-xs-12">
|
|
|
<div class="table-responsive">
|
|
|
- <table class="table table-striped table-bordered table-hover">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th>产品编码</th>
|
|
|
- <th>产品名称</th>
|
|
|
- <th>规格</th>
|
|
|
- <th>产品价格</th>
|
|
|
- <th>剩余库存</th>
|
|
|
- <th>产品销量</th>
|
|
|
- <th>产品库存</th>
|
|
|
- <th>产品状态</th>
|
|
|
- <th>服务城市</th>
|
|
|
- <th>排序</th>
|
|
|
- <th>限购数量</th>
|
|
|
- <th>修改时间</th>
|
|
|
- <th>操作</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- @foreach ($list as $a)
|
|
|
- <tr>
|
|
|
- <td> {{$a['product_code']}}</td>
|
|
|
- <td> {{$a['name']}}</td>
|
|
|
- <td> {{$a['spec']}}</td>
|
|
|
- <td> ¥<del>{{$a['market_price']}}</del> ¥{{$a['price']}}</td>
|
|
|
- <td>{{$a['stock']}}</td>
|
|
|
- <td>{{$a['sales_total']}}</td>
|
|
|
- <td>{{$a['stock_total']}}</td>
|
|
|
- <td> {{$a['status']?'已下架':'已上架'}} </td>
|
|
|
- <td> {{$a['city_name']}}</td>
|
|
|
- <td>
|
|
|
- @if(check_auth('admin/product/set_sort'))
|
|
|
- <input type="text" class="set_sort" id="{{$a['id']}}" value="{{$a['sort']}}">
|
|
|
- @else
|
|
|
- {{$a['sort']}}
|
|
|
- @endif
|
|
|
- </td>
|
|
|
- <td> {{$a['quota']}} </td>
|
|
|
- <td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
|
|
|
- <td>
|
|
|
- @if(check_auth('admin/product/edit'))
|
|
|
- <a class="btn btn-sm btn-warning" href="{{url('admin/product/edit?'.http_build_query(['id'=>$a['id']]))}}" title="查看">
|
|
|
- 编辑
|
|
|
- </a>
|
|
|
- @endif
|
|
|
- @if(check_auth('admin/product/copy'))
|
|
|
- <a class="btn btn-sm btn-primary" href="{{url('admin/product/copy?'.http_build_query(['id'=>$a['id']]))}}" title="复制">
|
|
|
- 复制
|
|
|
- </a>
|
|
|
- @endif
|
|
|
- @if(check_auth('admin/product/set_status'))
|
|
|
- @if ($a['status'])
|
|
|
- <a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
|
|
|
- 上架
|
|
|
- </a>
|
|
|
+ <form action="{{url('admin/product/batch_status')}}" method="post" class="post-form" id="batch_form">
|
|
|
+ <table class="table table-striped table-bordered table-hover">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>产品编码</th>
|
|
|
+ <th>产品名称</th>
|
|
|
+ <th>规格</th>
|
|
|
+ <th>产品价格</th>
|
|
|
+ <th>剩余库存</th>
|
|
|
+ <th>产品销量</th>
|
|
|
+ <th>产品库存</th>
|
|
|
+ <th>产品状态</th>
|
|
|
+ <th>服务城市</th>
|
|
|
+ <th>排序</th>
|
|
|
+ <th>限购数量</th>
|
|
|
+ <th>修改时间</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ @foreach ($list as $a)
|
|
|
+ <tr>
|
|
|
+ <td> <label ><input type="checkbox" name="product_list[]" class="check_items" value="{{$a['id']}}"> {{$a['product_code']}}</label></td>
|
|
|
+ <td> {{$a['name']}}</td>
|
|
|
+ <td> {{$a['spec']}}</td>
|
|
|
+ <td> ¥<del>{{$a['market_price']}}</del> ¥{{$a['price']}}</td>
|
|
|
+ <td>{{$a['stock']}}</td>
|
|
|
+ <td>{{$a['sales_total']}}</td>
|
|
|
+ <td>{{$a['stock_total']}}</td>
|
|
|
+ <td> {{$a['status']?'已下架':'已上架'}} </td>
|
|
|
+ <td> {{$a['city_name']}}</td>
|
|
|
+ <td>
|
|
|
+ @if(check_auth('admin/product/set_sort'))
|
|
|
+ <input type="text" class="set_sort" id="{{$a['id']}}" value="{{$a['sort']}}">
|
|
|
@else
|
|
|
- <a class="delete btn btn-sm btn-danger" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'1']))}}">
|
|
|
- 下架
|
|
|
- </a>
|
|
|
+ {{$a['sort']}}
|
|
|
@endif
|
|
|
- @endif
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- @endforeach
|
|
|
- <tr>
|
|
|
- <td colspan="20" class="page">{{$list->render()}}</td>
|
|
|
- </tr>
|
|
|
- <tr>
|
|
|
- <td colspan="20">总计 {{$list->total()}} 个产品</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ </td>
|
|
|
+ <td> {{$a['quota']}} </td>
|
|
|
+ <td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
|
|
|
+ <td>
|
|
|
+ @if(check_auth('admin/product/edit'))
|
|
|
+ <a class="btn btn-sm btn-warning" href="{{url('admin/product/edit?'.http_build_query(['id'=>$a['id']]))}}" title="查看">
|
|
|
+ 编辑
|
|
|
+ </a>
|
|
|
+ @endif
|
|
|
+ @if(check_auth('admin/product/copy'))
|
|
|
+ <a class="btn btn-sm btn-primary" href="{{url('admin/product/copy?'.http_build_query(['id'=>$a['id']]))}}" title="复制">
|
|
|
+ 复制
|
|
|
+ </a>
|
|
|
+ @endif
|
|
|
+ @if(check_auth('admin/product/set_status'))
|
|
|
+ @if ($a['status'])
|
|
|
+ <a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
|
|
|
+ 上架
|
|
|
+ </a>
|
|
|
+ @else
|
|
|
+ <a class="delete btn btn-sm btn-danger" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'1']))}}">
|
|
|
+ 下架
|
|
|
+ </a>
|
|
|
+ @endif
|
|
|
+ @endif
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ @endforeach
|
|
|
+ <tr>
|
|
|
+ <td><label ><input type="checkbox" class="check_all" > 全选</label></td>
|
|
|
+ <td>
|
|
|
+ <select name="status" class="form-control" required="" >
|
|
|
+ <option value="">选择操作</option>
|
|
|
+ <option value="1">下架</option>
|
|
|
+ <option value="0">上架</option>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ <td colspan="20" >
|
|
|
+ @csrf
|
|
|
+ <input type="submit" class="btn btn-sm btn-primary" value="提交"/>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td colspan="20" class="page">{{$list->render()}}</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td colspan="20">总计 {{$list->total()}} 个产品</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </form>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -200,4 +216,47 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
|
|
|
});
|
|
|
})
|
|
|
</script>
|
|
|
+<script>
|
|
|
+ $(function(){
|
|
|
+ // 全选按钮
|
|
|
+ $('.check_all').click(function(){
|
|
|
+ // 获取选择状态
|
|
|
+ var check_all = $(this).prop('checked');
|
|
|
+ // 子项选择
|
|
|
+ $('.check_items').prop('checked',check_all);
|
|
|
+ })
|
|
|
+ // 单选按钮
|
|
|
+ $('.check_items').click(function(){
|
|
|
+ // 默认全选
|
|
|
+ var check_all = true;
|
|
|
+ // 循环选项
|
|
|
+ $.each($('.check_items'),function(k,v){
|
|
|
+ // 选项状态
|
|
|
+ var check_items = $(v).prop('checked');
|
|
|
+ // 如果有一个未选。取消全选
|
|
|
+ if( !check_items ) check_all = false;
|
|
|
+ })
|
|
|
+ // 修改
|
|
|
+ $('.check_all').prop('checked',check_all);
|
|
|
+ })
|
|
|
+ // 站点传输
|
|
|
+ $('#batch_form').submit(function(){
|
|
|
+ // 默认未选择
|
|
|
+ var checked = false;
|
|
|
+ // 循环选项
|
|
|
+ $.each($('.check_items'),function(k,v){
|
|
|
+ // 选项状态
|
|
|
+ var check_items = $(v).prop('checked');
|
|
|
+ // 如果有一个选中,改为已选
|
|
|
+ if( check_items ) checked = true;
|
|
|
+ })
|
|
|
+ // 未选择,提示
|
|
|
+ if( !checked ) {
|
|
|
+ alert('请至少选择一个产品');
|
|
|
+ // 阻止事件
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+})
|
|
|
+</script>
|
|
|
@endsection
|