File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/views/mall/trade/order/form Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 6
6
</el-form-item >
7
7
<el-form-item label =" 订单调价" >
8
8
<el-input-number v-model =" formData.adjustPrice" :precision =" 2" :step =" 0.1" class =" w-100%" />
9
- <el-tag class =" mt -10px" type =" warning" >订单调价。 正数,加价;负数,减价</el-tag >
9
+ <el-tag class =" ml -10px" type =" warning" >订单调价。 正数,加价;负数,减价</el-tag >
10
10
</el-form-item >
11
11
<el-form-item label =" 调价后" >
12
12
<el-input v-model =" formData.newPayPrice" disabled />
@@ -38,10 +38,13 @@ const formData = ref({
38
38
})
39
39
watch (
40
40
() => formData .value .adjustPrice ,
41
- (data : number ) => {
42
- const num = formData .value .payPrice ! .replace (' 元' , ' ' )
43
- // @ts-ignore
44
- formData .value .newPayPrice = (num * 1 + data ).toFixed (2 ) + ' 元'
41
+ (adjustPrice : number | string ) => {
42
+ const numMatch = formData .value .payPrice .match (/ \d + (\. \d + )? / )
43
+ if (numMatch ) {
44
+ const payPriceNum = parseFloat (numMatch [0 ])
45
+ adjustPrice = typeof adjustPrice === ' string' ? parseFloat (adjustPrice ) : adjustPrice
46
+ formData .value .newPayPrice = (payPriceNum + adjustPrice ).toFixed (2 ) + ' 元'
47
+ }
45
48
}
46
49
)
47
50
You can’t perform that action at this time.
0 commit comments