fix(api-keys): trim trailing zeros from budget amounts

Display budget amounts with up to two decimal places without padding
trailing zeros. Keep exact amounts in the details popover and preserve
accounting precision.

Validation: frontend lint/type checks/build and browser checks passed.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Zyy
2026-09-11 16:08:20 +08:00
co-authored by Codex
parent 66fd09eba6
commit 73487fd98b
@@ -10,8 +10,8 @@ const windows = computed(() => [
{ label: '周', heading: '周用量', used: props.apiKey.weeklyUsedUsd, limit: props.apiKey.weeklyLimitUsd, reset: props.apiKey.weeklyResetsAt },
])
function amount(value: string) {
// 列表显示两位小数,明细直接使用原始字符串,保留全部金额精度。
return Number(value).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
// 列表最多显示两位小数,不补末尾零;明细保留原始金额的全部精度。
return Number(value).toLocaleString('en-US', { maximumFractionDigits: 2 })
}
</script>