export const numberFormat = (value)=> {
var param = {};
var k = 10000,
sizes = ['', '万', '亿', '万亿'],
i;
if(value < k){
param.value =value
param.unit=''
}else{
i = Math.floor(Math.log(value) / Math.log(k));
param.value = ((value / Math.pow(k, i))).toFixed(2);
param.unit = sizes[i];
}
return param;
}
export const keepTwoDecimalFull = (num) => {
if (num > 10000) {
let result = num / 10000;
result = Math.floor(result * 100) / 100;
var s_x = result.toString();
var pos_decimal = s_x.indexOf('.');
if (pos_decimal < 0) {
pos_decimal = s_x.length;
s_x += '.';
}
while (s_x.length <= pos_decimal + 2) {
s_x += '0';
}
s_x += '万';
} else {
s_x = num;
}
return s_x
}