Преглед на файлове

feat:wx超级订阅购买、续费

yangfeng преди 4 години
родител
ревизия
0cd894d235
променени са 20 файла, в които са добавени 573 реда и са изтрити 222 реда
  1. 64 0
      src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/css/rights_page.css
  2. BIN
      src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/image/rights-icons.png
  3. 5 2
      src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/price.js
  4. 1 0
      src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_index_new.js
  5. 12 5
      src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_renew.js
  6. 25 19
      src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_upgrade.js
  7. 0 65
      src/jfw/modules/app/src/web/templates/vipsubscribe/commonRules.html
  8. 18 7
      src/jfw/modules/app/src/web/templates/vipsubscribe/vip_UpgradePage.html
  9. 21 7
      src/jfw/modules/app/src/web/templates/vipsubscribe/vip_purchase.html
  10. 2 2
      src/jfw/modules/app/src/web/templates/vipsubscribe/vip_renew.html
  11. 4 2
      src/web/staticres/common-module/coupon/js/pay-order-template.js
  12. 1 1
      src/web/staticres/common-module/vipsubscribe/js/vip-size-template.js
  13. 64 0
      src/web/staticres/vipsubscribe/css/rights_page.css
  14. BIN
      src/web/staticres/vipsubscribe/image/rights-icons.png
  15. 2 1
      src/web/staticres/vipsubscribe/js/price.js
  16. 5 0
      src/web/staticres/vipsubscribe/js/vip_index_new.js
  17. 106 3
      src/web/staticres/vipsubscribe/js/vip_renew.js
  18. 0 65
      src/web/templates/common/commonRules.html
  19. 178 26
      src/web/templates/weixin/vipsubscribe/vip_purchase.html
  20. 65 17
      src/web/templates/weixin/vipsubscribe/vip_renew.html

Файловите разлики са ограничени, защото са твърде много
+ 64 - 0
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/css/rights_page.css


BIN
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/image/rights-icons.png


+ 5 - 2
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/price.js

@@ -40,7 +40,10 @@ var Calculation = {
                 "oneProvince_allBuyerClass": 3800,
                 "allProvince_allBuyerClass": 59900
             },
