// 隐藏手机号function hideMobile(phone) { return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');}/* 处理支付只能输入两位小数* add by Jack on 20180525* @param value*/handlePayAmount(value) { if (/^\d*?\.?\d{0,2}?$/gi.test(value)) { if (/^0+[1-9]+/.test(value)) { value = value.replace(/^0+/, ""); } if (/^0{2}\./.test(value)) { value = value.replace(/^0+/, "0"); } value = value.replace(/^\./gi, "0."); // if (parseFloat(value) > 200) { // value = "200.00"; // } return value; }}function handlePayAmount(value) { value = String(value); let indexOfDot = value.indexOf("."); if (indexOfDot == -1) { value = value * 1;// 去除前面多余的 0 } else { let str_ = value.substr(indexOfDot + 1); //限制只能输入一个小数点 if (str_.indexOf(".") != -1) { value = value.substr(0, indexOfDot + str_.indexOf(".") + 1); } if (indexOfDot == 0) { value = "0" + value; } value = value.substr(0, indexOfDot + 3);// 只能输入两位小数 // TODO 去除前面多余的 0 if (value > 0 && value.length > (indexOfDot+1)) { value = value * 1; } } return value || '';}