Нет описания

index.blade.php 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. @extends('admin/master')
  2. @section('content')
  3. <body>
  4. @if(session('info'))
  5. <div class="Huialert Huialert-info" onclick="$(this).remove()" id="info">
  6. {{session('info')}}
  7. </div>
  8. @endif
  9. <div class="page-container">
  10. <div>
  11. <input class="input-text" style="width:5%;text-align:center" type="text" value="商品名称"/>
  12. <input id="name" type="text" class="input-text" style="width:8%;text-align:center" name="name" value="{{$name?$name:''}}">
  13. <input class="input-text" style="width:5%;text-align:center" type="text" value="商品分类"/>
  14. <select style="width:7%;text-align:center" name="cate_name" id='cate_name'>
  15. <option value="0" @if($cate_name=='') selected @endif>选择分类</option>
  16. @foreach($cates as $v)
  17. <option value="{{$v}}" @if($cate_name==$v) selected @endif>{{$v}}</option>
  18. @endforeach
  19. </select>
  20. <a class="btn btn-primary radius" onclick="user_search()" href="javascript:;">搜索</a>
  21. <a class="btn btn-primary radius" onclick="admin_add('新增')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 新增商品</a>
  22. </div>
  23. <div class="mt-20">
  24. <table class="table table-border table-bordered table-bg table-hover table-sort">
  25. <thead>
  26. <tr class="text-c">
  27. {{--<th width="25"><input type="checkbox" name="" value=""></th>--}}
  28. <th width="5%">商品编号</th>
  29. <th width="10%">商品标题</th>
  30. <th width="8%">商品分类</th>
  31. <th width="8%">商品图片</th>
  32. <th width="8%">商品货号</th>
  33. <th width="25%">商品规格</th>
  34. <th width="15%">商品描述</th>
  35. <th width="5%">上架状态</th>
  36. <th width="8%">创建时间</th>
  37. <th width="10%">操作</th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. @if($result)
  42. @foreach($result as $a)
  43. <tr class="text-c">
  44. {{--<td><input name="" type="checkbox" value=""></td>--}}
  45. <td class="text-c">{{$a['id']}}</td>
  46. <td class="text-c">{{$a['name']}}</td>
  47. <td class="text-c">{{$a['goodsCategoryName']}}</td>
  48. <td class="text-c"><img style="width:100px;" src="{{$a['picUrl']}}" /></td>
  49. <td class="text-c">{{$a['productCode']}}</td>
  50. <td class="text-c">
  51. @foreach($a['sku_list'] as $item)
  52. 规格:{{$item['propsName']}}&nbsp;&nbsp; 可用库存:{{$item['quantity']}} &nbsp;&nbsp; 预占库存:{{$item['w_num']}} @if($item['is_weigh']==1)【称重商品】 @endif <br>
  53. @endforeach
  54. </td>
  55. <td class="text-c">{{$a['description']}}</td>
  56. <td class="text-c">@if($a['is_del']==1) 已下架 @else 已上架 @endif</td>
  57. <td class="text-c">{{$a['createTime']}}</td>
  58. <td class="f-14 product-brand-manage">
  59. <a style="text-decoration:none" onClick='admin_edit("编辑","{{$a['id']}}")' href="javascript:;" title="编辑"><span class="btn btn-primary radius">编辑</span></a>
  60. <a style="text-decoration:none" onClick='sku_edit("规格管理","{{$a['id']}}")' href="javascript:;" title="规格管理"><span class="btn btn-primary radius">规格管理</span></a>
  61. @if($a['is_del']==0)
  62. <a style="text-decoration:none" class="ml-5" onClick="admin_down(this, '{{$a["id"]}}')" href="javascript:;" title="下架"><span class="btn btn-danger radius">下架</span></a>
  63. @elseif($a['is_del']==1)
  64. <a style="text-decoration:none" class="ml-5" onClick="admin_up(this, '{{$a['id']}}')" href="javascript:;" title="上架"><span class="btn btn-success radius">上架</span></a>
  65. @endif
  66. <a style="text-decoration:none" class="ml-5" onClick="admin_del(this, '{{$a["id"]}}')" href="javascript:;" title="删除"><span class="btn btn-danger radius">删除</span></a>
  67. </td>
  68. </tr>
  69. @endforeach
  70. @endif
  71. </tbody>
  72. </table>
  73. </div>
  74. <div id="page" class="page_div"></div>
  75. </div>
  76. <!--_footer 作为公共模版分离出去-->
  77. <script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
  78. <script type="text/javascript" src="/admin/lib/layer/2.4/layer.js"></script>
  79. <script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
  80. <script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
  81. <script type="text/javascript" src="/admin/lib/page/paging.js"></script>
  82. <!--/_footer 作为公共模版分离出去-->
  83. <!--/_footer 作为公共模版分离出去-->
  84. <script type="text/javascript">
  85. $(function(){
  86. setTimeout("$('#info').hide()",3000);
  87. });
  88. /*管理员-添加*/
  89. function admin_add(title){
  90. location.href = '/admin/goods/create';
  91. }
  92. /*管理员-编辑*/
  93. function admin_edit(title,id){
  94. var page = '{{$page}}';
  95. location.href = "/admin/goods/edit/"+id+'?page=' + page;
  96. }
  97. function sku_edit(title,id){
  98. location.href = "/admin/goods/skulist?goods_id="+id;
  99. }
  100. function user_search(){
  101. var name = $('#name').val();
  102. var cate_name = $('#cate_name').val();
  103. location.href='index?page='+num + '&name='+name + '&cate_name='+cate_name;
  104. }
  105. /*管理员-下架*/
  106. function admin_down(obj,id){
  107. layer.confirm('确认要下架吗?',function(index){
  108. $.ajax({
  109. type: 'GET',
  110. url: '/admin/goods/down/'+id,
  111. dataType: 'json',
  112. success: function(data){
  113. if(data == 1){
  114. location.reload();
  115. }
  116. }
  117. });
  118. });
  119. }
  120. /**/
  121. function admin_up(obj,id){
  122. layer.confirm('确认要上架吗?',function(index){
  123. $.ajax({
  124. type: 'GET',
  125. url: '/admin/goods/up/'+id,
  126. dataType: 'json',
  127. success: function(data){
  128. if(data == 1){
  129. location.reload();
  130. }
  131. }
  132. });
  133. });
  134. }
  135. /*管理员-删除*/
  136. function admin_del(obj,id){
  137. layer.confirm('确认要删除吗?',function(index){
  138. $.ajax({
  139. type: 'GET',
  140. url: '/admin/goods/delete/'+id,
  141. dataType: 'json',
  142. success: function(data){
  143. if(data == 1){
  144. location.reload();
  145. }
  146. }
  147. });
  148. });
  149. }
  150. $("#page").paging({
  151. pageNo:{{$page}},
  152. totalPage: {{$pages}},
  153. totalSize: {{$count}},
  154. callback: function(num) {
  155. var name = $('#name').val();
  156. var cate_name = $('#cate_name').val();
  157. location.href='index?page='+num + '&name='+name + '&cate_name='+cate_name;
  158. }
  159. })
  160. </script>
  161. </body>
  162. @endsection