From 3ab45f295fb26c7794b4829976f3fb20c68a012e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 22 一月 2026 10:33:41 +0800
Subject: [PATCH] 新疆海川开心 1.采购模块的计算都改为保留三位小数并且不四舍五入
---
src/views/procurementManagement/paymentHistory/index.vue | 3
src/views/procurementManagement/procurementInvoiceLedger/index.vue | 7 +-
src/views/procurementManagement/procurementLedger/index.vue | 40 +++++++------
src/views/procurementManagement/invoiceEntry/components/ExpandTable.vue | 13 ++--
src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue | 14 ++--
src/views/procurementManagement/invoiceEntry/index.vue | 7 +-
src/views/procurementManagement/paymentEntry/index.vue | 12 ++--
src/utils/index.js | 38 ++++++++++++
src/views/procurementManagement/invoiceEntry/components/Modal.vue | 31 +++++-----
src/utils/summarizeTable.js | 6 +-
10 files changed, 109 insertions(+), 62 deletions(-)
diff --git a/src/utils/index.js b/src/utils/index.js
index 809593f..a4a55d2 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -409,3 +409,41 @@
return `${year}-${month}-${day}`;
}
+/**
+ * 鎴柇锛堣垗鍘伙級鎸囧畾浣嶆暟鍚庝笉鍥涜垗浜斿叆
+ * @param {number} num - 瑕佸鐞嗙殑鏁板瓧
+ * @param {number} decimals - 瑕佷繚鐣欑殑灏忔暟浣嶆暟锛岄粯璁や负0
+ * @returns {number} 鎴柇鍚庣殑鏁板瓧
+ * @example
+ * truncate(3.14159, 2) // 杩斿洖 3.14
+ * truncate(3.999, 2) // 杩斿洖 3.99
+ * truncate(-3.14159, 2) // 杩斿洖 -3.14
+ * truncate(123.456, 0) // 杩斿洖 123
+ */
+export function truncate(num, decimals = 0) {
+ // 鍙傛暟楠岃瘉
+ if (typeof num !== 'number' || isNaN(num)) {
+ console.warn('truncate: 绗竴涓弬鏁板繀椤绘槸鏈夋晥鏁板瓧');
+ return num;
+ }
+ if (typeof decimals !== 'number' || decimals < 0 || !Number.isInteger(decimals)) {
+ console.warn('truncate: 绗簩涓弬鏁板繀椤绘槸闈炶礋鏁存暟');
+ return num;
+ }
+
+ // 濡傛灉淇濈暀0浣嶅皬鏁帮紝鐩存帴浣跨敤 Math.trunc
+ if (decimals === 0) {
+ return Math.trunc(num);
+ }
+
+ // 璁$畻鍊嶆暟锛�10鐨刣ecimals娆℃柟锛�
+ const multiplier = Math.pow(10, decimals);
+
+ // 瀵逛簬璐熸暟锛屼娇鐢� Math.ceil 鏉ョ‘淇濇纭埅鏂�
+ // 瀵逛簬姝f暟锛屼娇鐢� Math.floor 鏉ユ埅鏂�
+ if (num < 0) {
+ return Math.ceil(num * multiplier) / multiplier;
+ } else {
+ return Math.floor(num * multiplier) / multiplier;
+ }
+}
diff --git a/src/utils/summarizeTable.js b/src/utils/summarizeTable.js
index 1ad480d..e84c6f9 100644
--- a/src/utils/summarizeTable.js
+++ b/src/utils/summarizeTable.js
@@ -28,7 +28,7 @@
} else {
// 榛樿淇濈暀涓や綅灏忔暟
sums[index] = parseFloat(sum).toFixed(
- specialFormat[prop]?.decimalPlaces ?? 2
+ specialFormat[prop]?.decimalPlaces ?? 3
);
}
} else {
@@ -43,11 +43,11 @@
// 涓嶅惈绋庢�讳环璁$畻
const calculateTaxExclusiveTotalPrice = (taxInclusiveTotalPrice, taxRate) => {
const taxRateDecimal = taxRate / 100;
- return (taxInclusiveTotalPrice / (1 + taxRateDecimal)).toFixed(2);
+ return (taxInclusiveTotalPrice / (1 + taxRateDecimal)).toFixed(3);
};
// 鍚◣鎬讳环璁$畻
const calculateTaxIncludeTotalPrice = (taxInclusiveUnitPrice, quantity) => {
- return (taxInclusiveUnitPrice * quantity).toFixed(2);
+ return (taxInclusiveUnitPrice * quantity).toFixed(3);
};
// 瀵煎嚭鍑芥暟渚涘叾浠栨枃浠朵娇鐢�
export {
diff --git a/src/views/procurementManagement/invoiceEntry/components/ExpandTable.vue b/src/views/procurementManagement/invoiceEntry/components/ExpandTable.vue
index 24a368a..63f31c3 100644
--- a/src/views/procurementManagement/invoiceEntry/components/ExpandTable.vue
+++ b/src/views/procurementManagement/invoiceEntry/components/ExpandTable.vue
@@ -14,7 +14,8 @@
<script setup>
import { usePaginationApi } from "@/hooks/usePaginationApi";
import { productList } from "@/api/procurementManagement/procurementLedger.js";
-import { nextTick } from "vue";
+import { nextTick, getCurrentInstance } from "vue";
+import { truncate } from "@/utils/index.js";
const { proxy } = getCurrentInstance();
defineOptions({
@@ -61,7 +62,7 @@
prop: "taxInclusiveUnitPrice",
width:200,
formatData: (val) => {
- return val ? parseFloat(val).toFixed(2) : "-";
+ return val ? truncate(parseFloat(val), 3) : "-";
},
},
{
@@ -69,7 +70,7 @@
prop: "taxInclusiveTotalPrice",
width:200,
formatData: (val) => {
- return val ? parseFloat(val).toFixed(2) : "-";
+ return val ? truncate(parseFloat(val), 3) : "-";
},
},
{
@@ -77,7 +78,7 @@
prop: "taxExclusiveTotalPrice",
width:200,
formatData: (val) => {
- return val ? parseFloat(val).toFixed(2) : "-";
+ return val ? truncate(parseFloat(val), 3) : "-";
},
},
{
@@ -85,7 +86,7 @@
prop: "ticketsAmount",
width:200,
formatData: (val) => {
- return val ? parseFloat(val).toFixed(2) : "-";
+ return val ? truncate(parseFloat(val), 3) : "-";
},
},
{
@@ -97,7 +98,7 @@
prop: "futureTicketsAmount",
width:200,
formatData: (val) => {
- return val ? parseFloat(val).toFixed(2) : "-";
+ return val ? truncate(parseFloat(val), 3) : "-";
},
},
],
diff --git a/src/views/procurementManagement/invoiceEntry/components/Modal.vue b/src/views/procurementManagement/invoiceEntry/components/Modal.vue
index 90b8a9a..ba31332 100644
--- a/src/views/procurementManagement/invoiceEntry/components/Modal.vue
+++ b/src/views/procurementManagement/invoiceEntry/components/Modal.vue
@@ -149,7 +149,7 @@
<el-table-column label="鏈寮�绁ㄦ暟" prop="ticketsNum" width="180">
<template #default="scope">
<el-input-number :step="0.1" :min="0" style="width: 100%"
- :precision="2"
+ :precision="3"
v-model="scope.row.ticketsNum"
@change="invoiceNumBlur(scope.row)"
/>
@@ -162,7 +162,7 @@
>
<template #default="scope">
<el-input-number :step="0.01" :min="0" style="width: 100%"
- :precision="2"
+ :precision="3"
v-model="scope.row.ticketsAmount"
@change="invoiceAmountBlur(scope.row)"
/>
@@ -214,6 +214,7 @@
import { getToken } from "@/utils/auth";
import useUserStore from "@/store/modules/user";
import dayjs from "dayjs";
+import { truncate } from "@/utils/index.js";
defineOptions({
name: "鏉ョエ鐧昏妯℃�佹",
@@ -303,7 +304,7 @@
prop: "taxInclusiveUnitPrice",
width: 150,
formatData: (val) => {
- return val ? parseFloat(val).toFixed(2) : 0;
+ return val ? truncate(parseFloat(val), 3) : 0;
},
},
{
@@ -311,7 +312,7 @@
prop: "taxInclusiveTotalPrice",
width: 150,
formatData: (val) => {
- return parseFloat(val).toFixed(2) ?? 0;
+ return val ? truncate(parseFloat(val), 3) : 0;
},
},
{
@@ -319,7 +320,7 @@
prop: "taxExclusiveTotalPrice",
width: 150,
formatData: (val) => {
- return parseFloat(val).toFixed(2) ?? 0;
+ return val ? truncate(parseFloat(val), 3) : 0;
},
},
{
@@ -351,10 +352,10 @@
];
const formattedNumber = (row, column, cellValue) => {
if (cellValue == 0) {
- return parseFloat(cellValue).toFixed(2);
+ return truncate(parseFloat(cellValue), 3);
}
if (cellValue) {
- return parseFloat(cellValue).toFixed(2);
+ return truncate(parseFloat(cellValue), 3);
} else {
return cellValue;
}
@@ -438,7 +439,7 @@
const totalAmount = allProductData.reduce((sum, item) => {
return sum + (Number(item.taxInclusiveTotalPrice) || 0);
}, 0);
- form.invoiceAmount = totalAmount.toFixed(2);
+ form.invoiceAmount = truncate(totalAmount, 3);
// 瀛樺偍閫変腑鐨勫悎鍚屾暟鎹�
selectedContracts.value = selectedRows;
@@ -480,11 +481,11 @@
return;
}
// 璁$畻鏈鏉ョエ閲戦
- row.ticketsAmount = (row.ticketsNum * row.taxInclusiveUnitPrice).toFixed(2)
+ row.ticketsAmount = truncate(row.ticketsNum * row.taxInclusiveUnitPrice, 3)
// 璁$畻鏈潵绁ㄦ暟
- row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2)
+ row.futureTickets = truncate(row.tempFutureTickets - row.ticketsNum, 3)
// 璁$畻鏈潵绁ㄩ噾棰�
- row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2)
+ row.futureTicketsAmount = truncate(row.tempFutureTicketsAmount - row.ticketsAmount, 3)
calculateinvoiceAmount();
};
@@ -500,12 +501,12 @@
}
// 璁$畻鏈鏉ョエ鏁�
row.ticketsNum = Number(
- (row.ticketsAmount / row.taxInclusiveUnitPrice).toFixed(2)
+ truncate(row.ticketsAmount / row.taxInclusiveUnitPrice, 3)
);
// 璁$畻鏈潵绁ㄦ暟
- row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2)
+ row.futureTickets = truncate(row.tempFutureTickets - row.ticketsNum, 3)
// 璁$畻鏈潵绁ㄩ噾棰�
- row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2)
+ row.futureTicketsAmount = truncate(row.tempFutureTicketsAmount - row.ticketsAmount, 3)
calculateinvoiceAmount();
};
@@ -516,7 +517,7 @@
invoiceAmountTotal += Number(item.ticketsAmount);
}
});
- form.invoiceAmount = invoiceAmountTotal.toFixed(2);
+ form.invoiceAmount = truncate(invoiceAmountTotal, 3);
};
const open = async (type, selectedRows) => {
diff --git a/src/views/procurementManagement/invoiceEntry/index.vue b/src/views/procurementManagement/invoiceEntry/index.vue
index 3719ffe..464f897 100644
--- a/src/views/procurementManagement/invoiceEntry/index.vue
+++ b/src/views/procurementManagement/invoiceEntry/index.vue
@@ -89,6 +89,7 @@
import ExpandTable from "./components/ExpandTable.vue";
import Modal from "./components/Modal.vue";
import {ElMessageBox} from "element-plus";
+import { truncate } from "@/utils/index.js";
defineOptions({
name: "鏉ョエ鐧昏",
@@ -149,7 +150,7 @@
prop: "contractAmount",
width:200,
formatData: (val) => {
- return val ? parseFloat(val).toFixed(2) : 0;
+ return val ? truncate(parseFloat(val), 3) : 0;
},
},
{
@@ -157,7 +158,7 @@
prop: "receiptPaymentAmount",
width:200,
formatData: (val) => {
- return val ? parseFloat(val).toFixed(2) : 0;
+ return val ? truncate(parseFloat(val), 3) : 0;
},
},
{
@@ -165,7 +166,7 @@
prop: "unReceiptPaymentAmount",
width:200,
formatData: (val) => {
- return val ? parseFloat(val).toFixed(2) : 0;
+ return val ? truncate(parseFloat(val), 3) : 0;
},
},
// {
diff --git a/src/views/procurementManagement/paymentEntry/index.vue b/src/views/procurementManagement/paymentEntry/index.vue
index 2a49a8a..9db9823 100644
--- a/src/views/procurementManagement/paymentEntry/index.vue
+++ b/src/views/procurementManagement/paymentEntry/index.vue
@@ -75,7 +75,7 @@
<el-input-number :step="0.01" :min="0" style="width: 100%"
v-model="scope.row.currentPaymentAmount"
:disabled="!scope.row.editType"
- :precision="2"
+ :precision="3"
placeholder="璇疯緭鍏�"
clearable
/>
@@ -199,7 +199,7 @@
<el-col :span="12">
<el-form-item label="鏈浠樻閲戦锛�" prop="currentPaymentAmount">
<el-input-number :step="0.01" :min="0" style="width: 100%"
- :precision="2"
+ :precision="3"
v-model="form.currentPaymentAmount"
placeholder="璇疯緭鍏�"
clearable
@@ -284,7 +284,7 @@
updatePaymentRegistration
} from "@/api/procurementManagement/procurementInvoiceLedger.js";
import useFormData from "@/hooks/useFormData";
-import { getCurrentDate } from "@/utils/index.js";
+import { getCurrentDate, truncate } from "@/utils/index.js";
const { proxy } = getCurrentInstance();
const tableColumn = ref([
@@ -329,21 +329,21 @@
label: "鍙戠エ閲戦(鍏�)",
prop: "invoiceAmount",
formatData: (params) => {
- return params ? parseFloat(params).toFixed(2) : 0;
+ return params ? truncate(parseFloat(params), 3) : 0;
},
},
{
label: "宸蹭粯娆鹃噾棰�(鍏�)",
prop: "paymentAmountTotal",
formatData: (params) => {
- return params ? parseFloat(params).toFixed(2) : 0;
+ return params ? truncate(parseFloat(params), 3) : 0;
},
},
{
label: "寰呬粯娆鹃噾棰�(鍏�)",
prop: "unPaymentAmountTotal",
formatData: (params) => {
- return params ? parseFloat(params).toFixed(2) : 0;
+ return params ? truncate(parseFloat(params), 3) : 0;
},
},
{
diff --git a/src/views/procurementManagement/paymentHistory/index.vue b/src/views/procurementManagement/paymentHistory/index.vue
index 4d23b9c..7cc99bf 100644
--- a/src/views/procurementManagement/paymentHistory/index.vue
+++ b/src/views/procurementManagement/paymentHistory/index.vue
@@ -69,6 +69,7 @@
import { paymentHistoryListPage } from "@/api/procurementManagement/paymentEntry.js";
import useFormData from "@/hooks/useFormData";
import dayjs from "dayjs";
+import { truncate } from "@/utils/index.js";
const { proxy } = getCurrentInstance();
const isShowSummarySon = ref(true);
@@ -90,7 +91,7 @@
label: "浠樻閲戦",
prop: "currentPaymentAmount",
formatData: (params) => {
- return params ? parseFloat(params).toFixed(2) : 0;
+ return params ? truncate(parseFloat(params), 3) : 0;
},
},
{
diff --git a/src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue b/src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue
index e26d73c..3072916 100644
--- a/src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue
+++ b/src/views/procurementManagement/procurementInvoiceLedger/Form/EditForm.vue
@@ -46,8 +46,10 @@
</template>
<script setup>
+import { getCurrentInstance, ref } from "vue";
import useFormData from "@/hooks/useFormData";
import { getProductRecordById } from "@/api/procurementManagement/procurementInvoiceLedger";
+import { truncate } from "@/utils/index.js";
const { proxy } = getCurrentInstance()
defineOptions({
@@ -75,7 +77,7 @@
form.createdAt = data.createdAt;
form.invoiceNumber = data.invoiceNumber;
form.ticketsNum = data.ticketsNum;
- form.ticketsAmount = data.ticketsAmount.toFixed(2);
+ form.ticketsAmount = truncate(data.ticketsAmount, 3);
form.taxInclusiveUnitPrice = data.taxInclusiveUnitPrice;
form.futureTickets = data.futureTickets;
temFutureTickets.value = data.futureTickets;
@@ -97,8 +99,8 @@
// 纭繚鎵�鏈夋暟鍊奸兘杞崲涓烘暟瀛楃被鍨嬭繘琛岃绠�
const ticketsAmount = Number(form.ticketsNum) * Number(form.taxInclusiveUnitPrice);
const futureTickets = Number(temFutureTickets.value) - Number(form.ticketsNum);
- form.futureTickets = Number(futureTickets.toFixed(2));
- form.ticketsAmount = Number(ticketsAmount.toFixed(2));
+ form.futureTickets = Number(truncate(futureTickets, 3));
+ form.ticketsAmount = Number(truncate(ticketsAmount, 3));
};
const inputTicketsAmount = (val) => {
// 纭繚鍚◣鍗曚环瀛樺湪涓斾笉涓洪浂
@@ -109,15 +111,15 @@
if (Number(val) > Number(form.futureTickets*form.taxInclusiveUnitPrice)) {
proxy.$modal.msgWarning("鏈鏉ョエ閲戦涓嶅緱澶т簬鎬婚噾棰�");
- form.ticketsAmount = (form.futureTickets*form.taxInclusiveUnitPrice).toFixed(2)
+ form.ticketsAmount = truncate(form.futureTickets*form.taxInclusiveUnitPrice, 3)
const ticketsNum = Number(form.ticketsAmount) / Number(form.taxInclusiveUnitPrice);
- form.ticketsNum = Number(ticketsNum.toFixed(2))
+ form.ticketsNum = Number(truncate(ticketsNum, 3))
return;
}
// 纭繚鎵�鏈夋暟鍊奸兘杞崲涓烘暟瀛楃被鍨嬭繘琛岃绠�
const ticketsNum = Number(val) / Number(form.taxInclusiveUnitPrice);
- form.ticketsNum = Number(ticketsNum.toFixed(2));
+ form.ticketsNum = Number(truncate(ticketsNum, 3));
};
defineExpose({
diff --git a/src/views/procurementManagement/procurementInvoiceLedger/index.vue b/src/views/procurementManagement/procurementInvoiceLedger/index.vue
index 6ddc27e..d719591 100644
--- a/src/views/procurementManagement/procurementInvoiceLedger/index.vue
+++ b/src/views/procurementManagement/procurementInvoiceLedger/index.vue
@@ -119,6 +119,7 @@
import useUserStore from "@/store/modules/user.js";
import dayjs from "dayjs";
import FileList from "./fileList.vue";
+import { truncate } from "@/utils/index.js";
defineOptions({
name: "鏉ョエ鍙拌处",
@@ -177,7 +178,7 @@
prop: "taxInclusiveTotalPrice",
width: 200,
formatData: (cell) => {
- return cell ? parseFloat(cell).toFixed(2) : 0;
+ return cell ? truncate(parseFloat(cell), 3) : 0;
},
},
{
@@ -190,7 +191,7 @@
prop: "ticketsAmount",
width: 200,
formatData: (cell) => {
- return cell ? parseFloat(cell).toFixed(2) : 0;
+ return cell ? truncate(parseFloat(cell), 3) : 0;
},
},
{
@@ -198,7 +199,7 @@
prop: "unTicketsPrice",
width: 200,
formatData: (cell) => {
- return cell ? parseFloat(cell).toFixed(2) : 0;
+ return cell ? truncate(parseFloat(cell), 3) : 0;
},
},
{
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 92cfd76..575b6e7 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -490,7 +490,7 @@
<el-form-item label="鍚◣鍗曚环(鍏�)锛�" prop="taxInclusiveUnitPrice">
<el-input-number
v-model="productForm.taxInclusiveUnitPrice"
- :precision="2"
+ :precision="3"
:step="0.1"
clearable
style="width: 100%"
@@ -503,7 +503,7 @@
<el-input-number
:step="0.1"
clearable
- :precision="2"
+ :precision="3"
style="width: 100%"
v-model="productForm.quantity"
placeholder="璇疯緭鍏�"
@@ -517,7 +517,7 @@
<el-form-item label="鍚◣鎬讳环(鍏�)锛�" prop="taxInclusiveTotalPrice">
<el-input-number
v-model="productForm.taxInclusiveTotalPrice"
- :precision="2"
+ :precision="3"
:step="0.1"
clearable
style="width: 100%"
@@ -554,7 +554,7 @@
<el-form-item label="搴撳瓨棰勮鏁伴噺锛�" prop="warnNum">
<el-input-number
v-model="productForm.warnNum"
- :precision="2"
+ :precision="3"
:step="0.1"
clearable
style="width: 100%"
@@ -638,7 +638,7 @@
<el-form-item label="鍚堝悓閲戦(鍏�)锛�" prop="contractAmount">
<el-input-number
v-model="scanAddForm.contractAmount"
- :precision="2"
+ :precision="3"
:step="0.1"
clearable
style="width: 100%"
@@ -822,7 +822,7 @@
import useUserStore from "@/store/modules/user";
import { modelList, productTreeList } from "@/api/basicData/product.js";
import dayjs from "dayjs";
-import { getCurrentDate } from "@/utils/index.js";
+import { getCurrentDate, truncate } from "@/utils/index.js";
const userStore = useUserStore();
@@ -930,7 +930,7 @@
};
const formattedNumber = (row, column, cellValue) => {
- return parseFloat(cellValue).toFixed(2);
+ return truncate(parseFloat(cellValue), 3);
};
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -1340,16 +1340,18 @@
}
// 鍚◣鎬讳环璁$畻
productForm.value.taxInclusiveTotalPrice =
- proxy.calculateTaxIncludeTotalPrice(
- productForm.value.taxInclusiveUnitPrice,
- productForm.value.quantity
+ truncate(
+ Number(productForm.value.taxInclusiveUnitPrice) * Number(productForm.value.quantity),
+ 3
);
if (productForm.value.taxRate) {
// 涓嶅惈绋庢�讳环璁$畻
+ const taxRate = Number(productForm.value.taxRate);
+ const taxRateDecimal = taxRate / 100;
productForm.value.taxExclusiveTotalPrice =
- proxy.calculateTaxExclusiveTotalPrice(
- productForm.value.taxInclusiveTotalPrice,
- productForm.value.taxRate
+ truncate(
+ Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRateDecimal),
+ 3
);
}
};
@@ -1364,29 +1366,29 @@
// 宸茬煡鍚◣鎬讳环鍜屾暟閲忥紝鍙嶇畻鍚◣鍗曚环
if (productForm.value.quantity) {
productForm.value.taxInclusiveUnitPrice =
- (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
+ truncate(Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity), 3);
}
// 宸茬煡鍚◣鎬讳环鍜屽惈绋庡崟浠凤紝鍙嶇畻鏁伴噺
else if (productForm.value.taxInclusiveUnitPrice) {
productForm.value.quantity =
- (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
+ truncate(Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice), 3);
}
// 鍙嶇畻涓嶅惈绋庢�讳环
productForm.value.taxExclusiveTotalPrice =
- (Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRate / 100)).toFixed(2);
+ truncate(Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRate / 100), 3);
} else if (field === 'taxExclusiveTotalPrice') {
// 鍙嶇畻鍚◣鎬讳环
productForm.value.taxInclusiveTotalPrice =
- (Number(productForm.value.taxExclusiveTotalPrice) * (1 + taxRate / 100)).toFixed(2);
+ truncate(Number(productForm.value.taxExclusiveTotalPrice) * (1 + taxRate / 100), 3);
// 宸茬煡鏁伴噺锛屽弽绠楀惈绋庡崟浠�
if (productForm.value.quantity) {
productForm.value.taxInclusiveUnitPrice =
- (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
+ truncate(Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity), 3);
}
// 宸茬煡鍚◣鍗曚环锛屽弽绠楁暟閲�
else if (productForm.value.taxInclusiveUnitPrice) {
productForm.value.quantity =
- (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
+ truncate(Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice), 3);
}
}
};
--
Gitblit v1.9.3