goods.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <include file="public@header"/>
  2. </head>
  3. <body>
  4. <div class="wrap js-check-wrap">
  5. <ul class="nav nav-tabs">
  6. <li class="active"><a>商品列表</a></li>
  7. <li ><a href="/admin/shop/goodsAdd">添加商品</a></li>
  8. </ul>
  9. <form class="well form-inline margin-top-20" method="post" action="{:url('shop/goods')}">
  10. <select class="form-control" name="cate_id" id="cate_id">
  11. <option value="0">分类</option>
  12. <foreach name="cateList" item="vo">
  13. <option value="{$vo.id}" <if condition="$cate_id == $vo.id">selected</if>>{$vo.name}</option>
  14. </foreach>
  15. </select>
  16. 关键字:
  17. <input class="form-control" type="text" name="keyword" style="width: 200px;" value="{:input('request.keyword')}"
  18. placeholder="商品名称/商家名称">
  19. <input type="submit" class="btn btn-primary" value="搜索"/>
  20. <a class="btn btn-default" href="{:url('shop/goods')}">清空</a>
  21. <a class="btn btn-warning" href="{:url('shop/goodsExport')}">导出</a>
  22. <a class="btn btn-danger" onclick="doDelete()">批量删除</a>
  23. </form>
  24. <form method="post" class="js-ajax-form">
  25. <table class="table table-hover table-bordered">
  26. <thead>
  27. <tr>
  28. <th><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">全选</th>
  29. <th>商家名称</th>
  30. <th width="80">封面图</th>
  31. <th width="80">产品名称</th>
  32. <th>行业</th>
  33. <th>分类</th>
  34. <th>库存</th>
  35. <th>积分</th>
  36. <th width="80">发布时间</th>
  37. <th>{:lang('STATUS')}</th>
  38. <th>{:lang('ACTIONS')}</th>
  39. </tr>
  40. </thead>
  41. <tbody>
  42. <php>
  43. $user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));
  44. </php>
  45. <foreach name="list" item="vo">
  46. <tr>
  47. <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
  48. value="{$vo.id}" title="ID:{$vo.id}">{$vo['id']}</td>
  49. <td>{$vo['name']?$vo['name']:lang('NOT_FILLED')}</td>
  50. <td>
  51. <a href="javascript:imagePreviewDialog('{:cmf_get_image_preview_url($vo.thumb)}');">
  52. <img src="{:cmf_get_image_preview_url($vo.thumb)}" alt="" width="48" height="48">
  53. </a>
  54. </td>
  55. <td>{$vo['goods_name']}</td>
  56. <td>{$vo['business_project']?$vo['business_project']:lang('NOT_FILLED')}</td>
  57. <td>{$vo['cate_name']}</td>
  58. <td>{$vo['stock']?$vo['stock']:0}</td>
  59. <td>{$vo['score']?$vo['score']:lang('NOT_FILLED')}</td>
  60. <td>{$vo['created_at']?$vo['created_at']:lang('NOT_FILLED')}</td>
  61. <!--<td>
  62. <switch name="vo.confirm_status">
  63. <case value="1">
  64. <span class="label label-success">待审核</span>
  65. </case>
  66. <case value="2">
  67. <span class="label danger">已审核</span>
  68. </case>
  69. <case value="3">
  70. <span class="label danger">已驳回</span>
  71. </case>
  72. </switch>
  73. </td>-->
  74. <td>
  75. <switch name="vo.status">
  76. <case value="1">
  77. <span class="label label-success">已上架</span>
  78. </case>
  79. <case value="2">
  80. <span class="label label-danger">已下架</span>
  81. </case>
  82. </switch>
  83. </td>
  84. <td>
  85. <a class="btn btn-xs btn-primary"
  86. href="{:url('shop/goodsEdit',array('id'=>$vo['id']))}">编辑</a>
  87. <if condition="$vo.status == 1">
  88. <a class="btn btn-xs btn-warning js-ajax-dialog-btn"
  89. href="{:url('shop/goodsConfirm',array('id'=>$vo['id'],'status'=>2))}"
  90. data-msg="确认下架该商品?">下架</a>
  91. <else/>
  92. <a class="btn btn-xs btn-success js-ajax-dialog-btn"
  93. href="{:url('shop/goodsConfirm',array('id'=>$vo['id'],'status'=>1))}"
  94. data-msg="确认上架该商品?">上架</a>
  95. </if>
  96. <a class="btn btn-xs btn-danger js-ajax-dialog-btn"
  97. href="{:url('shop/goodsDel',array('id'=>$vo['id']))}"
  98. data-msg="确认删除该商品?">删除</a>
  99. </td>
  100. </tr>
  101. </foreach>
  102. </tbody>
  103. </table>
  104. <div class="pagination">{$page}</div>
  105. </form>
  106. </div>
  107. <script src="__STATIC__/js/admin.js"></script>
  108. <script>
  109. function reloadPage(win) {
  110. win.location.reload();
  111. }
  112. $(function () {
  113. setCookie("refersh_time", 3);
  114. Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
  115. //批量冻结
  116. $('#js-batch-delete').click(function (e) {
  117. var ids = [];
  118. $("input[name='ids[]']").each(function () {
  119. if ($(this).is(':checked')) {
  120. ids.push($(this).val());
  121. }
  122. });
  123. if (ids.length == 0) {
  124. return false;
  125. }
  126. ids = ids.join(',');
  127. });
  128. //end
  129. });
  130. });
  131. </script>
  132. <script>
  133. function doDelete() {
  134. // Wind.use('artDialog', function () {
  135. var ids = [];
  136. $(".js-check:checked").each(function () {
  137. var id = $(this).val();
  138. if (id > 0) {
  139. ids.push(id);
  140. }
  141. });
  142. if (ids.length <= 0) {
  143. showMsg('请先选择操作项');
  144. return false;
  145. }
  146. if (confirm('确定批量删除选择项?不可恢复')) {
  147. $.post('/admin/shop/goodsDel', {id: ids}, function (res) {
  148. if (res.code == 1) {
  149. showMsg(res.msg);
  150. setTimeout(function () {
  151. location.reload();
  152. }, 800)
  153. } else {
  154. showMsg(res.msg);
  155. }
  156. }, "json")
  157. }
  158. }
  159. </script>
  160. </body>
  161. </html>