WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2025-01-22 4308e0bbe4e9e108ad4573accaad334555b459be
common/Tools.js
@@ -461,7 +461,7 @@
    /**
     * 数值转换为千分位格式
     * @param {Number|String} number - 传入的值
     * @param {String} decimalFormat - 处理小数的方式  - notRetain(不保留小数,没有小数时才生效),keepTwo(保留两位小数),keepThree(保留三位小数)
     * @param {String} decimalFormat - 处理小数的方式  - notRetain(不保留小数,有小数时也会去掉小数位),keepTwo(保留两位小数),keepThree(保留三位小数)
     * @return {string}
     */
    static thousandFormat(number, decimalFormat = 'keepTwo') {
@@ -477,9 +477,7 @@
        // 没有小数位
        if (!(num.indexOf('.') > -1)) {
            needThousand = num.toString();
            if (decimalFormat === 'notRetain') {
                decimals = '';
            } else if (decimalFormat === 'keepTwo') {
            if (decimalFormat === 'keepTwo') {
                decimals = '00';
            } else if (decimalFormat === 'keepThree') {
                decimals = '000';
@@ -506,7 +504,9 @@
            let temp = '';
            // 对整数取余
            let remainder = len % 3;
            decimals ? (temp = '.' + decimals) : temp;
            if (decimals) {
                temp = '.' + decimals;
            }
            if (remainder > 0) {
                // 不是3的整数倍
                return (