|
@@ -14,7 +14,8 @@
|
|
<link rel="stylesheet" type="text/css" href="/jyapp/vipsubscribe/css/base.css?v={{Msg "seo" "version"}}" />
|
|
<link rel="stylesheet" type="text/css" href="/jyapp/vipsubscribe/css/base.css?v={{Msg "seo" "version"}}" />
|
|
<link rel="stylesheet" type="text/css" href="/jyapp/vipsubscribe/iconfont/iconfont.css?v={{Msg "seo" "version"}}" />
|
|
<link rel="stylesheet" type="text/css" href="/jyapp/vipsubscribe/iconfont/iconfont.css?v={{Msg "seo" "version"}}" />
|
|
<link rel="stylesheet" href="/jyapp/vipsubscribe/css/vip_update.css?v={{Msg "seo" "version"}}5">
|
|
<link rel="stylesheet" href="/jyapp/vipsubscribe/css/vip_update.css?v={{Msg "seo" "version"}}5">
|
|
- {{include "/common/weixin.html"}}
|
|
|
|
|
|
+ <link rel="stylesheet" type="text/css" href="/jyapp/css/layout.css?v={{Msg "seo" "version"}}"/>
|
|
|
|
+ <link rel="stylesheet" type="text/css" href="/jyapp/css/font.css?v={{Msg "seo" "version"}}"/>
|
|
</head>
|
|
</head>
|
|
<style type="text/css">
|
|
<style type="text/css">
|
|
body,html {
|
|
body,html {
|
|
@@ -25,12 +26,17 @@
|
|
}
|
|
}
|
|
.vip_update .fixed-bottom-box, .vip_renew .fixed-bottom-box {
|
|
.vip_update .fixed-bottom-box, .vip_renew .fixed-bottom-box {
|
|
width: 100%;
|
|
width: 100%;
|
|
- position: fixed;
|
|
|
|
|
|
+ position: static;
|
|
bottom: 0;
|
|
bottom: 0;
|
|
left: 0;
|
|
left: 0;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|
|
<body class="no-touch">
|
|
<body class="no-touch">
|
|
|
|
+ <div class="app-layout-header">
|
|
|
|
+ <span class="app-back jyapp-icon jyapp-icon-zuojiantou"></span>
|
|
|
|
+ VIP订阅续费
|
|
|
|
+ </div>
|
|
|
|
+ <div class="app-layout-content-b">
|
|
<div class="vip_renew">
|
|
<div class="vip_renew">
|
|
<div class="choose_condition">
|
|
<div class="choose_condition">
|
|
<!-- 正常点击vip首页续费进入显示下列提示 -->
|
|
<!-- 正常点击vip首页续费进入显示下列提示 -->
|
|
@@ -185,7 +191,7 @@
|
|
<p><img src="/jyapp/vipsubscribe/image/weixin.png">微信支付</p>
|
|
<p><img src="/jyapp/vipsubscribe/image/weixin.png">微信支付</p>
|
|
</div>
|
|
</div>
|
|
<div class="weui-cell__hd">
|
|
<div class="weui-cell__hd">
|
|
- <input type="radio" class="weui-check" name="way" value="微信支付" id="wx" checked />
|
|
|
|
|
|
+ <input type="radio" class="weui-check paytypes" name="way" value="微信支付" id="wx" checked />
|
|
<i class="weui-icon-checked"></i>
|
|
<i class="weui-icon-checked"></i>
|
|
</div>
|
|
</div>
|
|
</label>
|
|
</label>
|
|
@@ -194,7 +200,7 @@
|
|
<p><img src="/jyapp/vipsubscribe/image/zhifubao.png">支付宝支付</p>
|
|
<p><img src="/jyapp/vipsubscribe/image/zhifubao.png">支付宝支付</p>
|
|
</div>
|
|
</div>
|
|
<div class="weui-cell__hd">
|
|
<div class="weui-cell__hd">
|
|
- <input type="radio" class="weui-check" name="way" value="支付宝支付" id="zfb" />
|
|
|
|
|
|
+ <input type="radio" class="weui-check paytypes" name="way" value="支付宝支付" id="zfb" />
|
|
<i class="weui-icon-checked"></i>
|
|
<i class="weui-icon-checked"></i>
|
|
</div>
|
|
</div>
|
|
</label>
|
|
</label>
|
|
@@ -203,73 +209,12 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ </div>
|
|
<script src="/vipsubscribe/js/jquery-2.1.4.js"></script>
|
|
<script src="/vipsubscribe/js/jquery-2.1.4.js"></script>
|
|
<script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}4"></script>
|
|
<script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}4"></script>
|
|
<!--<script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>-->
|
|
<!--<script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>-->
|
|
<script src="https://res.wx.qq.com/open/libs/weuijs/1.1.4/weui.min.js?v={{Msg "seo" "version"}}"></script>
|
|
<script src="https://res.wx.qq.com/open/libs/weuijs/1.1.4/weui.min.js?v={{Msg "seo" "version"}}"></script>
|
|
- <script type="text/javascript">
|
|
|
|
- //
|
|
|
|
- try{
|
|
|
|
- var signature = {{.T.signature}};
|
|
|
|
- var isConfigSuccess = true;
|
|
|
|
- var id = {{.T._id}}
|
|
|
|
- if(signature && signature.length == 4){
|
|
|
|
- wx.config({
|
|
|
|
- debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
|
|
- appId: signature[0], // 必填,公众号的唯一标识
|
|
|
|
- timestamp:signature[1], // 必填,生成签名的时间戳
|
|
|
|
- nonceStr: signature[2], // 必填,生成签名的随机串
|
|
|
|
- signature: signature[3],// 必填,签名,见附录1
|
|
|
|
- jsApiList: ['chooseWXPay','hideAllNonBaseMenuItem'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
|
|
- });
|
|
|
|
- wx.ready(function(){
|
|
|
|
- if(!isConfigSuccess){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- wx.hideAllNonBaseMenuItem();
|
|
|
|
- });
|
|
|
|
- wx.error(function(res){
|
|
|
|
- //config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
|
|
|
- //alert(res);
|
|
|
|
- isConfigSuccess = false;
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- //调用微信支付接口
|
|
|
|
- function onBridgeReady(res,ordercode){
|
|
|
|
- WeixinJSBridge.invoke('getBrandWCPayRequest',{
|
|
|
|
- "appId": res["appId"],
|
|
|
|
- "timeStamp": res["timestamp"],
|
|
|
|
- "nonceStr": res["nonceStr"],
|
|
|
|
- "package": res["prepayId"],
|
|
|
|
- "signType": res["signType"],
|
|
|
|
- "paySign": res["sign"]
|
|
|
|
- },
|
|
|
|
- function(r){
|
|
|
|
- if(r.err_msg == "get_brand_wcpay_request:ok"){
|
|
|
|
- setTimeout(function(){
|
|
|
|
- window.location.replace("/jyapp/front/vipsubscribe/toPaySuccessPage?orderCode="+ordercode);
|
|
|
|
- },500)
|
|
|
|
- }
|
|
|
|
-// }else if(r.err_msg == "get_brand_wcpay_request:cancel"){
|
|
|
|
-//// alert("开发环境【支付跳转完成】")
|
|
|
|
-// try{
|
|
|
|
-//// window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode="+ordercode);
|
|
|
|
-//// window.location.reload();
|
|
|
|
-// }catch(e){
|
|
|
|
-// alert(e)
|
|
|
|
-// }
|
|
|
|
-// }else{
|
|
|
|
-// weui.toast("系统异常,请稍微再试",{
|
|
|
|
-// duration: 2000,
|
|
|
|
-// className: 'custom-toast',
|
|
|
|
-// });
|
|
|
|
-// }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }catch(e){
|
|
|
|
- console.log(e)
|
|
|
|
- }
|
|
|
|
- </script>
|
|
|
|
|
|
+ <script src="/jyapp/js/common.js?v={{Msg "seo" "version"}}"></script>
|
|
<script>
|
|
<script>
|
|
$(function () {
|
|
$(function () {
|
|
var isPageHide = false;
|
|
var isPageHide = false;
|
|
@@ -292,6 +237,16 @@
|
|
|
|
|
|
// 选择订阅周期
|
|
// 选择订阅周期
|
|
$('.select_cycle > a').click(function () {
|
|
$('.select_cycle > a').click(function () {
|
|
|
|
+ if((nowUpgrade)>=36){
|
|
|
|
+ var overtimeWarning = `最长订阅周期不可超过3年<br />当前订阅周期:${nowUpgrade}个月`
|
|
|
|
+ weui.toast(overtimeWarning, {
|
|
|
|
+ duration: 3000,
|
|
|
|
+ className: 'custom-toast',
|
|
|
|
+ callback: function() {
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
$('#time_cycle').show(200);
|
|
$('#time_cycle').show(200);
|
|
})
|
|
})
|
|
// 选择支付方式
|
|
// 选择支付方式
|
|
@@ -366,6 +321,16 @@
|
|
currentNum = currentNum <= data.numboxMin ? data.numboxMin : currentNum - data
|
|
currentNum = currentNum <= data.numboxMin ? data.numboxMin : currentNum - data
|
|
.numboxStep;
|
|
.numboxStep;
|
|
}
|
|
}
|
|
|
|
+ if((currentNum+nowUpgrade)>36){
|
|
|
|
+ var overtimeWarning = `最长订阅周期不可超过3年<br />当前订阅周期:${nowUpgrade}个月`
|
|
|
|
+ weui.toast(overtimeWarning, {
|
|
|
|
+ duration: 3000,
|
|
|
|
+ className: 'custom-toast',
|
|
|
|
+ callback: function() {
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
if (currentNum >= 10) {
|
|
if (currentNum >= 10) {
|
|
$('.profit_tips').text("已选择"+currentNum+"个月,建议“按年订阅”更划算哦~");
|
|
$('.profit_tips').text("已选择"+currentNum+"个月,建议“按年订阅”更划算哦~");
|
|
$('.profit_tips').show();
|
|
$('.profit_tips').show();
|
|
@@ -406,8 +371,17 @@
|
|
|
|
|
|
/* -------- 控制年份number_box的事件 点击1年 2年 3年触发的事件------- */
|
|
/* -------- 控制年份number_box的事件 点击1年 2年 3年触发的事件------- */
|
|
$('#number_box_year').on('click', 'span', function (e) {
|
|
$('#number_box_year').on('click', 'span', function (e) {
|
|
- console.log(e.target.dataset.id)
|
|
|
|
let id = e.target.dataset.id;
|
|
let id = e.target.dataset.id;
|
|
|
|
+ if((id*12+nowUpgrade)>36){
|
|
|
|
+ var overtimeWarning = `最长订阅周期不可超过3年<br />当前订阅周期:${nowUpgrade}个月`
|
|
|
|
+ weui.toast(overtimeWarning, {
|
|
|
|
+ duration: 3000,
|
|
|
|
+ className: 'custom-toast',
|
|
|
|
+ callback: function() {
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
$('.profit_tips').hide()
|
|
$('.profit_tips').hide()
|
|
$('#number_box_month').removeClass('active');
|
|
$('#number_box_month').removeClass('active');
|
|
$(this).addClass('active').siblings().removeClass('active')
|
|
$(this).addClass('active').siblings().removeClass('active')
|
|
@@ -543,9 +517,12 @@
|
|
}else if(payType === "alipy"){
|
|
}else if(payType === "alipy"){
|
|
payHtml = "支付宝支付";
|
|
payHtml = "支付宝支付";
|
|
}
|
|
}
|
|
- $('input:radio[name="way"]').val(payHtml);
|
|
|
|
- $('input:radio[name="way"]').prop("checked", true);
|
|
|
|
- $("#payType").text(payHtml);
|
|
|
|
|
|
+ $(".paytypes").each(function(){
|
|
|
|
+ if($(this).attr("value") === payHtml){
|
|
|
|
+ $(this).prop("checked", true);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ $(".weixin_pay").text(payHtml);
|
|
}
|
|
}
|
|
|
|
|
|
//
|
|
//
|
|
@@ -629,14 +606,10 @@
|
|
$(".item_validity .label_for").text(dateHtml);
|
|
$(".item_validity .label_for").text(dateHtml);
|
|
}
|
|
}
|
|
if(starts !== "" && ends !== ""){
|
|
if(starts !== "" && ends !== ""){
|
|
- let end = new Date(ends*1000).toLocaleDateString();
|
|
|
|
- let endtime = end.split("/");
|
|
|
|
- let endYear = Number(endtime[0]);
|
|
|
|
- let endMonth = Number(endtime[1]);
|
|
|
|
- let start = new Date(starts*1000).toLocaleDateString();
|
|
|
|
- let starttime = start.split("/");
|
|
|
|
- let startYear = Number(starttime[0]);
|
|
|
|
- let startMonth = Number(starttime[1]);
|
|
|
|
|
|
+ let endYear = new Date(ends*1000).getFullYear();
|
|
|
|
+ let endMonth = new Date(ends*1000).getMonth()+1;
|
|
|
|
+ let startYear = new Date(starts*1000).getFullYear();
|
|
|
|
+ let startMonth = new Date(starts*1000).getMonth()+1;
|
|
let year = "";
|
|
let year = "";
|
|
let month = "";
|
|
let month = "";
|
|
if(endYear > startYear){
|
|
if(endYear > startYear){
|
|
@@ -684,17 +657,13 @@
|
|
}
|
|
}
|
|
}, false);
|
|
}, false);
|
|
//
|
|
//
|
|
- var nowDate = new Date(startTime).toLocaleDateString();
|
|
|
|
- nowDate = nowDate.split("/");
|
|
|
|
- var nowMonth = Number(nowDate[1]);
|
|
|
|
- var nowYear = Number(nowDate[0]);
|
|
|
|
- var nowDay = Number(nowDate[2]);
|
|
|
|
|
|
+ var nowMonth = new Date(startTime).getMonth()+1;
|
|
|
|
+ var nowYear = new Date(startTime).getFullYear();
|
|
|
|
+ var nowDay = new Date(startTime).getDate();
|
|
//
|
|
//
|
|
- var endDate = new Date(endTime).toLocaleDateString();
|
|
|
|
- endDate = endDate.split("/");
|
|
|
|
- var endMonth = Number(endDate[1]);
|
|
|
|
- var endYear = Number(endDate[0]);
|
|
|
|
- var endDay = Number(endDate[2]);
|
|
|
|
|
|
+ var endMonth = new Date(endTime).getMonth()+1;
|
|
|
|
+ var endYear = new Date(endTime).getFullYear();
|
|
|
|
+ var endDay = new Date(endTime).getDate();
|
|
var nowUpgrade = 0;
|
|
var nowUpgrade = 0;
|
|
if(endYear === nowYear){
|
|
if(endYear === nowYear){
|
|
if(endMonth === nowMonth){
|
|
if(endMonth === nowMonth){
|
|
@@ -773,7 +742,6 @@
|
|
}
|
|
}
|
|
//
|
|
//
|
|
$(".save_renew").on("click", function(){
|
|
$(".save_renew").on("click", function(){
|
|
- console.log(nowUpgrade)
|
|
|
|
// let times = $('.choose_item.select_cycle .info').attr('placeholder');
|
|
// let times = $('.choose_item.select_cycle .info').attr('placeholder');
|
|
let times = $('.choose_item.select_cycle .info').val();
|
|
let times = $('.choose_item.select_cycle .info').val();
|
|
if (times.match("月") !== null){
|
|
if (times.match("月") !== null){
|
|
@@ -781,35 +749,43 @@
|
|
}else if (times.match("年") !== null){
|
|
}else if (times.match("年") !== null){
|
|
times = 12 * Number(times.replace("年",""));
|
|
times = 12 * Number(times.replace("年",""));
|
|
}
|
|
}
|
|
- // 当续费时间 + 当前已经买的时间超过36个月,给出提醒
|
|
|
|
- if(times > 36-nowUpgrade){
|
|
|
|
- var overtimeWarning = `最长订阅周期不可超过3年<br />当前订阅周期:${nowUpgrade}个月`
|
|
|
|
- weui.toast(overtimeWarning, {
|
|
|
|
- duration: 3000,
|
|
|
|
- className: 'custom-toast',
|
|
|
|
- callback: function() {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
+ //
|
|
|
|
+ let payTypes = sessionStorage.payTypes;
|
|
|
|
+ let payType = "";
|
|
|
|
+ if(payTypes === "wx"){
|
|
|
|
+ payType = "wx_app";
|
|
|
|
+ }else if(payTypes === "alipy"){
|
|
|
|
+ payType = "alipy_app";
|
|
|
|
+ }
|
|
$(".save_renew").attr("disabled","disabled");
|
|
$(".save_renew").attr("disabled","disabled");
|
|
var param = {
|
|
var param = {
|
|
"area": JSON.stringify(area),
|
|
"area": JSON.stringify(area),
|
|
"industry": buyerclass.toString(),
|
|
"industry": buyerclass.toString(),
|
|
"time": $('.choose_item.select_cycle .info').val(),
|
|
"time": $('.choose_item.select_cycle .info').val(),
|
|
- "payWay":"wx_js",
|
|
|
|
|
|
+ "payWay":payType,
|
|
"pay_source": "Renew",
|
|
"pay_source": "Renew",
|
|
"endtime": ends,
|
|
"endtime": ends,
|
|
}
|
|
}
|
|
console.log(param)
|
|
console.log(param)
|
|
- $DoPost("/subscribepay/renewUpgrade/renewUpgradeCreateOrder",param,function(r){
|
|
|
|
- if(r.success){
|
|
|
|
|
|
+ $DoPost("/subscribepay/renewUpgrade/renewUpgradeCreateOrder", param, function (r) {
|
|
|
|
+ if (r.success) {
|
|
|
|
+ //唤起app支付
|
|
|
|
+ try {
|
|
|
|
+ if (pay_way == "wx_app") {
|
|
|
|
+ JyObj.wxPay(r.data.res);
|
|
|
|
+ } else {
|
|
|
|
+ JyObj.aliPay(r.data.res)
|
|
|
|
+ }
|
|
|
|
+ //校验是否支付完成
|
|
|
|
+ checkpay(r.data.code);
|
|
|
|
+ } catch (e) {
|
|
|
|
+ alert(e)
|
|
|
|
+ }
|
|
clearSessionStorage();
|
|
clearSessionStorage();
|
|
- onBridgeReady(JSON.parse(r.data.res),r.data.code);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ $(".save_renew").removeAttr("disabled")
|
|
}
|
|
}
|
|
- $(".save_renew").removeAttr("disabled");
|
|
|
|
- })
|
|
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
|
|
//
|
|
//
|
|
@@ -820,7 +796,24 @@
|
|
sessionStorage.removeItem("renew_finally_price");
|
|
sessionStorage.removeItem("renew_finally_price");
|
|
sessionStorage.removeItem("buyChecks");
|
|
sessionStorage.removeItem("buyChecks");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ //
|
|
|
|
+ //校验是否支付
|
|
|
|
+ var interval;
|
|
|
|
+
|
|
|
|
+ function checkpay(orderid) {
|
|
|
|
+ if (interval) {
|
|
|
|
+ clearInterval(interval);
|
|
|
|
+ }
|
|
|
|
+ interval = setInterval(function () {
|
|
|
|
+ $.post("/jypay/isPaySuccess", {code: orderid}, function (r) {
|
|
|
|
+ if (r.success) {
|
|
|
|
+ clearInterval(interval);
|
|
|
|
+ clearSessionStorage();
|
|
|
|
+ window.location.replace("/jyapp/vipsubscribe/toPaySuccessPage?orderCode=" + orderid);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }, 2000)
|
|
|
|
+ }
|
|
//
|
|
//
|
|
function checkObj(obj) {
|
|
function checkObj(obj) {
|
|
//检验数组
|
|
//检验数组
|