historicalPerformance.vue
20.9 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
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
<!-- 员工工资提成 -->
<template>
<div class="historicalPerformance">
<div class="content">
<div class="tips-header">
<i class="el-icon-warning custom-icon"></i>
<span class="log-text"
>请先到员工信息中配置底薪、绩效工资、入职日期,设置好绩效工资扣减规则,配置调店分配周期和业务场景判断日报扣款规则(确保人员所在门店的绩效工资方案已配置)</span
>
</div>
<div class="header">
<div class="name">{{ performanceData.staffName }}</div>
<div>
<span>|</span>{{ performanceData.staffPhone }}
<!-- <span>|</span>{{
performanceData.hireType == 1
? "校招管培生"
: performanceData.hireType == 2
? "社会招聘"
: "-"
}} -->
</div>
</div>
<div class="content-warp">
<el-table :data="performanceTableData" border>
<el-table-column
label="序号"
type="index"
:index="(index) => index + 1"
width="60"
align="center"
></el-table-column>
<el-table-column label="月份" prop="" align="center">
<template slot-scope="scope">
<span>{{ scope.row.monthStr }}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>底薪</span>
</template>
<template slot-scope="scope">
<span>{{
!isEmpty(scope.row.minimumSalary)
? `¥${scope.row.minimumSalary}`
: "-"
}}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>绩效工资</span>
</template>
<template slot-scope="scope">
<span>{{
!isEmpty(scope.row.performanceSalary)
? `¥${scope.row.performanceSalary}`
: "-"
}}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>实际出勤天数</span>
</template>
<template slot-scope="scope">
<span>{{
!isEmpty(scope.row.actualWorkDay)
? `${scope.row.actualWorkDay}天`
: "-"
}}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>业务提成</span>
</template>
<template slot-scope="scope">
<span>{{
!isEmpty(scope.row.commissionPrice)
? `¥${scope.row.commissionPrice}`
: "-"
}}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>平板扣款</span>
</template>
<template slot-scope="scope">
<span>{{
!isEmpty(scope.row.padDeductMoney)
? `- ¥${Math.abs(scope.row.padDeductMoney)}`
: "-"
}}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>日报扣款</span>
</template>
<template slot-scope="scope">
<span>{{
!isEmpty(scope.row.dailyDeductMoney)
? `- ¥${Math.abs(scope.row.dailyDeductMoney)}`
: "-"
}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="递延金">
<template slot-scope="scope">
<span>{{
!isEmpty(scope.row.defer)
? `${scope.row.defer > 0 ? "+" : "-"} ¥${Math.abs(
scope.row.defer
)}`
: "-"
}}</span>
</template>
</el-table-column>
<!-- <el-table-column align="center">
<template slot="header">
<span>退单冲减</span>
</template>
<template slot-scope="scope">
<span>{{
!isEmpty(scope.row.refundOffset)
? `- ¥${Math.abs(scope.row.refundOffset)}`
: "-"
}}</span>
</template>
</el-table-column> -->
<el-table-column align="center">
<template slot="header">
<span>其他应发/应扣</span>
</template>
<template slot-scope="scope">
<span>{{
!isEmpty(scope.row.otherDetail)
? `${scope.row.otherDetail < 0 ? "-" : ""} ¥${Math.abs(
scope.row.otherDetail
)}`
: "-"
}}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>合计应发工资</span>
</template>
<template slot-scope="scope">
<span v-if="scope.row.correctSalary">
<span>{{ `¥${scope.row.correctSalary}` }}</span>
<span class="change-flag">改</span>
</span>
<span v-else>
<span>{{
scope.row.salary ? `¥${scope.row.salary}` : "-"
}}</span>
<span class="empty-flag"></span>
</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right">
<template slot-scope="scope">
<span style="margin-right: 10px">
<!-- <auth-button
:data="scope.row"
:show-btn-ids="['9120509']"
v-if="showBtn(scope.row)"
/> -->
</span>
<auth-button
:data="scope.row"
:show-btn-ids="['9120510']"
></auth-button>
</template>
</el-table-column>
<template slot="empty">
<div v-if="whiteFlag">暂无数据</div>
<div v-else style="color: #f47f13">内容白名单可见</div>
</template>
</el-table>
<div class="total-amount">
总计实发工资:
<span v-if="whiteFlag" class="amount">{{ totalActualSalary }}元</span>
<span v-else style="color: #f47f13">内容白名单可见</span>
</div>
</div>
</div>
<!-- <div class="content">
<div class="header">
<div class="name">历史订单</div>
</div>
<div class="content-warp">
<d2-table-header :left-span="0">
<div class="scene-type">
<el-radio-group v-model="activeName" @change="handleSceneChange">
<el-radio-button size="small" label="1">轻改</el-radio-button>
<el-radio-button size="small" label="0">会员权益/升级</el-radio-button>
</el-radio-group>
</div>
<div>
<label>订单月份:</label>
<el-date-picker
size="small"
v-model="monthRange"
type="monthrange"
range-separator="至"
start-placeholder="开始月份"
end-placeholder="结束月份"
popper-class="statement-of-history-performance-month-picker"
style="margin-right: 8px;width: 284px"
@change="handleMonthRangeBlur"
:picker-options="rangePickerOptions">
</el-date-picker>
</div>
</d2-table-header>
<el-table :data="orderTableData" border>
<el-table-column label="日期" prop="" align="center">
<template slot-scope="scope">
<span>{{ scope.row.dataDate }}</span>
</template>
</el-table-column>
<el-table-column label="开单门店" prop="" align="center">
<template slot-scope="scope">
<span>{{ `${scope.row.merchantName}${scope.row.merchantId}` || '-' }}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>订单数</span>
<el-tooltip class="item" effect="dark" placement="top">
<template slot="content">
<p>该员工按日在当前门店当天所累计的总实际订单数,员工输入当天交车数才显示数据</p>
</template>
<i class="el-icon-question"></i>
</el-tooltip>
</template>
<template slot-scope="scope">
<span>{{ !isEmpty(scope.row.orderCount) ? scope.row.orderCount : '-' }}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>交车数</span>
<el-tooltip class="item" effect="dark" placement="top">
<template slot="content">
<p>该员工按日在当前门店录入的新车交付数总数</p>
</template>
<i class="el-icon-question"></i>
</el-tooltip>
</template>
<template slot-scope="scope">
<span>{{ !isEmpty(scope.row.deliveryCount) ? scope.row.deliveryCount : '-' }}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>渗透率</span>
<el-tooltip class="item" effect="dark" placement="top">
<template slot="content">
<p>该员工订单数/交车数的比值取整数</p>
</template>
<i class="el-icon-question"></i>
</el-tooltip>
</template>
<template slot-scope="scope">
<span>{{ !isEmpty(scope.row.deliveryCount) ? scope.row.deliveryCount == 0 ? '0%' : `${Math.round(scope.row.orderCount/scope.row.deliveryCount)*100}%` : '-' }}</span>
</template>
</el-table-column>
<el-table-column align="center">
<template slot="header">
<span>当天产值</span>
<el-tooltip class="item" effect="dark" placement="top">
<template slot="content">
<p>当天订单数的产值累计</p>
</template>
<i class="el-icon-question"></i>
</el-tooltip>
</template>
<template slot-scope="scope">
<span>{{ !isEmpty(scope.row.totalPrice) ? `¥${scope.row.totalPrice}` : '-' }}</span>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="page.pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
/>
</div>
</div> -->
<!-- 修订合计应发工资 -->
<revised-salary-dialog
:revised-salary-visible="revisedSalaryVisible"
v-if="revisedSalaryVisible"
:revised-salary-row="revisedSalaryRow"
@dialogClose="handleSalaryCloseDialog"
></revised-salary-dialog>
<!-- 提成构成 -->
<salary-details-dialog
:salary-details-visible="salaryDetailsVisible"
v-if="salaryDetailsVisible"
@dialogClose="handleSalaryDetailsColseDialog"
:detail-row="detailRow"
></salary-details-dialog>
</div>
</template>
<script>
import { staffLevelList, staffSceneLabelList } from "@/common/constants.js"
import { mapActions, mapState } from "vuex"
import revisedSalaryDialog from "./revisedSalaryDialog.vue"
import salaryDetailsDialog from "./salaryDetailsDialog.vue"
import { rangePickerOptions } from "@/common/format"
import { Util, deepClone } from "@/common/util"
import {
getStaffHistoryOrderListApi,
getStaffHistoryApi,
getCommissionLogicApi,
getStaffSalaryStatisticsApi,
getStoreLastDetailApi,
staffWhiteListFlagApi
} from "@/api/resident"
import { filterStr, isEmpty } from "../util"
import BigNumber from "bignumber.js"
export default {
name: "HistoricalPerformance",
components: {
revisedSalaryDialog,
salaryDetailsDialog
},
props: {
queryData: {
type: Object,
default: () => {}
}
},
data() {
return {
isEmpty,
rangePickerOptions: rangePickerOptions,
performanceData: {},
performanceTableData: [],
orderTableData: [],
monthRange: [],
revisedSalaryVisible: false,
salaryDetailsVisible: false,
totalActualSalary: "",
staffSceneLabelList: deepClone(staffSceneLabelList),
revisedSalaryRow: {},
total: 0,
page: {
pageSize: 10,
currentPage: 1
},
activeName: "1", // 默认选中轻改
configDetailInfo: {},
whiteFlag: false
}
},
computed: {
...mapState({
dowloadList: (state) => state.d2admin.user.dowloadList
})
},
mounted() {
this.performanceData = {
...this.performanceData,
...this.queryData
}
},
methods: {
...mapActions({
get: "d2admin/base/get",
close: "d2admin/page/close"
}),
getMonthSixMonthsBack(rowData) {
const currentDate = new Date()
const month = rowData?.salaryMonth.split("-")[1]
const specifiedDate = new Date(currentDate.getFullYear(), month - 1) // 创建指定月份的日期对象
specifiedDate.setMonth(specifiedDate.getMonth() - 6) // 向前推 6 个月
return specifiedDate.getMonth() + 1
},
resetData() {
// if (this.performanceData.hireType == 1) {
// this.getCommissionLogic()
// }
this.getPerformanceStatic()
// this.getOrderData()
this.getStaffWhite()
},
// 仅展示不包含当月的前三个月内
showBtn(row) {
const currentDate = new Date()
const currentYear = currentDate.getFullYear()
const currentMonth = currentDate.getMonth() + 1
const [year, month] = row.salaryMonth?.split("-").map(Number)
const inputMonth = year * 12 + month // 将年转换为月份并加上当前月份
const currentTotalMonths = currentYear * 12 + currentMonth // 当前时间的总月份数
return currentTotalMonths - inputMonth <= 3
},
// 获取是否有查看工资的权限
getStaffWhite() {
staffWhiteListFlagApi({}).then((res) => {
this.whiteFlag = res
this.getPerformanceData()
})
},
getPerformanceStatic() {
getStaffSalaryStatisticsApi({
// staffPhone: 15626599736
staffPhone: this.queryData?.staffPhone
}).then((res) => {
this.totalActualSalary = res.totalActualSalary || 0
})
},
// 工资明细
handleSalaryDetail(row) {
this.detailRow = {
...row,
hireType: this.queryData?.hireType
}
this.handleSalaryDetailsColseDialog()
},
handleSalaryDetailsColseDialog() {
this.salaryDetailsVisible = !this.salaryDetailsVisible
},
getParams() {
const startDate = deepClone(this.monthRange?.[0]) || ""
const endDate = deepClone(this.monthRange?.[1]) || ""
endDate && endDate.setMonth(endDate.getMonth() + 1)
let params = {
startDate: startDate
? Util.dateFormate(startDate, "YYYY-MM-DD HH:mm:ss")
: "",
endDate: endDate
? Util.dateFormate(endDate?.setDate(0), "YYYY-MM-DD") + " 23:59:59"
: "",
sceneType: this.activeName,
staffPhone: this.queryData?.staffPhone
}
return params
},
// 获取业绩数据
getPerformanceData() {
getStaffHistoryApi({
// staffPhone: 15626599736,
staffPhone: this.queryData?.staffPhone,
pageSize: 12,
currentPage: 1
}).then((res) => {
const chineseNums = [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"
]
res?.list?.forEach((row) => {
const month = row?.salaryMonth?.split("-")?.[1] - 1
row.monthStr = chineseNums[month]
row.staffSceneLabelStr = filterStr(
row.staffSceneLabel,
this.staffSceneLabelList
)
row.jobTypeStr = filterStr(
row.jobTypes,
staffLevelList,
this.performanceData?.hireType
)
row.deferredPayment =
!this.isEmpty(row.deferExpenses) && !this.isEmpty(row.deferIncome)
? new BigNumber(0 - row.deferExpenses || 0)
.plus(new BigNumber(row.deferIncome) || 0)
.toNumber()
: ""
})
this.performanceTableData = (this.whiteFlag ? res?.list : []) || []
})
},
// 每页条数
handleSizeChange(value) {
this.page.pageSize = value
this.getOrderData()
},
// 页码
handleCurrentChange(value) {
this.page.currentPage = value
this.getOrderData()
},
handleSceneChange() {
this.page.currentPage = 1
this.getOrderData()
},
handleMonthRangeBlur(e) {
this.page.currentPage = 1
// 获取历史订单数据
this.getOrderData()
},
getOrderData() {
let params = this.getParams()
params = {
...this.page,
...params
}
getStaffHistoryOrderListApi(params).then((res) => {
this.orderTableData = res?.list || []
this.total = res?.total || 0
})
},
// 修订工资
handleEditSalary(row) {
this.revisedSalaryRow = row
this.handleSalaryCloseDialog()
},
handleSalaryCloseDialog(e) {
if (e?.flag) {
// 刷新业绩列表数据
this.getPerformanceData()
}
this.revisedSalaryVisible = !this.revisedSalaryVisible
}
}
}
</script>
<style lang="scss" scoped>
.historicalPerformance {
background: #fff;
.content {
.tips-header {
padding: 3px 12px;
display: flex;
background: #f47f131a;
margin-left: 20px;
margin-bottom: 8px;
width: fit-content;
.custom-icon {
color: #f47f13;
width: 16px;
height: 16px;
margin: 1px 8px 0 0;
}
.log-text {
font-size: 14px;
color: #f47f13;
}
}
.header {
padding: 0 20px;
height: 48px;
display: flex;
align-items: center;
font-size: 14px;
border-bottom: 1px solid #e5e5e5;
.name {
font-size: 18px;
font-weight: bold;
color: #333333;
}
span {
color: #cccccc;
margin: 0 8px;
}
}
.content-warp {
padding: 16px 20px;
.plan-item {
margin-bottom: 16px;
font-size: 14px;
display: flex;
label {
width: 138px;
height: 32px;
line-height: 32px;
flex-shrink: 0;
color: #666666;
text-align: right;
}
.line-h-32 {
height: 32px;
line-height: 32px;
}
.label-value {
.wid_432 {
width: 432px;
margin-bottom: 16px;
}
.wid_136 {
width: 136px;
margin-bottom: 16px;
}
span {
margin: 0 4px;
}
}
}
::v-deep .el-table thead tr th {
background-color: #f2f4f7;
color: #333333;
font-weight: 500;
i {
color: #999999;
}
}
::v-deep .table-header {
margin-bottom: 10px;
.el-col {
display: flex;
justify-content: space-between;
}
.scene-type {
display: flex;
align-items: center;
margin-right: 20px;
}
label {
height: 32px;
line-height: 32px;
color: #1d1d1d;
}
}
}
.total-amount {
height: 60px;
display: flex;
align-items: center;
justify-content: flex-end;
font-size: 18px;
color: #333333;
.amount {
color: #2a58ad;
font-weight: bold;
}
}
}
.change-flag {
display: inline-block;
width: 18px;
height: 18px;
border-radius: 3px;
background: #f47f131a;
font-size: 12px;
color: #f47f13;
margin-left: 4px;
}
.empty-flag {
display: inline-block;
width: 18px;
height: 18px;
margin-left: 4px;
}
}
</style>
<style lang="scss">
.statement-of-history-performance-month-picker {
.el-month-table .in-range .cell:hover {
color: #ffffff;
}
}
</style>