浏览代码

feat: 超级订阅订单详情升级仅增购服务不展示购买人数2

cuiyalong 1 月之前
父节点
当前提交
7f3ab2ad26

+ 17 - 5
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_order_detail.js

@@ -22,7 +22,7 @@ function calcAccountNum(order) {
     var filter_vip_new = order.new_filter ? JSON.parse(order.new_filter) : {}
     var buyAccountCount = filterInfo.buyAccountCount || filter_vip_new.buyAccountCount || 0
     var giftAccountCount = filterInfo.giftAccountCount || filter_vip_new.giftAccountCount || 0
-    var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount) + 1
+    var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount)
 
     var addAreaCount = filterInfo.addAreaCount || filter_vip_new.addAreaCount || 0
     var onlyAddCount = addAreaCount <= 0 // 仅增购子账号
@@ -36,10 +36,6 @@ function calcAccountNum(order) {
         if (buyAccountCount == 0 && giftAccountCount == 0) {
             buyNumber2 = order.buyNum || filter_vip_new.finalAccountCount || 0
         } else {
-            // 仅增购子账号,不计算主账号数量
-            if (onlyAddCount) {
-                totalAccountCount -= 1
-            }
             buyNumber2 = order.buyNum || totalAccountCount || filter_vip_new.finalAccountCount || 0
         }
     } else {
@@ -48,6 +44,15 @@ function calcAccountNum(order) {
     return buyNumber2
 }
 
+function calcIsOnlyAddPower(order) {
+    var filter_vip = order.filter ? JSON.parse(order.filter) : {}
+    var filter_vip_new = order.new_filter ? JSON.parse(order.new_filter) : {}
+    var buyAccountCount = filter_vip.buyAccountCount || filter_vip_new.buyAccountCount || 0
+    var giftAccountCount = filter_vip.giftAccountCount || filter_vip_new.giftAccountCount || 0
+    var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount)
+    return totalAccountCount <= 0
+}
+
 $(function () {
     var canpay = true;
     var orderCode = decodeURIComponent(getParam("orderCode"));
@@ -85,7 +90,10 @@ $(function () {
                 }
             }
             var filterObjNew = JSON.parse(r.data.order.new_filter || '{}');
+            var order = r.data.order;
             //购买数量
+            var onlyAddPower = calcIsOnlyAddPower(order)
+            var upgrade = order.vip_type == 2 || order.service_type == 3
             if(r.data.order.buy_subject=='2'){
                 var buyAccountNum = calcAccountNum(r.data.order)
                 var num2 = r.data.order.buy_count||buyAccountNum
@@ -96,6 +104,10 @@ $(function () {
               $('.membernum').hide();
 
             }
+            if (onlyAddPower && upgrade) {
+                $('.membernum').parents('.l-item').hide()
+            }
+
             if (!r.data.order.discount_price || (r.data.order.discount_price && r.data.order.discount_price <= 0)) {
             		$(".discountPrice").parent().hide();
             }

+ 1 - 4
src/web/staticres/common-module/order-list/js/order-list.js

@@ -2750,7 +2750,7 @@ var vm = new Vue({
       var filter_vip_new = this.getNewFilterInfo(order)
       var buyAccountCount = filterInfo.buyAccountCount || filter_vip_new.buyAccountCount || 0
       var giftAccountCount = filterInfo.giftAccountCount || filter_vip_new.giftAccountCount || 0
-      var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount) + 1
+      var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount)
 
       var addAreaCount = filterInfo.addAreaCount || filter_vip_new.addAreaCount
       var onlyAddCount = false
@@ -2772,9 +2772,6 @@ var vm = new Vue({
             buyNumber2 = order.buyNum || filter_vip_new.finalAccountCount || 0
         } else {
             // 仅增购子账号,不计算主账号数量
-            if (onlyAddCount) {
-                totalAccountCount -= 1
-            }
             buyNumber2 = order.buyNum || totalAccountCount || filter_vip_new.finalAccountCount || 0
         }
       } else {

+ 3 - 6
src/web/templates/pc/myOrder.html

@@ -1036,7 +1036,7 @@
               var buyAccountCount = v.filter.buyAccountCount || v.newFilter.buyAccountCount || 0
               var giftAccountCount = v.filter.giftAccountCount || v.newFilter.giftAccountCount || 0
               // 购买数量要加上主账号
-              var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount) + 1
+              var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount)
 
               // 续费vip_type=1
               if (v.vip_type == 1) {
@@ -1207,7 +1207,7 @@
               // vip_type: //0:购买 1:续费 2:升级 3:试用
               var buyAccountCount = v.filter.buyAccountCount || v.newFilter.buyAccountCount || 0
               var giftAccountCount = v.filter.giftAccountCount || v.newFilter.giftAccountCount || 0
-              var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount) + 1
+              var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount)
 
               var addAreaCount = v.filter.addAreaCount || v.newFilter.addAreaCount || 0
               // 升级
@@ -1215,7 +1215,7 @@
                 if (addAreaCount <= 0) {
                   vipInfo.onlyAddCount = true
                 }
-                if (totalAccountCount <= 1) {
+                if (totalAccountCount <= 0) {
                   vipInfo.onlyAddPower = true
                 }
               }
@@ -1230,9 +1230,6 @@
                     v.buyAccountNum = v.buyNum||v.newFilter.finalAccountCount || 0
                 } else {
                     // 仅增购子账号,不计算主账号数量
-                    if (vipInfo.onlyAddCount) {
-                      totalAccountCount -= 1
-                    }
                     v.buyAccountNum = v.buyNum||totalAccountCount||v.newFilter.finalAccountCount || 0
                 }
 

+ 19 - 6
src/web/templates/pc/vip_orderDetail.html

@@ -173,7 +173,7 @@
             var filter_vip_new = order.new_filter ? JSON.parse(order.new_filter) : {}
             var buyAccountCount = filterInfo.buyAccountCount || filter_vip_new.buyAccountCount || 0
             var giftAccountCount = filterInfo.giftAccountCount || filter_vip_new.giftAccountCount || 0
-            var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount) + 1
+            var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount)
 
             var addAreaCount = filterInfo.addAreaCount || filter_vip_new.addAreaCount || 0
             var onlyAddCount = addAreaCount <= 0 // 仅增购子账号
