From 35bca0a78746b8b97497f89c9e1e52e643dc4d5e Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期日, 13 九月 2026 11:40:35 +0800
Subject: [PATCH] fix: 统一销售和采购相关页面金额、单价、数量、总价保留6位小数

---
 src/views/salesManagement/salesLedger/index.vue |   86 ++++++++++++++++++++++++++-----------------
 1 files changed, 52 insertions(+), 34 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index d2e82b5..c001152 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -664,7 +664,7 @@
           align="right"
         >
           <template #default="scope">
-            {{ Number(scope.row.totalAmount ?? 0).toFixed(2) }}
+            {{ Number(scope.row.totalAmount ?? 0).toFixed(6) }}
           </template>
         </el-table-column>
         <el-table-column fixed="right" label="鎿嶄綔" width="120" align="center">
@@ -776,7 +776,7 @@
                 :min="0"
                 v-model="productForm.taxInclusiveUnitPrice"
                 style="width: 100%"
-                :precision="2"
+                :precision="6"
                 placeholder="璇疯緭鍏�"
                 clearable
                 @change="calculateFromUnitPrice"
@@ -791,7 +791,7 @@
                 v-model="productForm.quantity"
                 placeholder="璇疯緭鍏�"
                 clearable
-                :precision="2"
+                :precision="6"
                 @change="calculateFromQuantity"
                 style="width: 100%"
               />
@@ -1144,7 +1144,7 @@
                       v-model="scope.row.deliveryQuantity"
                       :min="0"
                       :max="getDeliveryBatchDeliveryMax(scope.row)"
-                      :precision="2"
+                      :precision="6"
                       :step="0.01"
                       controls-position="right"
                       @change="handleDeliveryBatchQuantityChange(scope.row)"
@@ -1542,9 +1542,9 @@
 };
 const formattedNumber = (row, column, cellValue) => {
   if (cellValue === undefined || cellValue === null || cellValue === "") {
-    return "0.00";
+    return "0.000000";
   }
-  return parseFloat(cellValue).toFixed(2);
+  return parseFloat(cellValue).toFixed(6);
 };
 const findLedgerRecordByRow = (row) => {
   if (!row) return null;
@@ -1708,11 +1708,15 @@
 };
 // 涓昏〃鍚堣鏂规硶
 const summarizeMainTable = (param) => {
-  return proxy.summarizeTable(param, [
-    "contractAmount",
-    "taxInclusiveTotalPrice",
-    "taxExclusiveTotalPrice",
-  ]);
+  return proxy.summarizeTable(
+    param,
+    ["contractAmount", "taxInclusiveTotalPrice", "taxExclusiveTotalPrice"],
+    {
+      contractAmount: { decimalPlaces: 6 },
+      taxInclusiveTotalPrice: { decimalPlaces: 6 },
+      taxExclusiveTotalPrice: { decimalPlaces: 6 },
+    }
+  );
 };
 // 瀛愯〃鍚堣鏂规硶
 const summarizeChildrenTable = (param, parentRow) => {
@@ -1734,11 +1738,19 @@
       return "";
     });
   }
-  return proxy.summarizeTable(param, [
-    "taxInclusiveUnitPrice",
-    "taxInclusiveTotalPrice",
-    "taxExclusiveTotalPrice",
-  ]);
+  return proxy.summarizeTable(
+    param,
+    [
+      "taxInclusiveUnitPrice",
+      "taxInclusiveTotalPrice",
+      "taxExclusiveTotalPrice",
+    ],
+    {
+      taxInclusiveUnitPrice: { decimalPlaces: 6 },
+      taxInclusiveTotalPrice: { decimalPlaces: 6 },
+      taxExclusiveTotalPrice: { decimalPlaces: 6 },
+    }
+  );
 };
 // 鎵撳紑寮规
 const openForm = async (type, row) => {
@@ -1868,10 +1880,11 @@
     const quantity = Number(p.quantity ?? 0) || 0;
     const unitPrice = Number(p.unitPrice ?? 0) || 0;
     const taxRate = "13"; // 榛樿 13%锛屼究浜庣洿鎺ユ彁浜わ紙濡傞渶鍙湪浜у搧涓嚜琛屼慨鏀癸級
-    const taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
+    const taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(6);
     const taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(
       taxInclusiveTotalPrice,
-      taxRate
+      taxRate,
+      6
     );
     return {
       // 鍙拌处瀛楁
@@ -1880,7 +1893,7 @@
       unit: p.unit || "",
       quantity: quantity,
       taxRate: taxRate,
-      taxInclusiveUnitPrice: unitPrice.toFixed(2),
+      taxInclusiveUnitPrice: unitPrice.toFixed(6),
       taxInclusiveTotalPrice: taxInclusiveTotalPrice,
       taxExclusiveTotalPrice: taxExclusiveTotalPrice,
       invoiceType: "澧炴櫘绁�",
@@ -2549,7 +2562,7 @@
   const total = products.reduce((sum, product) => {
     return sum + (parseFloat(product.quantity) || 0);
   }, 0);
-  return total.toFixed(2);
+  return total.toFixed(6);
 };
 
 // 璁$畻浜у搧鎬婚噾棰�
@@ -2558,7 +2571,7 @@
   const total = products.reduce((sum, product) => {
     return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
   }, 0);
-  return total.toFixed(2);
+  return total.toFixed(6);
 };
 
 // 鐢ㄤ簬鎵撳嵃鐨勮绠楀嚱鏁�
