fix: billing total display now consistently uses 2 decimals, floor 0.01 for tiny positive amounts\n\n- Previous 6-decimal fallback caused visual inconsistency with list (shows 0.01)\n- Now: raw>0 and toFixed(2)>0 -> normal 2-decimal display\n- Now: raw>0 but toFixed(2)==0 -> floor to 0.01 (minimum visible unit)\n- Matches list column display format, no more '= 0.000125' in detail
This commit is contained in:
parent
4d5dd30668
commit
a9d2fc2abe
|
|
@ -1504,16 +1504,14 @@ function formatBillingDisplayPrice(usdAmount, rate, digits = 2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计费过程总额专用格式化:正常金额保持 2 位小数;极小金额(< 0.005)自动提升至 6 位小数,
|
* 计费过程总额专用格式化:始终保留 2 位小数与列表显示一致;
|
||||||
* 避免因 toFixed(2) 归零导致「计费过程」显示为 0。
|
* 正数金额经 toFixed(2) 归零时保底为 0.01,避免「= $0」但列表却有花费的不一致。
|
||||||
*/
|
*/
|
||||||
function formatBillingTotalDisplay(usdAmount, rate) {
|
function formatBillingTotalDisplay(usdAmount, rate) {
|
||||||
const raw = usdAmount * rate;
|
const raw = usdAmount * rate;
|
||||||
if (raw <= 0) return 0;
|
if (raw <= 0) return 0;
|
||||||
const fixed2 = Number(raw.toFixed(2));
|
const fixed2 = Number(raw.toFixed(2));
|
||||||
if (fixed2 > 0) return fixed2;
|
return fixed2 > 0 ? fixed2 : 0.01;
|
||||||
const fixed6 = Number(raw.toFixed(6));
|
|
||||||
return fixed6 > 0 ? fixed6 : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildBillingText(key, vars) {
|
function buildBillingText(key, vars) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue