截流自动化的商城平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

lists.html 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. {layout name="layout1" /}
  2. <style>
  3. .seckill-time{
  4. display: none;
  5. }
  6. </style>
  7. <div class="wrapper">
  8. <div class="layui-card">
  9. <div class="layui-card-body">
  10. <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
  11. <div class="layui-colla-item">
  12. <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
  13. <div class="layui-colla-content layui-show">
  14. <p>*商家提交需要参与限时秒杀的商品,平台审核通过之后即可参与活动</p>
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. <!-- 搜索模块-->
  20. <div class="layui-form" style="margin-bottom: 15px;">
  21. <div class="layui-form-item seach">
  22. <div class="layui-inline">
  23. <label class="layui-form-label">商家名称:</label>
  24. <div class="layui-input-inline" style="width: 200px;">
  25. <input type="text" id="shop_name" name="shop_name" placeholder="请输入商家名称" autocomplete="off" class="layui-input">
  26. </div>
  27. </div>
  28. <div class="layui-inline">
  29. <label class="layui-form-label">商品名称:</label>
  30. <div class="layui-input-inline" style="width: 200px;">
  31. <input type="text" id="name" name="name" placeholder="请输入商品名称" autocomplete="off" class="layui-input">
  32. </div>
  33. </div>
  34. <div class="layui-inline">
  35. <label class="layui-form-label">参与日期:</label>
  36. <div class="layui-input-inline" style="width: 200px;">
  37. <input type="text" id="start_end" disabled name="start_end" autocomplete="off" class="layui-input">
  38. </div>
  39. </div>
  40. <div class="layui-inline">
  41. <label class="layui-form-label">秒杀时段:</label>
  42. <div class="layui-input-inline">
  43. <select name="seckill_id" id="seckill_id">
  44. <option value="">全部</option>
  45. {foreach $seckill_time as $item}
  46. <option value="{$item['id']}">{$item['time']}</option>
  47. {/foreach}
  48. </select>
  49. </div>
  50. </div>
  51. <div class="layui-inline">
  52. <button class="layui-btn layui-btn-sm layuiadmin-btn-seckill {$view_theme_color}" lay-submit lay-filter="seckill-search">查询</button>
  53. <button class="layui-btn layui-btn-sm layuiadmin-btn-seckill layui-btn-primary" lay-submit lay-filter="seckill-clear-search">清空查询</button>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="layui-tab layui-tab-card" lay-filter="tab-all">
  58. <ul class="layui-tab-title">
  59. <li data-type="seckill" class="layui-this">审核通过(秒杀中{$statistics.seckillCount})</li>
  60. <li data-type="un_seckill" >审核通过(非秒杀中{$statistics.unSeckillCount})</li>
  61. <li data-type="wait_review" >待审核商品({$statistics.waitReview})</li>
  62. <li data-type="refuse_review" >审核拒绝商品({$statistics.refuseReview})</li>
  63. </ul>
  64. <div class="layui-card">
  65. <div class="layui-card-body">
  66. <table id="seckill-lists" lay-filter="seckill-lists"></table>
  67. <script type="text/html" id="shop-info">
  68. <img src="{{d.shop_logo}}" style="height:80px;width: 80px;margin-right: 10px;" class="image-show">
  69. <div class="layui-input-inline" style="text-align:left;width: 240px">
  70. <p>商家编号:{{d.shop_id}}</p>
  71. <p style="width: 180px;text-overflow:ellipsis;overflow: hidden">商家名称:{{d.shop_name}}</p>
  72. <p>商家类型:{{d.shop_type_desc}}</p>
  73. </div>
  74. </script>
  75. <script type="text/html" id="goods-info">
  76. <img src="{{d.image}}" style="height:60px;width: 60px" class="image-show"> {{d.name}}
  77. </script>
  78. <script type="text/html" id="goods-operation">
  79. <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="edit_goods">详情</a>
  80. {{# if( (d.review_status == 1) ){ }}
  81. <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="re_audit">违规重审</a>
  82. {{# } }}
  83. {{# if( (d.review_status == 0) ){ }}
  84. <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="audit">审核</a>
  85. {{# } }}
  86. </script>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <style>
  93. .layui-table-cell {
  94. height: auto;
  95. }
  96. </style>
  97. <script>
  98. layui.config({
  99. version:"{$front_version}",
  100. base: '/static/lib/' //静态资源所在路径
  101. }).use(['table','form','laydate'], function(){
  102. var $ = layui.$
  103. ,form = layui.form
  104. ,laydate = layui.laydate
  105. ,table = layui.table
  106. ,element = layui.element;
  107. laydate.render({
  108. elem: '#start_end' //指定元素
  109. ,range: '~'
  110. });
  111. //监听搜索
  112. form.on('submit(seckill-search)', function(data){
  113. var field = data.field;
  114. //执行重载
  115. table.reload('seckill-lists', {
  116. where: field,
  117. page: {
  118. curr: 1 //重新从第 1 页开始
  119. }
  120. });
  121. });
  122. $('.layui-btn.layuiadmin-btn-seckill').on('click', function(){
  123. var type = $(this).data('type');
  124. active[type] ? active[type].call(this) : '';
  125. });
  126. //图片放大
  127. $(document).on('click', '.image-show', function () {
  128. var src = $(this).attr('src');
  129. like.showImg(src,600);
  130. });
  131. //清空查询
  132. form.on('submit(seckill-clear-search)', function(){
  133. $('#name').val(''); //清空输入框
  134. $('#seckill_id').val(''); //清空输入框
  135. form.render('select');
  136. //刷新列表
  137. table.reload('seckill-lists', {
  138. where: [],
  139. page: {
  140. curr: 1 //重新从第 1 页开始
  141. }
  142. });
  143. });
  144. //获取列表
  145. getList('seckill')
  146. //切换列表
  147. element.on('tab(tab-all)', function (data) {
  148. var type = $(this).attr('data-type');
  149. getList(type)
  150. });
  151. //监听工具条
  152. table.on('tool(seckill-lists)', function(obj){
  153. var id = obj.data.id;
  154. if(obj.event === 're_audit'){
  155. var goods_id = obj.data.goods_id;
  156. var goods_name = obj.data.name;
  157. var seckill_id = obj.data.seckill_id;
  158. var start_date = obj.data.start_date;
  159. var end_date = obj.data.end_date;
  160. layer.open({
  161. type: 2
  162. ,title: '违规重审'
  163. ,content: '{:url("seckill.seckill_goods/reAudit")}?goods_id='+ goods_id + '&seckill_id=' + seckill_id + '&start_date=' + start_date + '&end_date=' + end_date
  164. ,area: ['60%', '60%']
  165. ,btn: ['确定', '返回']
  166. ,scrollbar: false
  167. ,maxmin: true
  168. ,yes: function(index, layero){
  169. var iframeWindow = window['layui-layer-iframe'+ index]
  170. ,submitID = 'reaudit-submit'
  171. ,submit = layero.find('iframe').contents().find('#'+ submitID);
  172. //监听提交
  173. iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
  174. var field = data.field;
  175. like.ajax({
  176. url:'{:url("seckill.seckill_goods/reAudit")}',
  177. data:field,
  178. type:"post",
  179. success:function(res)
  180. {
  181. if(res.code == 1)
  182. {
  183. layui.layer.msg(res.msg, {
  184. offset: '15px'
  185. , icon: 1
  186. , time: 1000
  187. },function () {
  188. window.location.href = window.location.href;
  189. });
  190. }
  191. }
  192. });
  193. });
  194. submit.trigger('click');
  195. layer.close(index);
  196. }
  197. ,cancel: function(index, layero){
  198. layer.close(index);
  199. }
  200. });
  201. }
  202. if(obj.event === 'audit') {
  203. var goods_id = obj.data.goods_id;
  204. var seckill_id = obj.data.seckill_id;
  205. var start_date = obj.data.start_date;
  206. var end_date = obj.data.end_date;
  207. layer.open({
  208. type: 2
  209. ,title: '审核'
  210. ,content: '{:url("seckill.seckill_goods/audit")}?goods_id='+ goods_id + '&seckill_id=' + seckill_id + '&start_date=' + start_date + '&end_date=' + end_date
  211. ,area: ['60%', '60%']
  212. ,btn: ['确定', '返回']
  213. ,scrollbar: false
  214. ,maxmin: true
  215. ,yes: function(index, layero){
  216. var iframeWindow = window['layui-layer-iframe'+ index]
  217. ,submitID = 'audit-submit'
  218. ,submit = layero.find('iframe').contents().find('#'+ submitID);
  219. //监听提交
  220. iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
  221. var field = data.field;
  222. like.ajax({
  223. url:'{:url("seckill.seckill_goods/audit")}',
  224. data:field,
  225. type:"post",
  226. success:function(res)
  227. {
  228. if(res.code == 1)
  229. {
  230. layui.layer.msg(res.msg, {
  231. offset: '15px'
  232. , icon: 1
  233. , time: 1000
  234. },function () {
  235. window.location.href = window.location.href;
  236. layer.close(index);
  237. });
  238. }
  239. }
  240. });
  241. });
  242. submit.trigger('click');
  243. }
  244. ,cancel: function(index, layero){
  245. layer.close(index);
  246. }
  247. });
  248. }
  249. if(obj.event === 'edit_goods'){
  250. var id = obj.data.goods_id;
  251. var seckill_id = obj.data.seckill_id;
  252. var start_date = obj.data.start_date;
  253. var end_date = obj.data.end_date;
  254. var index = layer.open({
  255. type: 2
  256. , title: '详情'
  257. , content: '{:url("seckill.seckill_goods/editGoods")}?id=' + id+'&seckill_id='+seckill_id+'&start_date=' + start_date + '&end_date=' + end_date
  258. , area: ['90%', '90%']
  259. , btn: ['关闭']
  260. , maxmin: true
  261. , yes: function (index, layero) {
  262. layer.close(index); //关闭弹层
  263. }
  264. });
  265. }
  266. });
  267. function getList(type) {
  268. layui.define(['table', 'form'], function(exports){
  269. var $ = layui.$
  270. ,table = layui.table
  271. ,form = layui.form
  272. ,url = '{:url("seckill.seckill_goods/goodsLists")}?type=' + type;
  273. var cols = [
  274. {title: '商家',width:320,toolbar: '#shop-info'},
  275. {title: '商品',width:320,toolbar: '#goods-info'}
  276. ,{field: 'goods_price',width:160, title: '商品价格'}
  277. ,{field: 'seckill_price',width:160, title:'秒杀价格'}
  278. ,{field: 'date',width:220, title:'参与日期'}
  279. ,{field: 'time',width:180, align: 'center', title:'秒杀时段'}
  280. ,{field: 'review_status_desc',width:220, title:'审核状态'}
  281. ,{field: 'review_desc',width:220, title:'审核说明'}
  282. ,{fixed: 'right', title: '操作',width:280, align: 'center', toolbar: '#goods-operation'}
  283. ];
  284. table.render({
  285. id:'seckill-lists'
  286. ,elem: '#seckill-lists'
  287. ,url: url //模拟接口
  288. ,cols: [cols]
  289. ,page:true
  290. ,text: {none: '暂无数据!'}
  291. ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
  292. return {
  293. "code":res.code,
  294. "msg":res.msg,
  295. "count": res.data.count, //解析数据长度
  296. "data": res.data.lists, //解析数据列表
  297. };
  298. },
  299. response: {
  300. statusCode: 1
  301. }
  302. ,done: function(res, curr, count){
  303. // 解决操作栏因为内容过多换行问题
  304. $(".layui-table-main tr").each(function (index, val) {
  305. $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
  306. $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
  307. });
  308. }
  309. });
  310. });
  311. }
  312. });
  313. </script>