@@ -2567,7 +2580,7 @@
   const total = products.reduce((sum, product) => {
     return sum + (parseFloat(product.quantity) || 0);
   }, 0);
-  return total.toFixed(2);
+  return total.toFixed(6);
 };
 
 const getTotalAmountForPrint = (products) => {
@@ -2575,7 +2588,7 @@
   const total = products.reduce((sum, product) => {
     return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
   }, 0);
-  return total.toFixed(2);
+  return total.toFixed(6);
 };
 
 const mathNum = () => {
@@ -2590,14 +2603,16 @@
   productForm.value.taxInclusiveTotalPrice =
     proxy.calculateTaxIncludeTotalPrice(
       productForm.value.taxInclusiveUnitPrice,
-      productForm.value.quantity
+      productForm.value.quantity,
+      6
     );
   if (productForm.value.taxRate) {
     // 涓嶅惈绋庢�讳环璁$畻
     productForm.value.taxExclusiveTotalPrice =
       proxy.calculateTaxExclusiveTotalPrice(
         productForm.value.taxInclusiveTotalPrice,
-        productForm.value.taxRate
+        productForm.value.taxRate,
+        6
       );
   }
 };
@@ -2616,14 +2631,15 @@
   isCalculating.value = true;
 
   // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
-  productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
+  productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(6);
 
   // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
   if (productForm.value.taxRate) {
     productForm.value.taxExclusiveTotalPrice =
       proxy.calculateTaxExclusiveTotalPrice(
         totalPrice,
-        productForm.value.taxRate
+        productForm.value.taxRate,
+        6
       );
   }
 
@@ -2653,12 +2669,12 @@
   // 鍏堣绠楀惈绋庢�讳环 = 涓嶅惈绋庢�讳环 / (1 - 绋庣巼/100)
   const taxRateDecimal = taxRate / 100;
   const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
-  productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
+  productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(6);
 
   // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
   productForm.value.taxInclusiveUnitPrice = (
     inclusiveTotalPrice / quantity
-  ).toFixed(2);
+  ).toFixed(6);
 
   isCalculating.value = false;
 };
@@ -2681,14 +2697,15 @@
   isCalculating.value = true;
 
   // 璁$畻鍚◣鎬讳环
-  productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
+  productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(6);
 
   // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
   if (productForm.value.taxRate) {
     productForm.value.taxExclusiveTotalPrice =
       proxy.calculateTaxExclusiveTotalPrice(
         productForm.value.taxInclusiveTotalPrice,
-        productForm.value.taxRate
+        productForm.value.taxRate,
+        6
       );
   }
 
@@ -2713,14 +2730,15 @@
   isCalculating.value = true;
 
   // 璁$畻鍚◣鎬讳环
-  productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
+  productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(6);
 
   // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
   if (productForm.value.taxRate) {
     productForm.value.taxExclusiveTotalPrice =
       proxy.calculateTaxExclusiveTotalPrice(
         productForm.value.taxInclusiveTotalPrice,
-        productForm.value.taxRate
+        productForm.value.taxRate,
+        6
       );
   }
 
@@ -2748,7 +2766,7 @@
 
   // 璁$畻涓嶅惈绋庢�讳环
   productForm.value.taxExclusiveTotalPrice =
-    proxy.calculateTaxExclusiveTotalPrice(inclusiveTotalPrice, taxRate);
+    proxy.calculateTaxExclusiveTotalPrice(inclusiveTotalPrice, taxRate, 6);
 
   isCalculating.value = false;
 };

--
Gitblit v1.9.3