优化正则提交

master
chenzhi 5 years ago
parent a3fa839e96
commit 453201539e

@ -169,6 +169,153 @@
} }
</style> </style>
<body>
<!--加载提示框-->
<div class="js_dialog" id="Dialog" style="display: none">
<div class="weui-mask"></div>
<div class="weui-dialog" style="width: 4.5rem;max-width: 4.5rem;display: flex;flex-direction:column;padding-bottom: .3rem;">
<div id="close_doalog" style="width: 100%;text-align: left;height: .6rem;display: flex;">
<img src="__IMG__/close-black.png" style="width: .3rem;height: .3rem;margin: .3rem 0 0 .3rem;">
</div>
<div style="width: 100%;text-align: center;">
<img src="__IMG__/load.gif" style="width:2.18rem;height:2.04rem;">
</div>
<p style="text-align: center;font-size: .24rem;margin:auto;line-height: 1.5;color:#292929;margin-top: -.5rem;">
支付结果将在两分钟内反馈<br/>请稍后在游戏内查看
</p>
<div style="width: 100%;text-align: center;display: flex;justify-content:center;margin-top:.5rem;">
<div style="width: 3.3rem;height: .6rem;background-color: #21B1EB;color: #ffffff;font-size: .28rem;border-radius:30px;line-height: .6rem;">
返回游戏
</div>
</div>
</div>
</div>
<!--提醒信息弹窗-->
<div class="js_dialog" id="msgdialog" style="display: none">
<div class="weui-mask"></div>
<div class="weui-dialog" style="width: 4.5rem;max-width: 4.5rrem;display: flex;flex-direction:column;padding-bottom: .3rem;">
<div id="close_tip" style="width: 100%;text-align: left;height: .6rem;display: flex;">
<img src="__IMG__/close-black.png" style="width: .3rem;height: .3rem;margin: .3rem 0 0 .3rem;">
</div>
<div style="width: 100%;text-align: center;">
<img src="__IMG__/txicon.png" style="width: 2.44rem;height: 1.46rem;">
</div>
<p id="tipmsg" style="text-align: center;font-size: .24rem;margin: .35rem auto;">
提示内容提示内容
</p>
<div style="width: 100%;text-align: center;display: flex;justify-content:center;">
<div id="tipok" style="width: 3.3rem;height: .6rem;background-color: #21B1EB;color: #ffffff;font-size: .28rem;border-radius:30px;line-height: .6rem;">
确认
</div>
</div>
</div>
</div>
<!--签约提示弹窗-->
<div class="js_dialog" id="bankdialog" style="display: none;">
<div class="weui-mask"></div>
<div class="weui-dialog" style="width: 6.3rem;max-width: 6.3rem;display: flex;flex-direction:column;padding-bottom: .3rem;">
<div id="" style="width: 100%;text-align: left;height: .6rem;display: flex;">
<img id="close_img" src="__IMG__/close-black.png" style="width: .3rem;height: .3rem;margin: .3rem 0 0 .3rem;">
<div style="font-size: .28rem;margin-top: .3rem; flex-grow:1;text-align: center;">银行卡签约</div>
</div>
<div style="margin:.3rem .3rem;text-align: left;">
<p style="font-size: .24rem;color:#A9A9A9; line-height: 1.2;">该银行卡未签约,无法进行充值,请获取短信验证进行签约</p>
<p style="font-size: .24rem;color:#292929;margin-top: .3rem;">手机:<span id="sign_mibile" style="margin-left:10px;"></span></p>
</div>
<div class="weui-cell weui-cell_vcode dialogcodebtn">
<div class="weui-cell__bd">
<input id="sign_code" class="weui-input" type="number" placeholder="请输入验证码">
</div>
<div class="weui-cell__ft ">
<a id="sign_sms" onclick="getSignSms()" href="javascript:;" class="weui-btn" style="width: 1.5rem;font-size: .24rem;background-color: #21B1EB;color: #fff;border-radius: .1rem;height: .5rem;line-height:.5rem;">获取验证码</a>
</div>
</div>
<div id="close" style="width: 100%;text-align: center;display: flex;justify-content:center;margin-top: .3rem;">
<div onclick="signcontract();" id="sign_contract" style="width: 5.3rem;height: .6rem;background-color: #21B1EB;color: #ffffff;font-size: .28rem;border-radius:5px;line-height: .6rem;">
确认
</div>
</div>
</div>
</div>
<div
style="height: 3.1rem;background-color: #21B1EB;color: #fff;border-bottom-left-radius:30%;border-bottom-right-radius:30%;padding: .43rem .3rem .6rem;line-height: 1.5;">
<p style="font-size: .4rem;">待支付……</p>
<p style="font-size: .24rem;margin-top:.3rem;">订单超过30分钟自动取消请在20分钟18秒内完成支付</p>
<p style="font-size: .24rem;">支付结果将在两分钟内反馈,请稍后在游戏内查看</p>
</div>
<form id="wfform" name="wfform" method="post" action="{:U('WapPay/shortcut_pay')}" target="_parent" >
<input type="hidden" id="wfddll" name="wfddll" value="wfddll" />
<input type="hidden" name="user_id" id="user_id" value="{$user_id}" />
<input type="hidden" name="game_id" id="game_id" value="{$game_id}" />
<div class="paypage">
<div class="weui-cells weui-cells_form" style="padding: .3rem 0 0;">
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">姓名:</label></div>
<div class="weui-cell__bd">
<input id="custName" name="custName" class="weui-input" type="text">
</div>
<div class="redtxt weui-cell__ft">
*
</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">银行卡号:</label></div>
<div class="weui-cell__bd">
<input id="cardNo" name="cardNo" class="weui-input" type="text">
</div>
<div class="redtxt weui-cell__ft">
*
</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">身份证号:</label></div>
<div class="weui-cell__bd">
<input id="idNo" name="idNo" class="weui-input" type="text">
</div>
<div class="redtxt weui-cell__ft">
*
</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">手机号:</label></div>
<div class="weui-cell__bd">
<input id="phoneNo" name="phoneNo" class="weui-input" type="text">
</div>
<div class="redtxt weui-cell__ft">
*
</div>
</div>
<div class="weui-cell weui-cell_vcode">
<div class="weui-cell__hd"><label class="weui-label">验证码:</label></div>
<div class="weui-cell__bd">
<input id="smsCode" name="smsCode" class="weui-input" type="number">
</div>
<div class="weui-cell__ft" style="margin-right: .24rem;margin-left:.3rem;">
<a id="sms" onclick="getSms()" href="javascript:;" class="weui-btn" style="font-size: .28rem;;background-color: #21B1EB;color: #fff;border-radius: .1rem;height: .6rem;line-height:.6rem;">获取验证码</a>
</div>
</div>
<div class="weui-cell paymoney" style="height:1.4rem;">
<div class="weui-cell__bd" >
<p style="font-size: .32rem;">支付金额:</p>
</div>
<div class="weui-cell__ft" style="font-size: .48rem;color: red;">{$pay_amount}</div>
</div>
</div>
</div>
<!-- -->
<div id="wfsubmit" style="border: 0;" class="weui-footer_fixed-bottom bottombutton">
立即提交订单
<!-- <input style="width: 100%;border: 0;margin: auto;position: absolute;top: 0;left: 0;opacity: 0;" onclick="return sendform()" type="submit" id="wfsubmit" name="wfsubmit" class="bottombutton"/> -->
</div>
</form>
</body>
<script type="text/javascript"> <script type="text/javascript">
var validCode=true; var validCode=true;
var smsstatus = true; var smsstatus = true;
@ -350,26 +497,25 @@ function getSignSms() {
} }
var btnpay = false; var btnpay = false;
function sendform() { $("#wfsubmit").click(function(){
if (btnpay == true) return ; if (btnpay == true) return ;
var isok = true;
btnpay = true; //名字
var isok = false; if(Check.trim($("#custName").val()) == ''){
isok = false;
if ($("#custName").val() != '' && $("#idNo").val() != '' && $("#phoneNo").val() != '' && $("#smsCode").val() != '') Tip.msgShow('名字不能为空');
isok = true; }
if (!isok) { if(!Check.bankcardCheck($("#cardNo").val())) isok = false;
btnpay = false; if(!Check.idcardCheck($("#idNo").val())) isok = false;
$("#tipmsg").html('参数不能为空'); if(!Check.mobileCheck($("#phoneNo").val())) isok = false;
$("#msgdialog").show(); if(!Check.codeCheck($("#smsCode").val())) isok = false;
// alert('参数不能为空');
}
if(isok){ if(isok){
$("#Dialog").show(); btnpay = true;
} $("#wfform").submit();
return isok;
} }
})
var tiptype = 0; var tiptype = 0;
$(function() { $(function() {
/* $("#close_tip").click(function() { /* $("#close_tip").click(function() {
@ -402,154 +548,70 @@ $(function() {
}) })
}); });
// // 提示类
var Tip = {
</script> showDom:false,
msgShow:function(str){
<body> //信息提示
<!--加载提示框--> Tip._hideShow();
<div class="js_dialog" id="Dialog" style="display: none"> $("#tipmsg").html(str);
<div class="weui-mask"></div> $("#msgdialog").show();
<div class="weui-dialog" style="width: 4.5rem;max-width: 4.5rem;display: flex;flex-direction:column;padding-bottom: .3rem;"> Tip.showDom = $("#msgdialog");
<div id="close_doalog" style="width: 100%;text-align: left;height: .6rem;display: flex;"> },
<img src="__IMG__/close-black.png" style="width: .3rem;height: .3rem;margin: .3rem 0 0 .3rem;"> loadShow:function(){
</div> Tip._hideShow();
<div style="width: 100%;text-align: center;"> $("#Dialog").show();
<img src="__IMG__/load.gif" style="width:2.18rem;height:2.04rem;"> Tip.showDom = $("#Dialog");
</div> },
<p style="text-align: center;font-size: .24rem;margin:auto;line-height: 1.5;color:#292929;margin-top: -.5rem;"> tipHide(){
支付结果将在两分钟内反馈<br/>请稍后在游戏内查看 Tip._hideShow();
</p> },
<div style="width: 100%;text-align: center;display: flex;justify-content:center;margin-top:.5rem;"> _hideShow:function(){
<div style="width: 3.3rem;height: .6rem;background-color: #21B1EB;color: #ffffff;font-size: .28rem;border-radius:30px;line-height: .6rem;"> if(Tip.showDom){
返回游戏 Tip.showDom.hide();
</div> }
</div> }
</div> }
</div> //验证类
<!--提醒信息弹窗--> var Check={
<div class="js_dialog" id="msgdialog" style="display: none"> trim(val){
<div class="weui-mask"></div> //去除全部空白
<div class="weui-dialog" style="width: 4.5rem;max-width: 4.5rrem;display: flex;flex-direction:column;padding-bottom: .3rem;"> return val.replace(/\s+/g, "");
<div id="close_tip" style="width: 100%;text-align: left;height: .6rem;display: flex;"> },
<img src="__IMG__/close-black.png" style="width: .3rem;height: .3rem;margin: .3rem 0 0 .3rem;"> mobileCheck(mobile){
</div> mobile = Check.trim(mobile);
<div style="width: 100%;text-align: center;"> if(!(/^1[3456789]\d{9}$/.test(mobile))){
<img src="__IMG__/txicon.png" style="width: 2.44rem;height: 1.46rem;"> Tip.msgShow("手机号码有误,请重填");
</div> return false;
<p id="tipmsg" style="text-align: center;font-size: .24rem;margin: .35rem auto;"> }
提示内容提示内容 return mobile;
</p> },
<div style="width: 100%;text-align: center;display: flex;justify-content:center;"> bankcardCheck(bankcard){
<div id="tipok" style="width: 3.3rem;height: .6rem;background-color: #21B1EB;color: #ffffff;font-size: .28rem;border-radius:30px;line-height: .6rem;"> bankcard = Check.trim(bankcard);
确认 if(!(/^([1-9]{1})(\d{15}|\d{18})$/.test(mobile))){
</div> Tip.msgShow("银行卡格式错误,请重新填写");
</div> return false;
</div> }
</div> return bankcard;
<!--签约提示弹窗--> },
<div class="js_dialog" id="bankdialog" style="display: none;"> idcardCheck(idcard){
<div class="weui-mask"></div> idcard = Check.trim(idcard);
<div class="weui-dialog" style="width: 6.3rem;max-width: 6.3rem;display: flex;flex-direction:column;padding-bottom: .3rem;"> if(!(/(^\d{15}$)|(^\d{17}([0-9]|X|x)$)/.test(idcard))){
<div id="" style="width: 100%;text-align: left;height: .6rem;display: flex;"> Tip.msgShow("身份证格式错误,请重新填写");
<img id="close_img" src="__IMG__/close-black.png" style="width: .3rem;height: .3rem;margin: .3rem 0 0 .3rem;"> return false;
<div style="font-size: .28rem;margin-top: .3rem; flex-grow:1;text-align: center;">银行卡签约</div> }
</div> return idcard;
<div style="margin:.3rem .3rem;text-align: left;"> },
<p style="font-size: .24rem;color:#A9A9A9; line-height: 1.2;">该银行卡未签约,无法进行充值,请获取短信验证进行签约</p> codeCheck(code){
<p style="font-size: .24rem;color:#292929;margin-top: .3rem;">手机:<span id="sign_mibile" style="margin-left:10px;"></span></p> code = Check.trim(code);
</div> if(!(/^[0-9]{6}$)/.test(idcard))){
Tip.msgShow("验证码格式错误应为6位数字");
<div class="weui-cell weui-cell_vcode dialogcodebtn"> return false;
}
<div class="weui-cell__bd"> return idcard;
<input id="sign_code" class="weui-input" type="number" placeholder="请输入验证码"> }
</div>
<div class="weui-cell__ft ">
<a id="sign_sms" onclick="getSignSms()" href="javascript:;" class="weui-btn" style="width: 1.5rem;font-size: .24rem;background-color: #21B1EB;color: #fff;border-radius: .1rem;height: .5rem;line-height:.5rem;">获取验证码</a>
</div>
</div>
<div id="close" style="width: 100%;text-align: center;display: flex;justify-content:center;margin-top: .3rem;">
<div onclick="signcontract();" id="sign_contract" style="width: 5.3rem;height: .6rem;background-color: #21B1EB;color: #ffffff;font-size: .28rem;border-radius:5px;line-height: .6rem;">
确认
</div>
</div>
</div>
</div>
<div
style="height: 3.1rem;background-color: #21B1EB;color: #fff;border-bottom-left-radius:30%;border-bottom-right-radius:30%;padding: .43rem .3rem .6rem;line-height: 1.5;">
<p style="font-size: .4rem;">待支付……</p>
<p style="font-size: .24rem;margin-top:.3rem;">订单超过30分钟自动取消请在20分钟18秒内完成支付</p>
<p style="font-size: .24rem;">支付结果将在两分钟内反馈,请稍后在游戏内查看</p>
</div>
<form id="wfform" name="wfform" method="post" action="{:U('WapPay/shortcut_pay')}" target="_parent">
<input type="hidden" id="wfddll" name="wfddll" value="wfddll" />
<input type="hidden" name="user_id" id="user_id" value="{$user_id}" />
<input type="hidden" name="game_id" id="game_id" value="{$game_id}" />
<div class="paypage"> };
<div class="weui-cells weui-cells_form" style="padding: .3rem 0 0;">
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">姓名:</label></div>
<div class="weui-cell__bd">
<input id="custName" name="custName" class="weui-input" type="text">
</div>
<div class="redtxt weui-cell__ft">
*
</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">银行卡号:</label></div>
<div class="weui-cell__bd">
<input id="cardNo" name="cardNo" class="weui-input" type="text">
</div>
<div class="redtxt weui-cell__ft">
*
</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">身份证号:</label></div>
<div class="weui-cell__bd">
<input id="idNo" name="idNo" class="weui-input" type="text">
</div>
<div class="redtxt weui-cell__ft">
*
</div>
</div>
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">手机号:</label></div>
<div class="weui-cell__bd">
<input id="phoneNo" name="phoneNo" class="weui-input" type="text">
</div>
<div class="redtxt weui-cell__ft">
*
</div>
</div>
<div class="weui-cell weui-cell_vcode">
<div class="weui-cell__hd"><label class="weui-label">验证码:</label></div>
<div class="weui-cell__bd">
<input id="smsCode" name="smsCode" class="weui-input" type="number">
</div>
<div class="weui-cell__ft" style="margin-right: .24rem;margin-left:.3rem;">
<a id="sms" onclick="getSms()" href="javascript:;" class="weui-btn" style="font-size: .28rem;;background-color: #21B1EB;color: #fff;border-radius: .1rem;height: .6rem;line-height:.6rem;">获取验证码</a>
</div>
</div>
<div class="weui-cell paymoney" style="height:1.4rem;">
<div class="weui-cell__bd" >
<p style="font-size: .32rem;">支付金额:</p>
</div>
<div class="weui-cell__ft" style="font-size: .48rem;color: red;">{$pay_amount}</div>
</div>
</div>
</div>
<!-- -->
<div style="border: 0;" class="weui-footer_fixed-bottom bottombutton">
立即提交订单
<input style="width: 100%;border: 0;margin: auto;position: absolute;top: 0;left: 0;opacity: 0;" onclick="return sendform()" type="submit" id="wfsubmit" name="wfsubmit" class="bottombutton"/>
</div>
</form>
</body>
</script>
</html> </html>
Loading…
Cancel
Save