index.php 6.3 KB

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