截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lists.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. {layout name="layout1" /}
  2. <div class="wrapper">
  3. <div class="layui-card">
  4. <!-- 操作提示 -->
  5. <div class="layui-card-body">
  6. <div class="layui-collapse" style="border:1px dashed #c4c4c4">
  7. <div class="layui-colla-item">
  8. <h2 class="layui-colla-title like-layui-colla-title">操作提示</h2>
  9. <div class="layui-colla-content layui-show">
  10. <p>*商家提交需要参与活动专区的商品,平台审核通过之后即可参与活动。</p>
  11. </div>
  12. </div>
  13. </div>
  14. </div>
  15. <!-- 搜索区域 -->
  16. <div class="layui-card-body layui-form">
  17. <div class="layui-form-item">
  18. <div class="layui-inline">
  19. <label class="layui-form-label">商家名称:</label>
  20. <div class="layui-input-block">
  21. <input type="text" name="shop_name" id="shop_name" placeholder="请输入商家名称"
  22. autocomplete="off" class="layui-input">
  23. </div>
  24. </div>
  25. <div class="layui-inline">
  26. <label class="layui-form-label">商品名称:</label>
  27. <div class="layui-input-block">
  28. <input type="text" name="goods_name" id="goods_name" placeholder="请输入商品名称"
  29. autocomplete="off" class="layui-input">
  30. </div>
  31. </div>
  32. <div class="layui-inline">
  33. <label class="layui-form-label">活动专区:</label>
  34. <div class="layui-input-block">
  35. <select name="activity_area" id="activity_area">
  36. <option value="">全部</option>
  37. {foreach $activity_area as $item => $val}
  38. <option value="{$val.id}">{$val.name}</option>
  39. {/foreach}
  40. </select>
  41. </div>
  42. </div>
  43. <div class="layui-inline" style="margin-left: 20px;">
  44. <button class="layui-btn layui-btn-sm layuiadmin-btn-ad {$view_theme_color}" lay-submit
  45. lay-filter="list-search">查询
  46. </button>
  47. <button class="layui-btn layui-btn-sm layuiadmin-btn-ad layui-btn-primary " lay-submit
  48. lay-filter="list-clear-search">清空查询
  49. </button>
  50. </div>
  51. </div>
  52. </div>
  53. <!-- 主体区域 -->
  54. <div class="layui-card-body">
  55. <div class="layui-tab layui-tab-card" lay-filter="lists-tab">
  56. <ul class="layui-tab-title">
  57. <li class="layui-this" data-type="1">活动商品({$num.audit_pass})</li>
  58. <li data-type="0">待审核商品({$num.unaudit})</li>
  59. <li data-type="2">审核拒绝商品({$num.audit_refund})</li>
  60. </ul>
  61. <div class="layui-card-body">
  62. <!--表格-->
  63. <table id="lists" lay-filter="lists"></table>
  64. <script type="text/html" id="lists-operation">
  65. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="detail"><i
  66. class="layui-icon"></i>详情</a>
  67. {{# if('待审核' == d.audit_status){ }}
  68. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="audit"><i
  69. class="layui-icon"></i>审核</a>
  70. {{# } }}
  71. {{# if('审核通过' == d.audit_status){ }}
  72. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="violation"><i class="layui-icon"></i>违规重审</a>
  73. {{# } }}
  74. </script>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <script>
  81. layui.use(['table'], function () {
  82. var form = layui.form
  83. , table = layui.table,
  84. type = 1
  85. , element = layui.element;
  86. //监听搜索
  87. form.on('submit(list-search)', function (data) {
  88. var field = data.field;
  89. //执行重载
  90. table.reload('lists', {
  91. where: field
  92. });
  93. });
  94. //清空查询
  95. form.on('submit(list-clear-search)', function () {
  96. $('#shop_name').val('');
  97. $('#goods_name').val('');
  98. $('#activity_area').val('');
  99. form.render('select');
  100. //刷新列表
  101. table.reload('lists', {
  102. where: [],
  103. page: {
  104. curr: 1
  105. },
  106. });
  107. });
  108. element.on('tab(lists-tab)', function (data) {
  109. type = $(this).attr('data-type');
  110. table.reload('lists', {
  111. where: {type: type}
  112. });
  113. });
  114. //事件
  115. var active = {};
  116. $('.layui-btn.layuiadmin-btn-handle').on('click', function () {
  117. var type = $(this).data('type');
  118. active[type] ? active[type].call(this) : '';
  119. });
  120. like.tableLists('#lists', '{:url("activity_area.goods/lists")}', [
  121. {type: 'numbers', title: '序号', align: 'center'}
  122. , {field: 'shop_name', title: '商家名称', align: "center"}
  123. , {field: 'name', title: '商品名称', align: "center"}
  124. , {field: 'min_price', title: '商品最低价格', align: "center"}
  125. , {field: 'max_price', title: '商品最高价格', align: "center"}
  126. , {field: 'activity_area_name', title: '参与专区', align: "center"}
  127. , {field: 'audit_status', title: '审核状态', align: "center"}
  128. , {field: 'audit_remark', title: '审核说明', align: "center"}
  129. , {title: '操作', align: 'center', fixed: 'right', toolbar: '#lists-operation'}
  130. ], {type: type});
  131. //监听工具条
  132. table.on('tool(lists)', function (obj) {
  133. if (obj.event === 'violation') {
  134. var id = obj.data.id;
  135. console.log(obj.data)
  136. layer.open({
  137. type: 2
  138. , title: '违规重审'
  139. , content: '{:url("activity_area.goods/violation")}?id=' + id
  140. , area: ['60%', '60%']
  141. , btn: ['确定', '取消']
  142. , yes: function (index, layero) {
  143. var iframeWindow = window['layui-layer-iframe' + index]
  144. , submitID = 'addSubmit'
  145. , submit = layero.find('iframe').contents().find('#' + submitID);
  146. //监听提交
  147. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  148. var field = data.field;
  149. like.ajax({
  150. url: '{:url("activity_area.goods/violation")}',
  151. data: field,
  152. type: "post",
  153. success: function (res) {
  154. if (res.code == 1) {
  155. layui.layer.msg(res.msg, {
  156. offset: '15px'
  157. , icon: 1
  158. , time: 1000
  159. });
  160. layer.close(index);
  161. table.reload('lists');
  162. window.location.reload();
  163. }
  164. }
  165. });
  166. });
  167. submit.trigger('click');
  168. }
  169. })
  170. } else if (obj.event === 'detail') {
  171. var id = obj.data.id;
  172. layer.open({
  173. type: 2
  174. , title: '活动专区商品详情'
  175. , content: '{:url("activity_area.goods/detail")}?id=' + id
  176. , area: ['90%', '90%']
  177. , btn: ['确定', '取消']
  178. , yes: function (index, layero) {
  179. var iframeWindow = window['layui-layer-iframe' + index]
  180. , submitID = 'edit-submit'
  181. , submit = layero.find('iframe').contents().find('#' + submitID);
  182. submit.trigger('click');
  183. }
  184. })
  185. } else if (obj.event === 'audit') {
  186. var id = obj.data.id;
  187. console.log(obj.data)
  188. layer.open({
  189. type: 2
  190. , title: '审核'
  191. , content: '{:url("activity_area.goods/audit")}?id=' + id
  192. , area: ['60%', '60%']
  193. , btn: ['确定', '取消']
  194. , yes: function (index, layero) {
  195. var iframeWindow = window['layui-layer-iframe' + index]
  196. , submitID = 'addSubmit'
  197. , submit = layero.find('iframe').contents().find('#' + submitID);
  198. //监听提交
  199. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  200. var field = data.field;
  201. like.ajax({
  202. url: '{:url("activity_area.goods/audit")}',
  203. data: field,
  204. type: "post",
  205. success: function (res) {
  206. if (res.code == 1) {
  207. layui.layer.msg(res.msg, {
  208. offset: '15px'
  209. , icon: 1
  210. , time: 1000
  211. });
  212. layer.close(index);
  213. table.reload('lists');
  214. window.location.reload();
  215. }
  216. }
  217. });
  218. });
  219. submit.trigger('click');
  220. }
  221. })
  222. }
  223. });
  224. });
  225. </script>