Files
ecom-dmb/ecom-dmb-frontend/apps/web-antd/src/utils/overview-fee-ratio.ts
T

11 lines
442 B
TypeScript

/**
* 店铺/工作台接口:费比 feeRatio / averageFeeRatio 为小数(推广费÷销售额,如 0.05 = 5%)。
* 达成率等字段后端已为 0–100 的数值,勿用本函数。
*/
export function formatFeeRatioPercent(value: number | undefined | null): string {
if (value === undefined || value === null) return '-';
const n = Number(value);
if (!Number.isFinite(n)) return '-';
return `${(n * 100).toFixed(1)}%`;
}