1
This commit is contained in:
1 parent
198d688cec
commit
e7e59c9f56
1 file changed
+2
-2
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user