|
@@ -19,6 +19,7 @@ var renew = {
|
|
|
isTrial: false,
|
|
|
renewList: []
|
|
|
},
|
|
|
+ isMaxTime:false,
|
|
|
init: function () {
|
|
|
this.initEvents()
|
|
|
this.recoverState()
|
|
@@ -141,6 +142,8 @@ var renew = {
|
|
|
if (size) {
|
|
|
// 初始化上次选择的商品规格
|
|
|
coupon.updatePrice(size.price / 100)
|
|
|
+ // 校验本次选择的周期是否达到3年的最大限制
|
|
|
+ renew.checkOver3Years(goodsSize.getTimeSelect(size.period))
|
|
|
} else {
|
|
|
// 初始化默认一个月*省份数量或全国价格
|
|
|
sessionStorage.removeItem('$select-coupon')
|
|
@@ -149,12 +152,13 @@ var renew = {
|
|
|
} else {
|
|
|
coupon.updatePrice(3800*count / 100)
|
|
|
}
|
|
|
+ // 校验本次选择的周期是否达到3年的最大限制
|
|
|
+ renew.checkOver3Years(goodsSize.getTimeSelect('1月'))
|
|
|
}
|
|
|
} else {
|
|
|
// 旧规则初始化价格
|
|
|
coupon.updatePrice(this.price / 100)
|
|
|
}
|
|
|
- // coupon.updatePrice(this.price / 100)
|
|
|
},
|
|
|
// 根据选中结果得到续费了多长时间的字符串
|
|
|
getDuration: function (timeSelect) {
|
|
@@ -226,18 +230,22 @@ var renew = {
|
|
|
// 续费后套餐剩余月数(需要加上原剩余月数lastMonth)
|
|
|
var renewMonthTotalStamp = lastMonthStamp + durationStamp
|
|
|
var renewMonthTotal = Math.round(renewMonthTotalStamp / (60 * 60 * 24 * 30))
|
|
|
-
|
|
|
+ console.log(renewMonthTotal, maxEndMonth)
|
|
|
if (renewMonthTotal > maxEndMonth) {
|
|
|
var showTipText = '<div style="white-space: nowrap;">最长订阅周期不可超过3年</div>剩余周期:' + this.monthToYear(lastMonth).str
|
|
|
weui.toast(showTipText, {
|
|
|
duration: 3000,
|
|
|
className: 'jy-toast',
|
|
|
})
|
|
|
+ renew.isMaxTime = true
|
|
|
// 确认按钮置灰
|
|
|
$('#enter_period').prop('disabled', true)
|
|
|
} else {
|
|
|
+ renew.isMaxTime = false
|
|
|
$('#enter_period').prop('disabled', false)
|
|
|
}
|
|
|
+ console.log(renew.isMaxTime,'renew.isMaxTime')
|
|
|
+ renew.flushSubmit()
|
|
|
},
|
|
|
// 是否展示即将到期
|
|
|
checkShowDueTip () {
|
|
@@ -299,7 +307,7 @@ var renew = {
|
|
|
},
|
|
|
// 是否可提交
|
|
|
flushSubmit: function () {
|
|
|
- if (this.timeCheckOk && sessionStorage.getItem("vipSub_read") === "true") {
|
|
|
+ if (this.timeCheckOk && sessionStorage.getItem("vipSub_read") === "true" && !this.isMaxTime) {
|
|
|
$('.vip-footer.renew .confirm').prop('disabled', false)
|
|
|
coupon.checkboxStatus = true
|
|
|
coupon.$refs.couponRef.submitStatus = false
|
|
@@ -611,9 +619,26 @@ var goodsSize = new Vue({
|
|
|
},
|
|
|
getGoodSize: function(data) {
|
|
|
// console.log(data, '父组件接收子组件传来的商品规格')
|
|
|
+ renew.checkOver3Years(this.getTimeSelect(data.period))
|
|
|
sessionStorage.removeItem('$select-coupon')
|
|
|
this.defaultSize = data
|
|
|
coupon.updatePrice(data.price/100)
|
|
|
+ },
|
|
|
+ getTimeSelect: function(data) {
|
|
|
+ var time;
|
|
|
+ switch (data) {
|
|
|
+ case '1月':
|
|
|
+ time = [1,2]
|
|
|
+ break;
|
|
|
+ case '1季':
|
|
|
+ time = [3,2]
|
|
|
+ break;
|
|
|
+ case '1年':
|
|
|
+ time = [1,1]
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ console.log(time)
|
|
|
+ return time
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -660,7 +685,7 @@ var coupon = new Vue({
|
|
|
checkSubmitStatus: function (checkStatus) {
|
|
|
sessionStorage.setItem("vipSub_read", checkStatus)
|
|
|
renew.flushSubmit()
|
|
|
- return renew.timeCheckOk && sessionStorage.getItem("vipSub_read") === "true"
|
|
|
+ return renew.timeCheckOk && sessionStorage.getItem("vipSub_read") === "true" && !renew.isMaxTime
|
|
|
},
|
|
|
saveEvent: function () {
|
|
|
renew.saveState()
|