修改价格格式
This commit is contained in:
@ -7,7 +7,7 @@ VITE_APP_ENV = 'development'
|
||||
# 开发环境
|
||||
# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
|
||||
# 李陈杰 209
|
||||
VITE_APP_BASE_API = 'http://192.168.110.180:8899'
|
||||
# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
|
||||
# 李陈杰 209
|
||||
# VITE_APP_BASE_API = 'http://192.168.110.209:8899'
|
||||
# 曾涛
|
||||
|
||||
@ -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