@ -62,17 +62,17 @@
< img src = "__IMG__/pay_way/dagou2.png" alt = "" >
< / div >
< / if >
< if condition = "!pay_limit('wx') and $money elt C('WX_PAY_LIMIT')" >
< if condition = "C('wei_xin.status') eq 1 or C('weixin_gf.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.wx') eq 1) or (C('heepay.status') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.wx_small') eq 1)" >
< div class = "payment_rest_way way_btn" data-type = "wxpay" data-url = "{:U('PayH5/weixin_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'),'api_ver'=>2))}" >
< div >
< img src = "__IMG__/pay_way/weixin.png" alt = "" >
< span > 微信< / span >
< / div >
< img src = "__IMG__/pay_way/dagou1.png" alt = "" >
< if condition = "C('wei_xin.status') eq 1 or C('weixin_gf.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.wx') eq 1) or (C('heepay.status') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.wx_small') eq 1)" >
< div class = "payment_rest_way way_btn" data-type = "wxpay" data-url = "{:U('PayH5/weixin_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'),'api_ver'=>2))}" >
< div >
< img src = "__IMG__/pay_way/weixin.png" alt = "" >
< span > 微信< / span >
< / div >
< / if >
< img src = "__IMG__/pay_way/dagou1.png" alt = "" >
< / div >
< / if >
< if condition = "C('sqpay.status') eq 1 and C('sqpay.shortcut') eq 1" >
< div class = "payment_rest_way way_btn" data-type = "shorcut" data-url = "{:U('Shortcut/wap_shortcut_pay', array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'),'code'=>1,'extend'=>I('extend'),'api_ver'=>2))}" >
< div >
@ -192,6 +192,7 @@
< / div >
< / div >
< / div >
< / div >
< / body >
< / html >
< script >
@ -212,26 +213,37 @@
}
//初始化选择
function defaultInit(){
var pay_price = {$pay_price};
if (pay_price == 0) {
payway="platform_pay";
payurl = "{:U('PayH5/platform_coin_deduction',array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'), 'api_ver' => 2))}";
$(".select_pay").hide();
} else {
payway="alipay";
payurl="{:U('PayH5/ali_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'),'api_ver'=>2))}";
try {
var pay_price = '{$pay_price}';
if (pay_price == 0) {
payway="platform_pay";
payurl = "{:U('PayH5/platform_coin_deduction',array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'), 'api_ver' => 2))}";
$(".select_pay").hide();
} else {
payway="alipay";
payurl="{:U('PayH5/ali_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id'),'user_token'=>I('user_token'),'api_ver'=>2))}";
}
} catch (error) {
alert("初始化错误");
}
}
defaultInit();
var timefun;
$(".select_pay_info").click(function(){
timefun = setTimeout(function(){
$(".tipmsg").html("切换支付失败");
$(".msgdialog").show();
},1000);
$(".payment_rest").show();
clearTimeout(timefun);
})
$(".payment_rest .title>img").click(function(){
$(".payment_rest").hide();
})
$(".payment_rest_way").click(function(){
$(".payment_rest_way").on("click",function(){
$(this).children("img").attr("src","__IMG__/pay_way/dagou2.png");
$(this).siblings(".payment_rest_way").children("img").attr("src","__IMG__/pay_way/dagou1.png");
let img=$(this).children("div").children("img").attr("src");
@ -243,11 +255,16 @@
$(".select_pay_info").children(".slide").attr("src",img);
$(".select_pay_info").children("div").text(text);
$(".payment_rest").hide();
})
//拉起支付
var flag = false;
$(".confirm_pay").on("click",function(){
if (flag) return ;
if (flag){
$(".tipmsg").html("支付请求中,请勿重复提交");
$(".msgdialog").show();
return false;
};
flag = true;
if(payway == "wxpay"){
@ -282,7 +299,12 @@
$(".tipmsg").html(result.msg);
$(".msgdialog").show();
}
}
},
error(){
flag=false;
$(".tipmsg").html("接口请求错误");
$(".msgdialog").show();
}
});
}
}
@ -303,7 +325,12 @@
$(".tipmsg").html(result.msg);
$(".msgdialog").show();
}
}
},
error(){
flag=false;
$(".tipmsg").html("接口请求错误");
$(".msgdialog").show();
}
});
return false;
}