index.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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="/shop/goods/add">添加商品</a></li>
  8. </ul>
  9. <form class="well form-inline margin-top-20" method="post" action="{:url('/shop/goods/index')}">
  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/index')}">清空</a>
  21. <a class="btn btn-warning" href="{:url('/shop/goods/export')}">导出</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.status">
  63. <case value="1">
  64. <span class="label label-success">已上架</span>
  65. </case>
  66. <case value="2">
  67. <span class="label label-danger">已下架</span>
  68. </case>
  69. </switch>
  70. </td>
  71. <td>
  72. <a class="btn btn-xs btn-primary"
  73. href="{:url('/shop/goods/edit',array('id'=>$vo['id']))}">编辑</a>
  74. <if condition="$vo.status == 1">
  75. <a class="btn btn-xs btn-warning js-ajax-dialog-btn"
  76. href="{:url('/shop/goods/confirm',array('id'=>$vo['id'],'status'=>2))}"
  77. data-msg="确认下架该商品?">下架</a>
  78. <else/>
  79. <a class="btn btn-xs btn-success js-ajax-dialog-btn"
  80. href="{:url('/shop/goods/confirm',array('id'=>$vo['id'],'status'=>1))}"
  81. data-msg="确认上架该商品?">上架</a>
  82. </if>
  83. <a class="btn btn-xs btn-danger js-ajax-dialog-btn"
  84. href="{:url('/shop/goods/del',array('id'=>$vo['id']))}"
  85. data-msg="确认删除该商品?">删除</a>
  86. </td>
  87. </tr>
  88. </foreach>
  89. </tbody>
  90. </table>
  91. <div class="pagination">{$page}</div>
  92. </form>
  93. </div>
  94. <script src="__STATIC__/js/admin.js"></script>
  95. <script>
  96. function reloadPage(win) {
  97. win.location.reload();
  98. }
  99. $(function () {
  100. setCookie("refersh_time", 3);
  101. Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
  102. //批量冻结
  103. $('#js-batch-delete').click(function (e) {
  104. var ids = [];
  105. $("input[name='ids[]']").each(function () {
  106. if ($(this).is(':checked')) {
  107. ids.push($(this).val());
  108. }
  109. });
  110. if (ids.length == 0) {
  111. return false;
  112. }
  113. ids = ids.join(',');
  114. });
  115. //end
  116. });
  117. });
  118. </script>
  119. <script>
  120. function doDelete() {
  121. // Wind.use('artDialog', function () {
  122. var ids = [];
  123. $(".js-check:checked").each(function () {
  124. var id = $(this).val();
  125. if (id > 0) {
  126. ids.push(id);
  127. }
  128. });
  129. if (ids.length <= 0) {
  130. showMsg('请先选择操作项');
  131. return false;
  132. }
  133. if (confirm('确定批量删除选择项?不可恢复')) {
  134. $.post('/shop/goods/del', {id: ids}, function (res) {
  135. if (res.code == 1) {
  136. showMsg(res.msg);
  137. setTimeout(function () {
  138. location.reload();
  139. }, 800)
  140. } else {
  141. showMsg(res.msg);
  142. }
  143. }, "json")
  144. }
  145. }
  146. </script>
  147. </body>
  148. </html>