MyStore.vue
20.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
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
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
<template>
<view class="store-container">
<view class="store-header flex">
<view class="sprite-icon icon-my-store"></view>
<text>我的门店</text>
<view class="tab-box" v-if="scene0PenetrationRateCommissions.length">
<view @click="selectTab(i.value)" :class="{ 'tab-item': true, active: activeIndex == i.value }" v-for="(i, index) in tabList" :key="index">{{ i.name }}</view>
</view>
<view :class="{ 'select-store flex': true, 'ml-auto': !scene0PenetrationRateCommissions.length }" @click="showPopup">
<view class="store-name text-hide">{{ form.merchantName }}</view>
<view class="up-icon"></view>
</view>
</view>
<view class="store-body flex">
<view class="total-box">
<view class="total-title">
<text>应触客台数</text>
<uni-icons type="help" size="18" color="#A2A2A8" @click="showTips"></uni-icons>
</view>
<view class="total-num">
{{ commissionsInfo[0].shouldToShopCount || 0 }}
<text>台</text>
</view>
<view class="total-time">截至{{ commissionsInfo[0].calculationDay }}</view>
</view>
<view class="total-detail flex">
<view class="month-box" v-for="(item, index) in commissionsInfo" :key="index">
<view class="month-header flex">
<view :class="`sprite-icon icon-${scene0PenetrationRateCommissions.length || item.sceneType == 0 ? 'yw-icon' : 'qg-tips'}`"></view>
<text>{{ item.showGoodsTypeName || (item.sceneType == 0 ? '权益' : '轻改') }}</text>
</view>
<view class="value-box flex">
<view class="value-desc flex">
<view class="value-title">产值</view>
<view class="value-price">
<text>¥</text>
{{ item.orderTotalPrice || '0' }}
</view>
</view>
<view class="value-desc flex">
<view class="value-title">成交</view>
<view class="value-price">
{{ item.orderCount || '0' }}
<text>单</text>
</view>
</view>
</view>
<view :class="{ 'value-detail': true, 'bg-box': commissionsInfo.length == 1 }">
<view class="detail-item" v-for="(v, k) in outputDetail" :key="k">
<view class="detail-label">
<text>{{ v.label }}</text>
<uni-icons type="help" size="15" color="#A2A2A8" v-if="v.content" @click="clickTips(v)"></uni-icons>
</view>
<view class="detail-link flex" @click="showProductDetail(item)" v-if="item.specificGoodsType && v.isLink">
<text>产品明细</text>
<view class="link-icon"></view>
</view>
<view class="detail-num" v-else>{{ item[v.value] || '0' }}{{ v.unit }}</view>
</view>
</view>
</view>
</view>
</view>
<view class="income-body">
<view class="income-header flex">
<view class="sprite-icon icon-income-icon"></view>
<text>本月收入测算</text>
<view class="history-box flex-center" @click="showPage('History')">
<view class="sprite-icon icon-lssl-icon"></view>
<text>历史收入</text>
</view>
</view>
<view class="income-panel">
<view class="panel-up flex">
<view class="sprite-icon icon-income-card"></view>
<text>本月预估收入</text>
<view class="time">截至{{ salaryDetail.calculationDay }}</view>
</view>
<view class="panel-bottom">
<text>¥</text>
{{ formatNumber(salaryDetail.correctSalary || 0) }}
</view>
</view>
<view class="income-detail">
<template v-for="(item, index) in IncomeList">
<view class="income-detail-item flex" v-if="isShow(item.value)" :key="index">
<view :class="`sprite-icon icon-${item.icon}`"></view>
<view class="item-label">{{ item.label }}</view>
<uni-icons type="help" size="15" color="#A2A2A8" @click="clickTips(item)"></uni-icons>
<view class="item-value">{{ item.showUnit }}{{ formatNumber(salaryDetail[item.value] || '0') }}</view>
<view class="item-next" @click="showDetail(item)" v-if="item.tabelTh && salaryDetail[item.value]"></view>
</view>
</template>
</view>
<view class="income-footer">个人所得税、社保、迟到、早退等月初统一核算,不包括在收入测算中。实际发放工资以工资核算为准。</view>
</view>
<Detail @close="show = false" :show="show" :detail="detail" :tabelTh="detail.tabelTh" :tabelTr="detail.tabelTr"></Detail>
<base-dialog @close="baseShow = false" @showBaseDetail="showBaseDetail" :show="baseShow"></base-dialog>
<base-detail
@close="
baseDetailShow = false
baseShow = true
"
:show="baseDetailShow"
:detail="detail"
></base-detail>
<Question @close="tipsShow = false" :show="tipsShow" :detail="tipsDetail"></Question>
<MessageBox ref="drawVisible" position="bottom" :isFooter="false" title="选择门店" :maxHeight="1000">
<view class="select-box">
<view class="select-item" :class="{ checked: form.merchantId == item.merchantId }" @click="selectMerchantId(item)" v-for="(item, index) in merchants" :key="index">
{{ item.merchantName }}
</view>
</view>
</MessageBox>
</view>
</template>
<script>
import Detail from './Detail'
import baseDialog from './baseDialog'
import baseDetail from './baseDetail'
import point from '@/mixin/point'
import Question from './Question.vue'
export default {
mixins: [point],
components: {
Question,
Detail,
baseDialog,
baseDetail
},
props: {
merchants: {
type: Array,
default: () => []
}
},
filters: {
getPrevDay(val) {
let date = new Date(val)
const prevDate = new Date(date.setDate(date.getDate() - 1))
const year = prevDate.getFullYear()
const month = prevDate.getMonth() + 1
const day = prevDate.getDate()
return `${year}-${month}-${day}`
}
},
inject: ['showPage'],
data() {
return {
show: false,
baseDetailShow: false,
baseShow: false,
tipsDetail: {},
tipsShow: false,
activeIndex: 1,
outputDetail: [
{
label: '渗透率',
content: '渗透率 = 成交订单数 / 应触客台数',
value: 'penetrationRate',
unit: '%'
},
{
label: '提成系数',
content: '根据不同的渗透率情况,将按照不同提成系数进行提成发放。',
value: 'calculateValue'
},
{
label: '提成比例',
value: 'commissionRatio',
isLink: true,
unit: '%'
}
],
outputList: [
{
sence: '延保',
icon: 'yw-icon',
value: 0
},
{
sence: '安心包Max',
icon: 'yw-icon',
value: 0
},
{
sence: '轻改',
icon: 'qg-tips',
value: 1
}
],
tabelTr: [{ list: [2, 3] }, { list: [2, 3] }],
tabList: [
{
name: '问界',
value: 1
},
{
name: '其他',
value: 2
}
],
detail: {},
salaryDetail: {},
form: {
merchantName: '',
merchantId: ''
},
commissionsInfo: [{}],
scene0PenetrationRateCommissions: [],
tipsList: [],
list: [],
show: false,
calDaliog: false,
caseList: []
}
},
mounted() {
this.outputList = this.outputList.filter(i => i.value == 0)
},
watch: {
'form.merchantId'(val) {
val && this.getIncomeCalculationDetail(val)
},
merchants: {
handler(val) {
this.form.merchantId = val[0].merchantId
this.form.merchantName = val[0].merchantName
},
immediate: true
}
},
methods: {
getDetail(salaryMonth) {
uni.$api.pointApi.monthSalaryDetail({ salaryMonth: `${this.year}-${(this.month + '').padStart(2, '0')}`, calculationDataFlag: 'Y' }).then(res => {
this.salaryDetail = res || {}
})
console.log(this.salaryDetail, 'salaryDetail')
},
/**
* @description 选择门店
* @param {Object} value 门店对象
* @property {number} value.merchantId 门店id
* @property {string} value.merchantName 门店名称
*/
selectMerchantId(value) {
this.form.merchantName = value.merchantName
this.form.merchantId = value.merchantId
// this.$set(this.form, 'merchantId', value.merchantId)
// this.$set(this.form, 'merchantName', value.merchantName)
this.$refs.drawVisible.close()
},
getIncomeCalculationDetail(merchantId) {
uni.$api.pointApi.incomeCalculationDetail({ merchantId }).then(res => {
console.log(res)
if (res && res.commissions) {
const commissions = res.commissions.find(i => i.configType == 3)
const commissionsOther = res.commissions.filter(i => i.configType == 1)
this.commissionsInfoQG = []
console.log(commissionsOther, 'commissionsInfoQG')
commissionsOther.forEach(i => {
this.commissionsInfoQG = [...this.commissionsInfoQG, ...(i.nscene0PenetrationRateGoodsCommissions || [])]
})
console.log(this.commissionsInfoQG, 'commissionsInfoQG')
this.scene0PenetrationRateCommissions = commissions?.scene0PenetrationRateCommissions || []
this.getCommissionsInfo()
} else {
this.commissionsInfo = [{}]
this.commissionsInfoQG = []
this.scene0PenetrationRateCommissions = []
}
})
},
/**
* @description 是否展示某个提成
* @param {string} key 提成key
* @returns {boolean} 是否展示
* @description 如果是equityCommission且不展示equityCommission但是展示lightCommission
* 如果是lightCommission且不展示lightCommission但是展示equityCommission
* 都不展示
*/
isShow(key) {
if (key == 'equityCommission' && !this.salaryDetail.equityCommission && this.salaryDetail.lightCommission) {
return
}
if (key == 'lightCommission' && !this.salaryDetail.lightCommission && this.salaryDetail.equityCommission) {
return
}
return true
},
getCommissionsInfo() {
console.log(this.scene0PenetrationRateCommissions, 'this.scene0PenetrationRateCommissions')
const result = this.scene0PenetrationRateCommissions.find(i => {
return i.configCarType == this.activeIndex
})
this.commissionsInfo = [...(result?.configCarTypeCommissions || []), ...this.commissionsInfoQG]
console.log(this.commissionsInfo, 'this.commissionsInfoQG', this.commissionsInfoQG)
},
clickTips(item) {
this.tipsDetail = item
this.tipsShow = true
},
showTips() {
this.clickTips({
label: '应触客台数',
content: '主机厂(门店)新车销量,未到店交付车辆将按照门店零售驻店的触客比例分配,公式如下:',
subContent: '应触客台数 =(门店交付数-所有售前触客数)×(个人售前触客数/所有零售驻店售前触客数)+个人售前触客数',
desc: '如门店只有一名零售驻店,则应触客台数=门店交付数'
})
},
showProductDetail(val) {
this.detail = {
label: '产品提成比例明细',
icon: 'info-icon',
scale: 1,
tabelTh: [
{
title: '产品名称'
},
{
title: '提成比例',
width: 20
}
],
tabelTr: [
'showGoodsTypeName',
{
key: 'commissionRatio',
format: val => {
return val + '%'
}
}
],
recordList: val.goodsTypeCommissions
}
console.log(this.detail, 11)
this.show = true
},
showBaseDetail(item) {
console.log(888)
this.baseShow = false
this.baseDetailShow = true
const recordList = [1, 2, 3]
this.detail = { ...item, recordList }
},
showDetail(item) {
if (item.label == '基本工资') {
this.baseShow = true
return
}
const total = this.salaryDetail[item.value]
const recordList = this.salaryDetail[item.recordKey]
this.detail = { ...item, total, recordList }
console.log(this.detail, 'detail')
this.show = true
},
selectTab(val) {
this.activeIndex = val
this.getCommissionsInfo()
},
showPopup() {
this.$refs.drawVisible.open()
}
}
}
</script>
<style scoped lang="scss">
.store-container {
padding-top: toRpx(32);
.store-header {
padding: 0 toRpx(36);
text {
font-size: toRpx(32);
margin-top: toRpx(-6);
margin-left: toRpx(12);
color: #1a1a1a;
}
.tab-box {
margin-left: auto;
width: toRpx(212);
height: toRpx(60);
background: #f0f6ff00;
border: toRpx(2) solid #e9ecf2;
border-radius: toRpx(430);
display: flex;
align-items: center;
justify-content: center;
.tab-item {
font-size: toRpx(26);
color: #666666;
text-align: center;
width: 50%;
&.active {
width: toRpx(100);
height: toRpx(48);
line-height: toRpx(48);
background: #ffffff;
border-radius: toRpx(462);
color: #2d66f7;
}
}
}
.select-store {
margin-left: toRpx(38);
width: toRpx(336);
height: toRpx(60);
background: #f0f6ff00;
border: toRpx(2) solid #dde9fb;
border-radius: toRpx(12);
padding: 0 toRpx(20);
&.ml-auto {
margin-left: auto;
}
.store-name {
width: toRpx(260);
}
.up-icon {
border-right: toRpx(10) solid transparent;
border-left: toRpx(10) solid transparent;
border-top: toRpx(10) solid #000000;
/* 箭头颜色 */
}
}
}
.store-body {
padding: 0 toRpx(36);
margin-top: toRpx(34);
.total-box {
width: 20%;
padding-left: toRpx(30);
.total-title {
font-size: toRpx(28);
color: #181a1f;
line-height: toRpx(36);
}
.total-num {
font-size: toRpx(48);
color: #3773f8;
font-weight: 600;
margin-top: toRpx(16);
text {
font-size: toRpx(22);
}
}
.total-time {
margin-top: toRpx(64);
font-size: toRpx(24);
color: #808291;
}
}
.total-detail {
flex: 1;
overflow-x: auto;
.month-box {
margin-left: toRpx(40);
flex: 1;
min-width: calc(50% - #{toRpx(40)});
padding: toRpx(32);
background: #ffffff;
border-radius: toRpx(24);
.month-header {
text {
font-size: toRpx(24);
color: #808291;
margin-left: toRpx(16);
}
}
.value-box {
margin-top: toRpx(12);
.value-desc {
width: 55%;
&:last-child {
width: 45%;
margin-left: toRpx(30);
}
.value-title {
font-size: toRpx(24);
color: #adb0b8;
line-height: toRpx(36);
}
.value-price {
font-size: toRpx(32);
color: #181a1f;
line-height: toRpx(60);
margin-left: toRpx(8);
text {
font-size: toRpx(24);
margin: 0 4rpx;
}
}
}
}
.value-detail {
background: #ffffff;
border-radius: toRpx(16);
display: grid;
padding: toRpx(8) 0;
margin-top: toRpx(4);
grid-template-columns: repeat(3, 1fr);
&.bg-box {
background: #f7faff;
border-radius: toRpx(16);
.detail-item {
padding-left: 40%;
}
}
.detail-item {
.detail-label {
font-size: toRpx(24);
color: #adb0b8;
line-height: toRpx(36);
}
.detail-link {
margin-top: toRpx(4);
font-size: toRpx(24);
color: #3773f8;
.link-icon {
border-left: toRpx(10) solid #3773f8;
border-bottom: toRpx(10) solid transparent;
border-top: toRpx(10) solid transparent;
margin-left: toRpx(10);
}
}
.detail-num {
font-size: toRpx(32);
color: #292d33;
line-height: toRpx(48);
}
}
}
}
}
}
.income-body {
margin-top: toRpx(40);
background: #ffffff;
border: toRpx(4) solid #ffffff;
box-shadow:
0 0 toRpx(40) -8rpx #5182cc33,
inset 0 toRpx(4) toRpx(8) 0 #ffffff80;
border-radius: toRpx(48);
padding: toRpx(32) toRpx(36);
height: calc(100vh - #{toRpx(400)});
.income-header {
text {
font-size: toRpx(32);
margin-top: toRpx(-6);
margin-left: toRpx(12);
color: #1a1a1a;
}
.history-box {
margin-left: auto;
width: 180rpx;
height: 60rpx;
border-radius: 16rpx;
opacity: 1;
background: linear-gradient(180deg, #61c0ff 0%, #2c66f7 100%);
box-shadow: inset 0 0 32rpx 0 #ffffff80;
text {
color: #ffffff;
font-size: 26rpx;
margin-left: 8rpx;
margin-top: 1prx;
}
}
}
.income-panel {
height: toRpx(152);
width: 100%;
padding: toRpx(24) toRpx(48);
background-image: linear-gradient(45deg, #edfaff 10%, #eff7fe 30%, #e5f2fe 50%, #d8f3fb 70%, #edfaff 80%, #c3e4fa 100%);
border: toRpx(2) solid #ffffff;
box-shadow: inset 0 toRpx(4) toRpx(8) 0 #ffffff80;
border-radius: toRpx(24);
box-sizing: border-box;
margin: toRpx(20) 0 toRpx(0);
.panel-up {
font-size: toRpx(28);
color: #808291;
.time {
margin-left: auto;
font-size: toRpx(24);
color: #808291;
}
text {
margin: 0 toRpx(16);
}
}
.panel-bottom {
font-weight: 600;
font-size: toRpx(40);
color: #181a1f;
margin-top: toRpx(14);
text {
font-size: toRpx(28);
}
}
}
.income-detail {
display: flex;
flex-wrap: wrap;
gap: toRpx(40) toRpx(96);
padding: toRpx(30);
.income-detail-item {
width: calc(50% - #{toRpx(96)});
.item-label {
font-weight: 300;
font-size: toRpx(26);
color: #181a1f;
margin: 0 toRpx(10) 0 toRpx(16);
}
.item-value {
font-size: toRpx(30);
color: #181a1f;
margin-left: auto;
}
.item-next {
margin-left: toRpx(24);
width: 0;
height: 0;
border-left: toRpx(10) solid #808291;
border-bottom: toRpx(10) solid transparent;
border-top: toRpx(10) solid transparent;
/* 箭头颜色 */
}
}
}
.income-footer {
font-size: toRpx(24);
color: #808291;
padding: toRpx(20) 0 toRpx(60) toRpx(40);
}
}
.store-footer {
margin-top: toRpx(40);
.store-btn {
width: 100%;
height: toRpx(80);
background-image: linear-gradient(180deg, #61c0ff 0%, #2c66f7 100%);
box-shadow: inset 0 0 toRpx(32) 0 #ffffff80;
border-radius: toRpx(16);
line-height: toRpx(80);
font-size: toRpx(28);
color: #ffffff;
text-align: center;
}
}
}
.select-box {
margin: toRpx(40) 0;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: toRpx(20);
overflow-y: scroll;
max-height: 50vh;
padding-bottom: toRpx(60);
.select-item {
text-align: center;
height: toRpx(68);
line-height: toRpx(68);
opacity: 1;
border: toRpx(2) solid #dce0e6;
color: #292d33;
font-size: toRpx(28);
border-radius: toRpx(8);
&.checked {
border: toRpx(2) solid #292d33;
}
}
}
</style>