let price = e.detail.value;
price = price.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
price = price.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
price = price.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
price = price.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
var reg = new RegExp("([0]*)([1-9]+[0-9]+)", "g");
price = price.replace(reg, "$2")
if(price[0] == 0 && price[2] == '.') {
price = price.substr(1,price.length);
}
if(price[0] == '.') {
price = '0' + price
}