From a22b8dccefdb34400e8930c11f6aae20164bd682 Mon Sep 17 00:00:00 2001 From: zy Date: Sat, 10 May 2025 18:15:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/crm/business/BusinessForm.vue | 8 ++++---- src/views/crm/business/components/BusinessProductForm.vue | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/views/crm/business/BusinessForm.vue b/src/views/crm/business/BusinessForm.vue index 3f792a93b..723cd2a07 100644 --- a/src/views/crm/business/BusinessForm.vue +++ b/src/views/crm/business/BusinessForm.vue @@ -320,11 +320,11 @@ watch( let totalOfflinePrice = 0; for (const product of newProducts) { - if (typeof product.onlinePrice === 'number') { - totalOnlinePrice += product.onlinePrice; + if (typeof product.onlinePrice) { + totalOnlinePrice += Number(product.onlinePrice); } - if (typeof product.offlinePrice === 'number') { - totalOfflinePrice += product.offlinePrice; + if (typeof product.offlinePrice) { + totalOfflinePrice += Number(product.offlinePrice); } } formData.value.onlinePrice = totalOnlinePrice.toFixed(2) diff --git a/src/views/crm/business/components/BusinessProductForm.vue b/src/views/crm/business/components/BusinessProductForm.vue index 56205ad77..11a0a7c89 100644 --- a/src/views/crm/business/components/BusinessProductForm.vue +++ b/src/views/crm/business/components/BusinessProductForm.vue @@ -114,6 +114,7 @@ watch( ); // 监听合同产品变化,计算合同产品总价 +const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 watch( () => formData.value, (val) => { @@ -128,6 +129,8 @@ watch( item.totalPrice = 0; } }); + // emit('success', formData.value) + }, { deep: true } ); @@ -149,7 +152,6 @@ watch( // }; // formData.value.push(newRow); // }; -const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 const getList = (val: []) => { for(let i = formData.value.length - 1; i >= 0; i--) { let obj = formData.value[i]