峰峰执法平台简易案件程序板块 pad端
Two
yang
2022-10-26 9b964f286f78aa75b2b1badb6361c63bdd95e545
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const rounding = (value) => {
  console.log(value,'value====')
  if(value || value == 0) {
    let num = parseFloat(value).toFixed(2)
    //数字千位分隔符号
    let str = num.toString()
    //没有小数点时,在末尾补上一个小数点
    if(str.indexOf('.') === -1) {
      str += '.'
    }
    return str.replace(/(\d)(?=(\d{3})+\.)/g, '$1,').replace(/\.$/, '')
  }else {
    return ''
  }
}
 
export {rounding}