|
@@ -34,12 +34,12 @@
|
34
|
34
|
<!-- <div class="smalLine"></div> -->
|
35
|
35
|
<!-- <el-button type="primary" plain size="mini"><i class="el-icon-refresh-right"></i> 更新数据</el-button> -->
|
36
|
36
|
</div>
|
37
|
|
- <div class="selectCustom">已择0个客户</div>
|
|
37
|
+ <div class="selectCustom">已择{{multipleArr.length}}个客户</div>
|
38
|
38
|
</div>
|
39
|
39
|
<div class="flex">
|
40
|
40
|
<el-button type="primary" plain size="mini" @click="setCustomerTag(1)">批量打标签</el-button>
|
41
|
41
|
<el-button type="primary" plain size="mini" @click="setCustomerTag(2)">批量移除标签</el-button>
|
42
|
|
- <el-button type="primary" plain size="mini">导出Excel</el-button>
|
|
42
|
+ <el-button type="primary" plain size="mini" @click="init(1,'export')">导出Excel</el-button>
|
43
|
43
|
</div>
|
44
|
44
|
</div>
|
45
|
45
|
<!-- table -->
|
|
@@ -135,7 +135,7 @@
|
135
|
135
|
</el-drawer>
|
136
|
136
|
<!-- 批量打标签 -->
|
137
|
137
|
<el-dialog :title="tagType==1?'批量打标签':'批量移除标签'" :visible.sync="tagVisible" width="600px" center top="15vh">
|
138
|
|
- <tag-dialog @closeTagDialog="closeTagDialog" :tagType='tagType'></tag-dialog>
|
|
138
|
+ <tag-dialog @closeTagDialog="closeTagDialog" :tagType='tagType' :userLength='multipleArr.length'></tag-dialog>
|
139
|
139
|
</el-dialog>
|
140
|
140
|
</div>
|
141
|
141
|
</template>
|
|
@@ -162,7 +162,7 @@ export default {
|
162
|
162
|
page: 1,
|
163
|
163
|
pages: 0,
|
164
|
164
|
total: 0,
|
165
|
|
- page_size: 2,
|
|
165
|
+ page_size: 20,
|
166
|
166
|
shieldingFlag: false,
|
167
|
167
|
pageOptions: [
|
168
|
168
|
{ name: '全部', id: 1 },
|
|
@@ -188,8 +188,9 @@ export default {
|
188
|
188
|
rowPro: {},//去详情的此条对象
|
189
|
189
|
multipleSelection: {},
|
190
|
190
|
exclude_multiple_selection: {},
|
|
191
|
+ multipleArr: [],
|
191
|
192
|
isAll: false,//是否选择全部
|
192
|
|
- tagVisible: true,
|
|
193
|
+ tagVisible: false,
|
193
|
194
|
tagType: 1
|
194
|
195
|
}
|
195
|
196
|
},
|
|
@@ -199,56 +200,37 @@ export default {
|
199
|
200
|
methods: {
|
200
|
201
|
closeTagDialog (val) {
|
201
|
202
|
if (val && val.length != 0) {
|
202
|
|
- this.page = page ? page : this.page;
|
203
|
|
- this.loading = true
|
204
|
|
- this.$axios.get(this.URL.BASEURL + this.URL.customer_setCustomerTag, {
|
205
|
|
- params: {
|
206
|
|
- user_id_list: this.user_id_list,
|
207
|
|
- customer_name: this.input_keyword,
|
208
|
|
- add_date_start: this.add_date_start,
|
209
|
|
- add_date_end: this.add_date_end,
|
210
|
|
- add_way: this.add_way,
|
211
|
|
- pay_status: this.pay_status,
|
212
|
|
- pay_num_min: this.pay_num_min,
|
213
|
|
- pay_num_max: this.pay_num_max,
|
214
|
|
- tag_type: this.tag_type,
|
215
|
|
- tag_id_list: this.tag_id_list,
|
216
|
|
- loss_status: this.loss_status,
|
217
|
|
- page: this.page,
|
218
|
|
- page_size: this.page_size
|
219
|
|
- }
|
|
203
|
+ let customer_list = [];
|
|
204
|
+ customer_list = this.multipleArr.map((v) => {
|
|
205
|
+ return { customer_id: v.customer_id, user_id: v.user_id }
|
|
206
|
+ })
|
|
207
|
+ this.$loading(this.$loadingConfig);
|
|
208
|
+ this.$axios.post(this.URL.BASEURL + this.URL.customer_setCustomerTag, {
|
|
209
|
+ // user_id_list: this.user_id_list,
|
|
210
|
+ // customer_name: this.input_keyword,
|
|
211
|
+ // add_date_start: this.add_date_start,
|
|
212
|
+ // add_date_end: this.add_date_end,
|
|
213
|
+ // add_way: this.add_way,
|
|
214
|
+ // pay_status: this.pay_status,
|
|
215
|
+ // pay_num_min: this.pay_num_min,
|
|
216
|
+ // pay_num_max: this.pay_num_max,
|
|
217
|
+ // tag_type: this.tag_type,
|
|
218
|
+ // tag_id_list: this.tag_id_list,
|
|
219
|
+ // loss_status: this.loss_status,
|
|
220
|
+
|
|
221
|
+ type: this.tagType,
|
|
222
|
+ tag_list: val,
|
|
223
|
+ customer_list: customer_list
|
220
|
224
|
}).then((res) => {
|
221
|
225
|
var res = res.data
|
222
|
|
- this.loading = false
|
|
226
|
+ this.$loading(this.$loadingConfig).close();
|
223
|
227
|
if (res && res.errno == 0) {
|
224
|
|
- this.tableData = res.rst.data.list;
|
225
|
|
- this.otherData = {
|
226
|
|
- count: res.rst.data.count,
|
227
|
|
- exclude_count: res.rst.data.exclude_count
|
228
|
|
- }
|
229
|
|
- this.total = res.rst.pageInfo.total;
|
230
|
|
- this.pages = res.rst.pageInfo.pages;
|
231
|
|
-
|
232
|
|
- // 回显选择
|
233
|
|
- let page_multiple_data = [];
|
234
|
|
- if (this.isAll && (!this.multipleSelection[this.page])) {
|
235
|
|
- page_multiple_data = this.tableData
|
236
|
|
- } else {
|
237
|
|
- let multiple_id = this.multipleSelection[this.page] ? this.multipleSelection[this.page].map((v) => {
|
238
|
|
- return v.user_id + '-' + v.customer_id
|
239
|
|
- }) : []
|
240
|
|
- this.tableData.forEach((item) => {
|
241
|
|
- if (multiple_id.indexOf((item.user_id + '-' + item.customer_id)) != -1) {
|
242
|
|
- page_multiple_data.push(item)
|
243
|
|
- }
|
244
|
|
- })
|
245
|
|
- }
|
246
|
|
- this.$nextTick(() => {
|
247
|
|
- page_multiple_data.forEach((row) => {
|
248
|
|
- this.$refs.multipleTable.toggleRowSelection(row, true);
|
249
|
|
- })
|
250
|
|
- })
|
251
|
|
-
|
|
228
|
+ this.$notify.info({
|
|
229
|
+ title: '提示',
|
|
230
|
+ message: `批量${this.tagType == 1 ? '打' : '移除'}标签进行中,请耐心等待!`,
|
|
231
|
+ duration: 0
|
|
232
|
+ });
|
|
233
|
+ this.customer_batchMarkTagResult(res.rst.id)
|
252
|
234
|
} else if (res.errno != 4002) {
|
253
|
235
|
this.$message({
|
254
|
236
|
message: res.err,
|
|
@@ -256,11 +238,64 @@ export default {
|
256
|
238
|
})
|
257
|
239
|
}
|
258
|
240
|
}).catch((err) => {
|
259
|
|
- this.loading = false
|
|
241
|
+ this.$loading(this.$loadingConfig).close();
|
260
|
242
|
});
|
261
|
243
|
}
|
262
|
244
|
this.tagVisible = false
|
263
|
245
|
},
|
|
246
|
+ customer_batchMarkTagResult (id) {//批量编辑标签结果
|
|
247
|
+ this.$axios.get(this.URL.BASEURL + this.URL.customer_batchMarkTagResult, {
|
|
248
|
+ params: {
|
|
249
|
+ id: id
|
|
250
|
+ }
|
|
251
|
+ }).then((res) => {
|
|
252
|
+ var res = res.data
|
|
253
|
+ if (res && res.errno == 0) {
|
|
254
|
+ if (res.rst.status == 3) {
|
|
255
|
+ this.$notify.closeAll()
|
|
256
|
+ this.$notify({
|
|
257
|
+ title: '成功',
|
|
258
|
+ message: '标签编辑成功!',
|
|
259
|
+ type: 'success',
|
|
260
|
+ duration: 0
|
|
261
|
+ });
|
|
262
|
+ this.multipleSelection = {};
|
|
263
|
+ this.exclude_multiple_selection = {};
|
|
264
|
+ this.multipleArr = [];
|
|
265
|
+ this.isAll = false;
|
|
266
|
+ this.init(this.page)
|
|
267
|
+ } else if (res.rst.status == 3) {
|
|
268
|
+ this.$notify.closeAll()
|
|
269
|
+ this.$notify.error({
|
|
270
|
+ title: '错误',
|
|
271
|
+ message: '标签编辑失败!',
|
|
272
|
+ type: 'success',
|
|
273
|
+ duration: 0
|
|
274
|
+ });
|
|
275
|
+ } else {
|
|
276
|
+ setTimeout(() => {
|
|
277
|
+ this.customer_batchMarkTagResult(id)
|
|
278
|
+ }, 2000)
|
|
279
|
+ }
|
|
280
|
+ } else if (res.errno != 4002) {
|
|
281
|
+ this.$notify.closeAll()
|
|
282
|
+ this.$notify.error({
|
|
283
|
+ title: '错误',
|
|
284
|
+ message: res.err,
|
|
285
|
+ type: 'success',
|
|
286
|
+ duration: 0
|
|
287
|
+ });
|
|
288
|
+ }
|
|
289
|
+ }).catch((err) => {
|
|
290
|
+ this.$notify.closeAll()
|
|
291
|
+ this.$notify.error({
|
|
292
|
+ title: '错误',
|
|
293
|
+ message: '标签编辑失败,服务器错误!',
|
|
294
|
+ type: 'success',
|
|
295
|
+ duration: 0
|
|
296
|
+ });
|
|
297
|
+ });
|
|
298
|
+ },
|
264
|
299
|
resetEvent () {//重置
|
265
|
300
|
this.resetFlag = !this.resetFlag
|
266
|
301
|
this.input_keyword = '';
|
|
@@ -328,8 +363,18 @@ export default {
|
328
|
363
|
}
|
329
|
364
|
this.init(1)
|
330
|
365
|
},
|
331
|
|
- init (page) {
|
332
|
|
- this.page = page ? page : this.page;
|
|
366
|
+ init (page, type) {
|
|
367
|
+ if (type != 'export') {
|
|
368
|
+ this.page = page ? page : this.page;
|
|
369
|
+ } else {
|
|
370
|
+ if (this.total == 0) {
|
|
371
|
+ this.$message({
|
|
372
|
+ message: '暂无数据可导出',
|
|
373
|
+ type: "warning"
|
|
374
|
+ })
|
|
375
|
+ return
|
|
376
|
+ }
|
|
377
|
+ }
|
333
|
378
|
this.loading = true
|
334
|
379
|
this.$axios.get(this.URL.BASEURL + this.URL.customerList, {
|
335
|
380
|
params: {
|
|
@@ -344,41 +389,44 @@ export default {
|
344
|
389
|
tag_type: this.tag_type,
|
345
|
390
|
tag_id_list: this.tag_id_list,
|
346
|
391
|
loss_status: this.loss_status,
|
347
|
|
- page: this.page,
|
348
|
|
- page_size: this.page_size
|
|
392
|
+ page: type == 'export' ? 1 : this.page,
|
|
393
|
+ page_size: type == 'export' ? this.$store.state.exportNumber : this.page_size
|
349
|
394
|
}
|
350
|
395
|
}).then((res) => {
|
351
|
396
|
var res = res.data
|
352
|
397
|
this.loading = false
|
353
|
398
|
if (res && res.errno == 0) {
|
354
|
|
- this.tableData = res.rst.data.list;
|
355
|
|
- this.otherData = {
|
356
|
|
- count: res.rst.data.count,
|
357
|
|
- exclude_count: res.rst.data.exclude_count
|
358
|
|
- }
|
359
|
|
- this.total = res.rst.pageInfo.total;
|
360
|
|
- this.pages = res.rst.pageInfo.pages;
|
361
|
|
-
|
362
|
|
- // 回显选择
|
363
|
|
- let page_multiple_data = [];
|
364
|
|
- if (this.isAll && (!this.multipleSelection[this.page])) {
|
365
|
|
- page_multiple_data = this.tableData
|
|
399
|
+ if (type == 'export') {
|
|
400
|
+ this.exportEvent(res.rst.data.list)
|
366
|
401
|
} else {
|
367
|
|
- let multiple_id = this.multipleSelection[this.page] ? this.multipleSelection[this.page].map((v) => {
|
368
|
|
- return v.user_id + '-' + v.customer_id
|
369
|
|
- }) : []
|
370
|
|
- this.tableData.forEach((item) => {
|
371
|
|
- if (multiple_id.indexOf((item.user_id + '-' + item.customer_id)) != -1) {
|
372
|
|
- page_multiple_data.push(item)
|
373
|
|
- }
|
|
402
|
+ this.tableData = res.rst.data.list;
|
|
403
|
+ this.otherData = {
|
|
404
|
+ count: res.rst.data.count,
|
|
405
|
+ exclude_count: res.rst.data.exclude_count
|
|
406
|
+ }
|
|
407
|
+ this.total = res.rst.pageInfo.total;
|
|
408
|
+ this.pages = res.rst.pageInfo.pages;
|
|
409
|
+
|
|
410
|
+ // 回显选择
|
|
411
|
+ let page_multiple_data = [];
|
|
412
|
+ if (this.isAll && (!this.multipleSelection[this.page])) {
|
|
413
|
+ page_multiple_data = this.tableData
|
|
414
|
+ } else {
|
|
415
|
+ let multiple_id = this.multipleSelection[this.page] ? this.multipleSelection[this.page].map((v) => {
|
|
416
|
+ return v.user_id + '-' + v.customer_id
|
|
417
|
+ }) : []
|
|
418
|
+ this.tableData.forEach((item) => {
|
|
419
|
+ if (multiple_id.indexOf((item.user_id + '-' + item.customer_id)) != -1) {
|
|
420
|
+ page_multiple_data.push(item)
|
|
421
|
+ }
|
|
422
|
+ })
|
|
423
|
+ }
|
|
424
|
+ this.$nextTick(() => {
|
|
425
|
+ page_multiple_data.forEach((row) => {
|
|
426
|
+ this.$refs.multipleTable.toggleRowSelection(row, true);
|
|
427
|
+ })
|
374
|
428
|
})
|
375
|
429
|
}
|
376
|
|
- this.$nextTick(() => {
|
377
|
|
- page_multiple_data.forEach((row) => {
|
378
|
|
- this.$refs.multipleTable.toggleRowSelection(row, true);
|
379
|
|
- })
|
380
|
|
- })
|
381
|
|
-
|
382
|
430
|
} else if (res.errno != 4002) {
|
383
|
431
|
this.$message({
|
384
|
432
|
message: res.err,
|
|
@@ -389,13 +437,17 @@ export default {
|
389
|
437
|
this.loading = false
|
390
|
438
|
});
|
391
|
439
|
},
|
392
|
|
- setCustomerTag (type) {//批量打标签、移除标签
|
393
|
|
- //type 操作类型 1添加标签 2移除标签
|
|
440
|
+ userChange () {
|
394
|
441
|
let multipleArr = []
|
395
|
442
|
for (var i in this.multipleSelection) {
|
396
|
443
|
multipleArr = multipleArr.concat(this.multipleSelection[1] ? this.multipleSelection[1] : [])
|
397
|
444
|
}
|
398
|
|
- if (multipleArr.length == 0) {
|
|
445
|
+ this.multipleArr = multipleArr;
|
|
446
|
+ },
|
|
447
|
+ setCustomerTag (type) {//批量打标签、移除标签
|
|
448
|
+ //type 操作类型 1添加标签 2移除标签
|
|
449
|
+ this.userChange()
|
|
450
|
+ if (this.multipleArr.length == 0) {
|
399
|
451
|
this.$message({
|
400
|
452
|
message: '请选择客户!',
|
401
|
453
|
type: "warning"
|
|
@@ -413,6 +465,7 @@ export default {
|
413
|
465
|
this.multipleSelection = {}
|
414
|
466
|
this.exclude_multiple_selection = {}
|
415
|
467
|
this.isAll = false
|
|
468
|
+ this.userChange()
|
416
|
469
|
}
|
417
|
470
|
},
|
418
|
471
|
handleSelectionChange (row) {//点击选择变化
|
|
@@ -429,6 +482,7 @@ export default {
|
429
|
482
|
})
|
430
|
483
|
this.exclude_multiple_selection[this.page] = page_multiple_data
|
431
|
484
|
}
|
|
485
|
+ this.userChange()
|
432
|
486
|
},
|
433
|
487
|
pageOptionSelect (val) {//选择
|
434
|
488
|
if (val && val != '') {
|
|
@@ -446,6 +500,7 @@ export default {
|
446
|
500
|
this.tableData.forEach((row) => {
|
447
|
501
|
this.$refs.multipleTable.toggleRowSelection(row, true);
|
448
|
502
|
});
|
|
503
|
+ this.userChange()
|
449
|
504
|
},
|
450
|
505
|
changeDrawerSize () {
|
451
|
506
|
this.drawerSize = this.drawerSize == '100%' ? '60%' : '100%'
|
|
@@ -461,6 +516,27 @@ export default {
|
461
|
516
|
this.$refs.detial.acIdx = 0
|
462
|
517
|
this.$refs.detial.init()
|
463
|
518
|
})
|
|
519
|
+ },
|
|
520
|
+ exportEvent (data) {
|
|
521
|
+ let list = data;
|
|
522
|
+ let tHeader = ['客户id', '客户名称', '客户备注', '客户头像', '外部联系人的类型', '客户状态', '所属客服', '客服ID', '所属部门', '标签', '性别', '添加时间', '添加渠道', '付费情况']
|
|
523
|
+ let filterVal = ['customer_id', 'name', 'remark', 'avatar', 'self_type', 'self_customer_enable', 'self_user_name', 'user_id', 'department_list', 'tag_list', 'self_gender', 'createtime', 'add_way', 'self_pay_num']
|
|
524
|
+ list.forEach((item) => {
|
|
525
|
+ item.self_pay_num = item.pay_num > 0 ? ('已付费(' + item.pay_num + '次)') : '未付费';
|
|
526
|
+ item.self_gender = item.gender == 1 ? '男' : item.gender == 2 ? '女' : '';
|
|
527
|
+ item.self_user_name = item.user_list.name;
|
|
528
|
+ item.self_type = item.type == 1 ? '微信用户' : item.type == 2 ? '' : '企业微信';
|
|
529
|
+ item.self_customer_enable = item.customer_enable == 0 ? '禁用' : item.customer_enable == 1 ? '可用' : item.customer_enable == 3 ? '已流失' : ''
|
|
530
|
+ })
|
|
531
|
+ let excelDatas = [
|
|
532
|
+ {
|
|
533
|
+ tHeader: tHeader, // sheet表一头部
|
|
534
|
+ filterVal: filterVal, // 表一的数据字段
|
|
535
|
+ tableDatas: list, // 表一的整体json数据
|
|
536
|
+ sheetName: ''// 表一的sheet名字
|
|
537
|
+ }
|
|
538
|
+ ]
|
|
539
|
+ this.$exportOrder({ excelDatas, name: `客户管理(导出时间:${this.$getDay(0)})` })
|
464
|
540
|
}
|
465
|
541
|
}
|
466
|
542
|
}
|