|
@@ -29,13 +29,19 @@ $(function () {
|
|
|
if (list[i].buyset.areacount === -1) {
|
|
|
showArea = "全国"
|
|
|
} else {
|
|
|
- showArea = list[i].buyset.areacount + "个省";
|
|
|
+ if (list[i].buyset.areacount > 0) {
|
|
|
+ showArea = list[i].buyset.areacount + "个省";
|
|
|
+ }
|
|
|
if (list[i].buyset.citys.length > 0) {
|
|
|
var cityCount = 0;
|
|
|
for (var j = 0; j < list[i].buyset.citys.length; j++) {
|
|
|
cityCount += list[i].buyset.citys[j];
|
|
|
}
|
|
|
- showArea += "、" + 3 + "个市(分布在" + list[i].buyset.citys.length + "个省内)";
|
|
|
+ if (list[i].buyset.areacount > 0) showArea += "、";
|
|
|
+ showArea += cityCount + "个市";
|
|
|
+ if (showArea > 1) {
|
|
|
+ showArea += "(分布在" + list[i].buyset.citys.length + "个省内)"
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
var industryShow = "";
|
|
@@ -91,6 +97,11 @@ $(function () {
|
|
|
|
|
|
// 设置已选择的区域和行业
|
|
|
function setSelectedAreaAndInd(selected) {
|
|
|
+ // buySet = {
|
|
|
+ // areacount: 2,
|
|
|
+ // buyerclasscount: 2,
|
|
|
+ // newcitys: []
|
|
|
+ // }
|
|
|
// 设置已选择区域
|
|
|
var citySum = arrSum(selected.citys);
|
|
|
var text = {
|
|
@@ -156,15 +167,14 @@ $(function () {
|
|
|
|
|
|
function showTimeOut(endTime, isTrail) {
|
|
|
var timeSub = endTime * 1000 - new Date().getTime();
|
|
|
- console.log("timeSub", timeSub);
|
|
|
if (timeSub > 0 && timeSub < 60 * 60 * 24 * 1000 * 3) {
|
|
|
var hours = Math.floor(timeSub / (60 * 60 * 1000));
|
|
|
var day = Math.floor(hours / 24);
|
|
|
if (day > 0) {
|
|
|
if (!isTrail) {
|
|
|
- $(".vip-header .expire-remind .remind-text").text("VIP订阅服务还有" + (day) + "天到期,请及时续费!");
|
|
|
+ $(".vip-header .expire-remind .remind-text").text("VIP订阅服务还有" + (day + 1) + "天到期,请及时续费!");
|
|
|
} else {
|
|
|
- $(".vip-header .expire-remind .remind-text").text("VIP订阅服务还有" + (day) + "天到期,请及时购买!");
|
|
|
+ $(".vip-header .expire-remind .remind-text").text("VIP订阅服务还有" + (day + 1) + "天到期,请及时购买!");
|
|
|
}
|
|
|
} else {
|
|
|
if (!isTrail) {
|
|
@@ -177,10 +187,6 @@ $(function () {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function clearSession() {
|
|
|
- sessionStorage.removeItem("vip_index_read");
|
|
|
- sessionStorage.removeItem('sub_vip_state');
|
|
|
- }
|
|
|
|
|
|
function arrSum(arr) {
|
|
|
var sum = 0
|
|
@@ -244,7 +250,6 @@ $(function () {
|
|
|
sessionStorage.setItem("vip_index_read", state ? "1" : "0");
|
|
|
});
|
|
|
|
|
|
-
|
|
|
// switch点击切换
|
|
|
$('.switch').on('click', function (e) {
|
|
|
var $this = $(this);
|
|
@@ -266,15 +271,53 @@ $(function () {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
- //保存取消提示 module 1 修改 2升级
|
|
|
+ //返回提示使用
|
|
|
+ function pushHistory() {
|
|
|
+ var state = {
|
|
|
+ title: "title",
|
|
|
+ url: "#"
|
|
|
+ };
|
|
|
+ window.history.pushState(state, "title", "#");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ function initBack(module) {
|
|
|
+ pushHistory();
|
|
|
+ //weui.toast(module);
|
|
|
+ $('.vip-footer .button-l.reset').off("click").on("click", function () {
|
|
|
+ cancelTip(module);
|
|
|
+ });
|
|
|
+ window.addEventListener("popstate", function (e) {
|
|
|
+ cancelTip(module);
|
|
|
+ pushHistory();
|
|
|
+ }, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存取消提示 module 1 修改 2升级 3续费 4购买
|
|
|
function cancelTip(module) {
|
|
|
+ var content = "";
|
|
|
+ var labName = "";
|
|
|
+ if (module === 1) {
|
|
|
+ content = "所选订阅设置已做修改,返回后修改的设置将不做保存。";
|
|
|
+ labName = "保存修改";
|
|
|
+ } else if (module === 2) {
|
|
|
+ content = "所选订阅设置已超出购买范围,升级后方才生效,返回后修改的设置将不做保存。";
|
|
|
+ labName = "立即升级"
|
|
|
+ } else if (module === 3) {
|
|
|
+ content = "所选订阅设置已超出购买范围,续费后方才生效,返回后修改的设置将不做保存。";
|
|
|
+ labName = "立即续费"
|
|
|
+ } else {
|
|
|
+ content = "所选订阅设置已超出购买范围,购买后方才生效,返回后修改的设置将不做保存。";
|
|
|
+ labName = "立即购买"
|
|
|
+ }
|
|
|
+
|
|
|
weui.dialog({
|
|
|
title: '提示信息',
|
|
|
- content: module == 1 ? '所选订阅设置已做修改,返回后修改的设置将不做保存。' : '所选订阅设置已超出购买范围,升级后方才生效,返回后修改的设置将不做保存。',
|
|
|
+ content: content,
|
|
|
className: 'jy-dialog',
|
|
|
buttons: [
|
|
|
{
|
|
|
- label: module == 1 ? '保存修改' : '立即升级',
|
|
|
+ label: labName,
|
|
|
type: 'primary',
|
|
|
onClick: function () {
|
|
|
doSubmit();
|
|
@@ -284,8 +327,8 @@ $(function () {
|
|
|
label: '取消',
|
|
|
type: 'default',
|
|
|
onClick: function () {
|
|
|
- clearSession()
|
|
|
- window.history.go(-1);
|
|
|
+ clearSessionStorage();
|
|
|
+ window.history.go(-2);
|
|
|
}
|
|
|
}
|
|
|
]
|
|
@@ -479,9 +522,11 @@ $(function () {
|
|
|
}
|
|
|
if (change) {
|
|
|
var afterEndTime;
|
|
|
- if (state.isTrial) $(".body-item.cycle .tip").text(change);
|
|
|
-
|
|
|
- $(".body-item.cycle .tip").show();
|
|
|
+ if (state.isTrial) {
|
|
|
+ $(".body-item.cycle .tip").text(change).show();
|
|
|
+ } else {
|
|
|
+ $(".body-item.cycle .tip").text("延长订阅周期" + change).show();
|
|
|
+ }
|
|
|
if (change.indexOf("月") > -1) {
|
|
|
var monthNum = parseInt(change.replace("个月", ""));
|
|
|
afterEndTime = getVipEndDate(2, monthNum, endflag);
|
|
@@ -555,7 +600,7 @@ $(function () {
|
|
|
var tmp1 = getAreaClassArr(reqData.oldArea);
|
|
|
var tmp2 = getAreaClassArr(reqData.area);
|
|
|
var areaNoChange = (JSON.stringify(tmp1[0].sort()) === JSON.stringify(tmp2[0].sort())) && (JSON.stringify(tmp1[1].sort()) === JSON.stringify(tmp2[1].sort()));
|
|
|
- if (IndustryNoChange && areaNoChange && changeTime.length == 0) {
|
|
|
+ if (IndustryNoChange && areaNoChange && changeTime.length === 0) {
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -573,16 +618,15 @@ $(function () {
|
|
|
});
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if (status[0] === -1) {
|
|
|
//直接修改
|
|
|
$(".vip-footer.modify").show();
|
|
|
-
|
|
|
- $('.vip-footer .button-l.reset').on("click", function () {
|
|
|
- cancelTip(1);
|
|
|
- });
|
|
|
+ initBack(1);
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ initBack(2);
|
|
|
+
|
|
|
//区域需要升级
|
|
|
if (status[1]) {
|
|
|
if (reqData.isTrial) {
|
|
@@ -604,6 +648,7 @@ $(function () {
|
|
|
});
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
if (status[0] > 0) {
|
|
|
//需要付钱
|
|
|
$(".vip-footer.upgrade").show();
|
|
@@ -613,8 +658,11 @@ $(function () {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (!status[1] && !status[2]) {
|
|
|
+ if (!status[1] && !status[2]) { //续费
|
|
|
+ console.log("wwwwwwwwwww")
|
|
|
+ initBack(3);
|
|
|
$(".vip-footer.upgrade .confirm").text("立即续费");
|
|
|
+ $(".jy-dialog .weui-dialog__bd").text("所选订阅设置已超出购买范围,续费后方才生效,返回后修改的设置将不做保存。")
|
|
|
} else {
|
|
|
//升级展示计价清单
|
|
|
if (!reqData.isTrial) {
|
|
@@ -626,11 +674,12 @@ $(function () {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (reqData.isTrial) $(".vip-footer.upgrade .confirm").text("立即购买");
|
|
|
+ if (reqData.isTrial) {//购买
|
|
|
+ initBack(4);
|
|
|
+ $(".vip-footer.upgrade .confirm").text("立即购买");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- $('.vip-footer .button-l.reset').on("click", function () {
|
|
|
- cancelTip(2);
|
|
|
- })
|
|
|
} else {
|
|
|
getDataWitXHR()
|
|
|
}
|
|
@@ -662,7 +711,8 @@ $(function () {
|
|
|
} else {
|
|
|
//订阅修改
|
|
|
if (r.data.doSuccess) {
|
|
|
- window.history.go(-1);
|
|
|
+ clearSessionStorage();
|
|
|
+ window.location.reload();
|
|
|
} else {
|
|
|
weui.toast('修改保存失败', {
|
|
|
duration: 1500,
|