From e7e59c9f560de33489bfd84505c3d9a023b7402a Mon Sep 17 00:00:00 2001 From: weiwei Date: Thu, 6 Mar 2025 19:44:16 +0800 Subject: [PATCH] 1 --- src/utils/formatMoney.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/formatMoney.ts b/src/utils/formatMoney.ts index b9ee379..4615c6d 100644 --- a/src/utils/formatMoney.ts +++ b/src/utils/formatMoney.ts @@ -3,8 +3,8 @@ * @param price * @returns */ -export function displayPrice(price: any, suffix: string = "元", fixed = 1) { - if (typeof price === "undefined") return "0.0" + suffix +export function displayPrice(price: any, suffix: string = "元", fixed = 2) { + if (typeof price === "undefined") return "0.00" + suffix const parsedNumber = typeof price === "string" ? parseFloat(price) : price return (parsedNumber / 100.0).toFixed(fixed) + suffix }