explainDialog.vue
4.57 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
<template>
<GLDialog :title="title" mode="mid" :visible.sync="isVisible" okText="确定" :before-close="handleClose" @onOk="handleConfirm" @onCancel="handleClose">
<div class="explain-title">示例规则定义</div>
<p class="business-info" v-if="diffExplain == 'constructionBonus'">升级订单施工奖励:70.00元;战败订单施工奖励:50.00元</p>
<GLTable v-else :tableData="tableData" :tableParams="tableParams" :hasPage="false"></GLTable>
<div class="explain-title mt20">示例业务场景</div>
<div class="business-info" v-html="infoHtml"></div>
</GLDialog>
</template>
<script>
export default {
data() {
return {
tableParams: {
tableColumns: [
{
label: '区间开始值',
prop: 'startValue'
},
{
label: '区间结束值',
prop: 'endValue'
},
{
label: '奖励金额/元',
prop: 'calculateValue'
}
]
},
tableData: []
}
},
props: {
isExplain: {
type: Boolean,
default: false
},
diffExplain: {
type: String,
default: ''
}
},
computed: {
title() {
const titleObj = {
commissionBonus: '提成奖励示例说明',
highCustomerUnitBonus: '高客单奖励示例说明',
successRateBonus: '成交率奖励示例说明',
constructionBonus: '施工奖励示例说明'
}
return titleObj[this.diffExplain]
},
infoHtml() {
const infoObj = {
commissionBonus: `<div class='mb10'>员工A在某个月中完成升级订单5个,对应的订单产值1000.00元、1500.00元、2000.00元、2500.00元、3000.00元,</div>
<div class='mb10'>则月度的平均客单价=升级订单总产值/升级订单数量=2000.00元,对应规则的提成比例=10.00%,按每个升级订单的产值*10%计算每单提成;</div>
<div class='mb10'>则员工A在该月份获得的总提成奖励=100.00+150.00+200.00+250.00+300.00=1000.00元。</div>`,
highCustomerUnitBonus: `<div class='mb10'>员工A在某个月中完成升级订单5个,对应的订单产值1000.00元、1500.00元、2000.00元、2500.00元、3000.00元,</div>
<div class='mb10'>按高客单奖励规则,产值在0.00-2000.00元的订单每单奖励0.00元(不奖励),产值在2000.00元以上的订单每单奖励100.00元;</div>
<div class='mb10'>则员工A在该月份获得的高客单奖励=0.00+0.00+0.00+100.00+100.00=200元。</div>`,
successRateBonus: `<div class='mb10'>员工A在某个月中完成升级订单9个,战败订单1个</div>
<div class='mb10'>则月度的成交率=升级订单数/(升级订单数+战败订单数)=90.00%,对应规则的奖励金额=1000.00元;</div>
<div class='mb10'>则员工A在该月份获得的成交率奖励=1000.00元。</div>`,
constructionBonus: `<div class='mb10'>员工A在某个月中施工了升级订单5个,施工了战败订单5个;</div>
<div class='mb10'>则员工A在该月份获得的总提成奖励=(70.00*5)+(50.00*5)=600.00元。</div>`
}
return infoObj[this.diffExplain]
},
isVisible() {
return this.isExplain
}
},
watch: {
diffExplain(newVal) {
console.log(newVal)
if (newVal == 'successRateBonus') {
this.tableData = [
{ startValue: '', endValue: '80%', calculateValue: 0.0 },
{ startValue: '80.01%', endValue: '90%', calculateValue: 1000.0 },
{ startValue: '90.01%', endValue: '', calculateValue: 2000.0 }
]
} else if (newVal == 'commissionBonus') {
this.tableData = [
{ startValue: 0.0, endValue: 2000.0, calculateValue: '10%' },
{ startValue: 2000.01, endValue: '', calculateValue: '20%' }
]
} else {
this.tableData = [
{ startValue: 0.0, endValue: 2000.0, calculateValue: 0.0 },
{ startValue: 2000.01, endValue: '', calculateValue: 2000.01 }
]
}
if (newVal == 'commissionBonus') {
this.tableParams.tableColumns[2].label = '提成比例'
} else {
this.tableParams.tableColumns[2].label = '奖励金额/元'
}
}
},
methods: {
handleConfirm() {
this.$emit('handleClose')
},
handleClose() {
this.$emit('handleClose')
}
}
}
</script>
<style lang="scss">
.explain-title {
font-weight: 600;
font-size: 16px;
color: #333333;
margin-bottom: 10px;
}
.business-info {
font-size: 14px;
color: #333333;
line-height: 18px;
}
.mb10 {
margin-bottom: 10px;
}
.mt20 {
margin-top: 20px;
}
</style>