优化提交正则验证

master
chenzhi 5 years ago
parent d73ff68984
commit dddadecf31

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

Loading…
Cancel
Save