From f34a379fc9a4908d39fac8b9688280e38bfaffbb Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期五, 11 九月 2026 10:57:33 +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 127f80e..2b59a94 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -656,7 +656,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">
@@ -768,7 +768,7 @@
:min="0"
v-model="productForm.taxInclusiveUnitPrice"
style="width: 100%"
- :precision="2"
+ :precision="6"
placeholder="璇疯緭鍏�"
clearable
@change="calculateFromUnitPrice"
@@ -783,7 +783,7 @@
v-model="productForm.quantity"
placeholder="璇疯緭鍏�"
clearable
- :precision="2"
+ :precision="6"
@change="calculateFromQuantity"
style="width: 100%"
/>
@@ -1136,7 +1136,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)"
@@ -1534,9 +1534,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;
@@ -1700,11 +1700,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) => {
@@ -1726,11 +1730,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) => {
@@ -1860,10 +1872,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 {
// 鍙拌处瀛楁
@@ -1872,7 +1885,7 @@
unit: p.unit || "",
quantity: quantity,
taxRate: taxRate,
- taxInclusiveUnitPrice: unitPrice.toFixed(2),
+ taxInclusiveUnitPrice: unitPrice.toFixed(6),
taxInclusiveTotalPrice: taxInclusiveTotalPrice,
taxExclusiveTotalPrice: taxExclusiveTotalPrice,
invoiceType: "澧炴櫘绁�",
@@ -2541,7 +2554,7 @@
const total = products.reduce((sum, product) => {
return sum + (parseFloat(product.quantity) || 0);
}, 0);
- return total.toFixed(2);
+ return total.toFixed(6);
};
// 璁$畻浜у搧鎬婚噾棰�
@@ -2550,7 +2563,7 @@
const total = products.reduce((sum, product) => {
return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
}, 0);
- return total.toFixed(2);
+ return total.toFixed(6);
};
// 鐢ㄤ簬鎵撳嵃鐨勮绠楀嚱鏁�
@@ -2559,7 +2572,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) => {
@@ -2567,7 +2580,7 @@
const total = products.reduce((sum, product) => {
return sum + (parseFloat(product.taxInclusiveTotalPrice) || 0);
}, 0);
- return total.toFixed(2);
+ return total.toFixed(6);
};
const mathNum = () => {
@@ -2582,14 +2595,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
);
}
};
@@ -2608,14 +2623,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
);
}
@@ -2645,12 +2661,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;
};
@@ -2673,14 +2689,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
);
}
@@ -2705,14 +2722,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
);
}
@@ -2740,7 +2758,7 @@
// 璁$畻涓嶅惈绋庢�讳环
productForm.value.taxExclusiveTotalPrice =
- proxy.calculateTaxExclusiveTotalPrice(inclusiveTotalPrice, taxRate);
+ proxy.calculateTaxExclusiveTotalPrice(inclusiveTotalPrice, taxRate, 6);
isCalculating.value = false;
};
--
Gitblit v1.9.3