UI优化,红包领取后缺少头像,名称字段

This commit is contained in:
bobobobo
2026-01-19 23:30:08 +08:00
parent d2a22b9419
commit 651d20b909
41 changed files with 2189 additions and 1827 deletions

View File

@@ -29,3 +29,20 @@ export const formatRMB = amount => {
return `${formattedInteger}.${decimal}`
}
/** 积分格式化 */
export const formatNumberWithWan = num => {
if (num < 10000) {
return num.toString()
}
// 保留小数:根据需求可调整 toFixed 的位数
let wan = num / 10000
// 如果是整数万,不显示小数;否则保留两位小数(或你想要的位数)
if (wan % 1 === 0) {
return wan + '万'
} else {
return wan.toFixed(2).replace(/\.?0+$/, '') + '万' // 去掉不必要的尾随零
}
}