文件
mashangyoujiu/Application/Vip/View/Onlinepay/continentPay.html

311 行
15 KiB
HTML
可执行文件

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<!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/reset.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/vip/css/onlinepay.css"/>
<script src="__PUBLIC__/vip/js/jquery-3.2.1.min.js"></script>
<style>
.active {
background-color: #ff877e;
color: #fff;
}
.input {
height: 13vw;
box-sizing: border-box;
width: 100%;
border-radius: 5px;
margin-top: 10px;
padding: 0 2vw;
font-size: 14px;
}
.remark {
width: 100%;
text-align: center;
font-size: 14px;
color: #999;
margin-top: 10px;
}
.activity{
color: #ff877e;
font-size: 12px;
}
</style>
</head>
<body>
<input type="hidden" id="storeid" value="{$userinfo['storeid']}">
<input type="hidden" id="openid" value="{$userinfo['openid']}">
<div class="head">
<div class="card_num">卡号:
<span class="card_show">{$userinfo['cardnum1']}</span>
<sapn class="card_show" style="display: none;">{$userinfo['cardnum']}</sapn>
</div>
<div class="balance">余额:<span>{$userinfo['balance']}</span></div>
</div>
<empty name="rechargelist">
<else/>
<div class="body" style="box-sizing: border-box;">
<div class="activity">常规活动</div>
<div>
<volist name="rechargelist" id="vo">
<div 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>
</div>
</volist>
</div>
</div>
<script>
$('.item').click(function () {
if ($('#money').val()) {
$('#money').val('');
}
})
</script>
</empty>
<empty name="plusVipRechargeList">
<else/>
<div class="body" style="box-sizing: border-box;">
<div class="activity">成为plus会员活动</div>
<div>
<volist name="plusVipRechargeList" id="vo">
<div 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>
</div>
</volist>
</div>
</div>
<script>
$('.item').click(function () {
if ($('#money').val()) {
$('#money').val('');
}
})
</script>
</empty>
<empty name="renewPlusRechargeList">
<else/>
<div class="body" style="box-sizing: border-box;">
<div class="activity">Plus会员续费活动</div>
<div>
<volist name="renewPlusRechargeList" id="vo">
<div 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>
</div>
</volist>
</div>
</div>
<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>
<button class="btn">确认充值</button>
</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('active')) {
$(this).removeClass('active');
} else {
$('.item').removeClass('active');
$(this).addClass('active');
}
})
$('.card_show').click(function () {
$('.card_show').show();
$(this).hide();
})
//充值生成订单信息
$(".btn").on('touchstart', function () {
var money = $('#money').val();
if (!money && !$('.active').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 : $('.active').attr('money')
}, function (ret) {
// console.log(ret);
if (ret.status == 1) {
//创建订单成功
$.post('/index.php/Pay/VipPay/recharge', {
out_trade_no: ret.out_trade_no,
online_pay_id: $('.active').length ? $('.active').attr('onlineid') : 0,
money: money ? money : $('.active').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>