index.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. <script type="text/javascript" src="{__PLUG_PATH}jquery.downCount.js"></script>
  4. {/block}
  5. {block name="content"}
  6. <div class="layui-fluid">
  7. <div class="layui-row layui-col-space15" id="app">
  8. <div class="layui-col-md12">
  9. <div class="layui-card">
  10. <div class="layui-card-header">拼团商品搜索</div>
  11. <div class="layui-card-body">
  12. <div class="alert alert-success alert-dismissable">
  13. <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
  14. 目前拥有{$countCombination}个拼团商品
  15. </div>
  16. <form class="layui-form">
  17. <div class="layui-form-item">
  18. <div class="layui-inline">
  19. <label class="layui-form-label">搜  索:</label>
  20. <div class="layui-input-inline">
  21. <input type="text" name="store_name" lay-verify="store_name" style="width: 100%" autocomplete="off" placeholder="请输入商品名称,关键字,编号" class="layui-input">
  22. </div>
  23. </div>
  24. <div class="layui-inline">
  25. <label class="layui-form-label">拼团状态:</label>
  26. <div class="layui-input-inline">
  27. <select name="is_show" lay-verify="is_show">
  28. <option value="">全部</option>
  29. <option value="1">开启</option>
  30. <option value="0">关闭</option>
  31. </select>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="layui-form-item">
  36. <label class="layui-form-label">
  37. <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="search" style="font-size:14px;line-height: 9px;">
  38. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索</button>
  39. <button lay-submit="export" lay-filter="export" class="layui-btn layui-btn-primary layui-btn-sm">
  40. <i class="layui-icon layui-icon-delete layuiadmin-button-btn" ></i> Excel导出</button>
  41. </label>
  42. </div>
  43. </form>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="layui-col-sm6 layui-col-md3">
  48. <div class="layui-card">
  49. <div class="layui-card-header">
  50. 总展现量
  51. <span class="layui-badge layuiadmin-badge">量</span>
  52. </div>
  53. <div class="layui-card-body">
  54. <p class="layuiadmin-big-font">{$statistics.browseCount}</p>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="layui-col-sm6 layui-col-md3">
  59. <div class="layui-card">
  60. <div class="layui-card-header">
  61. 访客人数
  62. <span class="layui-badge layuiadmin-badge">人</span>
  63. </div>
  64. <div class="layui-card-body">
  65. <p class="layuiadmin-big-font">{$statistics.visitCount}</p>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="layui-col-sm6 layui-col-md3">
  70. <div class="layui-card">
  71. <div class="layui-card-header">
  72. 参与人数
  73. <span class="layui-badge layuiadmin-badge">人</span>
  74. </div>
  75. <div class="layui-card-body">
  76. <p class="layuiadmin-big-font">{$statistics.partakeCount}</p>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="layui-col-sm6 layui-col-md3">
  81. <div class="layui-card">
  82. <div class="layui-card-header">
  83. 成团数量
  84. <span class="layui-badge layuiadmin-badge">量</span>
  85. </div>
  86. <div class="layui-card-body">
  87. <p class="layuiadmin-big-font">{$statistics.pinkCount}</p>
  88. </div>
  89. </div>
  90. </div>
  91. <!-- end-->
  92. <div class="layui-col-md12">
  93. <div class="layui-card">
  94. <div class="layui-card-header">拼团商品列表</div>
  95. <div class="layui-card-body">
  96. <div class="layui-btn-container">
  97. <a class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:700,w:1100});">添加拼团商品</a>
  98. </div>
  99. <table class="layui-hide" id="combinationList" lay-filter="combinationList"></table>
  100. <script type="text/html" id="status">
  101. <input type='checkbox' name='status' lay-skin='switch' value="{{d.id}}" lay-filter='status' lay-text='开启|关闭' {{ d.is_show == 1 ? 'checked' : '' }}>
  102. </script>
  103. <script type="text/html" id="stopTime">
  104. <div class="count-time-{{d.id}}" data-time="{{d._stop_time}}">
  105. <span class="days">00</span>
  106. :
  107. <span class="hours">00</span>
  108. :
  109. <span class="minutes">00</span>
  110. :
  111. <span class="seconds">00</span>
  112. </div>
  113. </script>
  114. <script type="text/html" id="barDemo">
  115. <button type="button" class="layui-btn layui-btn-xs" onclick="$eb.createModalFrame('{{d.title}}-设置规格','{:Url('attr_list')}?id={{d.id}}',{h:1000,w:1400});"><i class="layui-icon layui-icon-util"></i>规格</button>
  116. <button type="button" class="layui-btn layui-btn-xs" onclick="dropdown(this)">操作<span class="caret"></span></button>
  117. <ul class="layui-nav-child layui-anim layui-anim-upbit">
  118. <li>
  119. <a href="javascript:void(0);" onclick="$eb.createModalFrame('{{d.title}}-编辑','{:Url('edit')}?id={{d.id}}')"><i class="layui-icon layui-icon-edit"></i> 编辑活动</a>
  120. </li>
  121. <li>
  122. <a href="javascript:void(0);" onclick="$eb.createModalFrame('{{d.title}}-编辑内容','{:Url('edit_content')}?id={{d.id}}')"><i class="layui-icon layui-icon-edit"></i> 编辑内容</a>
  123. </li>
  124. <li>
  125. <a href="javascript:void(0);" class="delstor" lay-event='delstor'><i class="layui-icon layui-icon-delete"></i> 删除</a>
  126. </li>
  127. </ul>
  128. </script>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. {/block}
  135. {block name="script"}
  136. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  137. <script>
  138. layList.form.render();
  139. layList.tableList('combinationList',"{:Url('get_combination_list')}",function () {
  140. return [
  141. {field: 'id', title: '编号',width:'5%', sort: true,event:'id'},
  142. {field: 'image', title: '拼团图片',width:'10%',templet: '<p><img src="{{d.image}}" alt="{{d.title}}" class="open_image" data-image="{{d.image}}"></p>'},
  143. {field: 'title', title: '拼团名称'},
  144. {field: 'ot_price', title: '原价',width:'6%'},
  145. {field: 'price', title: '拼团价',width:'6%'},
  146. {field: 'people', title: '拼团人数',width:'7%',templet: '<span>【{{d.people}}】人</span>'},
  147. {field: 'count_people_all', title: '参与人数',width:'7%',templet: '<span>【{{d.count_people_all}}】人</span>'},
  148. {field: 'count_people_pink', title: '成团数量',width:'7%',templet: '<span>【{{d.count_people_pink}}】团</span>'},
  149. {field: 'quota_show', title: '限量',width:'4%'},
  150. {field: 'quota', title: '限量剩余',width:'6%'},
  151. {field: '_stop_time', title: '结束时间', width:'8%',toolbar: '#stopTime'},
  152. {field: 'is_show', title: '状态', width:'6%',templet:"#status"},
  153. {field: 'right', title: '操作', width:'10%', align: 'center', toolbar: '#barDemo'}
  154. ]
  155. });
  156. layList.search('search',function(where){
  157. layList.reload(where);
  158. setTime();
  159. });
  160. layList.search('export',function(where){
  161. location.href=layList.U({c:'ump.store_combination',a:'save_excel',q:{
  162. is_show:where.is_show,
  163. store_name:where.store_name
  164. }});
  165. })
  166. setTime();
  167. window.$combinationId = <?php echo json_encode($combinationId);?>;
  168. function setTime() {
  169. setTimeout(function () {
  170. $.each($combinationId,function (index,item) {
  171. if ($('.count-time-' + item).length) {
  172. if ($('.count-time-' + item).attr('data-time') != undefined) {
  173. $('.count-time-' + item).downCount({
  174. date: $('.count-time-' + item).attr('data-time'),
  175. offset: +8
  176. });
  177. }
  178. }
  179. })
  180. },3000);
  181. }
  182. layList.switch('status',function (odj,value,name) {
  183. if (odj.elem.checked == true) {
  184. layList.baseGet(layList.Url({
  185. c: 'ump.store_combination',
  186. a: 'set_combination_status',
  187. p: {status: 1, id: value}
  188. }), function (res) {
  189. layList.msg(res.msg);
  190. }, function () {
  191. odj.elem.checked = false;
  192. layui.form.render();
  193. layer.open({
  194. type: 1
  195. ,offset: 'auto'
  196. ,id: 'layerDemoauto' //防止重复弹出
  197. ,content: '<div style="padding: 20px 100px;">请先配置规格</div>'
  198. ,btn: '设置规格'
  199. ,btnAlign: 'c' //按钮居中
  200. ,shade: 0 //不显示遮罩
  201. ,yes: function(){
  202. layer.closeAll();
  203. $eb.createModalFrame('设置规格','{:Url('attr_list')}?id='+value+'',{h:1000,w:1400});
  204. }
  205. });
  206. });
  207. } else {
  208. layList.baseGet(layList.Url({
  209. c: 'ump.store_combination',
  210. a: 'set_combination_status',
  211. p: {status: 0, id: value}
  212. }), function (res) {
  213. layList.msg(res.msg);
  214. });
  215. }
  216. })
  217. layList.tool(function (event,data,obj) {
  218. switch (event) {
  219. case 'delstor':
  220. var url=layList.U({c:'ump.store_combination',a:'delete',q:{id:data.id}});
  221. $eb.$swal('delete',function(){
  222. $eb.axios.get(url).then(function(res){
  223. if(res.status == 200 && res.data.code == 200) {
  224. $eb.$swal('success',res.data.msg);
  225. obj.del();
  226. }else
  227. return Promise.reject(res.data.msg || '删除失败')
  228. }).catch(function(err){
  229. $eb.$swal('error',err);
  230. });
  231. })
  232. break;
  233. }
  234. })
  235. $(document).click(function (e) {
  236. $('.layui-nav-child').hide();
  237. })
  238. function dropdown(that){
  239. var oEvent = arguments.callee.caller.arguments[0] || event;
  240. oEvent.stopPropagation();
  241. var offset = $(that).offset();
  242. var top=offset.top-$(window).scrollTop();
  243. var index = $(that).parents('tr').data('index');
  244. $('.layui-nav-child').each(function (key) {
  245. if (key != index) {
  246. $(this).hide();
  247. }
  248. })
  249. if($(document).height() < top+$(that).next('ul').height()){
  250. $(that).next('ul').css({
  251. 'padding': 10,
  252. 'top': - ($(that).parent('td').height() / 2 + $(that).height() + $(that).next('ul').height()/2),
  253. 'min-width': 'inherit',
  254. 'position': 'absolute'
  255. }).toggle();
  256. }else{
  257. $(that).next('ul').css({
  258. 'padding': 10,
  259. 'top':$(that).parent('td').height() / 2 + $(that).height(),
  260. 'min-width': 'inherit',
  261. 'position': 'absolute'
  262. }).toggle();
  263. }
  264. }
  265. </script>
  266. {/block}