File: /www/wwwroot//www.xxlht.com/template/mobile/users/level_centre.htm
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>{$eyou.field.title}-{eyou:global name='web_name' /}</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<link href="{eyou:global name='web_cmspath'/}/favicon.ico" rel="shortcut icon" type="image/x-icon" />
{eyou:static file="users/skin/css/bootstrap.min.css"/}
{eyou:static file="users/skin/css/basic.css"/}
{eyou:static file="users/skin/css/eyoucms.css"/}
{eyou:include file="users/skin/css/diy_css.htm"/}
{eyou:static file="/public/static/common/js/jquery.min.js"/}
{eyou:static file="/public/plugins/layer-v3.1.0/layer.js"/}
{eyou:static file="/public/static/common/js/tag_global.js"/}
<style type="text/css">
@media (max-width: 640px){
.panel-body {
padding:18px;
}
/*.centre .panel-body {
padding: 18px;
}*/
}
</style>
</head>
<body class="pay shop">
<!-- 头部 -->
{eyou:include file="users/users_header.htm" /}
<!-- 头部结束 -->
<div class="member-profile ey-member">
<div class="container">
<div class="member-profile-content ">
<div class="row">
<!-- 侧边 -->
{eyou:include file="users/users_left.htm" /}
<!-- 侧边结束 -->
<!-- 中部 -->
<div class="col-xs-12 col-sm-10 ey-member-index">
<div class="panel panel-default m-b-0" style="min-height: 486px;">
<div class="panel-heading">
<strong>{$eyou.field.title}</strong>
</div>
<div class="panel-body shop-finance">
<div class="row">
<div class="clearfix">
<div class="pull-xs-left">
您的会员等级:{$users.level_name}
{eyou:neq name='$users.level' value='1'}
剩余会员天数:{$users.maturity_date}
{/eyou:neq}
</div>
</div>
<form name='theForm' id="theForm">
<div id="finance-list_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer clearfix">
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-10 no-footer dtr-inline" cellspacing="0" id="finance-list" data-table-ajaxurl="" data-table-pagelength="20" data-plugin="selectable" role="grid" aria-describedby="finance-list_info" >
<thead>
<tr role="row">
<th style="width: 50px; text-align: center;">选择</th>
<th style="width: 262px; text-align: center;">产品名称</th>
<th style="width: 200px; text-align: center;">产品价格</th>
<th style="width: 155px; text-align: center;">会员期限</th>
</tr>
</thead>
<tbody>
{eyou:empty name="users_type"}
<tr class="odd">
<td valign="top" colspan="6" class="dataTables_empty">当前没有会员升级产品</td>
</tr>
{eyou:else/}
{eyou:volist name="users_type" id="vo"}
<tr class="odd">
<td style="text-align: center;">
<label>
<input type="radio" {eyou:eq name='$key' value='0'}checked{/eyou:eq} name="type_id" value="{$vo.type_id}">
</label>
</td>
<td style="text-align: center;">
{$vo.type_name}
</td>
<td style="text-align: center;">
¥{$vo.price}
</td>
<td style="text-align: center;">
{$member_limit_arr[$vo['limit_id']]|default=''}
</td>
</tr>
{/eyou:volist}
{/eyou:empty}
</tbody>
</table>
</div>
<br/><br/>
<div class="form-group m-b-0">
<label>
<input type="radio" checked name='pay_id' value="1">
<img src="{eyou:global name='web_templets_pc' /}/users/skin/images/pay_yiyou.png" alt="余额支付">
</label>
{eyou:empty name='$is_open_wechat'}
<label>
<input type="radio" name='pay_id' value="2">
<img src="{eyou:global name='web_templets_pc' /}/users/skin/images/pay_weixin.png" alt="微信支付">
</label>
{/eyou:empty}
{eyou:empty name='$is_open_alipay'}
<label>
<input type="radio" name='pay_id' value="3">
<img src="{eyou:global name='web_templets_pc' /}/users/skin/images/pay_zhifubao.png" alt="支付宝支付">
</label>
{/eyou:empty}
</div>
<br/>
<input type="hidden" name='order_number' id="UnifiedNumber" value="{$OrderNumber}">
<div class="form-group m-b-0">
<a href="JavaScript:void(0);" id='Pay' onclick="CheckSubmit();" class="btn btn-primary">
去付款
</a>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- 中部结束 -->
</div>
</div>
</div>
</div>
<script type="text/javascript">
function CheckSubmit(){
// 禁用支付按钮
$('#Pay').prop("disabled",true).css("pointer-events","none");
layer_loading('正在处理');
$.ajax({
url: "{:url('Level/level_type_pay', ['_ajax'=>1])}",
data: $('#theForm').serialize(),
type:'POST',
dataType:'json',
success:function(res){
layer.closeAll();
$('#Pay').prop("disabled",false).css("pointer-events","");
if (1 == res.code) {
if (1 == res.msg.ReturnCode) {
// 余额支付逻辑
if (0 == res.msg.ReturnPay) {
// 余额不足支付
IsRecharge(res.msg);
} else {
// 支付完成
layer.msg(res.msg.ReturnMsg, {time: 1500},function(){
window.location.href = res.msg.ReturnUrl;
});
}
} else if (2 == res.msg.ReturnCode) {
// 微信支付逻辑
if (0 == res.msg.ReturnPay) {
// 加载订单号到隐藏域
$('#UnifiedNumber').val(res.msg.ReturnOrder);
// 根据返回值选择支付方式
if ('WeChatScanCode' == res.msg.WeChatType) {
WeChatScanCode(res.msg.ReturnUrl);
} else if ('WeChatH5' == res.msg.WeChatType) {
WeChatH5(res.msg.ReturnUrl);
} else if ('WeChatInternal' == res.msg.WeChatType) {
WeChatInternal(res.data);
}
} else {
// 支付完成
layer.msg(res.msg.ReturnMsg, {time: 1500},function(){
window.location.href = res.msg.ReturnUrl;
});
}
} else if (3 == res.msg.ReturnCode) {
// 支付宝支付逻辑
if (0 == res.msg.ReturnPay) {
AliPay(res.msg.ReturnUrl);
}
}
} else {
layer.alert(res.msg, {icon:0});
}
}
});
}
// 支付宝支付
function AliPay(ReturnUrl = '')
{
// 新页面跳转
window.open(ReturnUrl);
// 弹出支付是否完成确认框
layer.confirm('支付完成?', {
title:false,
btn: ['完成','其他方式支付'],
cancel: function(index, layero){
layer.closeAll();
}
}, function(){
layer.closeAll();
window.location.reload();
}, function(index){
layer.closeAll();
});
}
// 微信扫码支付,用于PC端
function WeChatScanCode(url)
{
//iframe窗
layer.open({
type: 2,
title: '充值支付',
shadeClose: false,
maxmin: false, //开启最大化最小化按钮
area: ['310px', '350px'],
content: url
});
}
// H5支付
function WeChatH5(ReturnUrl = '')
{
// 新页面跳转
window.open(ReturnUrl);
// 循环执行订单查询
var num = 0;
if (num >= 0) {
num = setInterval('WeChatOrderInquiry()', 1500);
}
// 弹出支付是否完成确认框
layer.confirm('支付完成?', {
title:false,
btn: ['完成','其他方式支付'],
// 当会员点击关闭按钮时,停止定时器查询
cancel: function(index, layero){
clearInterval(num);
}
}, function(){
WeChatOrderInquiry();
}, function(index){
// 当会员点击关闭按钮时,停止定时器查询
clearInterval(num);
layer.closeAll(index);
});
}
// 微信内部中进行支付
function WeChatInternal(OrderData)
{
var unified_id = OrderData.unified_id;
var unified_number = OrderData.unified_number;
var transaction_type = OrderData.transaction_type;
$.ajax({
url: "{eyou:url link='user/Pay/wechat_pay'/}",
data: {unified_id:unified_id,unified_number:unified_number,transaction_type:transaction_type},
type:'post',
dataType:'json',
success:function(res){
if (1 == res.code) {
Callpay(res.msg);
}else{
layer.alert(res.msg, {icon:0});
}
}
});
}
//调用微信JS api 支付
function jsApiCall(data)
{
WeixinJSBridge.invoke(
'getBrandWCPayRequest',data,
function(res){
if(res.err_msg == "get_brand_wcpay_request:ok"){
layer.msg('微信支付完成!', {time: 1000}, function(){
WeChatOrderInquiry();
});
}else if(res.err_msg == "get_brand_wcpay_request:cancel"){
layer.alert('用户取消支付,请选择支付方式!', {icon:0});
}else{
layer.alert('支付失败', {icon:0});
}
}
);
}
// 微信内部支付时,先进行数据判断
function Callpay(data)
{
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
}else{
jsApiCall(data);
}
}
// 支付后跳转
function WeChatOrderInquiry(){
var unified_number = $('#UnifiedNumber').val();
var transaction_type = 1;
$.ajax({
url: "{eyou:url link='user/Level/wechat_order_inquiry'/}",
data: {unified_number:unified_number,transaction_type:transaction_type},
type:'post',
dataType:'json',
success:function(res){
if (1 == res.data.status) {
window.location.href = res.url;
}
}
});
}
// 是否要去充值
function IsRecharge(data){
layer.confirm(data.ReturnMsg, {
title:false,
btn: ['去充值','其他方式支付'],
cancel: function(index, layero){
$('#Pay').prop("disabled",false).css("pointer-events","");
}
}, function(){
// 去充值
window.location.href = data.ReturnUrl;
}, function(index){
// 选择其他方式支付时,恢复禁用的余额支付按钮
$('#Pay').prop("disabled",false).css("pointer-events","");
layer.closeAll(index);
});
}
</script>
{eyou:include file="users/users_footer.htm" /}