mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 05:09:19 +08:00
fix: 统一盈亏字段精度为 2 位小数;修复 sub_plan_pricing.status 拼写错误
- CompanyOverviewServiceImpl / CategoryExportExcelServiceImpl / ExportServiceImpl / ShopOverviewStatisticsServiceImpl / ProductOverviewServiceImpl:所有 profitAfterTax / netProfit 等盈亏字段统一 setScale(2, RoundingMode.HALF_UP),避免 JSON 序列化时出现过多小数位 - sub_design.sql:stauts → status 拼写修正 - 前端:品类/商品排行榜/概览卡片等表格 feeRatio / roi 等数值精度统一展示处理
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 店铺概览:按接口返回数值原样展示(千分位),不在前端二次定标小数位。
|
||||
*/
|
||||
export function formatCurrencyZhFromApi(amount: number): string {
|
||||
const n = Number(amount);
|
||||
if (!Number.isFinite(n)) return '-';
|
||||
return `¥${n.toLocaleString('zh-CN', { maximumFractionDigits: 20 })}`;
|
||||
}
|
||||
|
||||
export function formatCurrencyZhFromApiOptional(
|
||||
amount: number | null | undefined,
|
||||
): string {
|
||||
if (amount === undefined || amount === null) return '-';
|
||||
return formatCurrencyZhFromApi(amount);
|
||||
}
|
||||
|
||||
export function formatNumberZhFromApi(value: number): string {
|
||||
const n = Number(value);
|
||||
if (!Number.isFinite(n)) return '-';
|
||||
return n.toLocaleString('zh-CN', { maximumFractionDigits: 20 });
|
||||
}
|
||||
|
||||
export function formatNumberZhFromApiOptional(
|
||||
value: number | null | undefined,
|
||||
): string {
|
||||
if (value === undefined || value === null) return '-';
|
||||
return formatNumberZhFromApi(value);
|
||||
}
|
||||
Reference in New Issue
Block a user