343 行
17 KiB
HTML
可执行文件
343 行
17 KiB
HTML
可执行文件
<!DOCTYPE html>
|
||
<html>
|
||
<!--[1.2.66]-->
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport"
|
||
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
|
||
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vip/css/templateB/card-online.css"/>
|
||
<script type="text/javascript" src="__PUBLIC__/vip/js/templateB/rem.js"></script>
|
||
<script src="__PUBLIC__/vip/js/jquery-3.2.1.min.js"></script>
|
||
<title>在线充值</title>
|
||
<style>
|
||
.remark {
|
||
width: 100%;
|
||
text-align: center;
|
||
font-size: 0.3rem;
|
||
color: #999;
|
||
margin-top: 0.2rem;
|
||
line-height: 0.7rem;
|
||
}
|
||
|
||
.activity {
|
||
color: #6FA1FB;
|
||
font-size: 12px;
|
||
padding-bottom: 0.2rem;
|
||
}
|
||
|
||
.content-money-1 {
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
padding-top: 0.4rem;
|
||
white-space: nowrap;
|
||
font-size: 0;
|
||
}
|
||
|
||
.content-money-info:nth-child(3n) {
|
||
margin-right: 0;
|
||
}
|
||
|
||
.content-money-info {
|
||
margin-bottom: 0.1rem;
|
||
}
|
||
|
||
.submit {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
.wrap {
|
||
padding-bottom: 1.2rem;
|
||
overflow-y: auto;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<div class="wrap">
|
||
<input type="hidden" id="storeid" value="{$userinfo['storeid']}">
|
||
<input type="hidden" id="openid" value="{$userinfo['openid']}">
|
||
<div class="content" style="height: auto;">
|
||
<div class="content-info">
|
||
<span>卡号</span>
|
||
<span class="card_show">{$userinfo['cardnum1']}</span>
|
||
<span class="card_show" style="display: none;">{$userinfo['cardnum']}</span>
|
||
</div>
|
||
<div class="content-info">
|
||
<span>余额</span>
|
||
<span>¥{$userinfo['balance']}</span>
|
||
</div>
|
||
<empty name="rechargelist">
|
||
<else/>
|
||
<div class="content-money-1">
|
||
<div class="activity">常规活动</div>
|
||
<div style="white-space: pre-wrap;">
|
||
<volist name="rechargelist" id="vo">
|
||
<div money="{$vo.recharge_money}" give="{$vo.give_money}" onlineid="{$vo.id}" class="content-money-info">
|
||
<input type="hidden" value="{$vo.id}">
|
||
<div class="content-money-info-a">充{$vo['recharge_money']}</div>
|
||
<div class="content-money-info-b">送{$vo['give_money']}</div>
|
||
</div>
|
||
</volist>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
$('.content-money-info').click(function () {
|
||
if ($('#money').val()) {
|
||
$('#money').val('');
|
||
}
|
||
})
|
||
</script>
|
||
</empty>
|
||
<empty name="plusVipRechargeList">
|
||
<else/>
|
||
<div class="content-money-1">
|
||
<div class="activity">成为Plus会员活动</div>
|
||
<div style="white-space: pre-wrap;">
|
||
<volist name="plusVipRechargeList" id="vo">
|
||
<div money="{$vo.recharge_money}" give="{$vo.give_money}" onlineid="{$vo.id}" class="content-money-info">
|
||
<input type="hidden" value="{$vo.id}">
|
||
<div class="content-money-info-a">充{$vo['recharge_money']}</div>
|
||
<div class="content-money-info-b">送{$vo['give_money']}</div>
|
||
</div>
|
||
</volist>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
$('.content-money-info').click(function () {
|
||
if ($('#money').val()) {
|
||
$('#money').val('');
|
||
}
|
||
})
|
||
</script>
|
||
</empty>
|
||
<empty name="renewPlusRechargeList">
|
||
<else/>
|
||
<div class="content-money-1">
|
||
<div class="activity">Plus会员续费活动</div>
|
||
<div style="white-space: pre-wrap;">
|
||
<volist name="renewPlusRechargeList" id="vo">
|
||
<div money="{$vo.recharge_money}" give="{$vo.give_money}" onlineid="{$vo.id}" class="content-money-info">
|
||
<input type="hidden" value="{$vo.id}">
|
||
<div class="content-money-info-a">充{$vo['recharge_money']}</div>
|
||
<div class="content-money-info-b">送{$vo['give_money']}</div>
|
||
</div>
|
||
</volist>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
$('.content-money-info').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 ($('.content-money-info').length) {
|
||
$('.content-money-info').removeClass('cheak');
|
||
}
|
||
})
|
||
</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>
|
||
<div class="submit btn">
|
||
<span>确认充值</span>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
<script type="text/javascript" src="__PUBLIC__/vue/js/vue2.5.16.js"></script>
|
||
<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 type="text/javascript">
|
||
$('.content-money-info').on('touchstart', function () {
|
||
if ($(".btn").hasClass("disabled")) {
|
||
return;
|
||
}
|
||
if ($(this).hasClass('cheak')) {
|
||
$(this).removeClass('cheak');
|
||
} else {
|
||
$('.content-money-info').removeClass('cheak');
|
||
$(this).addClass('cheak');
|
||
}
|
||
})
|
||
|
||
$('.card_show').click(function () {
|
||
$('.card_show').show();
|
||
$(this).hide();
|
||
})
|
||
|
||
//充值生成订单信息
|
||
$(".btn").on('touchstart', function () {
|
||
var money = $('#money').val();
|
||
if (!money && !$('.cheak').length) {
|
||
alertMsg("请输入充值金额或选择一个充值额度", 1000);
|
||
return;
|
||
}
|
||
if ($(".btn").hasClass("disabled")) {
|
||
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 : $('.cheak').attr('money')
|
||
}, function (ret) {
|
||
if (ret.status == 1) {
|
||
//创建订单成功
|
||
$.post('/index.php/Pay/VipPay/recharge', {
|
||
out_trade_no: ret.out_trade_no,
|
||
online_pay_id: $('.cheak').length ? $('.cheak').attr('onlineid') : 0,
|
||
money: money ? money : $('.cheak').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) {
|
||
// // alert(result.orderNo)
|
||
// 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> |