Commit c184c4c1 authored by youjie's avatar youjie

no message

parent 658d0221
......@@ -319,7 +319,7 @@ export function moneyFormat (num:any, decimal = 2, split = ','):any {
var res = ''
var dotIndex = String(num).indexOf('.')
if (dotIndex === -1) { // 整数
res = thousandFormat(String(num)) + '.' + '0'.repeat(decimal)
res = thousandFormat(String(num)) + '.' + '0'.repeat(decimal)
} else {
const numStr = String((Math.round(num * Math.pow(10, decimal)) / Math.pow(10, decimal)).toFixed(decimal)) // 四舍五入,然后固定保留2位小数
const decimals = numStr.slice(dotIndex, dotIndex + decimal + 1) // 截取小数位
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment