index.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. {/block}
  4. {block name="content"}
  5. <div class="layui-fluid" style="background: #fff;margin-top: -10px;">
  6. <div class="layui-tab layui-tab-brief" lay-filter="tab">
  7. <ul class="layui-tab-title">
  8. <li lay-id="list" {eq name='type' value='1'}class="layui-this" {/eq}>
  9. <a href="{eq name='type' value='1'}javascript:;{else}{:Url('index',['type'=>1])}{/eq}">显示中的门店({$show})</a>
  10. </li>
  11. <li lay-id="list" {eq name='type' value='2'}class="layui-this" {/eq}>
  12. <a href="{eq name='type' value='2'}javascript:;{else}{:Url('index',['type'=>2])}{/eq}">隐藏中的门店({$hide})</a>
  13. </li>
  14. <li lay-id="list" {eq name='type' value='3'}class="layui-this" {/eq}>
  15. <a href="{eq name='type' value='3'}javascript:;{else}{:Url('index',['type'=>3])}{/eq}">回收站的门店({$recycle})</a>
  16. </li>
  17. </ul>
  18. </div>
  19. <div class="layui-row layui-col-space15">
  20. <div class="layui-col-md12">
  21. <div class="layui-card">
  22. <div class="layui-card-body">
  23. <form class="layui-form layui-form-pane" action="">
  24. <div class="layui-form-item">
  25. <div class="layui-inline">
  26. <label class="layui-form-label">门店名称</label>
  27. <div class="layui-input-block">
  28. <input type="text" name="name" class="layui-input" placeholder="请输入门店名称,关键字,编号">
  29. <input type="hidden" name="type" value="{$type}">
  30. </div>
  31. </div>
  32. <div class="layui-inline">
  33. <div class="layui-input-inline">
  34. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
  35. <i class="layui-icon layui-icon-search"></i>搜索</button>
  36. <button class="layui-btn layui-btn-primary layui-btn-sm export" lay-submit="export" lay-filter="export">
  37. <i class="fa fa-floppy-o" style="margin-right: 3px;"></i>导出</button>
  38. </div>
  39. </div>
  40. </div>
  41. </form>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="layui-col-md12">
  46. <div class="layui-card">
  47. <!-- <div class="layui-card-header">门店列表</div>-->
  48. <div class="layui-card-body">
  49. <div class="layui-btn-container">
  50. <button class="layui-btn layui-btn-sm"
  51. onclick="$eb.createModalFrame(this.innerText,'{:Url('add')}',{h:700,w:1100})">添加门店
  52. </button>
  53. </div>
  54. <table class="layui-hide" id="List" lay-filter="List"></table>
  55. <script type="text/html" id="headimgurl">
  56. <img style="cursor: pointer" lay-event='open_image' src="{{d.image}}">
  57. </script>
  58. <script type="text/html" id="address">
  59. {{d.address}} {{d.detailed_address}}
  60. </script>
  61. <script type="text/html" id="checkboxstatus">
  62. <input type='checkbox' name='id' lay-skin='switch' value="{{d.id}}" lay-filter='is_show'
  63. lay-text='显示|隐藏' {{ d.is_show== 1 ? 'checked' : '' }}>
  64. </script>
  65. <script type="text/html" id="act">
  66. <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='edit'>
  67. 编辑门店
  68. </button>
  69. <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='del'>
  70. {{# if(d.is_del){ }}
  71. 恢复门店
  72. {{# }else{ }}
  73. 删除门店
  74. {{# } }}
  75. </button>
  76. </script>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  83. {/block}
  84. {block name="script"}
  85. <script>
  86. var type=<?=$type?>;
  87. layList.tableList('List', "{:Url('list',['type'=>$type])}", function () {
  88. return [
  89. {field: 'id', title: 'ID', sort: true, event: 'id', width: '4%'},
  90. {field: 'image', title: '门店图片', templet: '#headimgurl', width: '6%'},
  91. {field: 'name', title: '门店名称', width: '10%'},
  92. {field: 'phone', title: '门店电话', width: '10%'},
  93. {field: 'address', title: '地址', templet: '#address'},
  94. // {field: 'day_time', title: '营业时间', width: '15%'},
  95. // {field: 'valid_time', title: '核销有效日期', width: '11%'},
  96. {field: 'status', title: '是否显示', templet: "#checkboxstatus", width: '8%'},
  97. {field: 'right', title: '操作', align: 'center', toolbar: '#act', width: '14%'},
  98. ];
  99. });
  100. //查询条件
  101. layList.search('search',function(where){
  102. layList.reload(where);
  103. });
  104. //excel下载
  105. layList.search('export',function(where){
  106. where.excel = 1;
  107. location.href=layList.U({c:'system.system_store',a:'list',q:where});
  108. })
  109. //门店是否显示
  110. layList.switch('is_show', function (odj, value) {
  111. if (odj.elem.checked == true) {
  112. layList.baseGet(layList.Url({
  113. c: 'system.system_store',
  114. a: 'set_show',
  115. p: {is_show: 1, id: value}
  116. }), function (res) {
  117. layList.msg(res.msg, function () {
  118. layList.reload();
  119. });
  120. });
  121. } else {
  122. layList.baseGet(layList.Url({
  123. c: 'system.system_store',
  124. a: 'set_show',
  125. p: {is_show: 0, id: value}
  126. }), function (res) {
  127. layList.msg(res.msg, function () {
  128. layList.reload();
  129. });
  130. });
  131. }
  132. });
  133. //点击事件绑定
  134. layList.tool(function (event, data, obj) {
  135. switch (event) {
  136. case 'del':
  137. var url = layList.U({c: 'system.system_store', a: 'delete', q: {id: data.id}});
  138. if(data.is_del) var code = {title:"操作提示",text:"确定恢复门店吗?",type:'info',confirm:'是的,恢复该门店'};
  139. else var code = {title: "操作提示", text: "确定将该门店删除吗?", type: 'info', confirm: '是的,删除该门店'};
  140. $eb.$swal('delete', function () {
  141. $eb.axios.get(url).then(function (res) {
  142. if (res.status == 200 && res.data.code == 200) {
  143. $eb.$swal('success', res.data.msg);
  144. obj.del();
  145. location.reload();
  146. } else
  147. return Promise.reject(res.data.msg || '删除失败')
  148. }).catch(function (err) {
  149. $eb.$swal('error', err);
  150. });
  151. }, code)
  152. break;
  153. case 'open_image':
  154. $eb.openImage(data.image);
  155. break;
  156. case 'edit':
  157. $eb.createModalFrame(data.name + '-编辑', layList.U({a: 'add', q: {id: data.id}}), {h: 700, w: 1100});
  158. break;
  159. }
  160. })
  161. </script>
  162. {/block}