index.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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-row layui-col-space15">
  7. <div class="layui-col-md12">
  8. <div class="layui-card">
  9. <div class="layui-card-body">
  10. <form class="layui-form layui-form-pane" action="">
  11. <div class="layui-form-item">
  12. <div class="layui-inline">
  13. <label class="layui-form-label">门店名称</label>
  14. <div class="layui-input-block">
  15. <!-- <input type="text" name="name" class="layui-input" placeholder="请输入门店名称">-->
  16. <select name="store_id" class="form-control input-sm" v-model="where.store_id">
  17. <option value="">--请选择--</option>
  18. {volist name="store_list" id="vo"}
  19. <option value="{$vo.id}">{$vo.name}</option>
  20. {/volist}
  21. </select>
  22. </div>
  23. </div>
  24. <div class="layui-inline">
  25. <label class="layui-form-label">姓名编号:</label>
  26. <div class="layui-input-inline">
  27. <input type="text" name="name" lay-verify="name" style="width: 100%" autocomplete="off" placeholder="请输入姓名、编号" class="layui-input">
  28. </div>
  29. </div>
  30. <div class="layui-inline">
  31. <div class="layui-input-inline">
  32. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="search" lay-filter="search">
  33. <i class="layui-icon layui-icon-search"></i>搜索</button>
  34. </div>
  35. </div>
  36. </div>
  37. </form>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="layui-col-md12">
  42. <div class="layui-card">
  43. <!-- <div class="layui-card-header">门店列表</div>-->
  44. <div class="layui-card-body">
  45. <div class="layui-btn-container">
  46. <button class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:500,w:900})">添加店员</button>
  47. </div>
  48. <table class="layui-hide" id="List" lay-filter="List"></table>
  49. <script type="text/html" id="headimgurl">
  50. <img style="cursor: pointer" lay-event='open_image' src="{{d.avatar}}">
  51. </script>
  52. <script type="text/html" id="checkboxstatus">
  53. <input type='checkbox' name='id' lay-skin='switch' value="{{d.id}}" lay-filter='is_show'
  54. lay-text='开启|关闭' {{ d.status== 1 ? 'checked' : '' }}>
  55. </script>
  56. <script type="text/html" id="act">
  57. <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='edit'>
  58. 编辑
  59. </button>
  60. <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" lay-event='del'>
  61. 删除
  62. </button>
  63. </script>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. <script src="{__ADMIN_PATH}js/layuiList.js"></script>
  70. {/block}
  71. {block name="script"}
  72. <script>
  73. layList.tableList('List', "{:Url('list')}", function () {
  74. return [
  75. {field: 'id', title: 'ID', sort: true, event: 'id', width: '5%'},
  76. {field: 'nickname', title: '微信名称', width: '10%'},
  77. {field: 'avatar', title: '头像', templet: '#headimgurl', width: '15%'},
  78. {field: 'staff_name', title: '客服名称', width: '15%'},
  79. {field: 'name', title: '所属门店', width: '15%'},
  80. {field: 'add_time', title: '添加时间', width: '15%'},
  81. {field: 'status', title: '状态', templet: "#checkboxstatus", width: '10%'},
  82. {field: 'right', title: '操作', align: 'center', toolbar: '#act', width: '15%'},
  83. ];
  84. });
  85. layList.form.render();
  86. //查询条件
  87. layList.search('search',function(where){
  88. layList.reload(where);
  89. });
  90. //门店是否显示
  91. layList.switch('is_show', function (odj, value) {
  92. if (odj.elem.checked == true) {
  93. layList.baseGet(layList.Url({
  94. c: 'system.SystemStoreStaff',
  95. a: 'set_show',
  96. p: {is_show: 1, id: value}
  97. }), function (res) {
  98. layList.msg(res.msg, function () {
  99. layList.reload();
  100. });
  101. });
  102. } else {
  103. layList.baseGet(layList.Url({
  104. c: 'system.SystemStoreStaff',
  105. a: 'set_show',
  106. p: {is_show: 0, id: value}
  107. }), function (res) {
  108. layList.msg(res.msg, function () {
  109. layList.reload();
  110. });
  111. });
  112. }
  113. });
  114. //点击事件绑定
  115. layList.tool(function (event, data, obj) {
  116. switch (event) {
  117. case 'del':
  118. var url = layList.U({c: 'system.SystemStoreStaff', a: 'delete', q: {id: data.id}});
  119. var code = {title: "操作提示", text: "确定将该店员删除吗?", type: 'info', confirm: '是的,删除该店员'};
  120. $eb.$swal('delete', function () {
  121. $eb.axios.get(url).then(function (res) {
  122. if (res.status == 200 && res.data.code == 200) {
  123. $eb.$swal('success', res.data.msg);
  124. obj.del();
  125. location.reload();
  126. } else
  127. return Promise.reject(res.data.msg || '删除失败')
  128. }).catch(function (err) {
  129. $eb.$swal('error', err);
  130. });
  131. }, code)
  132. break;
  133. case 'open_image':
  134. $eb.openImage(data.avatar);
  135. break;
  136. case 'edit':
  137. $eb.createModalFrame(data.name + '-编辑', layList.U({a: 'edit', q: {id: data.id}}), {h: 700, w: 1100});
  138. break;
  139. }
  140. })
  141. </script>
  142. {/block}