Răsfoiți Sursa

fix: 数据包充值页面价格显示问题

cuiyalong 4 ani în urmă
părinte
comite
ff8b04f202

+ 3 - 2
src/jfw/modules/app/src/web/templates/dataPack/recharge.html

@@ -33,8 +33,8 @@
                   :key="index">
                   <div class="spec-i-label">${ item.label }</div>                    
                   <div class="spec-i-sub">
-                    <div class="spec-i-text del">${ item.price }元/条</div>
-                    <div class="spec-i-text">${ item.price  * charge.discount }元/条</div>
+                    <div class="spec-i-text del">${ item.before }元/条</div>
+                    <div class="spec-i-text">${ item.price }元/条</div>
                   </div>                    
                 </div>
               </div>
@@ -59,6 +59,7 @@
           position="bottom"
           close-icon="clear"
           class="j-popup"
+          @closed="chargeCountPopupClosed"
           :style="{ height: '45%' }">
           <div class="j-container">
             <div class="popup-header header-title">充值条数</div>

+ 2 - 2
src/web/staticres/common-module/data-pack/css/recharge.css

@@ -72,8 +72,8 @@
   position: absolute;
   right: -1px;
   bottom: -1px;
-  width: 0.28rem;
-  height: 0.28rem;
+  width: 0.4rem;
+  height: 0.4rem;
   background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKySURBVHgB7Zg/aNRQHMd/eXfWP6i9omJBhBOXa0W4bK6ni6Murro76Cgu1kF0aysOjnXTyTopLkEcHM8TxIMOHghFQfBAaUtp8/P9Qt+Rpnm99y+XBO6zXJJ7gc83v+S9XwIwZsyY0jIbdB54UFIuBF/mEfFu6QLUX7drR2qVeUC8RfulChDJT7KAbzbFsdIEaLxt19nBSL4eP16KADJ5ovAB9pMnCh1g9n276VVZgAA12RgGBaURdG4OkycKWYGZoHPHQ1hQGVu4CkSrq6I8UagKkDwgzOmcU5gAojUATXIPkGwNdMk1QFproEtuAYYtUKrkEsCVPDHyAC7liZEGUGkNdBnZQqbaGugykgrotAa6ZF4B3dZAlwpkiElrILg2PQVL/nm4ceYE/N3ahu6/jdRxmd1Cpq0BQfKPZs4O9inApY9fU8dWwTGiNUDD1iApT1AAGU4DDFoDRKPWIE2eePb9l/QcZ7eQ7QIlk7//7Qe8+flHep6TAHnJE9azUFJedfYQ2MgTVgGoNWAT7BPfnBbHnl6sw8mJA3C8WoErpyZhdWNTGsJWntM3XshkrQGJxyFBEk3iQJ7oGVWAWgOG8JxvHkr+93tzK7rycZKVcCTPn2B8px1gpzV4IvufJElWFqJx9LAbeU6IuKg1C+m0BrKrnIaJPLHmhVPKFaDWgMvfUx0vq0QSU3l++yyttPxXQ1dim9ZgeUdMVgljeU4I+JB+961A7KvBVTBEVgkbeURY7F5uvqRtaQVcvruKStw+dxqO8Wn28cqquTyfOtdZOCf2Ux9i1y/eriB59MJWt+X3xLE9C1mR5T0vvB6XJ3ZVIIuvBi5Iu/KCQQWy+mpgCz2w617op8kTUQWy/GpgSB8xfIEMFmTiAs/mxdshfX6te9zjM78pPqyx7eVey++rnPgfnLxxiLvERTEAAAAASUVORK5CYII=) no-repeat;
   background-size: contain;
 }

+ 39 - 13
src/web/staticres/common-module/data-pack/js/recharge.js

@@ -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'
             }
           }

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

@@ -14,6 +14,18 @@ var vm = new Vue({
       reqOrder: {},
       reqTime: {},
       orderStateMap: {
+        // 默认状态
+        'default': {
+          text: '',
+          bgcColor: '',
+          bgcClassName: '',
+          surplusTimeShow: false,
+          bottomButtonShow: {
+            pay: false,
+            invoke: false,
+            buyAgain: false
+          }
+        },
         0: {
           text: '待付款',
           bgcColor: '',
@@ -75,7 +87,8 @@ var vm = new Vue({
       },
       // 页面内容展示数组
       orderInfo: {
-        state: 0, // 订单状态: 0:待支付 1:已完成 -2:已取消 -3:已退款
+        // 订单状态: 0:待支付 1:已完成 -2:已取消 -3:已退款
+        state: 'default', // 默认default
         surplusTime: 0, // 取消订单倒计时
         headerImg: '', // 头图地址
         payWay: '',

+ 5 - 0
src/web/staticres/common-module/order-list/js/order-list.js

@@ -120,6 +120,11 @@ var vm = new Vue({
   },
   watch: {
     tabActiveName: function () {
+      // 如果页面被resetState(tab)重置过,则切换到该tab后手动调用onLoad
+      if (this.tabState.list.length === 0 && !this.tabState.loaded) {
+        this.onLoad()
+      }
+
       this.setScrollTop(this.tabState.scrollTop)
       this.setUrlQuery()
     }

+ 3 - 2
src/web/templates/weixin/dataPack/recharge.html

@@ -44,8 +44,8 @@
                   :key="index">
                   <div class="spec-i-label">${ item.label }</div>                    
                   <div class="spec-i-sub">
-                    <div class="spec-i-text del">${ item.price }元/条</div>
-                    <div class="spec-i-text">${ item.price * charge.discount }元/条</div>
+                    <div class="spec-i-text del">${ item.before }元/条</div>
+                    <div class="spec-i-text">${ item.price }元/条</div>
                   </div>                    
                 </div>
               </div>
@@ -70,6 +70,7 @@
           position="bottom"
           close-icon="clear"
           class="j-popup"
+          @closed="chargeCountPopupClosed"
           :style="{ height: '45%' }">
           <div class="j-container">
             <div class="popup-header header-title">充值条数</div>