index.blade.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. @extends('admin.public.base')
  2. @section('body_class')
  3. style="margin: 0 auto;width: 96%;padding: 30px 0px;"
  4. @endsection
  5. @section('content')
  6. <div class="page-header">
  7. @if(check_auth('admin/product/add'))
  8. <a href="{{url('admin/product/add')}}" class="btn btn-primary">新增</a>
  9. @endif
  10. </div>
  11. <form action="" method="get" class="form-horizontal form-line">
  12. <div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
  13. <input type="text" class="form-control" name="product_code" value="{{request('product_code','')}}" placeholder="请输入产品编码查询" />
  14. </div>
  15. <div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
  16. <input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入产品名称查询" />
  17. </div>
  18. <div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
  19. <select name="status" class="form-control">
  20. <option value="" >产品状态</option>
  21. <option value="0" @if (request('status') === '0' ) selected="selected" @endif >已上架</option>
  22. <option value="1" @if (request('status') === '1' ) selected="selected" @endif >编辑中</option>
  23. <option value="2" @if (request('status') === '2' ) selected="selected" @endif >预上架</option>
  24. <option value="3" @if (request('status') === '3' ) selected="selected" @endif >已中止</option>
  25. <option value="4" @if (request('status') === '4' ) selected="selected" @endif >已结束</option>
  26. </select>
  27. </div>
  28. <div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12">
  29. <select name="city_ids[]" class="form-control selectpicker" data-max-options="20" data-live-search="true" data-live-search-placeholder="搜索城市" data-none-results-text="未搜索到 {0}" title="选择城市" multiple>
  30. @foreach ($cityList as $group)
  31. <optgroup label="{{$group['name']}}">
  32. @foreach ($group['city'] as $city)
  33. <option value="{{$city['id']}}" @if ( in_array($city['id'],request('city_ids',[])) ) selected="selected" @endif >{{$city['name']}}</option>
  34. @endforeach
  35. </optgroup>
  36. @endforeach
  37. </select>
  38. </div>
  39. <div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
  40. <select name="business_id" class="form-control">
  41. <option value="" >商业公司</option>
  42. @foreach ($businessList as $business)
  43. <option value="{{$business['id']}}" @if (request('business_id') === $business['id'] ) selected="selected" @endif >{{$business['name']}}</option>
  44. @endforeach
  45. </select>
  46. </div>
  47. <div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-2" style="margin-right: 2px;">
  48. <input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入创建时间查询" />
  49. </div>
  50. <input type="submit" class="btn btn-sm btn-primary" value="查询"/>
  51. <a href="{{url('admin/product/index')}}" class="btn btn-sm btn-default" >重置</a>
  52. </form>
  53. <div class="row">
  54. <div class="col-xs-12">
  55. <div class="table-responsive">
  56. <table class="table table-striped table-bordered table-hover">
  57. <thead>
  58. <tr>
  59. <th>产品编码</th>
  60. <th>产品名称</th>
  61. <th>规格</th>
  62. <th>产品价格</th>
  63. <th>剩余库存</th>
  64. <th>产品销量</th>
  65. <th>产品库存</th>
  66. <th>服务城市</th>
  67. <th>商业公司</th>
  68. <th>排序</th>
  69. <th>限购数量</th>
  70. <th>产品状态</th>
  71. <th>修改时间</th>
  72. <th>操作</th>
  73. </tr>
  74. </thead>
  75. <tbody>
  76. @foreach ($list as $a)
  77. <tr>
  78. <td> {{$a['product_code']}}</td>
  79. <td> {{$a['name']}}</td>
  80. <td> {{$a['spec']}}</td>
  81. <td> ¥<del>{{$a['market_price']}}</del> ¥{{$a['price']}}</td>
  82. <td>{{$a['stock']}}</td>
  83. <td>{{$a['sales_total']}}</td>
  84. <td>{{$a['stock_total']}}</td>
  85. <td> {{$a['city_name']}}</td>
  86. <td> {{$a['business_name']}}</td>
  87. <td>
  88. @if(check_auth('admin/product/set_sort'))
  89. <input type="text" class="set_sort" id="{{$a['id']}}" value="{{$a['sort']}}">
  90. @else
  91. {{$a['sort']}}
  92. @endif
  93. </td>
  94. <td> {{$a['quota']}} </td>
  95. <td>
  96. @switch($a['status'])
  97. @case(1)
  98. 编辑中
  99. @break
  100. @case(0)
  101. 已上架
  102. @break
  103. @case(2)
  104. 预上架
  105. @break
  106. @case(3)
  107. 已中止
  108. @break
  109. @case(4)
  110. 已结束
  111. @break
  112. @default
  113. @break
  114. @endswitch
  115. </td>
  116. <td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
  117. <td>
  118. @if(check_auth('admin/product/edit'))
  119. <a class="btn btn-sm btn-warning" href="{{url('admin/product/edit?'.http_build_query(['id'=>$a['id']]))}}" title="查看">
  120. @if ( $a['status'] && $a['status'] != 2 ) 编辑 @else 查看 @endif
  121. </a>
  122. @endif
  123. @if(check_auth('admin/product/copy'))
  124. <a class="btn btn-sm btn-primary" href="{{url('admin/product/copy?'.http_build_query(['id'=>$a['id']]))}}" title="复制">
  125. 复制
  126. </a>
  127. @endif
  128. @if(check_auth('admin/product/set_status'))
  129. @switch($a['status'])
  130. @case(0)
  131. <a class="delete btn btn-sm btn-danger" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'3']))}}">
  132. 下架
  133. </a>
  134. @break
  135. @case(1)
  136. @if ( $a['puton_time'] )
  137. <a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'2']))}}">
  138. 预上架
  139. </a>
  140. @else
  141. <a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
  142. 上架
  143. </a>
  144. @endif
  145. @break
  146. @case(2)
  147. <a class="delete btn btn-sm btn-danger" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'3']))}}">
  148. 下架
  149. </a>
  150. @break
  151. @case(3)
  152. @if ( $a['puton_time'] )
  153. <a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'2']))}}">
  154. 预上架
  155. </a>
  156. @else
  157. <a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
  158. 上架
  159. </a>
  160. @endif
  161. @break
  162. @case(4)
  163. @if ( $a['puton_time'] )
  164. <a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'2']))}}">
  165. 预上架
  166. </a>
  167. @else
  168. <a class="delete btn btn-sm btn-success" data-url="{{url('admin/product/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
  169. 上架
  170. </a>
  171. @endif
  172. @break
  173. @endswitch
  174. @endif
  175. @if(check_auth('admin/product/get_poster'))
  176. <a href="{{url('admin/product/get_poster?'.http_build_query(['id'=>$a['id']]))}}" class="btn btn-sm btn-success" >海报</a>
  177. @endif
  178. </td>
  179. </tr>
  180. @endforeach
  181. <tr>
  182. <td colspan="20" class="page">{{$list->render()}}</td>
  183. </tr>
  184. <tr>
  185. <td colspan="20">总计 {{$list->total()}} 个产品</td>
  186. </tr>
  187. </tbody>
  188. </table>
  189. </div>
  190. </div>
  191. </div>
  192. @endsection
  193. @section('javascript')
  194. <script>
  195. $(function(){
  196. $('.set_sort').change(function(){
  197. var id = $(this).attr('id');
  198. var sort = $(this).val();
  199. $.ajax({
  200. type: 'get',
  201. url: "{{url('admin/product/set_sort')}}",
  202. data: {id:id,sort:sort},
  203. dataType: 'json',
  204. success: function(data) {
  205. art_dialog(data);
  206. },
  207. error: function(data) {
  208. art.dialog({
  209. content: data.responseJSON.message,
  210. lock: true,
  211. ok: function() {
  212. }
  213. });
  214. }
  215. });
  216. })
  217. })
  218. </script>
  219. @endsection