7/24 收银台 日期筛选,合计

This commit is contained in:
Zy
2026-07-24 09:23:50 +08:00
parent 0c4c9676b5
commit 903c92fef0
8 changed files with 143 additions and 219 deletions

View File

@@ -87,7 +87,7 @@ export function convertToChineseCapital(num: number | string): string {
* 标准化为Big实例空/undefined/null转0
* @param num 数字 | 数字字符串
*/
function toBig(num: string | number | undefined | null): Big {
export function toBig(num: string | number | undefined | null): Big {
if (num === null || num === undefined || num === '') return new Big(0);
return new Big(num);
}
@@ -112,6 +112,12 @@ export function maxMoney(a: string | number, b: string | number): number {
const bigB = toBig(b);
return Number(bigA.gt(bigB) ? bigA : bigB);
}
// 取较小值
export function minMoney(a: string | number, b: string | number): number {
const bigA = toBig(a);
const bigB = toBig(b);
return Number(bigA.lt(bigB) ? bigA : bigB);
}
/**
* 减法 a - b
*/
@@ -119,6 +125,12 @@ export function sub(a: string | number, b: string | number): number {
return Number(toBig(a).minus(toBig(b)));
}
/**
* 加法 a + b
*/
export function add(a: string | number, b: string | number): number {
return Number(toBig(a).plus(toBig(b)));
}
/**
* 乘法 a * b
*/