-            "quarter": {oneProvince_allBuyerClass: 9900, allProvince_allBuyerClass: 149900},
+            "quarter": {
+              "oneProvince_allBuyerClass": 9900, 
+              "allProvince_allBuyerClass": 149900
+            },
             "year": {
                 "oneProvince_allBuyerClass": 38000,
                 "allProvince_allBuyerClass": 599900
@@ -94,7 +97,7 @@ var Calculation = {
            buyTime  [数量,单位(1:年,2月)]
     return 价格、计价清单
      */
-    GetUpgradeDetail: function (newBuyset = new Buyset(), buyTime = [1, 2]) { //升级计价 time[数量,单位(1:年,2月)]
+    GetUpgradeDetail: function (newBuyset = new Buyset(), buyTime = []) { //升级计价 time[数量,单位(1:年,2月)]
         let subtotail = []; //计价清单
         let final_price = 0; //最终计算价格
         let nowEndTime = this.EndTime;

+ 1 - 0
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_index_new.js

@@ -59,6 +59,7 @@ $(function () {
   sessionStorage.removeItem("vip-cur-select-size")
   // 清除商品优惠券当前选择
   sessionStorage.removeItem("vip-cur-select-coupon")
+  sessionStorage.removeItem("$select-coupon")
   var $dialog;
   /* vue 代码 start 提交订单 */
   /* 

+ 12 - 5
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_renew.js

@@ -134,7 +134,7 @@ var renew = {
     setPrice: function (price) {
         this.price = parseInt(price)
         var size = JSON.parse(sessionStorage.getItem('vip-cur-select-size')) 
-        console.log(renew.buyInfo.buyset)
+        // console.log(renew.buyInfo.buyset)
         var count = renew.buyInfo.buyset.areacount == -1 ? 16 : renew.buyInfo.buyset.areacount
         if (this.buyInfo.buyset.upgrade == 1) {
           // 新规则初始化价格
@@ -142,8 +142,13 @@ var renew = {
             // 初始化上次选择的商品规格
             coupon.updatePrice(size.price / 100)
           } else {
-            // 初始化默认一个月*省份数量
-            coupon.updatePrice(3800*count / 100)
+            // 初始化默认一个月*省份数量或全国价格
+            sessionStorage.removeItem('$select-coupon')
+            if (count >= 16) {
+              coupon.updatePrice(59900 / 100)
+            } else {
+              coupon.updatePrice(3800*count / 100)
+            }
           }
         } else {
           // 旧规则初始化价格
@@ -594,7 +599,7 @@ var goodsSize = new Vue({
     getSizeStorage: function() {
       // 恢复商品规格选择
       var size = JSON.parse(sessionStorage.getItem('vip-cur-select-size')) 
-      console.log(size, '恢复的商品规格')
+      // console.log(size, '恢复的商品规格')
       if (size) {
         this.$refs.goodsSize.goodsActive = size.index
         this.defaultSize = size
@@ -604,7 +609,8 @@ var goodsSize = new Vue({
       }
     },
     getGoodSize: function(data) {
-      console.log(data, '父组件接收子组件传来的商品规格')
+      // console.log(data, '父组件接收子组件传来的商品规格')
+      sessionStorage.removeItem('$select-coupon')
       this.defaultSize = data
       coupon.updatePrice(data.price/100)
     }
@@ -635,6 +641,7 @@ var coupon = new Vue({
     this.init()
   }, 
   methods: {
+    updateCoupon: function(data) {},
     // 更新价格相关
     updatePrice: function (before) {
       console.log( '原价:' + before)

+ 25 - 19
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_upgrade.js

@@ -4,7 +4,7 @@ var purchase = {
   }, //已选择地区 {"一个省":["一个市"]}计算价格临时变量
   industrySelect: ["一个行业"], // 已选择行业 一个行业(计算价格临时变量)
   timeSelect: [1, 2], //已选择时间 timeSelect[0]时长  timeSelect[1] 1:年 2:月
-  timeValue: "个月",
+  timeValue: "1个月",
   endTime: "",
   price: {}, //价格
   nowBuyset: {},
@@ -102,7 +102,7 @@ var purchase = {
       console.log(e)
     }
     this.nowBuyset = getBuySet(purchase.areaSelect, purchase.industrySelect, this.price)
-    var old = this.oldBuySet
+    var old = purchase.oldBuySet
     // 选择完区域回显后 需判断选择省份结果
     console.log(this.nowBuyset.areacount,old.areacount,Object.keys(purchase.areaSelect).length)
     // 如果原套餐选择的非全国,当前选择的也非全国, 则判断当前选择的省份数量省份大于原套餐的省份数量,大于则可以提交,小于则不能提交
@@ -139,22 +139,24 @@ var purchase = {
     }
   },
   showArea: function () {
-    if (!$.isEmptyObject(this.areaSelect) && !this.areaSelect["一个省"]) { //有选择
+    if (!$.isEmptyObject(this.areaSelect)) { //有选择
       if (this.nowBuyset.areacount === -1 || this.nowBuyset.areacount >= 16) {
         $(".selected-area").text("全国");
         this.nowBuyset.areacount === -1
       } else {
         var tipTxt = "";
-        if (this.nowBuyset.areacount > 0) tipTxt += this.nowBuyset.areacount + " 个省";
-        var count = 0;
-        this.nowBuyset.citys.forEach(function (item, index) {
-          count += item;
-        });
-        if (count > 0) {
-          if (this.nowBuyset.areacount > 0) tipTxt += "、";
-          tipTxt += count + " 个市";
-          if (this.nowBuyset.citys.length > 1) tipTxt += "(分布在" + this.nowBuyset.citys.length + "个省内)"
-        }
+        // if (this.nowBuyset.areacount > 0) tipTxt += this.nowBuyset.areacount + "";
+        // var count = 0;
+        // this.nowBuyset.citys.forEach(function (item, index) {
+        //   count += item;
+        // });
+        // if (count > 0) {
+        //   if (this.nowBuyset.areacount > 0) tipTxt += "、";
+        //   tipTxt += count + " 个市";
+        //   if (this.nowBuyset.citys.length > 1) tipTxt += "(分布在" + this.nowBuyset.citys.length + "个省内)"
+        // }
+        /* 1个市相当于一个省,取对象的length */
+        tipTxt = Object.keys(this.areaSelect).length
         $(".selected-area").text(tipTxt);
       }
     } else {
@@ -211,12 +213,12 @@ var purchase = {
       }
     }
     this.timeValue = tmp;
+    
   },
   // 计算价格
   flushPrice: function (time, flag) {
     var times = [time[0], time[1]];
-    // var price = getsubVipOrderPriceBybuyset(this.nowBuyset, time); // 2021-5-20
-    // var givePrice = getsubVipOrderPriceBybuyset(this.nowBuyset, [time[1] === 1 ? 1 : time[0], time[1]]); // 2021-5-20
+    console.log(time,times, '11111')
     var obj = this.nowBuyset
     /* 处理 
       1.如果原选择的是全国,则不让跳转选择区域
@@ -231,8 +233,11 @@ var purchase = {
       purchase.areaSelect = {}
     }
     obj.areacount = Object.keys(purchase.areaSelect).length == 0 ? -1 : Object.keys(purchase.areaSelect).length
-    var price = Calculation.GetUpgradeDetail(new Buyset(obj.areacount,[],obj.buyerclasscount,1), time)
-    var givePrice = Calculation.GetUpgradeDetail(new Buyset(obj.areacount,[],obj.buyerclasscount,1), [time[1] === 1 ? 1 : time[0], time[1]])
+    // var price = Calculation.GetUpgradeDetail(new Buyset(obj.areacount,[],obj.buyerclasscount,1), time)
+    // var givePrice = Calculation.GetUpgradeDetail(new Buyset(obj.areacount,[],obj.buyerclasscount,1), [time[1] === 1 ? 1 : time[0], time[1]])
+    /* 超级订阅2.1版本 升级不再自动增加1个月周期,如需增加使用上面注释代码传入周期即可 */
+    var price = Calculation.GetUpgradeDetail(new Buyset(obj.areacount,[],obj.buyerclasscount,1))
+    var givePrice = Calculation.GetUpgradeDetail(new Buyset(obj.areacount,[],obj.buyerclasscount,1))
     price = Number(price[0] / 100) < 0 ? 0 : Number(price[0] / 100)
     var showPrice = formatMoney(price);
     if (flag === 1) {
@@ -261,7 +266,7 @@ var purchase = {
       var time1 = new Date(this.endTime * 1000).pattern('yyyy年MM月dd日');
       var end = getVipEndDate(thisValue[1], thisValue[0], this.endTime);
       var time2 = new Date(end * 1000).pattern('yyyy年MM月dd日');
-
+      console.log(time1, time2, thisValue,'时间')
       if (flag === 1) {
         $(".select_cycle .month").text(this.timeValue);
         var giveTime = this.timeValue
@@ -571,10 +576,11 @@ $(function () {
       'area_count': flag ? 0 : areaCount,
       // "industry": industry.join(","),
       'price': parseInt(coupon.initPrice*10000/100),
-      "time": purchase.timeValue.trim(),
+      // "time": purchase.timeValue.trim(),
       // "orderType": 5,
       "disWord": GetQueryString("disWord"),
     };
+    console.log(param, '提交订单的参数')
     console.log(area, 'area', purchase.nowBuyset, coupon.initPrice*10000/100)
     $DoPost("/subscribepay/vipsubscribe/upgrade", param, function (r) {
       if (r.success) {

Файловите разлики са ограничени, защото са твърде много
+ 0 - 65
src/jfw/modules/app/src/web/templates/vipsubscribe/commonRules.html


+ 18 - 7
src/jfw/modules/app/src/web/templates/vipsubscribe/vip_UpgradePage.html

@@ -37,6 +37,17 @@
       font-size: .24rem;
       color:#FE737A;
     }
+    .area-result{
+      display: flex;
+      align-items: center;
+      margin-left: .16rem;
+      background-color: #2ABED1;
+      color: #fff;
+      font-size: .22rem;
+      text-align: center;
+      padding: 0 .16rem;
+      border-radius: .41rem;
+    }
   </style>
 </head>
 
@@ -54,18 +65,18 @@
           <li class="body-item area">
             <a class="item-container" data-upgrade-to-area href="/jyapp/vipsubscribe/toChooseArea?header=upgrade">
               <div class="item">
-                <span class="item-l">
+                <span class="item-l" style="display: flex;align-items: center;">
                   <span class="item-label">省份数量</span>
+                  <div class="area-result">
+                    <span>已选:</span>
+                    <span class="selected-area"></span>
+                  </div>
                 </span>
-                <span class="item-r">
-                  <span class="selected-area-name ellipsis"></span>
+                <span class="item-r" style="width: auto;">
+                  <span style="color: #9b9ca3;">选择</span>
                   <span class="iconfont icon-arrow"></span>
                 </span>
               </div>
-              <div>
-                <span>已选择</span>
-                <span class="text selected-area"></span>
-              </div>
               <p class="error-update-tips">选择省份数量低于原套餐数,无法升级,请增加省份数量</p>
             </a>
           </li>

+ 21 - 7
src/jfw/modules/app/src/web/templates/vipsubscribe/vip_purchase.html

@@ -69,16 +69,17 @@
   .area-result{
     /* width:1.2rem; */
     height: .38rem;
-    padding: 0 .16rem;
     display: flex;
     align-items: center;
     justify-content: center;
     background: #2abed1;
-    border: 1px solid #2abed1;
     border-radius: 41px;
     font-size: .22rem;
     color: #fff;
   }
+  .area-result-text{
+    padding: 0 .16rem;
+  }
   </style>
   <!--E-手机号输入样式-->
 </head>
@@ -263,7 +264,7 @@
                     <td><span class="allP_allB">3880</span>元 年/全国/全行业</td>
                   </tr>
                 </table>
-                <dl class="tips">
+                <dl class="tips" style="display: none;">
                   <dt class="b-line">购买须知</dt>
                   <dd>套餐周期内,不支持套餐降级;</dd>
                   <dd>用户最多购买/续费3年套餐;</dd>
@@ -663,6 +664,7 @@
           data: function() {
             return {
               props: {
+                defaultSize: {},
                 areaCount: 1,
                 priceInfo: {}
               }
@@ -695,6 +697,7 @@
               var size = JSON.parse(sessionStorage.getItem('vip-cur-select-size')) 
               if (size) {
                 this.$refs.goodsSize.goodsActive = size.index
+                this.defaultSize = size
                 this.$nextTick(function(){
                   console.log(size.price, 'size.price')
                   coupon.updatePrice(size.price/100)
@@ -704,6 +707,7 @@
             },
             getGoodSize: function(data) {
               console.log(data, '父组件接收子组件传来的商品规格')
+              this.defaultSize = data
               coupon.updatePrice(data.price/100)
               goodsCoupon.updatePrice(data.price/100)
             }
@@ -934,7 +938,7 @@
             if (!$.isEmptyObject(this.areaSelect) && !this.areaSelect["一个省"]) { //有选择
               if (this.nowBuyset.areacount === -1) {
                 $(".choose_area").val("已选: 全国");
-                $(".area-result-text").text("已选: 全国");
+                $(".area-result-text").show().text("已选: 全国");
               } else {
                 var tipTxt = "已选: ";
                 if (this.nowBuyset.areacount > 0) tipTxt += this.nowBuyset.areacount + "";
@@ -948,11 +952,11 @@
                 //     if (this.nowBuyset.citys.length > 1) tipTxt += "(分布在" + this.nowBuyset.citys.length + "个省内)"
                 // }
                 $(".choose_area").val(tipTxt);
-                $(".area-result-text").text(tipTxt);
+                $(".area-result-text").show().text(tipTxt);
               }
             } else {
               $(".choose_area").val("");
-              $(".area-result-text").text("");
+              $(".area-result-text").hide().text("");
               //是否勾选已阅读
               if (sessionStorage.getItem("vipSub_read") === "true") {
                 $(".area_warn").css("display", "");
@@ -1286,13 +1290,23 @@
             if (activeCode.toLowerCase() === "jianyu360" && $('.coupon-code-tx .info').text() === "支付成功赠送30天订阅周期") {
               activeCodes = "jianyu360";
             }
+            var size = goodsSize.defaultSize
+            if (size && size.period) {
+              if(size.period.indexOf('月') > -1) {
+                size.period = size.period.replace('月', '个月')
+              }
+              sizeTime = size.period
+            } else {
+              sizeTime = '1个月'
+            }
+            console.log(sizeTime, '选择的周期')
             //付费用户
             var param = {
               "userLotteryId":goodsCoupon.curSelectCoupon.userLotteryId,
               "lotteryId": goodsCoupon.curSelectCoupon.lotteryId,
               "area": JSON.stringify(area),
               // "industry": industry.join(","),
-              "time": $(".info:eq(2)").val().trim(),
+              "time": sizeTime,
               "orderType":{{.T.orderType}},
               "price": parseInt(coupon.initPrice*10000/100),
               "activeCode": activeCodes,

+ 2 - 2
src/jfw/modules/app/src/web/templates/vipsubscribe/vip_renew.html

@@ -98,7 +98,7 @@
           <div id="goods-size-vue" data-new-vip style="display: none;">
             <goods-size-template ref="goodsSize" :config="props" @select-vip-size="getGoodSize"></goods-size-template>
           </div>
-            <div class="j-notice-bar bar-red vip-bar" style="text-align: center;">限时续费,3个月起,续多久送多久!</div>
+            <!-- <div class="j-notice-bar bar-red vip-bar" style="text-align: center;">限时续费,3个月起,续多久送多久!</div> -->
             <ul style="padding: .16rem .24rem;" data-old-vip>
                 <li class="body-item area-industry">
                     <div class="item-container">
@@ -161,7 +161,7 @@
         </div>
         <!-- vue组件 -->
         <div class="vip-footer" id="coupon-vue">
-          <pay-order-template ref="couponRef" :config="$data" @update="updateS" @save="saveEvent"></pay-order-template>
+          <pay-order-template ref="couponRef" :config="$data" @update-coupon="updateCoupon" @update="updateS" @save="saveEvent"></pay-order-template>
         </div>
         <div class="vip-footer renew" style="display: none;">
             <div class="footer-preview-container">

+ 4 - 2
src/web/staticres/common-module/coupon/js/pay-order-template.js

@@ -246,7 +246,9 @@ var couponTem = {
         _this.coupon.checkedId = couponStorage.userLotteryId;
         _this.coupon.userLotteryId = couponStorage.userLotteryId;
         _this.coupon.lotteryId = couponStorage.lotteryId
-        sessionStorage.removeItem('$select-coupon')
+        if(this.config.type.indexOf('vip') == -1) {
+          sessionStorage.removeItem('$select-coupon')
+        }
         _this.$emit('update-coupon',_this.coupon)
       } else {
         $.ajax({
@@ -272,7 +274,7 @@ var couponTem = {
                 _this.coupon.list = res.data.list;
                 _this.$emit('update-coupon',_this.coupon)
               } else {
-                console.log('没有优惠券')
+                // console.log('没有优惠券')
               }
             }
           },

+ 1 - 1
src/web/staticres/common-module/vipsubscribe/js/vip-size-template.js

@@ -78,7 +78,7 @@ var goodsSizeTem = {
           }
         }
       }
-      console.log(list)
+      // console.log(list)
       return list
     }
   },

Файловите разлики са ограничени, защото са твърде много
+ 64 - 0
src/web/staticres/vipsubscribe/css/rights_page.css


BIN
src/web/staticres/vipsubscribe/image/rights-icons.png


+ 2 - 1
src/web/staticres/vipsubscribe/js/price.js

@@ -40,6 +40,7 @@ var Calculation = {
                 "oneProvince_allBuyerClass": 3800,
                 "allProvince_allBuyerClass": 59900
             },
+            "quarter": {"oneProvince_allBuyerClass": 9900, "allProvince_allBuyerClass": 149900},
             "year": {
                 "oneProvince_allBuyerClass": 38000,
                 "allProvince_allBuyerClass": 599900
@@ -93,7 +94,7 @@ var Calculation = {
            buyTime  [数量,单位(1:年,2月)]
     return 价格、计价清单
      */
-    GetUpgradeDetail: function (newBuyset = new Buyset(), buyTime = [1, 2]) { //升级计价 time[数量,单位(1:年,2月)]
+    GetUpgradeDetail: function (newBuyset = new Buyset(), buyTime = []) { //升级计价 time[数量,单位(1:年,2月)]
         let subtotail = []; //计价清单
         let final_price = 0; //最终计算价格
         let nowEndTime = this.EndTime;

+ 5 - 0
src/web/staticres/vipsubscribe/js/vip_index_new.js

@@ -135,6 +135,11 @@ $(function () {
   //     }
   //   }
   // })
+  // 清除商品规格当前选择
+  sessionStorage.removeItem("vip-cur-select-size")
+  // 清除商品优惠券当前选择
+  sessionStorage.removeItem("vip-cur-select-coupon")
+  sessionStorage.removeItem("$select-coupon")
   /* vue 代码 end */
     //项目匹配开关
     var checkedflag = true;

+ 106 - 3
src/web/staticres/vipsubscribe/js/vip_renew.js

@@ -88,6 +88,17 @@ var renew = {
                             _this.buyInfo.buyset.upgrade || 0
                         )
                     )
+                    // 新超级订阅续费
+                    if (r.data.buyset.upgrade == 1) {
+                      $("[data-new-vip]").show()
+                      $("[data-old-vip]").hide()
+                      if (_this.buyInfo.buyset.areacount == -1) {
+                        goodsSize.props.areaCount = 16
+                      } else {
+                        goodsSize.props.areaCount = _this.buyInfo.buyset.areacount
+                      }
+                      
+                    }
                     // 初始化默认金额
                     _this.setPrice(_this.calcPrice())
                 }
@@ -102,6 +113,8 @@ var renew = {
             success: function (r) {
                 if (r) {
                     _this.requestRules = r
+                    // 将价格列表传至商品规格组件
+                  goodsSize.props.priceInfo = r.new
                 }
             }
         })
@@ -113,7 +126,27 @@ var renew = {
     // 设置价格
     setPrice: function (price) {
         this.price = parseInt(price)
-        coupon.updatePrice(this.price / 100)
+        var size = JSON.parse(sessionStorage.getItem('vip-cur-select-size')) 
+        // console.log(renew.buyInfo.buyset)
+        var count = renew.buyInfo.buyset.areacount == -1 ? 16 : renew.buyInfo.buyset.areacount
+        if (this.buyInfo.buyset.upgrade == 1) {
+          // 新规则初始化价格
+          if (size) {
+            // 初始化上次选择的商品规格
+            coupon.updatePrice(size.price / 100)
+          } else {
+            // 初始化默认一个月*省份数量或全国价格
+            sessionStorage.removeItem('$select-coupon')
+            if (count >= 16) {
+              coupon.updatePrice(59900 / 100)
+            } else {
+              coupon.updatePrice(3800*count / 100)
+            }
+          }
+        } else {
+          // 旧规则初始化价格
+          coupon.updatePrice(this.price / 100)
+        }
     },
     // 根据选中结果得到续费了多长时间的字符串
     getDuration: function (timeSelect) {
@@ -284,14 +317,26 @@ var renew = {
 
         $('.vip-footer.renew .confirm').on('click', function () {
             $('.vip-footer.renew .confirm').prop('disabled', true)
+            var upgrade = renew.buyInfo.buyset.upgrade
+            var size = goodsSize.defaultSize
+            var sizeTime = ''
+            if (size && size.period) {
+              if(size.period.indexOf('月') > -1) {
+                size.period = size.period.replace('月', '个月')
+              }
+              sizeTime = size.period
+            } else {
+              sizeTime = '1个月'
+            }
+            console.log(upgrade,sizeTime, '新or老')
             //支付请求
             var data = {
                 userLotteryId :coupon.$refs.couponRef.coupon.userLotteryId,
                 lotteryId : coupon.$refs.couponRef.coupon.lotteryId,
-                time : _this.getDuration(_this.timeSelect).trim(),
+                time : upgrade == 0 ? _this.getDuration(_this.timeSelect).trim() : sizeTime,
                 orderType: 5,
                 disWord :GetQueryString('disWord'),
-                price: _this.price
+                price: coupon.initPrice*10000/100
             }
             $.ajax({
                 // url: '/subscribepay/vipsubscribe/createOrder',
@@ -485,6 +530,8 @@ function clearSessionStorage() {
     sessionStorage.removeItem("pay_read_cache")
     sessionStorage.removeItem("liveActiveCode_renew");
     sessionStorage.removeItem("liveActiveCode_new");
+    // 清除商品规格当前选择
+    sessionStorage.removeItem("vip-cur-select-size")
 }
 function showToast(text) {
     weui.toast(text, {
@@ -506,6 +553,62 @@ function pickerShow(selector, f) {
     }
 }
 /* vue 代码 start */
+// vip商品规格组件
+var goodsSize = new Vue({
+  el:'#goods-size-vue',
+  data: function() {
+    return {
+      props: {
+        defaultSize: {},
+        areaCount: 1,
+        priceInfo: {}
+      }
+    }
+  },
+  created () {
+    
+  },
+  mounted () {
+    this.getSizeStorage()
+  },
+  methods: {
+    // 父组件传省份数量至子组件
+    getAreaCount: function() {
+      var areaStorage = JSON.parse(sessionStorage.getItem('vipSubSelectArea'))
+      console.log(renew.buyInfo.buyset.areacount)
+      if (areaStorage) {
+        var count = 0
+        for (var key in areaStorage) {
+          if (key.indexOf('全国') > -1) {
+            count = 16
+          } else {
+            count++
+          }
+        }
+        this.props.areaCount = count
+      }
+    },
+    getSizeStorage: function() {
+      // 恢复商品规格选择
+      var size = JSON.parse(sessionStorage.getItem('vip-cur-select-size')) 
+      // console.log(size, '恢复的商品规格')
+      if (size) {
+        this.$refs.goodsSize.goodsActive = size.index
+        this.defaultSize = size
+        this.$nextTick(function(){
+          coupon.updatePrice(size.price/100)
+        })
+      }
+    },
+    getGoodSize: function(data) {
+      // console.log(data, '父组件接收子组件传来的商品规格')
+      sessionStorage.removeItem('$select-coupon')
+      this.defaultSize = data
+      coupon.updatePrice(data.price/100)
+    }
+  }
+})
+// 订单提交组件
 var coupon = new Vue({ 
   el: '#coupon-vue',
   data: function () {

Файловите разлики са ограничени, защото са твърде много
+ 0 - 65
src/web/templates/common/commonRules.html


+ 178 - 26
src/web/templates/weixin/vipsubscribe/vip_purchase.html

@@ -13,6 +13,8 @@
     <link rel="stylesheet" href="/vipsubscribe/iconfont/iconfont.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/css/wxbutton.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" href="/vipsubscribe/css/vip_purchase.css?v={{Msg "seo" "version"}}">
+    <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/common-module/vipsubscribe/css/vip-size-template.css?v={{Msg "seo" "version"}}' />
+    <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/common-module/vipsubscribe/css/vip-coupon-template.css?v={{Msg "seo" "version"}}' />
     <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/common-module/coupon/css/pay-order-template.css?v={{Msg "seo" "version"}}' />
     <!--S-手机号输入样式-->
     <style>
@@ -58,6 +60,20 @@
       text-align: left;
       margin-top: 2px;
     }
+    .area-result{
+      /* width:1.2rem; */
+      height: .38rem;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      background: #2abed1;
+      border-radius: 41px;
+      font-size: .22rem;
+      color: #fff;
+    }
+    .area-result-text{
+      padding: 0 .16rem;
+    }
     </style>
     <!--E-手机号输入样式-->
 
@@ -91,15 +107,23 @@
             <div class="choose_condition">
                 <ul class="chooseList">
                     <li class="choose_item">
-                        <a href="/front/vipsubscribe/toChooseArea">
+                        <a href="javascript:;" onclick="toChooseArea()">
+                          <div style="display: flex;align-items: center;flex: 1;">
                             <span class="label">省份数量</span>
-                            {{if not .T.isTrial }}
-                                <input type="text" disabled value="" placeholder="1个省"
-                                       class="info choose_area">
-                            {{else}}
-                                <input type="text" disabled value="" placeholder="选择全国、省份、地市" class="info choose_area">
-                            {{end}}
+                            <div class="area-result">
+                              {{if not .T.isTrial }}
+                                  <input type="hidden" disabled value="" placeholder="1个省" class="info choose_area">
+                                  <span class="area-result-text"></span>
+                              {{else}}
+                                  <input type="hidden" disabled value="" placeholder="选择全国、省份、地市" class="info choose_area">
+                                  <span class="area-result-text"></span>
+                              {{end}}
+                            </div>
+                          </div>
+                          <div style="display: flex;align-items: center;">
+                            <em style="color: #9B9CA3;font-size: .28rem;">选择</em>
                             <i class="iconfont icon-arrow"></i>
+                          </div>
                         </a>
                         <p class="add_tips area_warn" style="display: none;">请选择区域</p>
                         <!-- 无选择时不显示 -->
@@ -121,7 +145,7 @@
                         <p class="add_tips industry_warn" style="display: none;">请选择行业</p>
                         <p class="add_tips industry" style="display:none">已选择 0 个行业</p>
                     </li>
-                    <li class="choose_item select_cycle">
+                    <li class="choose_item select_cycle" style="display: none;">
                         <!-- 需要选择订阅周期就用a标签,div.class="free-7day"隐藏 opacity: 1 !important; -->
                         <!-- 需要选择试用就用div标签,a标签隐藏 -->
                         {{if not .T.isTrial }}
@@ -141,8 +165,16 @@
 
                     </li>
                 </ul>
+                <!-- 商品规格 -->
+                <div id="goods-size-vue">
+                  <goods-size-template ref="goodsSize" :config="props" @select-vip-size="getGoodSize"></goods-size-template>
+                </div>
+                <!-- 商品优惠券 -->
+                <div id="goods-coupon-vue">
+                  <goods-coupon-template ref="goodsCoupon" @update-coupon="updateCoupon"></goods-coupon-template>
+                </div>
                 <!--S-手机号输入-->
-                <div class='order-phone-group'>
+                <div class='order-phone-group' style="margin: .24rem;border-radius: 8px;">
                   <label for='order_phone'>手机号码</label>
                   <input id='order_phone' autocomplete='off' placeholder='请输入手机号码' maxlength='11' type='tel' />
                   <p>手机号码输入错误</p>
@@ -210,7 +242,7 @@
                                 <td><span>3880</span>元 年/全国/全行业</td>
                             </tr>
                         </table>
-                        <dl class="tips">
+                        <dl class="tips" style="display: none;">
                             <dt class="b-line">购买须知</dt>
                             <dd>套餐周期内,不支持套餐降级;</dd>
                             <dd>用户最多购买/续费3年套餐;</dd>
@@ -443,6 +475,8 @@
         <!--<script src='{{Msg "seo" "cdn"}}/js/check-bind-phone.js?v={{Msg "seo" "version"}}'></script>-->
         <script src="/vipsubscribe/js/price.js?v={{Msg "seo" "version"}}"></script>
         <script src=//cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js></script>
+        <script src='{{Msg "seo" "cdn"}}/common-module/vipsubscribe/js/vip-size-template.js?v={{Msg "seo" "version"}}'></script>
+        <script src='{{Msg "seo" "cdn"}}/common-module/vipsubscribe/js/vip-coupon-template.js?v={{Msg "seo" "version"}}'></script>
         <script src='{{Msg "seo" "cdn"}}/common-module/coupon/js/pay-order-template.js?v={{Msg "seo" "version"}}'></script>
         {{include "/common/weixin.html"}}
         <script>
@@ -602,9 +636,95 @@
             sessionStorage.setItem("vipSubisTrial", "1");//试用界面
             //试用用户
             {{end}}
-
-            console.log({{.T.isTrial }}, '22222')
+            // 跳转区域选择清除商品规格及优惠券选择
+            function toChooseArea() {
+              sessionStorage.removeItem('vip-cur-select-coupon')
+              sessionStorage.removeItem('vip-cur-select-size')
+              location.href = '/jyapp/vipsubscribe/toChooseArea'         
+            }
             /* vue 代码 start */
+            // vip商品规格
+            var goodsSize = new Vue({
+              el:'#goods-size-vue',
+              data: function() {
+                return {
+                  props: {
+                    defaultSize: {},
+                    areaCount: 1,
+                    priceInfo: {}
+                  }
+                }
+              },
+              created () {
+                this.getAreaCount()
+              },
+              mounted () {
+                this.getSizeStorage()
+              },
+              methods: {
+                // 父组件传省份数量至子组件
+                getAreaCount: function() {
+                  var areaStorage = JSON.parse(sessionStorage.getItem('vipSubSelectArea'))
+                  if (areaStorage) {
+                    var count = 0
+                    for (var key in areaStorage) {
+                      if (key.indexOf('全国') > -1) {
+                        count = 16
+                      } else {
+                        count++
+                      }
+                    }
+                    this.props.areaCount = count
+                  }
+                },
+                getSizeStorage: function() {
+                  // 恢复商品规格选择
+                  var size = JSON.parse(sessionStorage.getItem('vip-cur-select-size')) 
+                  if (size) {
+                    this.$refs.goodsSize.goodsActive = size.index
+                    this.defaultSize = size
+                    this.$nextTick(function(){
+                      console.log(size.price, 'size.price')
+                      coupon.updatePrice(size.price/100)
+                      goodsCoupon.updatePrice(size.price/100)
+                    })
+                  }
+                },
+                getGoodSize: function(data) {
+                  console.log(data, '父组件接收子组件传来的商品规格')
+                  this.defaultSize = data
+                  coupon.updatePrice(data.price/100)
+                  goodsCoupon.updatePrice(data.price/100)
+                }
+              }
+            })
+            // vip优惠券
+            var goodsCoupon = new Vue({
+              el:'#goods-coupon-vue',
+              data: function() {
+                return {
+                  curSelectCoupon: {}
+                }
+              },
+              mounted () {},
+              methods: {
+                updatePrice: function(data){
+                  this.$refs.goodsCoupon.getCoupon(data)
+                },
+                updateCoupon: function(data) {
+                  console.log(data, '更新优惠券选择')
+                  this.curSelectCoupon = data
+                  var curSize = JSON.parse(sessionStorage.getItem('vip-cur-select-size'))
+                  // 更新优惠券选择同时更新订单组件的价格及优惠金额
+                  if (curSize) {
+                    coupon.updatePrice(curSize.price/100)
+                  } else {
+                    coupon.updatePrice(coupon.initPrice)
+                  }
+                }
+              }
+            })
+            // 订单提交组件
             var coupon = new Vue({ 
               el: '#coupon-vue',
               data: function () {
@@ -625,6 +745,7 @@
                   buttons: {
                     submit: this.submitOrder
                   },
+                  hideCoupon: true //超级订阅购买隐藏订单提交组件的优惠券部分
                 }
               },
               mounted () {
@@ -634,11 +755,17 @@
                 // 更新价格相关
                 updatePrice: function (before) {
                   console.log( '原价:' + before)
-                  console.log('是否是试用',{{.T.isTrial }})
+                  var curCoupon = JSON.parse(sessionStorage.getItem('vip-cur-select-coupon'))
+                  console.log(curCoupon, '当前选择的优惠券')
+                  if (curCoupon) {
+                    this.$refs.couponRef.coupon.value = curCoupon.reduce
+                  } else {
+                    this.$refs.couponRef.coupon.value = 0
+                  }
                   this.initPrice = before;
                   // 调用子组件查询最优卡券 vip试用用户不调用优惠券
                   if (!{{.T.isTrial }}) {
-                    this.$refs.couponRef.getCoupon();
+                    // this.$refs.couponRef.getCoupon();
                   }
                 },
                 // 初始化及回显相关
@@ -646,7 +773,7 @@
                   var areaStorage = sessionStorage.getItem('vipSubSelectArea');
                   var industryStorage = sessionStorage.getItem('vipSubSelectIndustry');
                   var readStorage = sessionStorage.getItem('vipSub_read') == 'true' ? true : false;
-                  console.log(areaStorage, industryStorage, readStorage)
+                  // console.log(areaStorage, industryStorage, readStorage)
                   if(readStorage) {
                     this.checkboxStatus = true
                   }
@@ -772,6 +899,8 @@
                                 //     showGiveStatus(false)
                                 // }
                                 Calculation.Init(false, undefined, [], 0)
+                                // 将价格列表传至商品规格组件
+                                goodsSize.props.priceInfo = r.new
                             }
                         }, false)
                     } catch (e) {
@@ -783,22 +912,25 @@
                     if (!$.isEmptyObject(this.areaSelect) && !this.areaSelect["一个省"]) { //有选择
                         if (this.nowBuyset.areacount === -1) {
                             $(".choose_area").val("全国");
+                            $(".area-result-text").show().text("已选: 全国");
                         } else {
-                            var tipTxt = "已选 ";
-                            if (this.nowBuyset.areacount > 0) tipTxt += this.nowBuyset.areacount + " 个省";
+                            var tipTxt = "已选: ";
+                            if (this.nowBuyset.areacount > 0) tipTxt += this.nowBuyset.areacount + "";
                             var count = 0;
                             this.nowBuyset.citys.forEach(function (item, index) {
                                 count += item;
                             });
-                            if (count > 0) {
-                                if (this.nowBuyset.areacount > 0) tipTxt += "、";
-                                tipTxt += count + " 个市";
-                                if (this.nowBuyset.citys.length > 1) tipTxt += "(分布在" + this.nowBuyset.citys.length + "个省内)"
-                            }
+                            // if (count > 0) {
+                            //     if (this.nowBuyset.areacount > 0) tipTxt += "、";
+                            //     tipTxt += count + " 个市";
+                            //     if (this.nowBuyset.citys.length > 1) tipTxt += "(分布在" + this.nowBuyset.citys.length + "个省内)"
+                            // }
                             $(".choose_area").val(tipTxt);
+                            $(".area-result-text").show().text(tipTxt);
                         }
                     } else {
                         $(".choose_area").val("");
+                        $(".area-result-text").hide().text("");
                         //是否勾选已阅读
                         if (sessionStorage.getItem("vipSub_read") === "true") {
                             $(".area_warn").css("display", "");
@@ -898,7 +1030,13 @@
                             $('.computed_price').html(showPrice);
                             $('.discount-price .dis-price').text(formatMoney(givePrice))
                         }
-                        coupon.updatePrice(price)
+                        // coupon.updatePrice(price)
+                        var size = JSON.parse(sessionStorage.getItem('vip-cur-select-size')) 
+                        // 首次进入没有选择商品规格 默认
+                        if (!size) {
+                          coupon.updatePrice(price)
+                          goodsCoupon.updatePrice(price)
+                        }
                     }
                 }
             };
@@ -1118,12 +1256,22 @@
                     if (activeCode.toLowerCase() === couponInfo.code && $('.coupon-code-tx .info').text() === couponInfo.successTip) {
                         activeCodes = couponInfo.code;
                     }
+                    var size = goodsSize.defaultSize
+                    if (size && size.period) {
+                      if(size.period.indexOf('月') > -1) {
+                        size.period = size.period.replace('月', '个月')
+                      }
+                      sizeTime = size.period
+                    } else {
+                      sizeTime = '1个月'
+                    }
+                    console.log(sizeTime, '选择的周期')
                     var param = {
-                        "userLotteryId":coupon.$refs.couponRef.coupon.userLotteryId,
-                        "lotteryId": coupon.$refs.couponRef.coupon.lotteryId,
+                      "userLotteryId":goodsCoupon.curSelectCoupon.userLotteryId,
+                      "lotteryId": goodsCoupon.curSelectCoupon.lotteryId,
                         "area": JSON.stringify(area),
                         // "industry": industry.join(","),
-                        "time": $(".info:eq(2)").val().trim(),
+                        "time": sizeTime,
                         "price": Number((coupon.initPrice*100).toFixed(2)),
                         "orderType":{{.T.orderType}},
                         "activeCode": activeCodes,
@@ -1211,6 +1359,10 @@
                 sessionStorage.removeItem("vip_index_read");
                 sessionStorage.removeItem("vip_change_time");
                 sessionStorage.removeItem("liveActiveCode_purchase");
+                // 清除商品规格当前选择
+                sessionStorage.removeItem("vip-cur-select-size")
+                // 清除商品优惠券当前选择
+                sessionStorage.removeItem("vip-cur-select-coupon")
             }
 
             /******* 获取url参数(正则)********/

+ 65 - 17
src/web/templates/weixin/vipsubscribe/vip_renew.html

@@ -16,22 +16,56 @@
     <link rel="stylesheet" href="/vipsubscribe/css/public.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" href="/css/wxbutton.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" href="/vipsubscribe/css/vip_renew.css?v={{Msg "seo" "version"}}">
+    <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/common-module/vipsubscribe/css/vip-size-template.css?v={{Msg "seo" "version"}}' />
     <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/common-module/coupon/css/pay-order-template.css?v={{Msg "seo" "version"}}' />
     <style>
-        .vip-header {
-            display: none;
-            padding: .26rem .3rem;
-            font-size: .26rem;
-            color: #FE737A;
-        }
-
-        .weui-toast {
-            z-index: 999999;
-        }
-
-        button[disabled] {
-            opacity: .5;
-        }
+      .vip-header {
+        display: none;
+        padding: .26rem .3rem;
+        font-size: .26rem;
+        color: #FE737A;
+      }
+      .weui-toast {
+        z-index: 999999;
+      }
+      button[disabled] {
+        opacity: .5;
+      }
+      .area-result{
+        position: relative;
+        padding: .3rem .32rem;
+        display: flex;
+        align-items: center;
+        background-color: #fff;
+      }
+      .area-result::after{
+        position: absolute;
+        box-sizing: border-box;
+        content: ' ';
+        pointer-events: none;
+        right: 0;
+        bottom: 0;
+        left: .32rem;
+        border-bottom: 1px solid #f5f5f5;
+        -webkit-transform: scaleY(0.7);
+        transform: scaleY(0.7);
+      }
+      .a-r-label{
+        margin-right: 0.08rem;
+        font-size: .32rem;
+        color: #171826;
+      }
+      .a-r-val{
+        height: .38rem;
+        padding: 0 .16rem;
+        display: flex;
+        align-items: center;
+        background: #2abed1;
+        border: 1px solid #2abed1;
+        border-radius: 41px;
+        font-size: .22rem;
+        color: #fff;
+      }
     </style>
 </head>
 
@@ -47,8 +81,18 @@
             <span class="header-right">您的超级订阅服务即将到期,为不影响您的使用。请立即续费</span>
         </div>
         <div class="vip-body">
-            <div class="j-notice-bar bar-red vip-bar" style="text-align: center;">限时续费,3个月起,续多久送多久!</div>
-            <ul style="padding: .16rem .24rem;">
+            <!-- <div class="j-notice-bar bar-red vip-bar" style="text-align: center;">限时续费,3个月起,续多久送多久!</div> -->
+          <div class="area-result" data-new-vip style="display: none;">
+            <div class="item area" style="display: flex;align-items: center;">
+              <span class="item-l a-r-label">省份数量</span>
+              <span class="a-r-val"><span class="item-r"></span></span>
+            </div>
+          </div>
+            <!-- 商品规格 -->
+          <div id="goods-size-vue" data-new-vip style="display: none;">
+            <goods-size-template ref="goodsSize" :config="props" @select-vip-size="getGoodSize"></goods-size-template>
+          </div>
+            <ul style="padding: .16rem .24rem;" data-old-vip>
                 <li class="body-item area-industry">
                     <div class="item-container">
                         <div class="item area">
@@ -82,7 +126,7 @@
                         </div>
                     </a>
                 </li>
-                <div class="tips">
+                <div class="tips" data-old-vip>
                     <div class="tip-title l-line">续费说明</div>
                     <div class="tip-content">
                         <div>1、仅支持原套餐延长周期续费,不支持套餐变更(含增加、减少、更改)原订阅的省份、城市、行业。 <br />续费费用=续费周期(按月/年)/原地区/原行业</div>
@@ -104,6 +148,9 @@
                     </div>
                 </li>
             </ul>
+            <div data-new-vip style="display: none;">
+              {{include "/common/commonRules.html"}}
+            </div>
         </div>
         <!-- vue组件 -->
         <div class="vip-footer renew" id="coupon-vue">
@@ -332,6 +379,7 @@
     </div>
     <script src="/vipsubscribe/js/jquery-2.1.4.js?v={{Msg "seo" "version"}}"></script>
     <script src=//cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js></script>
+    <script src='{{Msg "seo" "cdn"}}/common-module/vipsubscribe/js/vip-size-template.js?v={{Msg "seo" "version"}}'></script>
     <script src='{{Msg "seo" "cdn"}}/common-module/coupon/js/pay-order-template.js?v={{Msg "seo" "version"}}'></script>
     <script src="/vipsubscribe/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
     <script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>

Някои файлове не бяха показани, защото твърде много файлове са промени