// //保留三位小数 或两位小数
export const forMatMoney=(num,type)=> {
var result = parseFloat(num);
if (isNaN(result)) {
console.log('传递参数错误,请检查!');
return false;
}
result = Math.round(num * 100) / 100;
var s_x = result.toString();
var pos_decimal = s_x.indexOf('.');
if (pos_decimal < 0) {
pos_decimal = s_x.length;
s_x += '.';
}
if(type == 'capacity') {
while (s_x.length <= pos_decimal + 3) {
s_x += '0';
}
}else {
while (s_x.length <= pos_decimal + 2) {
s_x += '0';
}
}
return s_x;
}
// //保留三位小数 或两位小数
export const forMatMoney = (num, type) => {
let count = (type == 'capacity' ? 3 : 2)
if (Number(num) > 0){
return Number(num).toFixed(count)
}else{
retur