1.交班新增选择是否打印商品销售数据

This commit is contained in:
gyq
2024-07-23 10:25:20 +08:00
parent a282636266
commit d2183eec37
16 changed files with 412 additions and 400 deletions

View File

@@ -40,9 +40,10 @@ export function clearNoNum(obj) {
* 保留小数n位不进行四舍五入
* num你传递过来的数字,
* decimal你保留的几位,默认保留小数后两位
* isInt 是否保留0
*/
export function formatDecimal(num, decimal = 2) {
num = num.toString();
export function formatDecimal(num, decimal = 2, isInt = false) {
num = num.toFixed(3).toString();
const index = num.indexOf(".");
if (index !== -1) {
num = num.substring(0, decimal + index + 1);
@@ -50,5 +51,9 @@ export function formatDecimal(num, decimal = 2) {
num = num.substring(0);
}
//截取后保留两位小数
return parseFloat(num).toFixed(decimal);
if (isInt) {
return parseFloat(num);
} else {
return parseFloat(num).toFixed(decimal);
}
}