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

launch.html 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. {layout name="layout1" /}
  2. <style> .layui-table-cell { height: auto; } </style>
  3. <div class="wrapper">
  4. <div class="layui-card">
  5. <!-- 操作提示 -->
  6. {if !$bargain_id}
  7. <div class="layui-card-body">
  8. <div class="layui-collapse like-layui-collapse" style="border:1px dashed #c4c4c4">
  9. <div class="layui-colla-item">
  10. <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
  11. <div class="layui-colla-content layui-show">
  12. <p>*砍价列表,查看帮砍人数,信息,砍价订单等信息;</p>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. {/if}
  18. <!-- 搜索模块 -->
  19. <div class="layui-tab layui-tab-card" lay-filter="tab-all">
  20. <div class="layui-card-body layui-form">
  21. <div class="layui-form-item">
  22. <div class="layui-row">
  23. <div class="layui-inline">
  24. <label for="bargain_sn" class="layui-form-label">砍价编号:</label>
  25. <div class="layui-input-block">
  26. <input type="text" id="bargain_sn" name="bargain_sn" placeholder="请输入" autocomplete="off" class="layui-input">
  27. </div>
  28. </div>
  29. <div class="layui-inline">
  30. <label for="goods_name" class="layui-form-label">商品名称:</label>
  31. <div class="layui-input-block">
  32. <input type="text" id="goods_name" name="goods_name" placeholder="请输入" autocomplete="off" class="layui-input">
  33. </div>
  34. </div>
  35. <div class="layui-inline">
  36. <label for="status" class="layui-form-label">砍价状态:</label>
  37. <div class="layui-input-inline">
  38. <select name="status" id="status" >
  39. <option value="">全部</option>
  40. <option value="0">砍价中</option>
  41. <option value="1">砍价成功</option>
  42. <option value="2">砍价失败</option>
  43. </select>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="layui-row">
  48. <div class="layui-inline">
  49. <label for="keyword_type" class="layui-form-label">发起用户:</label>
  50. <div class="layui-input-block">
  51. <select id="keyword_type" name="keyword_type" >
  52. <option value="">请选择</option>
  53. <option value="sn">会员编号</option>
  54. <option value="nickname">会员昵称</option>
  55. <option value="mobile">手机号码</option>
  56. </select>
  57. </div>
  58. </div>
  59. <div class="layui-inline">
  60. <input type="text" id="keyword" name="keyword" placeholder="请输入" autocomplete="off" class="layui-input">
  61. </div>
  62. </div>
  63. <div class="layui-row">
  64. <div class="layui-inline">
  65. <label class="layui-form-label">发起时间:</label>
  66. <div class="layui-inline">
  67. <input type="text" id="launch_start_time" name="launch_start_time" placeholder="开始时间" autocomplete="off" class="layui-input">
  68. </div>
  69. <div class="layui-inline"> - </div>
  70. <div class="layui-inline">
  71. <input type="text" id="launch_end_time" name="launch_end_time" placeholder="结束时间" class="layui-input">
  72. </div>
  73. </div>
  74. <div class="layui-inline">
  75. <button class="layui-btn layui-btn-sm layuiadmin-btn-article {$view_theme_color}" lay-submit lay-filter="search">
  76. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  77. </button>
  78. <button class="layui-btn layui-btn-sm layui-btn-primary layuiadmin-btn-article }" lay-submit lay-filter="clear-search">重置</button>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. <!-- 数据表格 -->
  85. <div class="layui-card-body">
  86. <table id="table-lists" lay-filter="table-lists"></table>
  87. <script type="text/html" id="table-user">
  88. {{# if((d.user) == null){ }}
  89. 会员信息缺失
  90. {{# } else { }}
  91. <img src="{{d.user.avatar}}" style="height:80px;width: 80px" class="image-show">
  92. <div class="layui-input-inline" style="text-align: left">
  93. <p>会员编号:{{d.user.sn}}</p>
  94. <p>会员昵称:{{d.user.nickname}}</p>
  95. <p>会员等级:{{d.user.level.name ?? '无'}}</p>
  96. </div>
  97. {{# } }}
  98. </script>
  99. <script type="text/html" id="table-goods">
  100. <div>
  101. <img src="{{d.goods_image}}" alt="图片" style="width:60px;height:60px;float:left;" class="image-show">
  102. <div class="layui-inline">
  103. <div >{{d.goods_snap.name}}</div>
  104. <div>{{d.goods_snap.spec_value_str}}&nbsp; ¥{{d.goods_snap.price}}</div>
  105. </div>
  106. </div>
  107. </script>
  108. <script type="text/html" id="table-start_time">
  109. <div style="width:100px;height:60px;white-space:normal;">
  110. {{d.launch_start_time}}
  111. </div>
  112. </script>
  113. <script type="text/html" id="table-end_time">
  114. <div style="width:100px;height:60px;white-space:normal;">
  115. {{d.launch_end_time}}
  116. </div>
  117. </script>
  118. <script type="text/html" id="operation">
  119. <a class="layui-btn layui-btn-normal layui-btn-sm " lay-event="detail">详情</a>
  120. </script>
  121. </div>
  122. </div>
  123. </div>
  124. <script>
  125. layui.config({
  126. base: '/static/plug/layui-admin/dist/layuiadmin/' //静态资源所在路径
  127. }).extend({
  128. index: 'lib/index' //主入口模块
  129. }).use(['index','table','like', 'laydate'], function(){
  130. var $ = layui.$
  131. ,form = layui.form
  132. ,table = layui.table
  133. ,like = layui.like
  134. ,laydate = layui.laydate;
  135. // 渲染数据表格
  136. table.render({
  137. elem: '#table-lists'
  138. ,url: '{:url("bargain.Bargain/launch")}?bargain_id={$bargain_id}'
  139. ,cols: [[
  140. {field: 'id', title: '序号',width:60, align:"center"}
  141. ,{field: 'bargain_sn', title: '砍价编号',width:160, align:"center"}
  142. ,{field: 'user', title: '发起用户',width:300, templet: '#table-user'}
  143. ,{field: 'goods', title: '砍价商品',width:250, templet: '#table-goods'}
  144. ,{field: 'launchStartTime', title: '发起时间', width:120, align: 'center', templet: '#table-start_time'}
  145. ,{field: 'launchEndTime', title: '结束时间', width:120, align: 'center', templet: '#table-end_time'}
  146. ,{field: 'help_number', title: '已砍价次数', width:120, align: 'center'}
  147. ,{field: 'current_price', title: '当前价格', width:120, align: 'center'}
  148. ,{field: 'status', title: '砍价状态', width:100, align: 'center'}
  149. ,{fixed: 'right', title: '操作', align: 'center', toolbar: '#operation',width:100}
  150. ]]
  151. ,page:true
  152. ,text: {none: '暂无数据!'}
  153. ,response: {
  154. statusCode: 1
  155. }
  156. ,parseData: function(res){
  157. return {
  158. "code":res.code,
  159. "msg":res.msg,
  160. "count": res.data.count,
  161. "data": res.data.lists
  162. };
  163. }
  164. ,done: function(res, curr, count){
  165. $(".layui-table-main tr").each(function (index, val) {
  166. $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
  167. $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
  168. });
  169. }
  170. });
  171. //事件
  172. var active = {
  173. detail: function (obj) {
  174. layer.open({
  175. type: 2
  176. ,title: '砍价详情'
  177. ,content: '{:url("bargain.Bargain/detail")}?id='+obj.data.id
  178. ,area: ['90%','90%']
  179. });
  180. }
  181. };
  182. // 监听表格右侧工具条
  183. table.on('tool(table-lists)', function(obj){
  184. var type = obj.event;
  185. active[type] ? active[type].call(this, obj) : '';
  186. });
  187. // 切换状态
  188. form.on('switch(switch-status)',function (obj) {
  189. var id = obj.elem.attributes['data-id'].nodeValue;
  190. var fields = obj.elem.attributes['data-field'].nodeValue;
  191. var status = this.checked ? 1 : 0;
  192. var data = {"id":id, "field":fields, "status":status};
  193. active['switchStatus'] ? active['switchStatus'].call(this, data) : '';
  194. });
  195. // 绑定点击按钮事件
  196. $('.layui-btn.layuiadmin-btn').on('click', function(){
  197. var type = $(this).data('type');
  198. active[type] ? active[type].call(this) : '';
  199. });
  200. //图片放大
  201. $(document).on('click', '.image-show', function () {
  202. var src = $(this).attr('src');
  203. like.showImg(src);
  204. });
  205. // 开始时间
  206. laydate.render({
  207. type: 'datetime'
  208. ,elem: '#launch_start_time'
  209. ,trigger: 'click'
  210. ,done: function (value, date, endDate) {
  211. var startDate = new Date(value).getTime();
  212. var endTime = new Date($('#launch_end_time').val()).getTime();
  213. if (endTime < startDate) {
  214. layer.msg('结束时间不能小于开始时间');
  215. $('#launch_start_time').val($('#launch_end_time').val());
  216. }
  217. }
  218. });
  219. laydate.render({
  220. type: 'datetime'
  221. ,elem: '#launch_end_time'
  222. ,trigger: 'click'
  223. ,done: function (value, date, endDate) {
  224. var startDate = new Date($('#launch_start_time').val()).getTime();
  225. var endTime = new Date(value).getTime();
  226. if (endTime < startDate) {
  227. layer.msg('结束时间不能小于开始时间');
  228. $('#launch_end_time').val($('#launch_start_time').val());
  229. }
  230. }
  231. });
  232. //监听搜索
  233. form.on('submit(search)', function(data){
  234. var field = data.field;
  235. table.reload('table-lists', {
  236. where: field,
  237. page: { curr: 1 }
  238. });
  239. });
  240. // 监听重置搜素
  241. form.on('submit(clear-search)', function(){
  242. $('#bargain_sn').val('');
  243. $('#goods_name').val('');
  244. $('#status').val('');
  245. $('#keyword_type').val('');
  246. $('#keyword').val('');
  247. $('#launch_start_time').val('');
  248. $('#launch_end_time').val('');
  249. form.render('select');
  250. table.reload('table-lists', { where: [] });
  251. });
  252. $(document).on('click', '.day', function () {
  253. var value = parseInt($(this).attr('day'));
  254. var toDay = Times.getDay(value, false);
  255. var curDay = Times.getDay(0);
  256. $("#launch_start_time").val(toDay + ' 00:00:00');
  257. $("#launch_end_time").val(curDay + ' 00:00:00');
  258. })
  259. });
  260. </script>