fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 3m13s
Docker Build & Deploy / Deploy to Production (push) Successful in 8s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

This commit is contained in:
SunCheng
2026-02-19 11:04:05 +08:00
parent 6ca00c1478
commit 3402ffaae2
9 changed files with 233 additions and 34 deletions

View File

@@ -1,14 +1,15 @@
/**
* 格式化金额
* @param {number} value 金额数值
* @param {number} decimals 小数位数
* @returns {string} 格式化后的金额字符串
*/
export const formatMoney = (value) => {
export const formatMoney = (value, decimals = 1) => {
if (!value && value !== 0) {
return '0'
return Number(0).toFixed(decimals)
}
return Number(value)
.toFixed(0)
.toFixed(decimals)
.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}