|
@@ -76,9 +76,11 @@ var vm = new Vue({
|
|
|
},
|
|
|
watch: {
|
|
|
'charge.count': function () {
|
|
|
+ this.sortPrice()
|
|
|
this.calcPrice()
|
|
|
},
|
|
|
specActive: function () {
|
|
|
+ this.sortPrice()
|
|
|
this.calcPrice()
|
|
|
}
|
|
|
},
|
|
@@ -131,7 +133,8 @@ var vm = new Vue({
|
|
|
loading && loading.clear()
|
|
|
if (res) {
|
|
|
Object.assign(_this.priceInfo, res)
|
|
|
- _this.sortPrice(res)
|
|
|
+ _this.initPageInfo()
|
|
|
+ _this.sortPrice()
|
|
|
_this.calcPrice()
|
|
|
}
|
|
|
},
|
|
@@ -140,17 +143,15 @@ var vm = new Vue({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- sortPrice: function (info) {
|
|
|
- var discount = info.discount
|
|
|
- this.charge.discount = discount
|
|
|
- this.charge.duration = info.packs_validityYear
|
|
|
- // 标准字段包
|
|
|
- this.specList[0].before = info.unitPrice_normal // 普通字段包单价,单位元
|
|
|
- this.specList[0].price = info.unitPrice_normal * discount
|
|
|
- // 高级字段包
|
|
|
- this.specList[1].before = info.unitPrice_senior // 高级字段包单价,单位元
|
|
|
- this.specList[1].price = info.unitPrice_senior * discount
|
|
|
+ // 根据请求返回值初始化页面参数
|
|
|
+ initPageInfo: function () {
|
|
|
+ var info = this.priceInfo
|
|
|
+ // 总折扣
|
|
|
+ this.charge.discount = info.discount
|
|
|
|
|
|
+ // 有效时间
|
|
|
+ this.charge.duration = info.packs_validityYear
|
|
|
+
|
|
|
var list = []
|
|
|
if (Array.isArray(info.packs_showList)) {
|
|
|
info.packs_showList.forEach(function (item) {
|
|
@@ -166,8 +167,28 @@ var vm = new Vue({
|
|
|
this.charge.count = this.chargeCount.value
|
|
|
}
|
|
|
},
|
|
|
+ // 计算卡片展示金额
|
|
|
+ sortPrice: function () {
|
|
|
+ var info = this.priceInfo
|
|
|
+
|
|
|
+ // 获取被选中的条数info
|
|
|
+ var countItem = this.getCountItem()
|
|
|
+
|
|
|
+ // 条数折扣
|
|
|
+ var cDiscount = this.specActive == 1 ? countItem.senior_discount : countItem.normal_discount
|
|
|
+
|
|
|
+ // 普通字段包单价,单位元
|
|
|
+ this.specList[0].before = info.unitPrice_normal
|
|
|
+ this.specList[0].price = info.unitPrice_normal * cDiscount * info.discount
|
|
|
+ // 高级字段包单价,单位元
|
|
|
+ this.specList[1].before = info.unitPrice_senior
|
|
|
+ this.specList[1].price = info.unitPrice_senior * cDiscount * info.discount
|
|
|
+ },
|
|
|
+ // 计算卡片展示金额 和 支付总金额
|
|
|
calcPrice: function () {
|
|
|
+ // 获取被选中的规格卡片info
|
|
|
var specItem = this.getSpecItem()
|
|
|
+ // 获取被选中的条数info
|
|
|
var countItem = this.getCountItem()
|
|
|
// 数据包折扣
|
|
|
var discount = this.charge.discount
|
|
@@ -183,6 +204,7 @@ var vm = new Vue({
|
|
|
|
|
|
this.updatePrice(this.price.after, this.price.before)
|
|
|
},
|
|
|
+ // 获取被选中的规格卡片info
|
|
|
getSpecItem: function () {
|
|
|
var _this = this
|
|
|
var t = {}
|
|
@@ -195,6 +217,7 @@ var vm = new Vue({
|
|
|
})
|
|
|
return t
|
|
|
},
|
|
|
+ // 获取被选中的条数info
|
|
|
getCountItem: function () {
|
|
|
var _this = this
|
|
|
var t = {}
|
|
@@ -207,6 +230,9 @@ var vm = new Vue({
|
|
|
})
|
|
|
return t
|
|
|
},
|
|
|
+ chargeCountPopupClosed: function () {
|
|
|
+ this.chargeCount.value = this.chargeCount.infoList[0].value
|
|
|
+ },
|
|
|
clickSpec: function (item) {
|
|
|
this.specActive = item.id
|
|
|
},
|
|
@@ -256,10 +282,10 @@ var vm = new Vue({
|
|
|
loading && loading.clear()
|
|
|
if (res.error_code === 0 && res.data) {
|
|
|
if (utils.isWeiXinBrowser) {
|
|
|
- history.replaceState({}, '', '/front/wx_dataExport/wxToOrderDetail?orderCode=' + res.data.orderCode);
|
|
|
+ history.replaceState({}, '', '/weixin/common/dataPack/orderDetail?order_code=' + res.data.orderCode);
|
|
|
location.href = '/weixin/pay/checkout_dataPack?orderCode=' + res.data.orderCode
|
|
|
} else {
|
|
|
- history.replaceState({}, '', '/jyapp/front/dataExport/toOrderDetail?orderCode=' + res.data.orderCode);
|
|
|
+ history.replaceState({}, '', '/jyapp/common/dataPack/orderDetail?order_code=' + res.data.orderCode);
|
|
|
location.href = "/jyapp/pay/checkout_dataPack?orderCode=" + res.data.orderCode + '&from=buy'
|
|
|
}
|
|
|
}
|