@@ -189,9 +189,6 @@
                     buyNumber2 = order.buyNum || filter_vip_new.finalAccountCount || 0
                 } else {
                     // 仅增购子账号,不计算主账号数量
-                    if (onlyAddCount) {
-                        totalAccountCount -= 1
-                    }
                     buyNumber2 = order.buyNum || totalAccountCount || filter_vip_new.finalAccountCount || 0
                 }
             } else {
@@ -199,6 +196,16 @@
             }
             return buyNumber2
         }
+
+        function calcIsOnlyAddPower(order) {
+            var filter_vip = order.filter ? JSON.parse(order.filter) : {}
+            var filter_vip_new = order.new_filter ? JSON.parse(order.new_filter) : {}
+            var buyAccountCount = filter_vip.buyAccountCount || filter_vip_new.buyAccountCount || 0
+            var giftAccountCount = filter_vip.giftAccountCount || filter_vip_new.giftAccountCount || 0
+            var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount)
+            return totalAccountCount <= 0
+        }
+
         var serverInitTime = null
         var timerId = null
         $(function () {
@@ -334,6 +341,7 @@
                         //}else {
                             $("#status_success").removeClass("hide");
                         //}
+                        var order = r.data.order;
                         //兑换码 不展示支付时间 p307
                         if (r.data.order.pay_time&&filterObj.badge!="exchange"){
                             $(".pay_time_p").css("display", "");
@@ -343,9 +351,14 @@
                         if(r.data.order.buy_subject=='2'){
                             var buyAccountNum = calcAccountNum(r.data.order)
                             var num2 = r.data.order.buy_count||buyAccountNum
-                          $('.pay_number_t').text(num2+"人")
-                          $('.pay_number').show()
+                            $('.pay_number_t').text(num2+"人")
+                            $('.pay_number').show()
 
+                            var onlyAddPower = calcIsOnlyAddPower(r.data.order)
+                            var upgrade = order.vip_type == 2 || order.service_type == 3
+                            if (onlyAddPower && upgrade) {
+                                $('.pay_number').hide()
+                            }
                         }
                         //支付方式
                         if (r.data.order.billingMode===1){

+ 50 - 4
src/web/templates/weixin/vipsubscribe/vip_order_detail.html

@@ -241,6 +241,42 @@
         }
         return cycle
     }
+
+    function calcAccountNum(order) {
+        var filterInfo = order.filter ? JSON.parse(order.filter) : {}
+        var filter_vip_new = order.new_filter ? JSON.parse(order.new_filter) : {}
+        var buyAccountCount = filterInfo.buyAccountCount || filter_vip_new.buyAccountCount || 0
+        var giftAccountCount = filterInfo.giftAccountCount || filter_vip_new.giftAccountCount || 0
+        var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount)
+
+        var addAreaCount = filterInfo.addAreaCount || filter_vip_new.addAreaCount || 0
+        var onlyAddCount = addAreaCount <= 0 // 仅增购子账号
+
+        // 续费vip_type=1
+        if (order.vip_type == 1 || order.service_type == 2) {
+            // 人数就是购买人数
+            buyNumber2 = filterInfo.buyAccountCount || filter_vip_new.finalAccountCount || 0
+        } else if (order.vip_type == 2 || order.service_type == 3) {
+            // 人数是升级人数/如果只补充服务,则人数就是购买人数
+            if (buyAccountCount == 0 && giftAccountCount == 0) {
+                buyNumber2 = order.buyNum || filter_vip_new.finalAccountCount || 0
+            } else {
+                buyNumber2 = order.buyNum || totalAccountCount || filter_vip_new.finalAccountCount || 0
+            }
+        } else {
+            buyNumber2 = order.buy_count || order.buyNum || filter_vip_new.finalAccountCount || 0
+        }
+        return buyNumber2
+    }
+
+    function calcIsOnlyAddPower(order) {
+        var filter_vip = order.filter ? JSON.parse(order.filter) : {}
+        var filter_vip_new = order.new_filter ? JSON.parse(order.new_filter) : {}
+        var buyAccountCount = filter_vip.buyAccountCount || filter_vip_new.buyAccountCount || 0
+        var giftAccountCount = filter_vip.giftAccountCount || filter_vip_new.giftAccountCount || 0
+        var totalAccountCount = Number(buyAccountCount) + Number(giftAccountCount)
+        return totalAccountCount <= 0
+    }
     $(function () {
         //分享
         initShare({{.T.signature}},{{.T.openid}}, 2, "jy_wxmyorder",{{.T.nickname}},{{.T.avatar}});
@@ -277,14 +313,24 @@
                     }
                 }
                 //购买数量
+                var order = r.data.order;
+                //购买数量
+                var onlyAddPower = calcIsOnlyAddPower(order)
+                var upgrade = order.vip_type == 2 || order.service_type == 3
                if(r.data.order.buy_subject=='2'){
-                 $('.membernum').show();
-                 $('.buy_num_value').text(r.data.order.buy_count+'人')
-
+                 var buyAccountNum = calcAccountNum(order)
+                 var num2 = r.data.order.buy_count||buyAccountNum
+                 $('.buy_num_value').text(num2+'人')
+                 if (num2) {
+                    $('.membernum').show();
+                 }
                 }else{
                   $('.membernum').parent().hide();
-
                 }
+                if (onlyAddPower && upgrade) {
+                    $('.membernum').parents('.l-item').hide()
+                }
+
                 if (!r.data.order.discount_price || (r.data.order.discount_price && r.data.order.discount_price <= 0)) {
             		    $(".discountPrice").parent().hide();
                 }