优化提交正则验证

master
chenzhi 5 years ago
parent d73ff68984
commit dddadecf31

@ -498,20 +498,35 @@
var btnpay = false;
$("#wfsubmit").click(function(){
if (btnpay == true) return ;
var isok = true;
//名字
if(Check.trim($("#custName").val()) == ''){
isok = false;
Tip.msgShow('名字不能为空');
return ;
}
if(!Check.bankcardCheck($("#cardNo").val())){
isok = false;
return;
}
if(!Check.idcardCheck($("#idNo").val())){
isok = false;
return;
}
if(!Check.mobileCheck($("#phoneNo").val())){
isok = false;
return;
}
if(!Check.codeCheck($("#smsCode").val())){
isok = false;
return;
}
if(!Check.bankcardCheck($("#cardNo").val())) isok = false;
if(!Check.idcardCheck($("#idNo").val())) isok = false;
if(!Check.mobileCheck($("#phoneNo").val())) isok = false;
if(!Check.codeCheck($("#smsCode").val())) isok = false;
if(isok){
btnpay = true;
$("#wfform").submit();
Tip.loadShow();
}
})
@ -604,11 +619,12 @@
},
codeCheck(code){
code = Check.trim(code);
if(!(/^[0-9]{6}$)/.test(code))){
console.log(code);
if(!(/^\d{6}$/.test(code))){
Tip.msgShow("验证码格式错误应为6位数字");
return false;
}
return idcard;
return code;
}
};

Loading…
Cancel
Save