deduct.vue
2.91 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
<template>
<div class="container" style="margin: 10px;">
<!-- 当前费率展示 -->
<el-form ref="model" :model="model" label-width="120px" :rules="rules">
<el-form-item label="专员提成金额" prop="CommissionMoney">
<el-input v-model="model.CommissionMoney" placeholder="请输入专员提成金额" ref="CommissionMoney" maxlength="10" @blur="ChangeMoney">
<template slot="append">元</template>
</el-input>
</el-form-item>
<el-form-item label="经理提成金额" prop="ManagerMoney">
<el-input v-model="model.ManagerMoney" placeholder="请输入经理提成金额" ref="ManagerMoney" maxlength="10" @blur="ChangeMoney">
<template slot="append">元</template>
</el-input>
</el-form-item>
<el-form-item label="独享金额" >
<el-input v-model="Dmoney" placeholder="独享金额" maxlength="10" disabled>
<template slot="append">元</template>
</el-input>
</el-form-item>
</el-form>
<el-button type="success" @click="Submit" style="margin-left: 40px;">确认更改</el-button>
</div>
</template>
<script>
import {
UpdateCalculation,
GetModelCalculation
} from '../../api/calculation.js'
export default {
data() {
return {
size: '',
rules: {
ManagerMoney: [{
required: true,
message: '请输入经理提成',
trigger: 'blur'
},
{
pattern: /^\d+(\.\d+)?$/,
message: '请输入金额'
}
],
CommissionMoney: [{
required: true,
message: '请输入专员提成',
trigger: 'blur'
},
{
pattern: /^\d+(\.\d+)?$/,
message: '请输入金额'
}
]
},
model: {
"id": 0,
"CommissionMoney": 0,
"ManagerMoney": 0,
"add_time": "2022-01-08T21:37:09.691Z",
"update_time": "2022-01-08T21:37:09.691Z",
"status": 0
},
Dmoney:0,
form: {
"KeyWord": "",
"TotalCount": 0,
"PageIndex": 1,
"PageSize": 1,
"Sort": [{
"Field": "",
"Type": 0
}]
}
}
},
created() {
this.GetMoney()
},
methods: {
ChangeMoney(){
this.Dmoney=parseInt(this.model.CommissionMoney)+parseInt(this.model.ManagerMoney)
},
// 查询当前费率标准
GetMoney() {
GetModelCalculation(this.form).then(res=>{
this.model.CommissionMoney=res.data.data.rows[0].CommissionMoney
this.model.ManagerMoney=res.data.data.rows[0].ManagerMoney
this.Dmoney=this.model.CommissionMoney+this.model.ManagerMoney
})
},
// 确认更改提成费用
Submit() {
this.$refs.model.validate((valid) => {
if (valid) {
UpdateCalculation(this.model).then(res => {
console.log('修改数据', res)
if (res.data.code == 200) {
this.$message.success('更改提成费率成功')
} else {
this.$message.error('更改失败,请重试')
}
})
}
})
}
}
}
</script>
<style>
.container {
width: 100%;
}
</style>