feat:充值记录、更新余额

This commit is contained in:
dzc committed 2024-12-30 20:07:42 +08:00
1 parent 8e12194caf
commit 6925cf0eca
7 files changed
+339 -129

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
export const convertToInteger = (num: number | string | undefined): number => {
if (typeof num === 'undefined') return 0
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
return Math.round(parsedNumber * 100)
}
+10
View File
@@ -0,0 +1,10 @@
/**
* 显示价格把分转换到元
* @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
}