lists.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. {extend name="app/admin/view/base.html"/}
  2. {block name="resources"}
  3. {/block}
  4. {block name="main"}
  5. <div class="layui-collapse ns-tips">
  6. <div class="layui-colla-item">
  7. <h2 class="layui-colla-title">操作提示</h2>
  8. <ul class="layui-colla-content layui-show">
  9. <li>优惠套餐显示在商品详情,是一种捆绑购买的优惠活动</li>
  10. <li>商家可以选择发布组合套餐,同时可以设置套餐价格</li>
  11. </ul>
  12. </div>
  13. </div>
  14. <div class="ns-screen layui-collapse">
  15. <div class="layui-colla-item">
  16. <h2 class="layui-colla-title">筛选</h2>
  17. <form class="layui-colla-content layui-form layui-show">
  18. <div class="layui-form-item">
  19. <div class="layui-inline">
  20. <label class="layui-form-label">活动名称:</label>
  21. <div class="layui-input-inline">
  22. <input type="text" id="bl_name" name="bl_name" placeholder="请输入活动名称" class="layui-input" autocomplete="off">
  23. </div>
  24. </div>
  25. <div class="layui-inline">
  26. <label class="layui-form-label">店铺名称:</label>
  27. <div class="layui-input-inline">
  28. <input type="text" id="search_text" name="search_text" placeholder="请输入店铺名称" class="layui-input" autocomplete="off">
  29. </div>
  30. </div>
  31. <!--<div class="layui-inline">-->
  32. <!--<label class="layui-form-label">状态:</label>-->
  33. <!--<div class="layui-input-inline">-->
  34. <!--<select name="status" lay-filter="status">-->
  35. <!--<option value=""></option>-->
  36. <!--<option value="1">开启</option>-->
  37. <!--<option value="0">关闭</option>-->
  38. <!--</select>-->
  39. <!--</div>-->
  40. <!--</div>-->
  41. </div>
  42. <div class="ns-form-row">
  43. <button class="layui-btn ns-bg-color" lay-submit lay-filter="search">筛选</button>
  44. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  45. </div>
  46. </form>
  47. </div>
  48. </div>
  49. <div class="layui-tab ns-table-tab" lay-filter="bundling_tab">
  50. <ul class="layui-tab-title">
  51. <li class="layui-this" lay-id="_all">全部</li>
  52. <li lay-id="1_open">已开启</li>
  53. <li lay-id="0_close">已关闭</li>
  54. </ul>
  55. <div class="layui-tab-content">
  56. <div class="layui-tab-item layui-show">
  57. <!-- 列表 -->
  58. <table id="activity_list" lay-filter="activity_list"></table>
  59. </div>
  60. </div>
  61. </div>
  62. <!-- 状态 -->
  63. <script type="text/html" id="status">
  64. {{ d.status == 0 ? '<span style="color: red">关闭</span>' : '<span style="color: green">开启</span>' }}
  65. </script>
  66. <!-- 操作 -->
  67. <script type="text/html" id="operation">
  68. <div class="ns-table-btn">
  69. <a class="layui-btn" lay-event="detail">详情</a>
  70. <a class="layui-btn" lay-event="delete">删除</a>
  71. </div>
  72. </script>
  73. {/block}
  74. {block name="script"}
  75. <script>
  76. layui.use(['form','element'], function() {
  77. var table,
  78. element = layui.element,
  79. form = layui.form;
  80. form.render();
  81. //监听Tab切换,以改变地址hash值
  82. element.on('tab(bundling_tab)', function(){
  83. var id = this.getAttribute('lay-id');
  84. location.hash = 'bundling_tab='+ id;
  85. var status = id.split("_")[0];
  86. table.reload({
  87. page: {
  88. curr: 1
  89. },
  90. where: { status : status }
  91. });
  92. });
  93. table = new Table({
  94. elem: '#activity_list',
  95. url: ns.url("bundling://admin/bundling/lists"),
  96. cols: [
  97. [{
  98. field: 'bl_name',
  99. title: '名称',
  100. unresize: 'false',
  101. width: '20%'
  102. },{
  103. field: 'site_name',
  104. title: '店铺名称',
  105. unresize: 'false',
  106. width: '10%'
  107. }, {
  108. field: 'bl_price',
  109. title: '商品优惠价格',
  110. unresize: 'false',
  111. width: '15%',
  112. align: 'right',
  113. templet: function(data) {
  114. return '<span>¥'+ data.bl_price +'</span>';
  115. }
  116. }, {
  117. field: 'goods_money',
  118. title: '<span style="padding-right: 15px;">商品总价</span>',
  119. unresize: 'false',
  120. width: '15%',
  121. align: 'right',
  122. templet: function(data) {
  123. return '<span style="padding-right: 15px;">¥'+ data.goods_money +'</span>';
  124. }
  125. }, {
  126. title: '状态',
  127. unresize: 'false',
  128. width: '10%',
  129. templet: '#status'
  130. }, {
  131. field: 'update_time',
  132. title: '创建时间',
  133. unresize: 'false',
  134. width: '15%',
  135. templet: function(data) {
  136. return ns.time_to_date(data.update_time);
  137. }
  138. }, {
  139. title: '操作',
  140. toolbar: '#operation',
  141. unresize: 'false',
  142. width: '15%'
  143. }]
  144. ]
  145. });
  146. /**
  147. * 监听工具栏操作
  148. */
  149. table.tool(function(obj) {
  150. var data = obj.data;
  151. switch (obj.event) {
  152. case 'detail': //详情
  153. location.href = ns.url("bundling://admin/bundling/detail?bl_id=" + data.bl_id + "&site_id=" +data.site_id);
  154. break;
  155. case 'delete': //删除
  156. deleteBunding(data.bl_id, data.site_id);
  157. }
  158. });
  159. //删除组合套餐
  160. function deleteBunding(bl_id, site_id){
  161. $.ajax({
  162. url: ns.url("bundling://admin/bundling/delete"),
  163. data: {bl_id, site_id},
  164. dataType: 'JSON',
  165. type: 'POST',
  166. async: false,
  167. success: function(res) {
  168. layer.msg(res.message);
  169. if(res.code == 0){
  170. table.reload();
  171. }
  172. }
  173. });
  174. }
  175. /**
  176. * 搜索功能
  177. */
  178. form.on('submit(search)', function(data) {
  179. table.reload({
  180. page: {
  181. curr: 1
  182. },
  183. where: data.field
  184. });
  185. return false;
  186. });
  187. });
  188. </script>
  189. {/block}