修改价格格式
This commit is contained in:
@ -74,6 +74,11 @@ export const formatPrice = (price, show = true) => {
|
||||
const fixedNum = num.toFixed(4);
|
||||
const [integer, decimal] = fixedNum.split('.');
|
||||
|
||||
// 检查小数部分是否为0
|
||||
if (decimal === '0000') {
|
||||
return `${integer}.00`;
|
||||
}
|
||||
|
||||
// 千分位处理
|
||||
const formattedInteger = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user