employeeTasksView.vue
10.6 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
<!-- 驻店员工查看任务 -->
<template>
<d2-container :loading="$store.state.d2admin.loading.value">
<div class="d2-container-content">
<p class="edit-sub-title">
查看员工任务
</p>
<glsx-combi-form class="edit-form-container"
ref="editFormRef2"
label-width="154px"
default-width="432px"
:is-block="true"
form-ref="editChildRef"
:form-obj="viewInfo"
:form-data="viewFormData">
<div slot="inStoreTarget">
<d2-table :array-span-method="arraySpanMethod" :table-data="viewInfo.tableData" :table-params="tableParams" :has-page="false">
<!-- 车主类型 -->
<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="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>
</d2-table>
</div>
</glsx-combi-form>
<div class="page_footer">
<el-button type="primary" @click="handleClose">
返回
</el-button>
</div>
</div>
</d2-container>
</template>
<script>
import { mapActions } from 'vuex'
import { getStaffTaskDetailApi } from '@api/inStoreTargetConfig'
export default {
name: 'EmployeeTaskView',
data() {
return {
viewFormData: [{
label: '门店名称',
isHide: false,
name: 'merchantName',
type: 'showTxt'
}, {
label: '业务场景',
isHide: false,
name: 'sceneTypeTxt',
type: 'showTxt'
}, {
label: '驻店员工',
isHide: false,
name: 'staffName',
type: 'showTxt'
}, {
label: '联系方式',
isHide: false,
name: 'phoneNumber',
type: 'showTxt'
}, {
label: '考核周期',
isHide: false,
name: 'checkMonthPeriod',
type: 'showTxt'
}, {
label: '驻店目标',
isHide: false,
addHtml: 'inStoreTarget'
}],
tableParams: {
tableColumns: [{
label: '月度',
prop: 'checkMonth',
formatter: (cellValue) => {
return { 1: '首月', 2: '次月', 3: '第三月' }[cellValue?.checkMonth]
}
}, {
label: '周期',
prop: 'checkPeriod',
formatter: (cellValue) => {
return { 1: '上半月', 2: '下半月' }[cellValue?.checkPeriod]
}
}, {
label: '车主类型',
prop: 'selectCarType',
addHtml: 'selectCarType'
}, {
label: '主推产品套餐',
prop: 'studentNumber',
width: '180',
addHtml: 'selectPackageType'
}, {
label: '目标转化率',
prop: 'conversionRate',
addHtml: 'conversionRate'
}, {
label: '提成系数',
prop: 'conversionRatePercentage',
addHtml: 'conversionRatePercentage'
}, {
label: '目标客单价',
prop: 'customerUnitPrice',
addHtml: 'customerUnitPrice'
}, {
label: '提成系数',
prop: 'customerUnitPricePercentage',
addHtml: 'customerUnitPricePercentage'
}]
},
viewInfo: {
tableData: []
},
spanArr1: [],
spanIndex1: 0,
spanArr2: [],
spanIndex2: 0,
spanArr3: [],
spanIndex3: 0
}
},
mounted() {
const routerQuery = this.$route.query
// 获取详情
this.getDetailInfo(routerQuery)
},
methods: {
...mapActions({
get: 'd2admin/base/get',
close: 'd2admin/page/close'
}),
getDetailInfo(routerQuery) {
getStaffTaskDetailApi({ id: routerQuery?.id }).then(res => {
res.taskList?.forEach(val => {
val.checkMonth = res?.checkMonth
val.checkPeriod = res?.checkPeriod
})
res = {
merchantName: res?.targetCofig?.merchantName,
sceneTypeTxt: ['会员权益/升级', '精品升级'][res?.targetCofig?.sceneType] || '-',
staffName: res.staffName,
phoneNumber: res.phoneNumber,
checkMonthPeriod: `${{ 1: '首月', 2: '次月', 3: '第三月' }[res?.checkMonth]}-${{ 1: '上半月', 2: '下半月' }[res?.checkPeriod]}`,
tableData: res?.taskList || []
}
this.viewInfo = res || {}
this.merge(res?.tableData)
}).catch(() => {})
},
// 合并表格
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
const len = this.viewInfo?.tableData?.length
const t = 10
if (columnIndex === 0) {
// 第一列 序号
const _row_1 = this.spanArr1[rowIndex]
const _col_1 = _row_1 > 0 ? 1 : 0
return {
rowspan: _row_1,
colspan: _col_1
}
} else if (columnIndex === 1) {
// 第二列 月度
const _row_2 = this.spanArr2[rowIndex]
const _col_2 = _row_2 > 0 ? 1 : 0
return {
rowspan: _row_2,
colspan: _col_2
}
// 第三列 周期
} else if (columnIndex === 2) {
const _row_3 = this.spanArr3[rowIndex]
const _col_3 = _row_3 > 0 ? 1 : 0
return {
rowspan: _row_3,
colspan: _col_3
}
} else if (columnIndex === t) {
const _row_4 = len
const _col_4 = 1
return {
rowspan: _row_4,
colspan: _col_4
}
} else if (rowIndex === len) {
return {
rowspan: 1,
colspan: 1
}
}
},
// 初始化合并行数组
mergeInit() {
this.spanArr1 = [] // 合并序号
this.spanIndex1 = 0 // 合并序号索引
this.spanArr2 = [] // 合并月度
this.spanIndex2 = 0 // 合并月度索引
this.spanArr3 = [] // 合并周期
this.spanIndex3 = 0 // 合并周期索引
},
// 合并表格
merge(data) {
this.mergeInit()
if (data.length > 0) {
for (var i = 0; i < data.length; i++) {
if (i === 0) {
// 第一行必须存在,以第一行为基准
this.spanArr1.push(1) // 合并序号
this.spanIndex1 = 0
this.spanArr2.push(1) // 合并月度
this.spanIndex2 = 0
this.spanArr3.push(1) // 合并周期
this.spanIndex3 = 0
} else {
// 根据月度和考核周期进行合并
if (data[i].checkMonth == data[i - 1].checkMonth && data[i].checkPeriod == data[i - 1].checkPeriod) {
this.spanArr1[this.spanIndex1] += 1
this.spanArr1.push(0)
this.spanArr2[this.spanIndex2] += 1
this.spanArr2.push(0)
this.spanArr3[this.spanIndex3] += 1
this.spanArr3.push(0)
} else {
this.spanArr1.push(1)
this.spanIndex1 = i
this.spanArr2.push(1)
this.spanIndex2 = i
this.spanArr3.push(1)
this.spanIndex3 = i
}
}
}
}
},
// 返回
handleClose() {
this.close({ tagName: '/inStoreGoalsConfig' })
// 返回后列表页tab默认选中驻店员工目标项
this.$router.push({
name: 'inStoreGoalsConfig',
params: {
tabPane: "1",
tabLabel: "staffTargetList"
}
})
this.close({ tagName: '/employeeTasksView' })
}
}
}
</script>
<style scoped lang="scss">
.edit-sub-title {
padding-bottom: 14px;
border-bottom: 1px solid #e8e8ea;
}
.page_footer{
display: flex;
justify-content: center;
}
::v-deep .el-form-item__content{
width: calc(100% - 154px);
}
</style>