322 行
15 KiB
HTML
可执行文件
322 行
15 KiB
HTML
可执行文件
<!DOCTYPE html>
|
||
<html>
|
||
<!--[1.2.66]-->
|
||
<head>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||
<meta charset="UTF-8">
|
||
<title>在线充值</title>
|
||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vip/css/templateA/css-comment.css"/>
|
||
<script src="__PUBLIC__/rem/js/rem.js"></script>
|
||
<link rel="stylesheet" href="__PUBLIC__/vip/css/templateA/recharge.css">
|
||
<script src="__PUBLIC__/vip/js/jquery-3.2.1.min.js"></script>
|
||
<style>
|
||
.input {
|
||
height: 13vw;
|
||
box-sizing: border-box;
|
||
width: 100%;
|
||
border-radius: 5px;
|
||
margin-top: 10px;
|
||
padding: 0 2vw;
|
||
font-size: 14px;
|
||
border: 1px solid #eee;
|
||
}
|
||
|
||
.remark {
|
||
width: 100%;
|
||
text-align: center;
|
||
font-size: 14px;
|
||
color: #999;
|
||
margin-top: 10px;
|
||
}
|
||
|
||
.activity{
|
||
color: #EC4957;
|
||
font-size: 12px;
|
||
}
|
||
|
||
.submit{
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 50px;
|
||
background: #EC4957;
|
||
font-size: 16px;
|
||
font-weight: 400;
|
||
color: rgba(255, 255, 255, 1);
|
||
line-height: 50px;
|
||
text-align: center;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body id="app">
|
||
<input type="hidden" id="storeid" value="{$userinfo['storeid']}">
|
||
<input type="hidden" id="openid" value="{$userinfo['openid']}">
|
||
<div class="head">
|
||
<div class="recharge-box">
|
||
<div class="recharge-list">
|
||
<span>卡号</span>
|
||
<span>{$userinfo['cardnum1']}</span>
|
||
</div>
|
||
<div class="recharge-list">
|
||
<span>余额</span>
|
||
<span>¥{$userinfo['balance']}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<empty name="rechargelist">
|
||
<else/>
|
||
<div class="activity">常规活动</div>
|
||
<ul class="rechargePrice" style="box-sizing: border-box;">
|
||
<volist name="rechargelist" id="vo">
|
||
<li class="item" money="{$vo.recharge_money}" give="{$vo.give_money}" onlineid="{$vo.id}">
|
||
<input type="hidden" value="{$vo.id}">
|
||
<div>充<span>{$vo['recharge_money']}</span></div>
|
||
<div>送<span>{$vo['give_money']}</span></div>
|
||
</li>
|
||
</volist>
|
||
</ul>
|
||
<script>
|
||
$('.item').click(function () {
|
||
if ($('#money').val()) {
|
||
$('#money').val('');
|
||
}
|
||
})
|
||
</script>
|
||
</empty>
|
||
<empty name="plusVipRechargeList">
|
||
<else/>
|
||
<div class="activity" style="margin-top: 10px;">成为Plus会员活动</div>
|
||
<ul class="rechargePrice" style="box-sizing: border-box;">
|
||
<volist name="plusVipRechargeList" id="vo">
|
||
<li class="item" money="{$vo.recharge_money}" give="{$vo.give_money}" onlineid="{$vo.id}">
|
||
<input type="hidden" value="{$vo.id}">
|
||
<div>充<span>{$vo['recharge_money']}</span></div>
|
||
<div>送<span>{$vo['give_money']}</span></div>
|
||
</li>
|
||
</volist>
|
||
</ul>
|
||
<script>
|
||
$('.item').click(function () {
|
||
if ($('#money').val()) {
|
||
$('#money').val('');
|
||
}
|
||
})
|
||
</script>
|
||
</empty>
|
||
<empty name="renewPlusRechargeList">
|
||
<else/>
|
||
<div class="activity" style="margin-top: 10px;">Plus会员活动</div>
|
||
<ul class="rechargePrice" style="box-sizing: border-box;">
|
||
<volist name="renewPlusRechargeList" id="vo">
|
||
<li class="item" money="{$vo.recharge_money}" give="{$vo.give_money}" onlineid="{$vo.id}">
|
||
<input type="hidden" value="{$vo.id}">
|
||
<div>充<span>{$vo['recharge_money']}</span></div>
|
||
<div>送<span>{$vo['give_money']}</span></div>
|
||
</li>
|
||
</volist>
|
||
</ul>
|
||
<script>
|
||
$('.item').click(function () {
|
||
if ($('#money').val()) {
|
||
$('#money').val('');
|
||
}
|
||
})
|
||
</script>
|
||
</empty>
|
||
<if condition="$canInput eq 1">
|
||
<input class="input" id="money" type="number" placeholder="请输入充值金额">
|
||
<if condition="$auto_read_recharge_grade eq 1 AND $rechargelist">
|
||
<div class="remark">自定义充值享受赠送优惠</div>
|
||
<elseif condition="$rechargelist"/>
|
||
<div class="remark">自定义充值<strong>不</strong>享受赠送优惠</div>
|
||
<else/>
|
||
<div style="height: 20px;width: 100%"></div>
|
||
</if>
|
||
<script>
|
||
$('#money').on('input', function () {
|
||
if ($('.active').length) {
|
||
$('.item').removeClass('active');
|
||
}
|
||
})
|
||
</script>
|
||
</if>
|
||
<if condition="$rechargelist OR $plusVipRechargeList OR $renewPlusRechargeList OR $canInput eq 1">
|
||
<else/>
|
||
<div class="body" style="box-sizing: border-box;">
|
||
<div style="width: 100%;text-align: center;font-size: 14px;">商家未设置充值信息</div>
|
||
</div>
|
||
</if>
|
||
<div class="submit">确认充值</div>
|
||
</body>
|
||
<script src="__PUBLIC__/vip/js/window-reload.js"></script>
|
||
<script src="__PUBLIC__/js/tips.js"></script>
|
||
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
|
||
<script>
|
||
$('.item').on('touchstart', function () {
|
||
if ($(".btn").hasClass("disabled")) {
|
||
return;
|
||
}
|
||
if ($(this).hasClass('priceActive')) {
|
||
$(this).removeClass('priceActive');
|
||
} else {
|
||
$('.item').removeClass('priceActive');
|
||
$(this).addClass('priceActive');
|
||
}
|
||
})
|
||
$('.card_show').click(function () {
|
||
$('.card_show').show();
|
||
$(this).hide();
|
||
})
|
||
//充值生成订单信息
|
||
$(".submit").on('touchstart', function () {
|
||
var money = $('#money').val();
|
||
if (!money && !$('.priceActive').length) {
|
||
alertMsg("请输入充值金额<br>或选择一个充值额度", 1000);
|
||
return;
|
||
}
|
||
if ($(".btn").hasClass("disabled")) {
|
||
return;
|
||
}
|
||
// alertMsg($('.priceActive').attr('onlineid'));
|
||
// return ;
|
||
$(".btn").addClass("disabled");
|
||
|
||
alertShowLoading({centerBg: 'transparent', bgOpacity: 0.3});
|
||
var storeid = $("#storeid").val();
|
||
$.post("/index.php/Pay/VipPay/NewSubmitDirectOrder", {
|
||
storeid: storeid,
|
||
trade_amount: money ? money : $('.priceActive').attr('money')
|
||
}, function (ret) {
|
||
if (ret.status == 1) {
|
||
//创建订单成功
|
||
$.post('/index.php/Pay/VipPay/recharge', {
|
||
out_trade_no: ret.out_trade_no,
|
||
online_pay_id: $('.priceActive').length ? $('.priceActive').attr('onlineid') : 0,
|
||
money: money ? money : $('.priceActive').attr('money')
|
||
}, function (data) {
|
||
if (data.status == 1) {
|
||
$.post('/index.php/Pay/PayContinent/vipRecharge_v1', {
|
||
out_trade_no: ret.out_trade_no,
|
||
openid: $('#openid').val(),
|
||
storeid: storeid
|
||
}, function (result) {
|
||
alertHideLoading(function () {
|
||
if (result.status == 1) {
|
||
wx.chooseWXPay({
|
||
timestamp: result.apiTimestamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
|
||
nonceStr: result.apiNoncestr, // 支付签名随机串,不长于 32 位
|
||
package: result.apiPackage, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
|
||
signType: result.apiSigntype, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
|
||
paySign: result.apiPaysign, // 支付签名
|
||
success: function (result1) {
|
||
// 支付成功后的回调函数
|
||
if (result1.errMsg == 'chooseWXPay:ok') {
|
||
alertShowLoading({centerBg: 'transparent', bgOpacity: 0.3},function () {
|
||
// $.post('/index.php/Pay/VipPay/XdlWxOnlinePay', {
|
||
// out_trade_no: ret.out_trade_no,
|
||
// storeid: storeid,
|
||
// orderNo: result.orderNo,
|
||
// money: money,
|
||
// }, function (result2) {
|
||
// alertHideLoading();
|
||
// alertMsg(result2.msg, 1000, function () {
|
||
// if (result2.status == 1) {
|
||
// //充值成功
|
||
// localStorage.onlinepay = 1;
|
||
// window.history.go(-1);
|
||
// } else {
|
||
// //充值失败
|
||
// $(".btn").removeClass("disabled");
|
||
// }
|
||
// });
|
||
// })
|
||
$.post('/index.php/Pay/VipPay/searchWxOnlinePay', {
|
||
out_trade_no: ret.out_trade_no
|
||
}, function (result) {
|
||
if (result.status == 1) {
|
||
alertHideLoading();
|
||
alertMsg(result.msg, 1000, function () {
|
||
localStorage.onlinepay = 1;
|
||
window.history.go(-1);
|
||
});
|
||
} else {
|
||
var time = 0;
|
||
var timer = setInterval(function () {
|
||
$.post('/index.php/Pay/VipPay/searchWxOnlinePay', {
|
||
out_trade_no: ret.out_trade_no
|
||
}, function (result) {
|
||
if (result.status == 1) {
|
||
clearInterval(timer);
|
||
alertHideLoading();
|
||
alertMsg(result.msg, 1000, function () {
|
||
//充值成功
|
||
localStorage.onlinepay = 1;
|
||
window.history.go(-1);
|
||
})
|
||
} else {
|
||
if (time > 6) {
|
||
//充值失败
|
||
alertHideLoading();
|
||
clearInterval(timer);
|
||
alertMsg(result.msg, 1000, function () {
|
||
//充值成功
|
||
localStorage.onlinepay = 1;
|
||
window.history.go(-1);
|
||
})
|
||
$(".btn").removeClass("disabled");
|
||
}
|
||
}
|
||
});
|
||
}, 2000)
|
||
}
|
||
})
|
||
})
|
||
}
|
||
},
|
||
cancel: function (res) {
|
||
//用户点击取消时的回调函数,仅部分有用户取消操作的api才会用到。
|
||
$(".btn").removeClass("disabled");
|
||
}
|
||
});
|
||
} else {
|
||
alertHideLoading(function () {
|
||
alertMsg(result.msg, 1000, function () {
|
||
$(".btn").removeClass("disabled");
|
||
});
|
||
})
|
||
}
|
||
})
|
||
|
||
})
|
||
} else {
|
||
alertHideLoading(function () {
|
||
alertMsg(data.msg, 1000, function () {
|
||
$(".btn").removeClass("disabled");
|
||
});
|
||
})
|
||
}
|
||
})
|
||
} else {
|
||
alertHideLoading(function () {
|
||
alertMsg(ret.msg, 1000, function () {
|
||
$(".btn").removeClass("disabled");
|
||
});
|
||
})
|
||
}
|
||
})
|
||
});
|
||
wx.config({
|
||
debug: false,
|
||
appId: "{$signPackage.appId}",
|
||
timestamp: "{$signPackage.timestamp}",
|
||
nonceStr: "{$signPackage.nonceStr}",
|
||
signature: "{$signPackage.signature}",
|
||
jsApiList: ['chooseWXPay']
|
||
});
|
||
wx.error(function (res) {
|
||
alert("出错了:" + res.errMsg);//这个地方的好处就是wx.config配置错误,会弹出窗口哪里错误,然后根据微信文档查询即可。
|
||
});
|
||
</script>
|
||
</html>
|