|
@@ -9,13 +9,13 @@
|
|
|
<title>VIP订阅升级</title>
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
|
- <script src="/jyapp/vipsubscribe/js/rem.js?v={{Msg "seo" "version"}}"></script>
|
|
|
+ <!--<script src="/jyapp/vipsubscribe/js/rem.js?v={{Msg "seo" "version"}}"></script>-->
|
|
|
<link rel="stylesheet" type="text/css" href="/jyapp/vipsubscribe/css/weui.min.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" href="/jyapp/vipsubscribe/css/public.css?v={{Msg "seo" "version"}}">
|
|
|
<link rel="stylesheet" href="/jyapp/vipsubscribe/css/vip_update.css?v={{Msg "seo" "version"}}4">
|
|
|
- {{include "/common/weixin.html"}}
|
|
|
+ {{include "/common/js.html"}}
|
|
|
</head>
|
|
|
<style type="text/css">
|
|
|
body,html {
|
|
@@ -26,12 +26,17 @@
|
|
|
}
|
|
|
.vip_update .fixed-bottom-box, .vip_renew .fixed-bottom-box {
|
|
|
width: 100%;
|
|
|
- position: fixed;
|
|
|
+ position: static;
|
|
|
bottom: 0;
|
|
|
left: 0;
|
|
|
}
|
|
|
</style>
|
|
|
<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_update">
|
|
|
<div class="choose_condition">
|
|
|
<p class="update_tip">提示:订阅升级可在已购买的服务基础上,增加区域、行业、以及延长订阅周期!</p>
|
|
@@ -282,7 +287,7 @@
|
|
|
<p><img src="/jyapp/vipsubscribe/image/weixin.png">微信支付</p>
|
|
|
</div>
|
|
|
<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>
|
|
|
</div>
|
|
|
</label>
|
|
@@ -291,7 +296,7 @@
|
|
|
<p><img src="/jyapp/vipsubscribe/image/zhifubao.png">支付宝支付</p>
|
|
|
</div>
|
|
|
<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>
|
|
|
</div>
|
|
|
</label>
|
|
@@ -300,75 +305,11 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
<script src="/jyapp/vipsubscribe/js/jquery-2.1.4.js"></script>
|
|
|
<!--<script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>-->
|
|
|
<script src="/jyapp/vipsubscribe/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
|
|
|
<script src="/jyapp/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}3"></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"){
|
|
|
- //
|
|
|
- clearSessionStorage();
|
|
|
- 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>
|
|
|
$(function () {
|
|
|
var isPageHide = false;
|
|
@@ -444,10 +385,8 @@
|
|
|
// 选择生效日期
|
|
|
$('.choose_effect_date > a').click(function () {
|
|
|
$('#effective_date').show(200);
|
|
|
- var nowDates = new Date().toLocaleDateString();
|
|
|
- nowDates = nowDates.split("/");
|
|
|
- var nowMonths = Number(nowDates[1]);
|
|
|
- var nowYears = Number(nowDates[0]);
|
|
|
+ var nowMonths = new Date().getMonth()+1;
|
|
|
+ var nowYears = new Date().getFullYear();
|
|
|
var as = nowMonths +1;
|
|
|
if(as > 12){
|
|
|
as = as-12;
|
|
@@ -839,9 +778,12 @@
|
|
|
}else if(payType === "alipy"){
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
if(sessionStorage.upgrade_cyclecount!==undefined&&sessionStorage.upgrade_cycleunit!==undefined){
|
|
@@ -952,17 +894,13 @@
|
|
|
$(".save_upgrade").attr('disabled','disabled');
|
|
|
var nowUpgrade = "";
|
|
|
//
|
|
|
- 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 oldPrice = "";
|
|
|
var price = "";
|
|
|
var effect = "";
|
|
@@ -1235,13 +1173,11 @@
|
|
|
let effective = $("#effect_date_name").text();
|
|
|
var effect = "now";
|
|
|
if(effective !== "立即生效,需支付当月费用差价"){
|
|
|
- let nowDate = new Date().toLocaleDateString();
|
|
|
- nowDate = nowDate.split("/");
|
|
|
- let nowMonth = Number(nowDate[1]);
|
|
|
- let nowYear = Number(nowDate[0]);
|
|
|
+ let nowMonth = new Date().getMonth()+1;
|
|
|
+ let nowYear = new Date().getFullYear();
|
|
|
let a = nowMonth +1
|
|
|
if(a > 12){
|
|
|
- a = nowMonth-12;
|
|
|
+ a = a-12;
|
|
|
nowYear = nowYear +1;
|
|
|
}
|
|
|
let b = nowYear+"/"+a+"/1";
|
|
@@ -1266,25 +1202,46 @@
|
|
|
if(renew_time !== "不延长"){
|
|
|
times = $('.choose_item.lengthen .info').text();
|
|
|
}
|
|
|
+ //
|
|
|
+ let payTypes = sessionStorage.payType;
|
|
|
+ let payType = "";
|
|
|
+ if(payTypes === "wx"){
|
|
|
+ payType = "wx_app";
|
|
|
+ }else if(payTypes === "alipy"){
|
|
|
+ payType = "alipy_app";
|
|
|
+ }
|
|
|
//
|
|
|
var param = {
|
|
|
"area": JSON.stringify(areas),
|
|
|
"industry": industrys.join(","),
|
|
|
"areas": JSON.stringify(areaarr),
|
|
|
"industryarr": industryarr.join(","),
|
|
|
- "payWay": "wx_js",
|
|
|
+ "payWay": payType,
|
|
|
"effect": effect,
|
|
|
"pay_source" : "Upgrade",
|
|
|
"time": times,
|
|
|
"nowUp": Number(nowRenew),
|
|
|
}
|
|
|
console.log(param)
|
|
|
- $DoPost("/subscribepay/renewUpgrade/renewUpgradeCreateOrder",param,function(r){
|
|
|
- if(r.success){
|
|
|
- onBridgeReady(JSON.parse(r.data.res),r.data.code);
|
|
|
+ $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();
|
|
|
+ } else {
|
|
|
+ $(".save_upgrade").removeAttr("disabled")
|
|
|
}
|
|
|
- $(".save_upgrade").removeAttr("disabled");
|
|
|
- })
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
//
|
|
@@ -1298,8 +1255,24 @@
|
|
|
sessionStorage.removeItem("effectiveDate");
|
|
|
sessionStorage.removeItem("buyCheck");
|
|
|
}
|
|
|
-
|
|
|
//
|
|
|
+ //校验是否支付
|
|
|
+ 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) {
|
|
|
//检验数组
|