index.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <style>
  2. </style>
  3. <div id="app" v-cloak>
  4. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  5. <div slot="header">
  6. <span>核销员列表</span>
  7. <div style="float: right">
  8. <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="editClick">添加核销员</el-button>
  9. </div>
  10. </div>
  11. <div class="table-body">
  12. <el-form ref="form" style="margin-bottom: 10px;" :model="searchInfo" label-width="96px" size="mini">
  13. <el-row :gutter="24">
  14. <el-col :span="5" style="padding-left: 0;" class="top_form">
  15. <el-form-item label="会员ID">
  16. <el-input v-model="searchInfo.user_id" placeholder="请输入会员ID" clearable></el-input>
  17. </el-form-item>
  18. </el-col>
  19. <el-button @click="toSearch" style="padding: 9px 15px !important;" size="small" type="primary">搜索</el-button>
  20. </el-row>
  21. </el-form>
  22. <el-tabs v-model="activeName" >
  23. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;" >
  24. <el-table-column prop="user_id" min-width="30" label="会员ID" align="center"></el-table-column>
  25. <el-table-column label="会员" >
  26. <template slot-scope="scope">
  27. <div class="user_img" flex="cross:center">
  28. <el-image class="default-avatar" :src="scope.row.user.avatar_url">
  29. <div slot="error" class="image-slot">
  30. <com-image src="resources/img/mall/default_avatar_url.png"></com-image>
  31. </div>
  32. </el-image>
  33. <div class="uer-nickname over1" v-if="scope.row.user.nickname">{{scope.row.user.nickname}}</div>
  34. <div class="uer-nickname over1" v-else >ID:{{scope.row.user_id}}</div>
  35. </div>
  36. </template>
  37. </el-table-column>
  38. <el-table-column label="累计核销金额" prop="total_money" ></el-table-column>
  39. <el-table-column label="累计核销订单" prop="nums" ></el-table-column>
  40. <el-table-column label="启用状态" width="120" align="center">
  41. <template slot-scope="scope">
  42. <el-switch
  43. :active-value="1"
  44. :inactive-value="0"
  45. @change="switchStatus(scope.row)"
  46. v-model="scope.row.status">
  47. </el-switch>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="创建时间" align="center">
  51. <template slot-scope="scope">
  52. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="备注" prop="remark" align="center"></el-table-column>
  56. <el-table-column label="操作" align="center">
  57. <template slot-scope="scope">
  58. <el-button circle size="mini" type="text" @click="ClerkDelete(scope.row, scope.$index)">
  59. 删除
  60. </el-button>
  61. <el-button type="text" @click="clerkLog(scope.row.user_id)" class="all_text">核销明细</el-button>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. </el-tabs>
  66. <div flex="box:last cross:center">
  67. <div></div>
  68. <div>
  69. <el-pagination v-if="pagination" :page-size="pagination.defaultPageSize"
  70. style="float: right;" background @current-change="pageChange"
  71. layout="prev, pager, next" :total="pagination.totalCount">
  72. </el-pagination>
  73. </div>
  74. </div>
  75. </div>
  76. </el-card>
  77. <el-dialog :visible.sync="edit_visible" width="20%" title="添加核销员">
  78. <div>
  79. <el-form @submit.native.prevent label-width="150px">
  80. <el-form-item label="用户昵称">
  81. <el-autocomplete v-model="editForm.nickname" value-key="nickname" @keyup.enter.native="keyUp"
  82. :fetch-suggestions="querySearchAsync" placeholder="请输入用户昵称/id/手机号"
  83. @select="shareClick"></el-autocomplete>
  84. </el-form-item>
  85. <el-form-item label="备注">
  86. <el-input v-model="editForm.remark" placeholder="" clearable style="width: 200px" ></el-input>
  87. </el-form-item>
  88. </el-form>
  89. </div>
  90. <span slot="footer" class="dialog-footer">
  91. <el-button @click="editCancel" type="default" size="small">取消</el-button>
  92. <el-button type="primary" style="margin-bottom: 10px;" size="small" @click="editSave">保存</el-button>
  93. </span>
  94. </el-dialog>
  95. </div>
  96. <script>
  97. const app = new Vue({
  98. el: '#app',
  99. data: {
  100. levels:[],
  101. searchInfo: {
  102. user_id: '',
  103. nickname_or_mobile: '', //会员昵称/手机号
  104. source: '',//用户来源
  105. register_start: '',//注册开始时间
  106. register_end: '',//注册结束时间
  107. level: '',//注册结束时间
  108. },
  109. list: [],
  110. editForm:{},
  111. channelArr: [],//渠道
  112. edit_visible: false,
  113. loading: false,
  114. activeName: '-1',
  115. pagination: null,
  116. level: {
  117. show: false,
  118. agent: null,
  119. },
  120. },
  121. computed: {
  122. },
  123. mounted() {
  124. this.loadData();
  125. },
  126. methods: {
  127. loadData() {
  128. this.loading = true;
  129. let params = {
  130. r: 'store/client/clerk/index'
  131. };
  132. params = Object.assign(params, this.searchInfo);
  133. request({
  134. params: params,
  135. method: 'get',
  136. }).then(e => {
  137. this.loading = false;
  138. if (e.data.code == 0) {
  139. this.list = e.data.data.list;
  140. this.pagination = e.data.data.pagination;
  141. this.levels = e.data.data.levels;
  142. } else {
  143. this.$message.error(e.data.msg);
  144. }
  145. }).catch(e => {
  146. this.loading = false;
  147. });
  148. },
  149. toSearch() {
  150. this.page = 1;
  151. this.loadData();
  152. },
  153. pageChange(page) {
  154. this.search.page = page;
  155. this.loadData();
  156. },
  157. clerkLog(id){
  158. this.$navigate({
  159. r: 'store/client/clerk/clerk-log',
  160. id: id
  161. })
  162. },
  163. editClick() {
  164. console.log(222);
  165. this.edit_visible = true;
  166. },
  167. querySearchAsync(queryString, cb){
  168. request({
  169. params: {
  170. r: 'store/client/clerk/search-user',
  171. keyword: queryString
  172. }
  173. }).then(res => {
  174. if (res.data.code == 0) {
  175. cb(res.data.data.list)
  176. } else {
  177. this.$message.error(res.data.msg);
  178. }
  179. });
  180. },
  181. shareClick(row) {
  182. console.log(row);
  183. this.editForm.user_id = row.user_id
  184. },
  185. editCancel() {
  186. this.edit_visible = false;
  187. },
  188. editSave() {
  189. if (!this.editForm.user_id) {
  190. this.$message.error('请选择会员');
  191. return null;
  192. }
  193. request({
  194. params: {
  195. r: 'store/client/clerk/edit',
  196. },
  197. method: 'post',
  198. data: {
  199. user_id: this.editForm.user_id,
  200. remark: this.editForm.remark,
  201. }
  202. }).then(response => {
  203. if (response.data.code == 0) {
  204. this.edit_visible = false;
  205. this.$message.success('添加成功');
  206. this.loadData();
  207. } else {
  208. this.$message.error(response.data.msg);
  209. }
  210. }).catch(response => {
  211. this.edit.btnLoading = false;
  212. });
  213. },
  214. switchStatus(row) {
  215. let self = this;
  216. self.listLoading = true;
  217. let status = row ? parseInt(row.status) : '';
  218. request({
  219. params: {
  220. r: 'store/client/clerk/switch-status',
  221. },
  222. method: 'post',
  223. data: {
  224. id: row.id,
  225. status: status,
  226. }
  227. }).then(e => {
  228. self.listLoading = false;
  229. if (e.data.code === 0) {
  230. self.$message.success(e.data.msg);
  231. } else {
  232. self.$message.error(e.data.msg);
  233. }
  234. self.getList();
  235. }).catch(e => {
  236. console.log(e);
  237. });
  238. },
  239. ClerkDelete(row, index) {
  240. let self = this;
  241. self.$confirm('删除该核销员等级, 是否继续?', '提示', {
  242. confirmButtonText: '确定',
  243. cancelButtonText: '取消',
  244. type: 'warning'
  245. }).then(() => {
  246. self.listLoading = true;
  247. request({
  248. params: {
  249. r: 'store/client/clerk/delete',
  250. },
  251. method: 'post',
  252. data: {
  253. id: row.id,
  254. }
  255. }).then(e => {
  256. self.listLoading = false;
  257. if (e.data.code === 0) {
  258. self.$message.success(e.data.msg);
  259. self.list.splice(index, 1);
  260. } else {
  261. self.$message.error(e.data.msg);
  262. }
  263. }).catch(e => {
  264. console.log(e);
  265. });
  266. }).catch(() => {
  267. self.$message.info('已取消删除')
  268. });
  269. },
  270. }
  271. });
  272. </script>
  273. <style>
  274. .el-tabs__header {
  275. font-size: 16px;
  276. }
  277. .table-body {
  278. padding: 20px;
  279. background-color: #fff;
  280. }
  281. .table-body .el-button {
  282. padding: 0 !important;
  283. border: 0;
  284. margin: 0 5px;
  285. }
  286. .input-item {
  287. width: 250px;
  288. margin: 0 0 20px;
  289. display: inline-block;
  290. }
  291. /*.input-item .el-input__inner {*/
  292. /* border-right: 0;*/
  293. /*}*/
  294. .input-item .el-input__inner:hover {
  295. border: 1px solid #dcdfe6;
  296. /*border-right: 0;*/
  297. outline: 0;
  298. }
  299. .input-item .el-input__inner:focus {
  300. border: 1px solid #dcdfe6;
  301. /*border-right: 0;*/
  302. outline: 0;
  303. }
  304. .input-item .el-input-group__append {
  305. background-color: #fff;
  306. border-left: 0;
  307. width: 10%;
  308. padding: 0;
  309. }
  310. .input-item .el-input-group__append .el-button {
  311. padding: 0;
  312. }
  313. .input-item .el-input-group__append .el-button {
  314. margin: 0;
  315. }
  316. .batch {
  317. margin: 0 0 20px;
  318. display: inline-block;
  319. }
  320. .batch .el-button {
  321. padding: 9px 15px !important;
  322. }
  323. .el-table th>.cell{
  324. color: #333;
  325. font-weight: bold;
  326. font-size: 14px;
  327. }
  328. .el-table__footer-wrapper, .el-table__header-wrapper{
  329. border-bottom: 1.4px solid #D6D6D6;
  330. }
  331. .el-table th>.cell {
  332. color: #333;
  333. font-weight: bold;
  334. font-size: 14px;
  335. }
  336. .table1 .el-table__footer-wrapper,
  337. .table1 .el-table__header-wrapper {
  338. border-bottom: 1.4px solid #D6D6D6;
  339. }
  340. .user_img{
  341. position: relative;
  342. margin-right: 8px;
  343. /* height: 50px;
  344. width: 50px; */
  345. }
  346. .default-avatar{
  347. width: 50px;
  348. height: 50px;
  349. border-radius: 50%;
  350. margin-right: 8px;
  351. }
  352. .uer-nickname {
  353. flex: 1;
  354. }
  355. </style>