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/invoiceEntry/components/Modal.vue | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
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) => {
--
Gitblit v1.9.3