From 0a7f62f18d322dcb82ec3134075ea4e71f010825 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期四, 25 六月 2026 09:09:09 +0800
Subject: [PATCH] fix: 报价、审核、采购台账、供应商往来、销售台账、客户往来小数点保留6位小数

---
 src/views/salesManagement/salesLedger/index.vue |   70 ++++++++++++++++++++--------------
 1 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index a82f141..6e1d64c 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -568,7 +568,7 @@
                          width="160"
                          align="right">
           <template #default="scope">
-            {{ Number(scope.row.totalAmount ?? 0).toFixed(2) }}
+            {{ formatDecimal(scope.row.totalAmount) }}
           </template>
         </el-table-column>
         <el-table-column fixed="right"
@@ -666,11 +666,11 @@
           <el-col :span="12">
             <el-form-item label="鍚◣鍗曚环(鍏�)锛�"
                           prop="taxInclusiveUnitPrice">
-              <el-input-number :step="0.01"
+              <el-input-number :step="0.000001"
                                :min="0"
                                v-model="productForm.taxInclusiveUnitPrice"
                                style="width: 100%"
-                               :precision="2"
+                               :precision="6"
                                placeholder="璇疯緭鍏�"
                                clearable
                                @change="calculateFromUnitPrice" />
@@ -1057,6 +1057,11 @@
   import useFormData from "@/hooks/useFormData.js";
   import dayjs from "dayjs";
   import FileUpload from "@/components/AttachmentUpload/file/index.vue";
+  import {
+    tableAmountFormatter,
+    formatDecimal,
+    buildAmountSummaryFormat,
+  } from "@/utils/numberFormat";
   import ImageUpload from "@/components/AttachmentUpload/image/index.vue";
   import { getCurrentDate } from "@/utils/index.js";
   import { listCustomer } from "@/api/basicData/customer.js";
@@ -1401,12 +1406,7 @@
       return productOptions.value;
     });
   };
-  const formattedNumber = (row, column, cellValue) => {
-    if (cellValue === undefined || cellValue === null || cellValue === "") {
-      return "0.00";
-    }
-    return parseFloat(cellValue).toFixed(2);
-  };
+  const formattedNumber = tableAmountFormatter;
   const findLedgerRecordByRow = row => {
     if (!row) return null;
     if (
@@ -1569,11 +1569,15 @@
   };
   // 涓昏〃鍚堣鏂规硶
   const summarizeMainTable = param => {
-    return proxy.summarizeTable(param, [
-      "contractAmount",
-      "taxInclusiveTotalPrice",
-      "taxExclusiveTotalPrice",
-    ]);
+    return proxy.summarizeTable(
+      param,
+      ["contractAmount", "taxInclusiveTotalPrice", "taxExclusiveTotalPrice"],
+      buildAmountSummaryFormat([
+        "contractAmount",
+        "taxInclusiveTotalPrice",
+        "taxExclusiveTotalPrice",
+      ])
+    );
   };
   // 瀛愯〃鍚堣鏂规硶
   const summarizeChildrenTable = (param, parentRow) => {
@@ -1595,11 +1599,19 @@
         return "";
       });
     }
-    return proxy.summarizeTable(param, [
-      "taxInclusiveUnitPrice",
-      "taxInclusiveTotalPrice",
-      "taxExclusiveTotalPrice",
-    ]);
+    return proxy.summarizeTable(
+      param,
+      [
+        "taxInclusiveUnitPrice",
+        "taxInclusiveTotalPrice",
+        "taxExclusiveTotalPrice",
+      ],
+      buildAmountSummaryFormat([
+        "taxInclusiveUnitPrice",
+        "taxInclusiveTotalPrice",
+        "taxExclusiveTotalPrice",
+      ])
+    );
   };
   // 鎵撳紑寮规
   const openForm = async (type, row) => {
@@ -1727,7 +1739,7 @@
       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 = formatDecimal(unitPrice * quantity);
       const taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(
         taxInclusiveTotalPrice,
         taxRate
@@ -1739,7 +1751,7 @@
         unit: p.unit || "",
         quantity: quantity,
         taxRate: taxRate,
-        taxInclusiveUnitPrice: unitPrice.toFixed(2),
+        taxInclusiveUnitPrice: formatDecimal(unitPrice),
         taxInclusiveTotalPrice: taxInclusiveTotalPrice,
         taxExclusiveTotalPrice: taxExclusiveTotalPrice,
         invoiceType: "澧炴櫘绁�",
@@ -2413,7 +2425,7 @@
     const total = products.reduce((sum, product) => {
       return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
     }, 0);
-    return total.toFixed(2);
+    return formatDecimal(total);
   };
 
   // 鐢ㄤ簬鎵撳嵃鐨勮绠楀嚱鏁�
@@ -2430,7 +2442,7 @@
     const total = products.reduce((sum, product) => {
       return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
     }, 0);
-    return total.toFixed(2);
+    return formatDecimal(total);
   };
 
   const mathNum = () => {
@@ -2471,7 +2483,7 @@
     isCalculating.value = true;
 
     // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
-    productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
+    productForm.value.taxInclusiveUnitPrice = formatDecimal(totalPrice / quantity);
 
     // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
     if (productForm.value.taxRate) {
@@ -2508,12 +2520,12 @@
     // 鍏堣绠楀惈绋庢�讳环 = 涓嶅惈绋庢�讳环 / (1 - 绋庣巼/100)
     const taxRateDecimal = taxRate / 100;
     const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
-    productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
+    productForm.value.taxInclusiveTotalPrice = formatDecimal(inclusiveTotalPrice);
 
     // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
-    productForm.value.taxInclusiveUnitPrice = (
+    productForm.value.taxInclusiveUnitPrice = formatDecimal(
       inclusiveTotalPrice / quantity
-    ).toFixed(2);
+    );
 
     isCalculating.value = false;
   };
@@ -2536,7 +2548,7 @@
     isCalculating.value = true;
 
     // 璁$畻鍚◣鎬讳环
-    productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
+    productForm.value.taxInclusiveTotalPrice = formatDecimal(unitPrice * quantity);
 
     // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
     if (productForm.value.taxRate) {
@@ -2568,7 +2580,7 @@
     isCalculating.value = true;
 
     // 璁$畻鍚◣鎬讳环
-    productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
+    productForm.value.taxInclusiveTotalPrice = formatDecimal(unitPrice * quantity);
 
     // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
     if (productForm.value.taxRate) {

--
Gitblit v1.9.3