staffTargetList.vue
17.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
<!-- 驻店员工目标 -->
<template>
<d2-container class="staff-target-list m-t-40">
<div class="header"
slot="header">
<d2-search ref="showSearch"
class="show-search"
:search-form="searchForm"
:label-width="'100px'"
:form-data="showFormData">
</d2-search>
<div class="up-btns">
<el-button @click="searchList"
size="small"
type="primary">
查询
</el-button>
<el-button size="small"
@click="handleReset">
重置
</el-button>
</div>
</div>
<div class="d2-container-content">
<d2-table-header>
<auth-button category="Button"
style="{display: inline-block}"
:show-btn-ids="['9120704']" />
</d2-table-header>
<d2-table ref="staffTargetTable"
:has-num="false"
:search-form="searchForm"
:table-params="tableParams"
:table-data="tableData"
:table-total="total"
@refreshTable="jumpPage"
:array-span-method="arraySpanMethod">
<!-- 车主类型 -->
<template slot="selectCarType"
slot-scope="scope">
<div v-if="scope.scope.selectCarType == 0">无</div>
<div v-if="scope.scope.selectCarType == 1">
车辆价格:{{ scope.scope.minCarPrice }}-{{ scope.scope.maxCarPrice }}万</div>
<div v-if="scope.scope.selectCarType == 2">车辆类型:
<span v-for="(subItem, subIndex) in scope.scope.carList"
:key="subIndex">{{ `${subItem.carSeriesName}` }}<span
v-if="subIndex < scope.scope.carList.length - 1"> / </span></span>
</div>
</template>
<!-- 商品分类 -->
<template slot="selectGoodsType"
slot-scope="scope">
<div v-if="scope.scope.selectGoodsType == 0">无</div>
<div v-if="scope.scope.selectGoodsType == 1">
<span v-for="(subItem, subIndex) in scope.scope.goodsTypeList"
:key="subIndex">{{ subItem.goodsTypeName }}<span
v-if="subIndex < scope.scope.goodsTypeList.length - 1"> + </span></span>
</div>
</template>
<!-- 主推产品套餐 -->
<template slot="selectPackageType"
slot-scope="scope">
<div v-if="scope.scope.selectPackageType == 0">无</div>
<!-- 单商品/多个商品 -->
<div v-if="scope.scope.selectPackageType == 1">
<div style="padding: 0 3px;width: 180px;overflow: hidden; text-overflow: ellipsis;white-space: nowrap;"
v-for="(subItem, subIndex) in scope.scope.packageList"
:key="subIndex">{{ subItem.upgradeGoodsName }}</div>
</div>
<!-- 商品组合 -->
<div v-if="scope.scope.selectPackageType == 2">
<span v-for="(subItem, subIndex) in scope.scope.packageList"
:key="subIndex">{{ subItem.upgradeGoodsName }}<span
v-if="subIndex < scope.scope.packageList.length - 1"> + </span></span>
</div>
</template>
<!-- 目标转化率 -->
<template slot="conversionRate"
slot-scope="scope">
<div v-if="scope.scope.selectPackageType == 1">
<div v-for="(subItem, subIndex) in scope.scope.packageList"
:key="subIndex">{{ `${subItem.conversionRate}%` || '-' }}</div>
</div>
<div v-else>{{ `${scope.scope.conversionRate}%` || '-' }}</div>
</template>
<!-- 目标转化率提成 -->
<template slot="conversionRatePercentage"
slot-scope="scope">
<div v-if="scope.scope.selectPackageType == 1">
<div v-for="(subItem, subIndex) in scope.scope.packageList"
:key="subIndex">{{ `${subItem.conversionRatePercentage}%` || '-' }}</div>
</div>
<div v-else>{{ `${scope.scope.conversionRatePercentage}%` || '-' }}</div>
</template>
<!-- 客单价 -->
<template slot="customerUnitPrice"
slot-scope="scope">
<div v-if="scope.scope.selectPackageType == 1">
<div v-for="(subItem, subIndex) in scope.scope.packageList"
:key="subIndex">{{ `¥${subItem.customerUnitPrice}` || '-' }}</div>
</div>
<div v-else>{{ `¥${scope.scope.customerUnitPrice}` || '-' }}</div>
</template>
<!-- 客单价提成 -->
<template slot="customerUnitPricePercentage"
slot-scope="scope">
<div v-if="scope.scope.selectPackageType == 1">
<div v-for="(subItem, subIndex) in scope.scope.packageList"
:key="subIndex">{{ `${subItem.customerUnitPricePercentage}%` || '-' }}</div>
</div>
<div v-else>{{ `${scope.scope.customerUnitPricePercentage}%` || '-' }}</div>
</template>
<!-- 关联服务商 -->
<!-- <div slot="serviceNameList" slot-scope="scope">
<div v-for="item in scope.scope.targetCofig.serviceList" :key="item.merchantId">{{ item.merchantName }}</div>
</div> -->
<!-- 关联服务商商户号 -->
<!-- <div slot="serviceIdList" slot-scope="scope">
<div v-for="item in scope.scope.targetCofig.serviceList" :key="item.merchantId">{{ item.merchantId }}</div>
</div> -->
<div slot="auth-button"
slot-scope="scope">
<!-- 查看 -->
<span style="margin-right: 10px;">
<auth-button :data="scope.scope"
:show-btn-ids="['9120705']" />
</span>
</div>
</d2-table>
</div>
</d2-container>
</template>
<script>
import { mapActions, mapState } from 'vuex'
import { Util } from '@/common/util'
import { getStaffTaskListApi } from '@api/inStoreTargetConfig'
export default {
name: "StoreTargetList",
data() {
return {
// 搜索框
showFormData: [{
label: '驻店员工',
name: 'staffNameOrPhone',
type: 'input',
placeholder: '请输入驻店员工姓名/手机号',
isClear: true,
keyFn: this.keyDownGetList
}, {
label: '场景名称',
name: 'sceneType',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confValue',
optionsName: 'sceneTypeList'
}, {
label: '商户名称',
name: 'allMerchantName',
type: 'input',
placeholder: '请输入园区店/流量方/服务商名称',
isClear: true,
keyFn: this.keyDownGetList
}, {
label: '商户号',
name: 'allMerchantId',
type: 'input',
inputType: 'number',
placeholder: '请输入园区店/流量方/服务商商户号',
isClear: true,
keyFn: this.keyDownGetList
}],
getListApi: getStaffTaskListApi,
// 表格参数
tableParams: {
needUnique: true,
mutiSelectUniqueKey: 'uniqueVal',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: {
width: '100'
},
tableColumns: [{
label: '序号',
prop: 'num',
width: '60'
}, {
label: '员工名称',
prop: 'staffName',
width: '120'
}, {
label: '联系方式',
prop: 'phoneNumber',
width: '120'
}, {
label: '账号创建日期',
prop: 'registerTime',
width: '110',
formatter: (cellValue) => {
return cellValue.registerTime ? Util.dateFormate(cellValue.registerTime, 'YYYY-MM-DD') : ''
}
}, {
label: '考核状态',
prop: 'checkStatus',
className: (cellValue) => {
return {
0: 'redSpot',
1: 'blueSpot',
2: 'greenSpot'
}[cellValue.checkStatus]
},
formatter: (cellValue) => {
return {
0: '待考核',
1: '考核中',
2: '已考核'
}[cellValue.checkStatus]
}
}, {
label: '考核周期',
prop: 'checkPeriod',
width: '120',
formatter: (cellValue) => {
return `${{
1: '首月',
2: '次月',
3: '第三月'
}[cellValue?.checkMonth]}-${{
1: '上半月',
2: '下半月'
}[cellValue?.checkPeriod]}`
}
}, {
label: '业务场景',
prop: 'sceneType',
width: '120',
formatter: (cellValue) => {
return {
0: '会员权益/升级',
1: '精品升级'
}[cellValue?.targetCofig?.sceneType]
}
}, {
label: '流量方',
prop: 'merchantName',
width: '150',
formatter: (cellValue) => {
return cellValue?.targetCofig?.merchantName
}
}, {
label: '车主类型',
prop: 'selectCarType',
width: '160',
addHtml: 'selectCarType'
}, {
label: '商品分类',
prop: 'goodsType',
width: '160',
addHtml: 'selectGoodsType'
}, {
label: '主推产品套餐',
prop: 'studentNumber',
width: '180',
addHtml: 'selectPackageType'
}, {
label: '目标转化率',
prop: 'conversionRate',
width: '100',
addHtml: 'conversionRate'
}, {
label: '提成系数',
prop: 'conversionRatePercentage',
width: '80',
addHtml: 'conversionRatePercentage'
}, {
label: '目标客单价',
prop: 'customerUnitPrice',
width: '100',
addHtml: 'customerUnitPrice'
}, {
label: '提成系数',
prop: 'customerUnitPricePercentage',
width: '80',
addHtml: 'customerUnitPricePercentage'
},
// {
// label: '关联服务商',
// prop: 'merchantName',
// width: '160',
// addHtml: 'serviceNameList'
// }, {
// label: '关联服务商号',
// prop: 'merchantId',
// width: '120',
// addHtml: 'serviceIdList'
// },
{
label: '关联园区店',
prop: 'yqMerchantName',
width: '160',
formatter: (cellValue) => {
return cellValue?.targetCofig?.yqMerchantName
}
}, {
label: '关联园区店商户号',
prop: 'yqMerchantId',
width: '160',
formatter: (cellValue) => {
return cellValue?.targetCofig?.yqMerchantId
}
}, {
label: '最近更新时间',
prop: 'updatedDate',
width: '160',
formatter: (cellValue) => {
return cellValue.updatedDate ? Util.dateFormate(cellValue.updatedDate, 'YYYY-MM-DD HH:mm:ss') : ''
}
}]
},
// 查询条件
searchForm: {
staffNameOrPhone: '',
allMerchantName: '',
allMerchantId: '',
sceneType: ''
},
baseData: {
sceneTypeList: [{
confId: 1,
confValue: '精品升级'
}, {
confId: 0,
confValue: '会员权益/升级'
}]
},
tableData: [],
page: {
pageSize: 10,
currentPage: 1
},
total: 0,
spanArr1: [],
spanIndex1: 0,
spanArr2: [],
spanIndex2: 0,
spanArr3: [],
spanIndex3: 0,
spanArr4: [],
spanIndex4: 0,
spanArr5: [],
spanIndex5: 0,
spanArr6: [],
spanIndex6: 0,
spanArr7: [],
spanIndex7: 0,
spanArr8: [],
spanIndex8: 0,
spanArr9: [],
spanIndex9: 0,
spanArr10: [],
spanIndex10: 0,
spanArr11: [],
spanIndex11: 0,
spanArr12: [],
spanIndex12: 0
}
},
computed: {
...mapState({
dowloadList: (state) => state.d2admin.user.dowloadList,
updateList: (state) => state.d2admin.user.updateList
})
},
mounted() {
this.getBaseData()
this.getListData()
},
methods: {
...mapActions({
get: 'd2admin/base/get',
close: 'd2admin/page/close'
}),
...mapActions('d2admin/user', ['actionSetDownloadList']),
getBaseData() {
this.showFormData.forEach((item, index) => {
if (item.type === 'select') {
this.baseData[item.name + 'List'].unshift({
confId: '',
confValue: '全部'
})
this.$set(this.showFormData[index], 'optionList', this.baseData[item.optionsName])
}
})
},
searchList() {
this.page = {
pageSize: this.page.pageSize,
currentPage: 1
}
this.$refs.staffTargetTable.page.currentPage = 1
this.getListData()
},
jumpPage(page) {
this.page = page
this.getListData()
},
getListData() {
var params = this.searchForm
params = {
...this.page,
...params
}
getStaffTaskListApi(params).then(res => {
this.total = res.total
this.restructureData(res)
})
},
restructureData(data) {
const arr = []
data?.list?.forEach((val, index) => {
val.num = index + 1
val?.taskList?.forEach(subVal => {
arr.push({ ...subVal, ...val })
})
})
this.tableData = arr
this.merge(arr)
},
// 初始化合并行数组
mergeInit() {
for (var i = 1; i < 13; i++) {
this[`spanArr${i}`] = []
this[`spanIndex${i}`] = 0
}
},
// 合并表格
merge(data) {
this.mergeInit()
if (data.length > 0) {
for (var i = 0; i < data.length; i++) {
for (var j = 1; j < 13; j++) {
if (i === 0) {
// 第一行必须存在,以第一行为基准
this[`spanArr${j}`].push(1) // 合并序号
this[`spanIndex${j}`] = 0
} else {
if (data[i].id == data[i - 1].id) {
this[`spanArr${j}`][this[`spanIndex${j}`]] += 1
this[`spanArr${j}`].push(0)
} else {
this[`spanArr${j}`].push(1)
this[`spanIndex${j}`] = i
}
}
}
}
}
},
// 合并表格
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
const len = this.tableData?.length
const t = 20
for (var i = 0; i < 8; i++) {
if (columnIndex == i) {
return {
rowspan: this[`spanArr${i + 1}`][rowIndex],
colspan: this[`spanArr${i + 1}`][rowIndex] > 0 ? 1 : 0
}
}
}
// 第十六列 关联园区店
if (columnIndex == 15) {
const _row_9 = this.spanArr9[rowIndex]
const _col_9 = _row_9 > 0 ? 1 : 0
return {
rowspan: _row_9,
colspan: _col_9
}
// 第十七列 关联园区店商户号
} else if (columnIndex == 16) {
const _row_10 = this.spanArr10[rowIndex]
const _col_10 = _row_10 > 0 ? 1 : 0
return {
rowspan: _row_10,
colspan: _col_10
}
// 第十八列 最近更新时间
} else if (columnIndex == 17) {
const _row_11 = this.spanArr11[rowIndex]
const _col_11 = _row_11 > 0 ? 1 : 0
return {
rowspan: _row_11,
colspan: _col_11
}
// 第十九列 操作
} else if (columnIndex == 18) {
const _row_12 = this.spanArr12[rowIndex]
const _col_12 = _row_12 > 0 ? 1 : 0
return {
rowspan: _row_12,
colspan: _col_12
}
} else if (columnIndex === t) {
const _row_13 = len
const _col_13 = 1
return {
rowspan: _row_13,
colspan: _col_13
}
} else if (rowIndex === len) {
return {
rowspan: 1,
colspan: 1
}
}
},
beforeSearchFn() {
return new Promise(resolve => {
resolve()
})
},
setTableFinishFun(data) {
},
// 重置
handleReset() {
this.searchForm = {
staffNameOrPhone: '',
allMerchantName: '',
allMerchantId: '',
sceneType: ''
}
this.searchList()
},
// 导出
handleExport() {
var params = this.searchForm
params.method = 'dj.api.smartcarlife.staffTargetCheck.export.async'
const list = [
...this.dowloadList,
{
name: '导出',
exportParam: JSON.stringify(params),
status: 'waiting',
timeid: new Date().getTime()
}
]
this.actionSetDownloadList({ list, type: 'dowloadList' })
},
// 查看任务详情
handleStaffView(row) {
this.close({ tagName: '/inStoreGoalsConfig' })
this.$router.push({
path: '/employeeTasksView',
query: { id: row.id }
})
}
}
}
</script>
<style lang="scss" scoped>
.m-t-40 {
margin-top: 40px;
}
</style>