salaryDetailsDialog.vue
14.3 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
<!-- 工资明细 -->
<template>
<baseDialog :dialog-config="dialogConfig" :is-show.sync="visible"
@handleClick="handleAddConfirm">
<div class="dialog-content">
<!-- <d2-table :hasPage="false" :hasNum="false"
:tableData="salaryList"
:table-params="salaryTableParams">
<template slot="deferredIncluded" slot-scope="scope">
<span v-if="isEmpty(scope.scope.deferIncome)">-</span>
<el-tooltip class="item" effect="dark" v-else placement="top">
<template slot="content">
<p>{{ getMonthSixMonthsBack }}月递延金</p>
</template>
<span>{{ `¥${scope.scope.deferIncome}` }}</span>
</el-tooltip>
</template>
</d2-table> -->
<div class="header" v-if="detailInfo.clockingInOpenFlag == 'Y'">
员工本月应出勤天数{{ detailInfo.shouldWorkDay }}天,实际出勤天数{{ detailInfo.actualWorkDay }}天,基本工资收入=
<span>{{ detailInfo.basicSalary }}元</span> ÷
<span>{{ detailInfo.shouldWorkDay }}</span> ×
<span>{{ detailInfo.actualWorkDay }}</span> =
<span>{{ detailInfo.actualBasicSalary }}元</span>
</div>
<div class="content" >
<div class="title">{{ detailRow.salaryMonth && detailRow.salaryMonth.split('-')[1] }}月提成构成:</div>
<div v-if="detailInfo && detailInfo.detailArray && detailInfo.detailArray.length">
<el-tabs v-model="activeName" type="card">
<el-tab-pane v-for="(item, index) in detailInfo.detailArray" :key="index" :label="item.key" :name="`${index}`">
<div v-for="(subItem, subIdx) in item.data" :key="subIdx" class="content-item">
<div class="content-item-header">
<div>
<span>{{ subItem.merchantName }}</span>
<span>{{ subItem.merchantId }}</span>
<span class="car-text" v-if="subItem.configCarType">{{ subItem.configCarType ==1 ? '单问界' : '其他车系' }}</span>
</div>
<div>门店总提成金额<span class="price-text">{{ (commissionPrice = [2].includes(subItem.configType) ? subItem.grCommissionPrice : subItem.goodsCommissionPrice) || '-' }}元</span></div>
</div>
<div class="content-item-body">
<div class="left-line" :style="{ 'height': subItem.allocationDetailList.length ? (48 * (subItem.allocationDetailList.length) + 63) + 'px' : '117px'}">
<div class="line" style="top: 117px" v-if="!subItem.allocationDetailList || !subItem.allocationDetailList.length"></div>
<div class="line" :style="{'top': (48 * (idx + 1) + 63) + 'px'}" v-for="(v, idx) in subItem.allocationDetailList" :key="idx"></div>
</div>
<div class="content-item-body-title">
<span>{{ subItem.staffName || '-' }} | </span>
<span>交车数 {{ isEmpty(subItem.deliveryCount) ? '-' : `${subItem.deliveryCount}` }} | </span>
<span>触客数 {{ isEmpty(subItem.toShopCount) ? '-' : `${subItem.toShopCount}` }} </span>
</div>
<d2-table :hasPage="false"
:tableData="subItem.allocationDetailList"
:table-params="tableParams">
</d2-table>
<div class="content-item-body-footer" v-if="subItem.dailyReportDeductDateList && subItem.dailyReportDeductDateList.length">
员工本月在门店上岗日报无填写或填写有误,分别是
<span v-for="(v, idx) in subItem.dailyReportDeductDateList" :key="idx">{{v}}日<span v-if="idx !== subItem.dailyReportDeductDateList.length - 1">、</span></span>
共计扣款<span>{{ subItem.dailyReportDeductMoney || '-' }}元</span>
</div>
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</baseDialog>
</template>
<script>
import { getSalaryDetailApi } from '@api/resident'
import { staffLevelList, staffSceneLabelList } from '@/common/constants.js'
import { isEmpty, filterStr } from '../util.js'
export default {
name: 'SalaryDetailsDialog',
data() {
return {
isEmpty,
filterStr,
staffLevelList,
staffSceneLabelList,
dialogConfig: {
title: '提成构成',
width: '1080px'
},
salaryTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableColumns: [
{
label: '基本工资',
prop: 'actualBasicSalary',
formatter: (row) => {
return !isEmpty(row.actualBasicSalary) ? `¥${row.actualBasicSalary}` : '-'
}
},
{
label: '保底工资',
prop: 'minimumSalary',
formatter: (row) => {
return !isEmpty(row.minimumSalary) ? `¥${row.minimumSalary}` : '-'
}
},
{
label: '作为导师收入',
prop: 'mentorCommission',
width: '120px',
formatter: (row) => {
return !isEmpty(row.mentorCommission) ? `¥${row.mentorCommission}` : '-'
}
},
{
label: '门店提成',
prop: 'merchantCommission',
formatter: (row) => {
return !isEmpty(row.merchantCommission) ? `¥${row.merchantCommission}` : '-'
}
},
{
label: '平板扣款',
prop: 'padDeductMoney',
formatter: (row) => {
return !isEmpty(row.padDeductMoney) ? `- ¥${Math.abs(row.padDeductMoney)}` : '-'
}
},
{
label: '日报扣款',
prop: 'dailyDeductMoney',
formatter: (row) => {
return !isEmpty(row.dailyDeductMoney) ? `- ¥${Math.abs(row.dailyDeductMoney)}` : '-'
}
},
{
label: '退单冲减',
prop: 'refundOffset',
formatter: (row) => {
return !isEmpty(row.refundOffset) ? `- ¥${Math.abs(row.refundOffset)}` : '-'
}
},
{
label: '递延金扣款',
prop: 'deferExpenses',
formatter: (row) => {
return !isEmpty(row.deferExpenses) ? `- ¥${Math.abs(row.deferExpenses)}` : '-'
}
},
{
label: '递延金纳入',
prop: '',
addHtml: 'deferredIncluded'
},
{
label: '合计应发工资',
prop: 'correctSalary',
width: '120px',
formatter: (row) => {
return !isEmpty(row.correctSalary) ? `¥${row.correctSalary}` : '-'
}
},
]
},
salaryList: [],
detailInfo: {},
activeName: '',
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableColumns: [
{
label: '产品名称',
prop: 'goodsTypeName',
formatter: (row) => {
return `${row?.thirdLevelGoodsTypeName ? row.thirdLevelGoodsTypeName : row?.secondaryGoodsTypeName ? row.secondaryGoodsTypeName : row.goodsTypeName}` + `${row?.allocationType == 5 ? '(售后)' : ''}`
}
},
{
label: '订单量',
prop: 'orderCount'
},
{
label: '贡献产值',
prop: 'orderTotalPrice',
width: 80,
formatter: (row) => {
return !isEmpty(row.orderTotalPrice) ? `¥${row.orderTotalPrice}` : '-'
}
},
{
label: '个人渗透率',
prop: 'penetrationRate',
formatter: (row) => {
return row.penetrationRate ? `${row.penetrationRate}%` : '-'
}
},
{
label: '比例×系数',
prop: '',
width: 100,
formatter: (row) => {
// allocationType:(6非售后 比例取值outputCommissionRatio 系数取值calculateValue)(新类型社招轻改7 比例取值calculateValue 系数取外层结构avgCustomerCalculateValue)(5售后)
return row.allocationType == 6 ?
`${!isEmpty(row.outputCommissionRatio) ? row.outputCommissionRatio : '-'}%×${row.calculateValue}`
: row.allocationType == 7
? `${!isEmpty(row.calculateValue) ? row.calculateValue : '-'}%×${row.avgCustomerCalculateValue}`
: row.allocationType == 5 ? `${row.calculateValue}%` : '-'
}
},
{
label: '提成金额',
prop: 'commissionPrice',
width: 100,
formatter: (row) => {
return !isEmpty(row.commissionPrice) ? `¥${row.commissionPrice}` : '-'
}
}
]
}
}
},
props: {
salaryDetailsVisible: {
type: Boolean,
default: false
},
detailRow: {
type: Object,
default: () => {}
}
},
computed: {
visible: {
get() {
return this.salaryDetailsVisible
},
set(newVal) {
this.$emit('dialogClose', { flag: newVal, attrName: 'salaryDetailsVisible' })
}
},
getMonthSixMonthsBack: {
get() {
const currentDate = new Date()
const month = this.detailRow.salaryMonth.split('-')[1]
const specifiedDate = new Date(currentDate.getFullYear(), month - 1) // 创建指定月份的日期对象
specifiedDate.setMonth(specifiedDate.getMonth() - 6) // 向前推 6 个月
return (specifiedDate.getMonth() + 1)
}
}
},
mounted() {
this.getSalaryDetail()
},
methods: {
handleAddConfirm() {
this.$emit('dialogClose')
},
getSalaryDetail() {
getSalaryDetailApi({ id: this.detailRow.id }).then(res => {
if (res) {
const detailArray = res?.detailList && Object.keys(res?.detailList)?.map(key => {
return {
key: key,
data: res?.detailList[key]
}
})
// const { actualBasicSalary, minimumSalary, mentorCommission, merchantCommission, padDeductMoney, dailyDeductMoney, refundOffset, deferExpenses, deferIncome, correctSalary } = res || {}
// this.salaryList = [{
// actualBasicSalary,
// minimumSalary,
// mentorCommission,
// merchantCommission,
// padDeductMoney,
// dailyDeductMoney,
// refundOffset,
// deferExpenses,
// deferIncome,
// correctSalary
// }]
for (var j = 0; j < detailArray?.length; j++) {
const seen = new Set()
detailArray[j].data = detailArray[j]?.data?.map(item => {
item?.allocationDetailList?.forEach(v => { // 按产值系数取客单价绩效配置系数
v.avgCustomerCalculateValue = item.avgCustomerCalculateValue
})
const key = `${item.merchantId}-${item.sceneType}`
if (seen.has(key)) {
return { ...item, dailyReportDeductDateList: [] } // 同个门店同个场景只显示一条日报扣款数据
} else {
seen.add(key)
return item
}
})
}
res.detailArray = detailArray
this.activeName = detailArray?.length ? '0' : ''
}
this.detailInfo = res || {}
})
}
}
}
</script>
<style lang="scss" scoped>
.dialog-content {
max-height: calc(68vh - 70px);
overflow: auto;
.header {
margin-top: 15px;
font-weight: 500;
span{
color: #2A58AD;
}
}
.content{
.title {
color: #333333;
font-weight: bold;
margin-top: 15px;
}
::v-deep .el-tabs__header {
margin-bottom: 0;
.el-tabs__nav-scroll{
background: #ffffff;
padding: 16px 0 0;
.el-tabs__nav{
height: 38px;
background: #E8E8E8;
border-radius: 4px;
margin-left: 2px;
padding: 2px;
.el-tabs__active-bar {
display: none !important;
}
.el-tabs__item {
height: 32px;
line-height: 32px;
width: 170px;
color: #666666;
padding: 0 24px;
}
.el-tabs__item.is-active {
color: #2A58AD;
font-weight: 600;
background: #ffffff;
border-radius: 3px;
border: none;
}
}
}
}
.content-item{
.content-item-header{
display: flex;
justify-content: space-between;
height: 42px;
line-height: 42px;
background: #F5F7FA;
color: #000000;
padding: 0 16px;
margin-top: 20px;
font-weight: bold;
border-bottom: 1px solid #E7E7E7;
.car-text {
margin-left: 16px;
font-weight: normal;
padding: 4px 8px;
height: 12px;
font-size: 12px;
color: #666666;
background: #FFFFFF;
border: 1px solid #E8E8E8;
border-radius: 2px;
}
.price-text{
margin-left: 2px;
color: #2A58AD;
}
}
.content-item-body{
padding: 0 36px;
position: relative;
.left-line{
position: absolute;
left: 15px;
width: 1px;
background: #E7E7E7;
.line{
width: 21px;
height: 1px;
background: #E7E7E7;
position: absolute;
left: 0;
}
}
.content-item-body-title{
color: #1D1D1D;
padding: 12px 0;
}
::v-deep .el-table th {
background: #F5F7FA;
}
::v-deep .el-table__row{
height: 48px;
}
}
.content-item-body-footer{
margin-top: 12px;
color: #666666;
span{
color: #2A58AD;
}
}
}
}
.footer{
color: #333333;
font-weight: 500;
padding: 16px;
.amount{
font-size: 16px;
font-weight: 600;
color: #2A58AD;
}
}
}
</style>