wangkaiyue 4 жил өмнө
parent
commit
1ac79aa619

+ 19 - 9
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/price.js

@@ -74,15 +74,25 @@ var Calculation = {
             return tmpBuyset.areacount >= oldBuyset.areacount + oldBuyset.citys.length;
         }
     },
-    //首次购买
-    //续费 newBuyset 传入undefined
-    GetTotal: (newBuyset, buyTime = [1, 2]) => { //newBuyset 用户选择的套餐;time[数量,单位(1:年,2月)]
+    /*
+    首次购买 或 单独续费
+    param newBuyset 选择套餐 [*续费时传入undefined]
+          buyTime  [数量,单位(1:年,2月)]
+    return 价格
+    */
+    GetTotal: (newBuyset, buyTime = [1, 2]) => { //newBuyset 用户选择的套餐;
         if (newBuyset) {//首次购买
-            return this.getBuysetPrice(newBuyset, t)
+            return this.getBuysetPrice(newBuyset, buyTime)
         }
-        return this.getBuysetPrice(this.OldBuyset, t)   //续费
+        return this.getBuysetPrice(this.OldBuyset, buyTime)   //续费
     },
-    GetUpgradeDetail: (newBuyset = new Buyset(), buyTime = [1, 2]) => { //升级计价
+    /*
+    套餐升级
+    param  newBuyset 选择套餐
+           buyTime  [数量,单位(1:年,2月)]
+    return 价格、计价清单
+     */
+    GetUpgradeDetail: (newBuyset = new Buyset(), buyTime = [1, 2]) => { //升级计价 time[数量,单位(1:年,2月)]
         let subtotail = []; //计价清单
         let final_price = 0; //最终计算价格
         let nowEndTime = this.EndTime;
@@ -94,7 +104,7 @@ var Calculation = {
                 let old = new Buyset(thisBuyset.areacount, thisBuyset.newcitys, thisBuyset.buyerclasscount, this.upgrade || 0)
                 var this_price = this.GetSubPrice(old, newBuyset, thisStartTime, nowEndTime);
                 if (this_price < 0) {
-                    return [-2, []]
+                    return [-2, []]  //已续费升级异常
                 }
                 //清单数组
                 subtotail.push({
@@ -111,7 +121,7 @@ var Calculation = {
         //现在使用升级价格
         var now_price = this.GetSubPrice(this.OldBuyset, newBuyset, new Date().getTime() / 1000, nowEndTime);
         if (now_price < 0) {
-            return [-2, []]
+            return [-2, []] //当前套餐升级异常
         }
         //清单数组
         subtotail.push({
@@ -126,7 +136,7 @@ var Calculation = {
         if (buyTime.length !== 0) {
             var thisPrice = this.getBuysetPrice(newBuyset, t);
             if (thisPrice < 0) {
-                return [-2, []]
+                return [-2, []] //本次升级中续费时间异常
             }
             console.log(newBuyset, t, "额外升级费用", thisPrice);
             final_price = this.numAdd(final_price, thisPrice);