From 243da124a8e23a8b308675e7f7559b27b3dc468c Mon Sep 17 00:00:00 2001 From: puhui999 Date: Mon, 22 Apr 2024 11:35:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E4=B8=8D=E5=87=BA=E6=9D=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/trade/order/form/OrderUpdatePriceForm.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/views/mall/trade/order/form/OrderUpdatePriceForm.vue b/src/views/mall/trade/order/form/OrderUpdatePriceForm.vue index eb932ffa..3da8d962 100644 --- a/src/views/mall/trade/order/form/OrderUpdatePriceForm.vue +++ b/src/views/mall/trade/order/form/OrderUpdatePriceForm.vue @@ -6,7 +6,7 @@ - 订单调价。 正数,加价;负数,减价 + 订单调价。 正数,加价;负数,减价 @@ -38,10 +38,13 @@ const formData = ref({ }) watch( () => formData.value.adjustPrice, - (data: number) => { - const num = formData.value.payPrice!.replace('元', '') - // @ts-ignore - formData.value.newPayPrice = (num * 1 + data).toFixed(2) + '元' + (adjustPrice: number | string) => { + const numMatch = formData.value.payPrice.match(/\d+(\.\d+)?/) + if (numMatch) { + const payPriceNum = parseFloat(numMatch[0]) + adjustPrice = typeof adjustPrice === 'string' ? parseFloat(adjustPrice) : adjustPrice + formData.value.newPayPrice = (payPriceNum + adjustPrice).toFixed(2) + '元' + } } )