Browse Source

fix: 初始化超级订阅金额计算问题

cuiyalong 4 years ago
parent
commit
c987f7c773

+ 15 - 7
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_renew.js

@@ -13,7 +13,8 @@ var renew = {
         buyset: {
             areacount: 0,
             newcitys: [],
-            buyerclasscount: 3
+            buyerclasscount: 0,
+            upgrade: 0
         },
         isTrial: false,
         renewList: []
@@ -48,8 +49,8 @@ var renew = {
             result.area = strArr.join('、')
         }
 
-        // 行业(3个行业价格和全部行业价格相同,当购买3个以上行业页面显示全部行业)
-        if (buySet.buyerclasscount === -1 || buySet.buyerclasscount >= 3) {
+        // 行业
+        if (buySet.buyerclasscount === -1) {
             result.industry = '全部行业'
         } else {
             result.industry = buySet.buyerclasscount + '个行业'
@@ -78,8 +79,13 @@ var renew = {
                     _this.calcDuration(true)
                     // 初始化价格计算类
                     Calculation.Init(
-                        false,
-                        new Buyset(_this.buyInfo.buyset.areacount, _this.buyInfo.buyset.newcitys, _this.buyInfo.buyset.buyerclasscount)
+                        _this.buyInfo.isTrial,
+                        new Buyset(
+                            _this.buyInfo.buyset.areacount,
+                            _this.buyInfo.buyset.newcitys,
+                            _this.buyInfo.buyset.buyerclasscount,
+                            _this.buyInfo.buyset.upgrade
+                        )
                     )
                     // 初始化默认金额
                     _this.setPrice(_this.calcPrice())
@@ -293,9 +299,8 @@ var renew = {
                 type: 'POST',
                 data: data,
                 success: function (r) {
-                    $('.vip-footer.renew .confirm').prop('disabled', false)
-                    clearSessionStorage()
                     if (r.success) {
+                        clearSessionStorage()
                         try {
                             history.replaceState({}, '', '/jyapp/vipsubscribe/toOrderDetailPage?orderCode=' + r.data.code);
                             window.location.href = "/jyapp/pay/checkout_subvip?orderCode=" + r.data.code + "&t=1&from=buy"
@@ -306,6 +311,9 @@ var renew = {
                         showToast(r.errMsg || '请求失败')
                     }
                     
+                },
+                complete: function () {
+                    $('.vip-footer.renew .confirm').prop('disabled', false)
                 }
             })
         })

+ 15 - 7
src/web/staticres/vipsubscribe/js/vip_renew.js

@@ -13,7 +13,8 @@ var renew = {
         buyset: {
             areacount: 0,
             newcitys: [],
-            buyerclasscount: 3
+            buyerclasscount: 0,
+            upgrade: 0
         },
         isTrial: false,
         renewList: []
@@ -48,8 +49,8 @@ var renew = {
             result.area = strArr.join('、')
         }
 
-        // 行业(3个行业价格和全部行业价格相同,当购买3个以上行业页面显示全部行业)
-        if (buySet.buyerclasscount === -1 || buySet.buyerclasscount >= 3) {
+        // 行业
+        if (buySet.buyerclasscount === -1) {
             result.industry = '全部行业'
         } else {
             result.industry = buySet.buyerclasscount + '个行业'
@@ -78,8 +79,13 @@ var renew = {
                     _this.calcDuration(true)
                     // 初始化价格计算类
                     Calculation.Init(
-                        false,
-                        new Buyset(_this.buyInfo.buyset.areacount, _this.buyInfo.buyset.newcitys, _this.buyInfo.buyset.buyerclasscount)
+                        _this.buyInfo.isTrial,
+                        new Buyset(
+                            _this.buyInfo.buyset.areacount,
+                            _this.buyInfo.buyset.newcitys,
+                            _this.buyInfo.buyset.buyerclasscount,
+                            _this.buyInfo.buyset.upgrade
+                        )
                     )
                     // 初始化默认金额
                     _this.setPrice(_this.calcPrice())
@@ -293,9 +299,8 @@ var renew = {
                 type: 'POST',
                 data: data,
                 success: function (r) {
-                    $('.vip-footer.renew .confirm').prop('disabled', false)
-                    clearSessionStorage()
                     if (r.success) {
+                        clearSessionStorage()
                         try {
                             history.replaceState({}, '', '/front/vipsubscribe/toOrderDetailPage?orderCode=' + r.data.code);
                             window.location.href = "/weixin/pay/checkout_subvip?t=1&orderCode=" + r.data.code;
@@ -306,6 +311,9 @@ var renew = {
                         showToast(r.errMsg || '请求失败')
                     }
                     
+                },
+                complete: function () {
+                    $('.vip-footer.renew .confirm').prop('disabled', false)
                 }
             })
         })