|
@@ -20,10 +20,11 @@ var renew = {
|
|
|
renewList: []
|
|
|
},
|
|
|
init: function () {
|
|
|
+ this.initEvents()
|
|
|
this.recoverState()
|
|
|
this.getPrice()
|
|
|
this.getBuySetInfo()
|
|
|
- this.initEvents()
|
|
|
+ this.setTimePickerSelected(this.timeSelect)
|
|
|
},
|
|
|
setAreaAndIndustry: function () {
|
|
|
var buySet = this.buyInfo.buyset
|
|
@@ -84,7 +85,7 @@ var renew = {
|
|
|
_this.buyInfo.buyset.areacount,
|
|
|
_this.buyInfo.buyset.newcitys,
|
|
|
_this.buyInfo.buyset.buyerclasscount,
|
|
|
- _this.buyInfo.buyset.upgrade
|
|
|
+ _this.buyInfo.buyset.upgrade || 0
|
|
|
)
|
|
|
)
|
|
|
// 初始化默认金额
|
|
@@ -105,12 +106,14 @@ var renew = {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- calcPrice: function () {
|
|
|
- return Calculation.GetTotal(undefined, this.timeSelect)
|
|
|
+ // 计算价格
|
|
|
+ calcPrice: function (timeSelect) {
|
|
|
+ return Calculation.GetTotal(undefined, timeSelect ? timeSelect : this.timeSelect)
|
|
|
},
|
|
|
+ // 设置价格
|
|
|
setPrice: function (price) {
|
|
|
this.price = price
|
|
|
- coupon.updatePrice(formatMoney(this.price / 100))
|
|
|
+ coupon.updatePrice(this.price / 100)
|
|
|
},
|
|
|
// 根据选中结果得到一个时间段的时间戳
|
|
|
getDuration: function (timeSelect) {
|
|
@@ -173,14 +176,14 @@ var renew = {
|
|
|
month: month
|
|
|
}
|
|
|
},
|
|
|
- checkOver3Years: function () {
|
|
|
+ checkOver3Years: function (timeSelect) {
|
|
|
// 根据
|
|
|
var endTime = this.buyInfo.endTime
|
|
|
if (!endTime) {
|
|
|
return
|
|
|
}
|
|
|
var maxEndMonth = 36 // 最大续费36个月
|
|
|
- var durationInfo = this.getDuration(this.timeSelect)
|
|
|
+ var durationInfo = this.getDuration(timeSelect)
|
|
|
var durationStamp = durationInfo.stamp // 续费时间段时间戳
|
|
|
|
|
|
// 最长订阅周期不可超过3年 ------------
|
|
@@ -213,15 +216,19 @@ var renew = {
|
|
|
}
|
|
|
},
|
|
|
setTimePickerSelected: function (timeSelect) {
|
|
|
- timeSelect = [1 ,2]
|
|
|
- if (timeSelect[1] === 1) {
|
|
|
+ if (timeSelect[1] == 1) {
|
|
|
// 年
|
|
|
- dStamp = timeSelect[0] * 12 * perMonthStamp
|
|
|
- s = timeSelect[0] + '年'
|
|
|
- } else if (timeSelect[1] === 2) {
|
|
|
+ var cButton = $('.year_number.j-button-select[data-id=' + timeSelect[0] + ']')
|
|
|
+ if (cButton) {
|
|
|
+ cButton.trigger('click')
|
|
|
+ } else {
|
|
|
+ $('input[value=year]').trigger('click')
|
|
|
+ }
|
|
|
+ } else if (timeSelect[1] == 2) {
|
|
|
// 月
|
|
|
- dStamp = timeSelect[0] * perMonthStamp
|
|
|
- s = timeSelect[0] + '个月'
|
|
|
+ $('input[value=month]').trigger('click')
|
|
|
+ $('#number_box_month .month_number').text(timeSelect[0] - 1)
|
|
|
+ $('#number_box_month button.add').trigger('click')
|
|
|
}
|
|
|
},
|
|
|
getTimePickerSelected: function () {
|
|
@@ -241,10 +248,10 @@ var renew = {
|
|
|
return timeSelectedArr
|
|
|
},
|
|
|
onTimePickerChange: function () {
|
|
|
- this.timeSelect = this.getTimePickerSelected()
|
|
|
- var price = this.calcPrice()
|
|
|
+ var timeSelect = this.getTimePickerSelected()
|
|
|
+ var price = this.calcPrice(timeSelect)
|
|
|
$('.computed_price').text(formatMoney(price / 100))
|
|
|
- this.checkOver3Years()
|
|
|
+ this.checkOver3Years(timeSelect)
|
|
|
},
|
|
|
// 恢复数据
|
|
|
recoverState: function () {
|
|
@@ -278,8 +285,10 @@ var renew = {
|
|
|
// 确认订阅周期
|
|
|
$('#enter_period').on('click', function () {
|
|
|
$('.weui-mask').trigger('click')
|
|
|
+ _this.timeSelect = _this.getTimePickerSelected()
|
|
|
_this.calcDuration(true)
|
|
|
_this.setPrice(_this.calcPrice())
|
|
|
+ _this.saveState()
|
|
|
})
|
|
|
|
|
|
$('.vip-footer.renew .confirm').on('click', function () {
|
|
@@ -557,6 +566,7 @@ var coupon = new Vue({
|
|
|
// 阅读协议点击事件
|
|
|
readEvent: function () {
|
|
|
renew.saveState()
|
|
|
+ toRead()
|
|
|
},
|
|
|
// 订单提交事件
|
|
|
submitOrder: function () {
|