This commit is contained in:
Teo
2025-09-10 01:20:22 +08:00
94 changed files with 5317 additions and 950 deletions

View File

@ -62,7 +62,23 @@ export const addDateRange = (params: any, dateRange: any[], propName?: string) =
}
return search;
};
// 价格格式化函数
export const formatPrice = (price, show = true) => {
if ((!show && price == 0) || price == '' || price == undefined || price == null) return '';
if (!price && price !== 0) return '0.0000';
// 转换为数字并保留四位小数
const num = Number(price);
if (isNaN(num)) return '0.0000';
const fixedNum = num.toFixed(4);
const [integer, decimal] = fixedNum.split('.');
// 千分位处理
const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return `${formattedInteger}.${decimal}`;
};
// 回显数据字典
export const selectDictLabel = (datas: any, value: number | string) => {
if (value === undefined) {