From 949d344cd69a74d93141ffe74fecc05c0f4f5d8a Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期一, 02 十一月 2026 10:17:38 +0800
Subject: [PATCH] fix(crm): 修正商机「整单折扣」算法错误

---
 src/views/crm/business/data.ts          |   18 +++++++++---------
 src/views/crm/business/modules/form.vue |   11 ++++++-----
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/views/crm/business/data.ts b/src/views/crm/business/data.ts
index d1c9a3e..7f81ee9 100644
--- a/src/views/crm/business/data.ts
+++ b/src/views/crm/business/data.ts
@@ -151,15 +151,15 @@
       dependencies: {
         triggerFields: ['totalProductPrice', 'discountPercent'],
         trigger(values, form) {
-          const discountPrice =
-            erpPriceMultiply(
-              values.totalProductPrice,
-              values.discountPercent / 100,
-            ) ?? 0;
-          form.setFieldValue(
-            'totalPrice',
-            values.totalProductPrice - discountPrice,
-          );
+          const totalProductPrice = values.totalProductPrice ?? 0;
+          const discountPercent = values.discountPercent;
+          // 涓� form.vue 淇濇寔涓�鑷达細98 琛ㄧず 98 鎶橈紱涓虹┖鎴� 0 瑙嗕负涓嶆墦鎶�
+          const totalPrice =
+            !discountPercent || discountPercent === 0
+              ? totalProductPrice
+              : (erpPriceMultiply(totalProductPrice, discountPercent / 100) ??
+                0);
+          form.setFieldValue('totalPrice', totalPrice);
         },
       },
     },
diff --git a/src/views/crm/business/modules/form.vue b/src/views/crm/business/modules/form.vue
index 6b312cb..b99d38f 100644
--- a/src/views/crm/business/modules/form.vue
+++ b/src/views/crm/business/modules/form.vue
@@ -38,11 +38,12 @@
         0,
       ) ?? 0;
     const discountPercent = formData.value.discountPercent;
-    const discountPrice =
-      discountPercent === null
-        ? 0
-        : erpPriceMultiply(totalProductPrice, discountPercent / 100);
-    const totalPrice = totalProductPrice - (discountPrice ?? 0);
+    // 鎶樻墸鐜囪涔夛細濉� 98 琛ㄧず鎸� 98% 璁′环锛堝嵆 98 鎶橈級銆�
+    // 涓虹┖鎴� 0 鏃惰浣滀笉鎵撴姌锛岄伩鍏嶉粯璁ゅ�� 0 鎶婇噾棰濈畻鎴� 0銆�
+    const totalPrice =
+      !discountPercent || discountPercent === 0
+        ? totalProductPrice
+        : (erpPriceMultiply(totalProductPrice, discountPercent / 100) ?? 0);
     formData.value!.totalProductPrice = totalProductPrice;
     formData.value!.totalPrice = totalPrice;
     formApi.setValues(formData.value!);

--
Gitblit v1.9.3