fix:硬件管理

This commit is contained in:
dzc committed 2025-01-11 15:53:42 +08:00
1 parent 5f757796c8
commit 087d49c6ac
7 files changed
+654 -604

No files matched your search

+11 -11
View File
@@ -1,21 +1,21 @@
/**
* 显示价格把分转换到元
* @param price
* @returns
* @param price
* @returns
*/
export function displayPrice(price: any, suffix: string = "元") {
if (typeof price === 'undefined') return '0.0' + suffix
const parsedNumber = typeof price === 'string' ? parseFloat(price) : price
return (parsedNumber / 100.0).toFixed(1) + suffix
export function displayPrice(price: any, suffix: string = "元", fixed = 1) {
if (typeof price === "undefined") return "0.0" + suffix
const parsedNumber = typeof price === "string" ? parseFloat(price) : price
return (parsedNumber / 100.0).toFixed(fixed) + suffix
}
/**
* 把显示价格改为分
* @param price
* @returns
* @param price
* @returns
*/
export const storePrice = (num: number | string | undefined) => {
if (typeof num === 'undefined') return 0
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
if (typeof num === "undefined") return 0
const parsedNumber = typeof num === "string" ? parseFloat(num) : num
return Math.round(parsedNumber * 100)
}
}