<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "UTF-8" >
<!-- <meta name="viewport" content="width=device - width, initial - scale=1.0"> -->
< meta name = "viewport" content = "width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >
< meta http-equiv = "X-UA-Compatible" content = "ie=edge" >
< script src = "__JS__/jquery-1.11.1.min.js" > < / script >
< link rel = "stylesheet" type = "text/css" href = "__CSS__/reset.css" / >
< link rel = "stylesheet" type = "text/css" href = "__CSS__/payment.css" / >
< title > 支付中心-0< / title >
< / head >
< body >
< div class = "payment" >
<!-- <div class="heard">
< div class = "heard_box" >
< a href = "" style = "background-image: url('__IMG__/pay_way/close.png');" > < / a >
支付中心
< / div >
< / div > -->
< div class = "payment_model" style = "position: fixed;width: 100%;height: 100%;top: 0;left: 0;background:rgba(38,38,38,0.4);z-index: 0;display: none" > < / div >
< div class = "payment_window" style = "z-index: 1;display: none" >
< div class = "payment_window_img" >
< img src = "__IMG__/payment_window.png" alt = "" >
< div > < / div >
< / div >
< div class = "payment_window_confirm" > 返回< / div >
< div class = "payment_window_close" > < img src = "__IMG__/pay_way/close2.png" alt = "" > < / div >
< / div >
< div class = "containner" >
< div class = "indent" >
< div class = "indent_box" >
< div > 订单金额: < span > ¥{$data['price']}元< / span > < / div >
< div > 您的账户余额: < span > {$balance+$bind_balance}平台币< / span > < / div >
< / div >
< / div >
< div class = "documents" >
< div class = "documents_box" >
< if condition = "$discount lt 10" >
< div > < span > 折扣:{$discount}折< / span > < span > -¥{$discount_amount}< / span > < / div >
< / if >
< div > < span > 适用平台金额:< / span > < span > -¥{$apply_money}< / span > < / div >
< div > < span > 还需支付:< / span > < span > ¥{$pay_price}< / span > < / div >
< / div >
< / div >
< div class = "select_pay" >
< div class = "select_pay_box" >
< div > 请选择支付方式:< / div >
< div class = "select_pay_info" >
< img src = "__IMG__/pay_way/zhifubao.png" alt = "" class = "slide" >
< div > 支付宝< / div >
< img src = "__IMG__/pay_way/blue_black.png" alt = "" class = "boult" >
< / div >
< / div >
< / div >
< div class = "payment_btn" >
< div >
支付金额 < span > ¥{$pay_price}< / span >
< / div >
< div class = "confirm_pay" > 确认支付< / div >
< / div >
< div class = "payment_rest" style = "display: none;" >
< div class = "payment_rest_box" >
< div class = "title" >
< div > 请选择支付方式< / div >
< img src = "__IMG__/pay_way/dacha.png" alt = "" >
< / div >
< if condition = "C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1) or (C('heepay.status') eq 1 and C('heepay.alipay') eq 1)" >
< div class = "payment_rest_way way_btn" data-type = "alipay" data-url = "{:U('PayH5/ali_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/zhifubao.png" alt = "" >
< span > 支付宝< / span >
< / div >
< img src = "__IMG__/pay_way/dagou2.png" alt = "" >
< / div >
< / if >
< 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 = "" >
< / div >
< / if >
< if condition = "C('sqpay.status') eq 1 and C('sqpay.shortcut') eq 1" >
< div class = "payment_rest_way way_btn" data-type = "sqshorcut" 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 >
< img src = "__IMG__/pay_way/xianshang.png" alt = "" >
< span > 快捷支付< / span >
< / div >
< img src = "__IMG__/pay_way/dagou1.png" alt = "" >
< / div >
< / if >
< if condition = "C('yeepay.status') eq 1 and C('yeepay.shortcut') eq 1" >
< div class = "payment_rest_way way_btn" data-type = "shorcut" data-url = "{:U('Shortcut/yee_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 >
< img src = "__IMG__/pay_way/xianshang.png" alt = "" >
< span > 快捷银行< / span >
< / div >
< img src = "__IMG__/pay_way/dagou1.png" alt = "" >
< / div >
< / if >
< / div >
< / div >
<!-- <div class="payment_rest_btn">其他支付方式</div> -->
< / div >
<!-- 未成年不许支付弹窗 -->
< div class = "msgdialog" style = "display: none" >
< div class = "forbid_model" > < / div >
< div class = "forbid_window" >
< div class = "forbid_pay" >
< img src = "__IMG__/pay_way/forbid.png" alt = "" style = "margin-top: .5rem;" >
< div class = "tipmsg" > 未成年禁止支付哟< / div >
< / div >
< div class = "forbid_confirm" style = "margin: 0.45rem auto;" > 确认< / div >
< div class = "forbid_close" > < img src = "__IMG__/pay_way/close2.png" alt = "" > < / div >
< / div >
< / div >
< / div >
< input style = "display: none" id = "user_token" value = "{$_REQUEST['user_token']}" >
< input style = "display: none" id = "user_id" value = "{$_REQUEST['user_id']}" >
< input style = "display: none" id = "game_id" value = "{$_REQUEST['game_id']}" >
<!-- 横屏 -->
< div class = "payment_heng" >
<!-- <div class="heard">
< div class = "heard_box" >
< a href = "" style = "background-image: url('__IMG__/pay_way/close.png');" > < / a >
支付中心
< / div >
< / div > -->
< div class = "payment_model" style = "position: fixed;width: 100%;height: 100%;top: 0;left: 0;background:rgba(38,38,38,0.4);z-index: 0;display: none" > < / div >
< div class = "payment_window" style = "display: none" >
< div class = "payment_window_img" >
< img src = "__IMG__/payment_window.png" alt = "" >
< div > < / div >
< / div >
< div class = "payment_window_confirm" > 返回< / div >
< div class = "payment_window_close" > < img src = "__IMG__/pay_way/close2.png" alt = "" > < / div >
< / div >
< div class = "containner" >
< div class = "indent" >
< div class = "indent_box" >
< div > 订单金额: < span > ¥{$data['price']}元< / span > < / div >
< div > 您的账户余额: < span > {$balance+$bind_balance}平台币< / span > < / div >
< / div >
< / div >
< div class = "documents" >
< div class = "documents_box" >
< if condition = "$discount lt 10" >
< div > < span > 折扣:{$discount}折< / span > < span > -¥{$discount_amount}< / span > < / div >
< / if >
< div > < span > 适用平台金额:< / span > < span > -¥{$apply_money}< / span > < / div >
< div > < span > 还需支付:< / span > < span > ¥{$pay_price}< / span > < / div >
< / div >
< / div >
< div class = "select_pay" >
< div class = "select_pay_box" >
< div > 请选择支付方式:< / div >
< div class = "select_pay_info" >
< img src = "__IMG__/pay_way/zhifubao.png" alt = "" class = "slide" >
< div > 支付宝< / div >
< img src = "__IMG__/pay_way/blue_black.png" alt = "" class = "boult" >
< / div >
< / div >
< / div >
< div class = "payment_btn" >
< div >
支付金额 < span > ¥{$pay_price}< / span >
< / div >
< div class = "confirm_pay" > 确认支付< / div >
< / div >
< div class = "payment_rest" style = "display: none;" >
< div class = "payment_rest_box" >
< div class = "title" >
< div > 请选择支付方式< / div >
< img src = "__IMG__/pay_way/dacha.png" alt = "" >
< / div >
< if condition = "C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1) or (C('heepay.status') eq 1 and C('heepay.alipay') eq 1)" >
< div class = "payment_rest_way way_btn" data-type = "alipay" data-url = "{:U('PayH5/ali_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/zhifubao.png" alt = "" >
< span > 支付宝< / span >
< / div >
< img src = "__IMG__/pay_way/dagou2.png" alt = "" >
< / div >
< / if >
< 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 = "" >
< / div >
< / if >
< if condition = "C('sqpay.status') eq 1 and C('sqpay.shortcut') eq 1" >
< div class = "payment_rest_way way_btn" data-type = "sqshorcut" 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 >
< img src = "__IMG__/pay_way/xianshang.png" alt = "" >
< span > 快捷支付< / span >
< / div >
< img src = "__IMG__/pay_way/dagou1.png" alt = "" >
< / div >
< / if >
< if condition = "C('yeepay.status') eq 1 and C('yeepay.shortcut') eq 1" >
< div class = "payment_rest_way way_btn" data-type = "shorcut" data-url = "{:U('Shortcut/yee_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 >
< img src = "__IMG__/pay_way/xianshang.png" alt = "" >
< span > 快捷银行< / span >
< / div >
< img src = "__IMG__/pay_way/dagou1.png" alt = "" >
< / div >
< / if >
< / div >
< / div >
<!-- 供上下滑动延长 -->
< div style = "width: 100%;height: 2rem;" > < / div >
<!-- 未成年不许支付弹窗 -->
< div class = "msgdialog" style = "display: none" >
< div class = "forbid_model" > < / div >
< div class = "forbid_window" >
< div class = "forbid_pay" >
< img src = "__IMG__/pay_way/forbid.png" alt = "" style = "margin-top: .25rem;" >
< div class = "tipmsg" > 未成年禁止支付哟< / div >
< / div >
< div class = "forbid_confirm" style = "margin: 0.2rem auto;" > 确认< / div >
< div class = "forbid_close" > < img src = "__IMG__/pay_way/close2.png" alt = "" > < / div >
< / div >
< / div >
< / div >
< / div >
< / body >
< / html >
< script >
// 业务逻辑js
var payway='';
var payurl='';
// -----乱世枭雄适配 begin
try {
var game_id = "{$game_id}";
} catch (error) {
var game_id = 0;
}
if(game_id == 232){
$(".payment .payment_btn").css("bottom","1rem");
$(".payment .payment_rest").css("bottom","1rem");
}
// ------ 乱世枭雄适配 end
flag = false;
function small_program(status) {
if (status == "1") { // 小程序
if ($('#sdk_version').val() == 1) { // android
window.txyxsdk.getSmallRoutine($('#small_json').val());
} else {
window.webkit.messageHandlers.miniprogramPay.postMessage($('#small_json').val());
}
return false;
}
$(this).removeAttr("onclick", "");
return true;
}
//初始化选择
function defaultInit(){
try {
var pay_price = '{$pay_price}';
var user_token = $('#user_token').val();
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))}";
payChannelIntentionInit(user_token);
}
} catch (error) {
alert("初始化错误");
}
}
function payChannelIntentionInit(user_token) {
var game_id = $('#game_id').val();
var user_id = $('#user_id').val();
$.ajax({
type:'post',
dataType:'json',
data:{user_token:user_token,payway:payway,game_id:game_id,user_id:user_id},
url:'/sdk.php/Spend/addPayChannelIntention',
success:function(result) {
if(result.code==0) {
flag=false;
$(".tipmsg").html(result.msg);
$(".msgdialog").show();
}
},
error: function(){
flag=false;
$(".tipmsg").html("接口请求错误");
$(".msgdialog").show();
}
});
}
function closeWindow() {
$(".payment_window").hide();
$(".payment_model").hide();
}
function showWindow(msg) {
$(".payment_window_img").children().next().text(msg);
$(".payment_window").show();
$(".payment_model").show();
}
var timefun;
$(function() {
defaultInit();
$(".payment_window_close").click(function() {
closeWindow();
});
$(".payment_window_confirm").click(function() {
closeWindow();
});
$(".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").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");
var img=$(this).children("div").children("img").attr("src");
var text = $(this).children("div").children("span").text();
//获取支付参数
if (payway == $(this).data("type")) return ;
payway = $(this).data("type");
payurl = $(this).data("url");
var user_token = $('#user_token').val();
payChannelIntentionInit(user_token);
$(".select_pay_info").children(".slide").attr("src",img);
$(".select_pay_info").children("div").text(text);
$(".payment_rest").hide();
});
//拉起支付
$(".confirm_pay").on("click",function(){
if (flag){
$(".tipmsg").html("支付请求中,请勿重复提交.");
$(".msgdialog").show();
return false;
};
flag = true;
if(payway == "wxpay"){
wxpay();
}
if(payway == "alipay"){
alipay();
}
if(payway == "shorcut"){
shorcut();
}
if(payway == "sqshorcut"){
sqshorcut();
}
if(payway == "platform_pay"){
platform_pay();
}
});
$(".payment_rest_btn").click(function(){
$(".payment_rest_btn").hide();
$(".weixin").show();
});
$(".forbid_confirm,.forbid_close").click(function(){
$(".msgdialog").hide();
});
});
//微信支付
function wxpay(){
$r = small_program("{:C('sqpay.wx_small')}");
if ($r) {
var url = payurl;
$.ajax({
type:'post',
dataType:'json',
data:{},
url:url,
success:function(result) {
if(result.code==200) {
window.location.href = result.url;
} else if(result.code == 1001){
flag=false;
showWindow(result.msg);
} else {
flag=false;
$(".tipmsg").html(result.msg);
$(".msgdialog").show();
}
},
error: function(){
flag=false;
$(".tipmsg").html("接口请求错误");
$(".msgdialog").show();
}
});
}
}
//支付宝支付
function alipay(){
var url = payurl;
$.ajax({
type:'post',
dataType:'json',
data:{},
url:url,
success:function(result) {
if(result.code==200) {
window.location.href = result.url;
} else if(result.code == 1001){
flag=false;
showWindow(result.msg);
} else {
flag=false;
$(".tipmsg").html(result.msg);
$(".msgdialog").show();
}
},
error:function(){
flag=false;
$(".tipmsg").html("接口请求错误");
$(".msgdialog").show();
}
});
return false;
}
//快捷支付
function shorcut(){
var url = payurl;
$.ajax({
type:'post',
dataType:'json',
data:{},
url:url,
success:function(result) {
if(result.code==200) {
window.location.href = result.url;
} else if(result.code == 1001){
flag=false;
showWindow(result.msg);
} else {
flag=false;
$(".tipmsg").html(result.msg);
$(".msgdialog").show();
}
},
error:function(){
flag=false;
$(".tipmsg").html("接口请求错误");
$(".msgdialog").show();
}
});
return false;
// window.location.href =payurl;
}
//sq快捷支付
function sqshorcut(){
var url = payurl;
$.ajax({
type:'post',
dataType:'json',
data:{sign: 1},
url:url,
success:function(result) {
if(result.code==200) {
window.location.href = payurl;
} else if(result.code == 1001){
flag=false;
showWindow(result.msg);
} else {
flag=false;
$(".tipmsg").html(result.msg);
$(".msgdialog").show();
}
},
error:function(){
flag=false;
$(".tipmsg").html("接口请求错误");
$(".msgdialog").show();
}
});
return false;
// window.location.href = payurl;
}
//平台币支付
function platform_pay(){
window.location.href = payurl;
}
< / script >
< script type = "text/javascript" >
var evt = "onorientationchange" in window ? "orientationchange" : "resize";
window.addEventListener(evt,resize,false);
function resize(fals) {
if(window.orientation == 0 || window.orientation == 180) {
$(".payment").show();
$(".payment_heng").hide();
}else {
$(".payment").hide();
$(".payment_heng").show();
}
}
resize(true);
< / script >