Skip to content

Commit 243da12

Browse files
author
puhui999
committed
fix: 调整价格弹窗不出来问题
1 parent deb4585 commit 243da12

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/views/mall/trade/order/form/OrderUpdatePriceForm.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</el-form-item>
77
<el-form-item label="订单调价">
88
<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>
1010
</el-form-item>
1111
<el-form-item label="调价后">
1212
<el-input v-model="formData.newPayPrice" disabled />
@@ -38,10 +38,13 @@ const formData = ref({
3838
})
3939
watch(
4040
() => 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+
}
4548
}
4649
)
4750

0 commit comments

Comments
 (0)