function setThousandsMarkNoDecimal(num) {if (!num) return num;let fu = false;if (num.toString().includes('-')) {fu = true;num = Number(num.toString().substr(1));}num = num.toFixed(2); let str = num.toString(); let str2 = null;if (str.indexOf('.') !== -1) {const strArr = str.split('.'); str = strArr[0]; str2 = strArr[1]; }let result = ''; while (str.length > 3) {result = ',' + str.slice(str.length - 3, str.length) + result;str = str.slice(0, str.length - 3); }if (str.length <= 3 && str.length > 0) {result = str + result;}str2 ? (result = result + '.' + str2) : '';result = fu ? '-' + result : result;return result || 0;
}
const reserveFloat = (x) => {x = x.replace(/[^\d.]/g, ''); x = x.replace(/^\./g, ''); x = x.replace(/\.{2,}/g, '.'); x = x.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.');x = x.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); var s = x.toString().split('.');if (s.length == 1) {x = x.toString() + '.00';return x;}if (s.length > 1) {if (s[1].length < 2) {x = x.toString() + '0';}return x;}return x;
};
export const numSetThousadMark = (num, zeroFiexd, unit) => {let str = '';if (!unit) {unit = '';}if (isRealNum(num)) {if (zeroFiexd === 2) {if (+num == 0) {str = '0.00' + unit;} else if (+num > 0) {str = setThousandsMark(reserveFloat(num.toString())) + unit;} else if (+num < 0) {str = '-' + setThousandsMark(clearFuhao(reserveFloat(num.toString()))) + unit;}} else {if (+num === 0) {str = '0' + unit;} else if (+num > 0) {str = setThousandsMark(num.toString()) + unit;} else if (+num < 0) {str = '-' + setThousandsMark(clearFuhao(num.toString())) + unit;}}}return str;
};