截流自动化的商城平台
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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. {layout name="layout1" /}
  2. <style>
  3. .layui-table-cell {
  4. height: auto;
  5. white-space: normal;
  6. }
  7. </style>
  8. <div class="wrapper">
  9. <div class="layui-card">
  10. <div class="layui-card-body">
  11. <div class="layui-collapse like-layui-collapse">
  12. <div class="layui-colla-item">
  13. <h2 class="layui-colla-title like-layui-colla-title">操作提示</h2>
  14. <div class="layui-colla-content layui-show">
  15. <p>* 商家提交直播商品后,平台审核后,将交由微信再次进行审核;</p>
  16. <p>* 直播商品每天最多可添加500次,删除商品每天最多可删除1000次。</p>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <!-- 搜索区域 -->
  22. <div class="layui-card-body layui-form">
  23. <div class="layui-form-item">
  24. <div class="layui-inline">
  25. <label class="layui-form-label">商家名称:</label>
  26. <div class="layui-input-block">
  27. <select name="shop_id" id="shop_id">
  28. <option value="">全部</option>
  29. {foreach $shop as $val}
  30. <option value="{$val.id}">{$val.name}</option>
  31. {/foreach}
  32. </select>
  33. </div>
  34. </div>
  35. <div class="layui-inline">
  36. <label for="goods_name" class="layui-form-label">商品名称:</label>
  37. <div class="layui-inline" style="margin-right:0;">
  38. <div class="layui-input-inline" >
  39. <input type="text" id="goods_name" name="goods_name" placeholder="请输入商品名称"
  40. autocomplete="off" class="layui-input">
  41. </div>
  42. </div>
  43. </div>
  44. <div class="layui-inline">
  45. <a class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="search">搜索</a>
  46. <a class="layui-btn layui-btn-sm layui-btn-primary" lay-submit lay-filter="clear-search">重置</a>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="layui-tab layui-tab-card" lay-filter="tab-all">
  51. <ul class="layui-tab-title">
  52. <li data-type="all" class="layui-this">全部</li>
  53. <li data-type="ing">审核中</li>
  54. <li data-type="success">审核通过</li>
  55. <li data-type="fail">审核未通过</li>
  56. </ul>
  57. <div class="layui-tab-item layui-show">
  58. <div class="layui-card">
  59. <div class="layui-card-body">
  60. <div style="padding-bottom: 10px;" class="add">
  61. <!-- <button class="layui-btn layui-btn-sm layuiadmin-btn layui-btn-primary" data-type="sync">-->
  62. <!-- 同步商品库-->
  63. <!-- </button>-->
  64. </div>
  65. <table id="like-table-lists" lay-filter="like-table-lists"></table>
  66. <script type="text/html" id="operation">
  67. {{# if(d.sys_audit_status < 1 ){ }}
  68. <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="audit">审核</a>
  69. {{# } }}
  70. <a class="layui-btn layui-btn-primary layui-btn-sm" lay-event="detail">详情</a>
  71. {{# if(d.sys_audit_status > 1 ){ }}
  72. <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del">删除</a>
  73. {{# } }}
  74. </script>
  75. <!-- 商品信息 -->
  76. <script type="text/html" id="table-goods">
  77. <div class="goods-content">
  78. <div style="text-align: left;">
  79. <img src="{{ d.cover_img }}" style="height:80px;width: 80px" class="image-show">
  80. <div class="layui-input-inline ">
  81. <span class="">{{ d.name }}</span>
  82. </div>
  83. </div>
  84. </div>
  85. </script>
  86. <!-- 商品价格 -->
  87. <script type="text/html" id="table-price">
  88. <div class="price-content">
  89. <span>{{ d.price_text }}</span>
  90. </div>
  91. </script>
  92. <!-- 审核状态 -->
  93. <script type="text/html" id="table-audit">
  94. <div class="audit-content">
  95. <span>{{ d.audit_status_text }}</span>
  96. <span>{{ d.audit_remark }}</span>
  97. </div>
  98. </script>
  99. <!-- 商家状态 -->
  100. <script type="text/html" id="table-shop">
  101. <img src="{{d.shop.logo}}" alt="图标" style="width:60px;height:60px;margin-right:5px;">
  102. <div class="layui-inline" style="text-align:left;">
  103. <p>商家名称:{{d.shop.name}}</p>
  104. <p>商家类型:{{d.shop.type_desc}}</p>
  105. </div>
  106. </script>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. <script>
  114. layui.use(['table', 'laydate', 'form'], function () {
  115. var $ = layui.$
  116. , table = layui.table
  117. , element = layui.element
  118. , form = layui.form
  119. , status = 'all';
  120. form.on("submit(search)", function(data){
  121. table.reload("like-table-lists", {
  122. where: data.field,
  123. page: {
  124. curr: 1
  125. }
  126. });
  127. });
  128. form.on("submit(clear-search)", function(){
  129. $("#goods_name").val("");
  130. $("#shop_id").val("");
  131. form.render();
  132. table.reload("like-table-lists", {
  133. where: {},
  134. page: {
  135. curr: 1
  136. }
  137. });
  138. });
  139. getList();
  140. element.on('tab(tab-all)', function (data) {
  141. status = $(this).attr('data-type');
  142. getList();
  143. });
  144. function getList() {
  145. like.tableLists("#like-table-lists", '{:url("live.LiveGoods/lists")}?status=' + status, [
  146. {field: 'goodsId', width: 80, title: 'ID', sort: true, hide: true}
  147. ,{field:"storeInfo", title:"商家信息", templet:"#table-shop", width:250}
  148. , {field: 'goods_info', title: '商品信息', width: 300, templet:'#table-goods'}
  149. , {field: 'price', title: '商品价格', width: 200, align: 'center',templet: '#table-price'}
  150. , {field: 'url', title: '商品链接', width: 320, align: 'center'}
  151. , {field: 'audit_status', title: '状态', width: 200, align: 'center', templet:'#table-audit'}
  152. , {fixed: 'right', title: '操作', width: 150, align: 'center', toolbar: '#operation'}
  153. ]);
  154. }
  155. //图片放大
  156. $(document).on('click', '.image-show', function () {
  157. var src = $(this).attr('src');
  158. like.showImg(src, 400);
  159. });
  160. //事件
  161. var active = {
  162. audit: function (obj) {
  163. layer.open({
  164. type: 2
  165. , title: '审核'
  166. , content: '{:url("live.LiveGoods/audit")}?id=' + obj.data.id
  167. , area: ['90%', '90%']
  168. , yes: function (index, layero) {
  169. var iframeWindow = window['layui-layer-iframe' + index]
  170. , submitID = 'addSubmit'
  171. , submit = layero.find('iframe').contents().find('#' + submitID);
  172. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  173. var field = data.field;
  174. console.log(field);
  175. like.ajax({
  176. url: '{:url("live.LiveGoods/audit")}',
  177. data: field,
  178. type: "post",
  179. success: function (res) {
  180. if (res.code === 1) {
  181. layui.layer.msg(res.msg, {offset: '15px', icon: 1, time: 1000});
  182. layer.close(index);
  183. table.reload('like-table-lists');
  184. }
  185. }
  186. });
  187. });
  188. submit.trigger('click');
  189. }
  190. });
  191. },
  192. detail: function (obj) {
  193. layer.open({
  194. type: 2
  195. , title: '商品信息'
  196. , content: '{:url("live.LiveGoods/detail")}?id=' + obj.data.id
  197. , area: ['90%', '90%']
  198. , yes: function (index, layero) {
  199. }
  200. });
  201. },
  202. // 同步商品库
  203. sync: function () {
  204. table.reload('like-table-lists');
  205. },
  206. // 删除
  207. del: function (obj) {
  208. layer.confirm('确定要删除商品:' + obj.data.name, function (index) {
  209. like.ajax({
  210. url: '{:url("live.LiveGoods/del")}',
  211. data: {id: obj.data.id},
  212. type: "post",
  213. success: function (res) {
  214. if (res.code === 1) {
  215. layui.layer.msg(res.msg, {offset: '15px', icon: 1, time: 1000});
  216. layer.close(index);
  217. obj.del();
  218. }
  219. }
  220. });
  221. layer.close(index);
  222. })
  223. }
  224. };
  225. // 监听表格右侧工具条
  226. table.on('tool(like-table-lists)', function (obj) {
  227. var type = obj.event;
  228. active[type] ? active[type].call(this, obj) : '';
  229. });
  230. // 绑定点击按钮事件
  231. $('.layui-btn.layuiadmin-btn').on('click', function () {
  232. var type = $(this).data('type');
  233. active[type] ? active[type].call(this) : '';
  234. });
  235. });
  236. </script>