feat: 增加点歌配置列表页面,修复转桌报错导致页面无反应问题,去除添加耗材的库存数量以及弹窗关闭表单重置失败问题

This commit is contained in:
2025-03-17 10:55:01 +08:00
parent 6a37b53c8c
commit ed25a9c5e6
10 changed files with 451 additions and 13 deletions

View File

@@ -441,3 +441,15 @@ export function swapArrayEle(arr, i1, i2) {
arr[i1] = arr.splice(i2, 1, arr[i1])[0];
return arr;
}
// 价格保留两位小数不四舍五入
export function customTruncateToTwoDecimals(number) {
let stringNumber = number.toString();
let dotIndex = stringNumber.indexOf(".");
if (dotIndex === -1) {
return number; // 如果没有小数点,直接返回原数
} else {
let integerPart = stringNumber.substring(0, dotIndex); // 整数部分
let decimalPart = stringNumber.substring(dotIndex + 1, dotIndex + 3); // 小数部分,取两位
return parseFloat(integerPart + "." + decimalPart); // 重新组合并返回
}
}