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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. {layout name="layout1" /}
  2. <style>
  3. .layui-table-cell{
  4. height:auto;
  5. overflow:hidden;
  6. text-overflow:inherit;
  7. }
  8. </style>
  9. <div class="wrapper">
  10. <div class="layui-card">
  11. <div class="layui-card-body">
  12. <div class="layui-collapse like-layui-collapse">
  13. <div class="layui-colla-item">
  14. <h2 class="layui-colla-title like-layui-colla-title">操作提示</h2>
  15. <div class="layui-colla-content layui-show">
  16. <p>* 商家提交直播间后,平台审核通过之后才可开始直播</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 class="layui-form-label">直播状态:</label>
  37. <div class="layui-input-block">
  38. <select name="live_status" id="live_status">
  39. <option value="">全部</option>
  40. {foreach $live_status as $item => $val}
  41. <option value="{$item}">{$val}</option>
  42. {/foreach}
  43. </select>
  44. </div>
  45. </div>
  46. <div class="layui-row">
  47. <div class="layui-inline">
  48. <label class="layui-form-label">开播时间:</label>
  49. <div class="layui-input-inline">
  50. <div class="layui-input-inline">
  51. <input type="text" name="start_time" class="layui-input" id="start_time"
  52. placeholder="" autocomplete="off">
  53. </div>
  54. </div>
  55. <div class="layui-input-inline" style="margin-right: 5px;width: 20px;">
  56. <label class="layui-form-mid">至</label>
  57. </div>
  58. <div class="layui-input-inline">
  59. <input type="text" name="end_time" class="layui-input" id="end_time"
  60. placeholder="" autocomplete="off">
  61. </div>
  62. </div>
  63. <div class="layui-inline">
  64. <a class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="search">搜索</a>
  65. <a class="layui-btn layui-btn-sm layui-btn-primary" lay-submit lay-filter="clear-search">重置</a>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="layui-tab layui-tab-card" lay-filter="tab-all">
  71. <ul class="layui-tab-title">
  72. <li data-type="" class="layui-this">全部</li>
  73. <li data-type="0">待审核</li>
  74. <li data-type="1">审核通过</li>
  75. <li data-type="2">审核未通过</li>
  76. </ul>
  77. <div class="layui-tab-item layui-show">
  78. <div class="layui-card">
  79. <div class="layui-card-body">
  80. <div style="padding-bottom: 10px;">
  81. <!-- <button class="layui-btn layui-btn-sm layuiadmin-btn layui-btn-primary" data-type="sync">-->
  82. <!-- 同步直播间-->
  83. <!-- </button>-->
  84. </div>
  85. <table id="like-table-lists" lay-filter="like-table-lists"></table>
  86. <script type="text/html" id="operation">
  87. <a class="layui-btn layui-btn-primary layui-btn-sm" lay-event="detail">详情</a>
  88. {{# if(d.audit_status == 0 ){ }}
  89. <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="audit">审核</a>
  90. {{# } }}
  91. <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="recommend">推荐直播间</a>
  92. </script>
  93. <!-- 直播间信息 -->
  94. <script type="text/html" id="table-anchor">
  95. <img src="{{ d.feeds_img }}" style="height:80px;width: 80px" class="image-show">
  96. <div class="layui-input-inline" style="text-align: left;">
  97. <p >{{ d.name }}</p>
  98. <p >主播:{{ d.anchor_name }}</p>
  99. </div>
  100. </script>
  101. <script type="text/html" id="table-shop">
  102. <img src="{{d.shop.logo}}" alt="图标" style="width:60px;height:60px;margin-right:5px;">
  103. <div class="layui-inline" style="text-align:left;">
  104. <p>商家名称:{{d.shop.name}}</p>
  105. <p>商家类型:{{d.shop.type_desc}}</p>
  106. </div>
  107. </script>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <script>
  115. layui.use(['table', 'form', 'laydate', 'element'], function () {
  116. var $ = layui.$
  117. , table = layui.table
  118. , laydate = layui.laydate
  119. , element = layui.element
  120. , form = layui.form
  121. , status = -1;
  122. //日期时间范围
  123. laydate.render({
  124. elem: '#start_time'
  125. , type: 'datetime'
  126. , theme: '#1E9FFF'
  127. });
  128. laydate.render({
  129. elem: '#end_time'
  130. , type: 'datetime'
  131. , theme: '#1E9FFF'
  132. });
  133. form.on("submit(search)", function(data){
  134. table.reload("like-table-lists", {
  135. where: data.field,
  136. page: {
  137. curr: 1
  138. }
  139. });
  140. });
  141. form.on("submit(clear-search)", function(){
  142. $("#shop_id").val("");
  143. $("#live_status").val("");
  144. $("#start_time").val("");
  145. $("#end_time").val("");
  146. form.render();
  147. table.reload("like-table-lists", {
  148. where: {},
  149. page: {
  150. curr: 1
  151. }
  152. });
  153. });
  154. getList();
  155. element.on('tab(tab-all)', function (data) {
  156. status = $(this).attr('data-type');
  157. getList();
  158. });
  159. function getList() {
  160. like.tableLists("#like-table-lists", '{:url("live.LiveRoom/lists")}?status=' + status, [
  161. {field: 'id', title: 'ID', sort: true, hide: true}
  162. ,{field:"storeInfo", title:"商家信息", templet:"#table-shop", width:250}
  163. , {field: 'live_time_text', title: '开播时间', align: 'center', width:250}
  164. , {field: 'anchor', title: '直播间信息', align: 'center', templet:'#table-anchor', width:300}
  165. , {field: 'audit_status_text', title: '审核状态', align: 'center', width:120}
  166. , {field: 'live_status_text', title: '直播状态', align: 'center', width:120}
  167. , {field: 'goods_num', title: '商品数量', align: 'center', width:120}
  168. , {field: 'sort', title: '推荐值', align: 'center', width:120}
  169. , {fixed: 'right', title: '操作', align: 'center', toolbar: '#operation', width:250}
  170. ]);
  171. }
  172. //事件
  173. var active = {
  174. audit: function (obj) {
  175. layer.open({
  176. type: 2
  177. , title: '审核'
  178. , content: '{:url("live.LiveRoom/audit")}?id=' + obj.data.id
  179. , area: ['90%', '90%']
  180. , yes: function (index, layero) {
  181. }
  182. });
  183. },
  184. detail: function (obj) {
  185. layer.open({
  186. type: 2
  187. , title: '直播间信息'
  188. , content: '{:url("live.LiveRoom/detail")}?id=' + obj.data.id
  189. , area: ['90%', '90%']
  190. , yes: function (index, layero) {
  191. }
  192. });
  193. },
  194. recommend: function (obj) {
  195. layer.open({
  196. type: 2
  197. , title: '推荐直播间'
  198. , content: '{:url("live.LiveRoom/recommend")}?id=' + obj.data.id
  199. , area: ['40%', '40%']
  200. , btn: ['确定', '取消']
  201. , yes: function (index, layero) {
  202. console.log(obj.id)
  203. var iframeWindow = window['layui-layer-iframe' + index]
  204. , submitID = 'addSubmit'
  205. , submit = layero.find('iframe').contents().find('#' + submitID);
  206. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  207. var field = data.field;
  208. like.ajax({
  209. url: '{:url("live.LiveRoom/recommend")}',
  210. data: field,
  211. type: "post",
  212. success: function (res) {
  213. if (res.code === 1) {
  214. layui.layer.msg(res.msg, {offset: '15px', icon: 1, time: 1000});
  215. layer.close(index);
  216. table.reload('like-table-lists');
  217. }
  218. }
  219. });
  220. });
  221. submit.trigger('click');
  222. }
  223. });
  224. },
  225. // 同步直播间
  226. sync: function () {
  227. table.reload('like-table-lists');
  228. },
  229. };
  230. // 监听表格右侧工具条
  231. table.on('tool(like-table-lists)', function (obj) {
  232. var type = obj.event;
  233. active[type] ? active[type].call(this, obj) : '';
  234. });
  235. // 绑定点击按钮事件
  236. $('.layui-btn.layuiadmin-btn').on('click', function () {
  237. var type = $(this).data('type');
  238. active[type] ? active[type].call(this) : '';
  239. });
  240. // 图片
  241. $(document).on('click', '.image-show', function () {
  242. var src = $(this).attr('src');
  243. like.showImg(src, 400);
  244. });
  245. });
  246. </script>