/*
 * @Date: 2023-05-08 21:49:41
 * @LastEditors: 陈禹琨 chenyukun@prolog-int.com
 * @LastEditTime: 2024-03-06 13:41:12
 * @FilePath: /upcloud-wms-qingniu-web/src/views/kzyWMS/inBound/config/utils.js
 * @Description: cyk
 */
export function formatNumZero(p1) {
    var leng = p1.length - p1.indexOf(".") - 1
    if (p1.indexOf(".") > -1) {
        for (let i = leng; i > 0; i--) {
            //如果p1末尾有0
            if (p1.lastIndexOf("0") > -1 && p1.substr(p1.length - 1, 1) == 0) {
                var k = p1.lastIndexOf("0");
                //如果小数点后只有一个0 去掉小数点
                if (p1.charAt(k - 1) == ".") {
                    return p1.substring(0, k - 1);
                } else {
                    //否则 去掉一个0
                    p1 = p1.substring(0, k);
                }
            } else {
                //如果末尾没有0
                return p1;
            }
        }
    }
    return p1;
}
