修改价格格式

This commit is contained in:
ljx
2025-09-15 18:04:57 +08:00
parent 958b15a355
commit 4057a78368
2 changed files with 6 additions and 1 deletions

View File

@ -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'
# 曾涛

View File

@ -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, ',');