This commit is contained in:
weiwei committed 2025-03-06 19:44:16 +08:00
1 parent 198d688cec
commit e7e59c9f56
1 file changed
+2 -2
+2 -2
View File
@@ -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
}