function formatMoney (num, option = {}) {
option = {
decimals: 5,
padEnd: false,
delimiter: ',',
...option
}
if (isNaN(num)) return num
let numArr = (num + '').split('.')
if (option.decimals) {
if (numArr.length > 0) {
num = Math.round(num * Math.pow(10,option.decimals)) / Math.pow(10,option.decimals)
numArr = (num + '').split('.')
}
numArr[1] = (numArr[1] || '')
if (option.padEnd) numArr[1] = numArr[1].toString().padEnd(option.decimals, '0')
}
let intVal = numArr[0].replace(/(\d{1,3})(?=(\d{3})+)/g,`$1${option.delimiter}`)
let floatVal = numArr[1] ? `.${numArr[1]}` : '.00'
if(floatVal.length==2){
floatVal = floatVal+'0'
}
return intVal + floatVal
}