From 55c89a667220d8dd5fb99e2d8219d3aee15cb594 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 04 十一月 2026 16:32:11 +0800
Subject: [PATCH] refactor(srm): 重构供应商采购界面,新增询价比价与保证金页面

---
 src/views/erp/purchase/order/modules/item-form.vue |   36 ++++++++++++++++++++++++++----------
 1 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/src/views/erp/purchase/order/modules/item-form.vue b/src/views/erp/purchase/order/modules/item-form.vue
index 7ba1dc1..61d915f 100644
--- a/src/views/erp/purchase/order/modules/item-form.vue
+++ b/src/views/erp/purchase/order/modules/item-form.vue
@@ -164,6 +164,7 @@
 
 /** 澶勭悊琛屾暟鎹彉鏇� */
 function handleRowChange(row: any) {
+  calcRow(row);
   const index = tableData.value.findIndex((item) => item.seq === row.seq);
   if (index === -1) {
     tableData.value.push(row);
@@ -173,14 +174,30 @@
   emit('update:items', [...tableData.value]);
 }
 
+/**
+ * 璁$畻琛岄噾棰�
+ * 鍗曚环涓哄惈绋庡崟浠凤細閲戦锛堜环绋庡悎璁★級= 鍗曚环 * 鏁伴噺锛岀◣棰濅粠鍚◣閲戦涓弽绠楋紝涓嶅啀棰濆鍔犵◣
+ */
+function calcRow(row: ErpPurchaseOrderApi.PurchaseOrderItem) {
+  if (!row.productPrice || !row.count) {
+    return;
+  }
+  const totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
+  const taxPercent = Number(row.taxPercent) || 0;
+  row.totalProductPrice = totalProductPrice;
+  row.taxPrice =
+    taxPercent > 0
+      ? (erpPriceMultiply(
+          totalProductPrice,
+          taxPercent / (100 + taxPercent),
+        ) ?? 0)
+      : 0;
+  row.totalPrice = totalProductPrice;
+}
+
 /** 鍒濆鍖栬鏁版嵁 */
 function initRow(row: ErpPurchaseOrderApi.PurchaseOrderItem) {
-  if (row.productPrice && row.count) {
-    row.totalProductPrice = erpPriceMultiply(row.productPrice, row.count) ?? 0;
-    row.taxPrice =
-      erpPriceMultiply(row.totalProductPrice, (row.taxPercent || 0) / 100) ?? 0;
-    row.totalPrice = row.totalProductPrice + row.taxPrice;
-  }
+  calcRow(row);
 }
 
 /** 琛ㄥ崟鏍¢獙 */
@@ -195,7 +212,7 @@
         throw new Error(`绗� ${i + 1} 琛岋細浜у搧鏁伴噺涓嶈兘涓虹┖`);
       }
       if (!item.productPrice || item.productPrice <= 0) {
-        throw new Error(`绗� ${i + 1} 琛岋細浜у搧鍗曚环涓嶈兘涓虹┖`);
+        throw new Error(`绗� ${i + 1} 琛岋細鍚◣鍗曚环涓嶈兘涓虹┖`);
       }
     }
   }
@@ -294,11 +311,10 @@
           <div class="flex space-x-4">
             <span>鏁伴噺锛歿{ erpCountInputFormatter(summaries.count) }}</span>
             <span>
-              閲戦锛歿{ erpPriceInputFormatter(summaries.totalProductPrice) }}
+              绋庨锛堜环鍐呭惈锛夛細{{ erpPriceInputFormatter(summaries.taxPrice) }}
             </span>
-            <span>绋庨锛歿{ erpPriceInputFormatter(summaries.taxPrice) }}</span>
             <span>
-              绋庨鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
+              浠风◣鍚堣锛歿{ erpPriceInputFormatter(summaries.totalPrice) }}
             </span>
           </div>
         </div>

--
Gitblit v1.9.3