Browse Source

Merge branch 'dev/v1.0.56_zsy' of jianyu/web into feature/v1.0.56

zhangsiya 1 year ago
parent
commit
7a34580209

+ 15 - 6
apps/bigmember_pc/src/store/order.js

@@ -509,11 +509,11 @@ export default {
       { index, id, extend }
     ) {
       // 请求前-展示默认产品规格选择、活动等信息
-      await dispatch('setProductSpecInfo', {
-        index,
-        id,
-        extend
-      })
+      // await dispatch('setProductSpecInfo', {
+      //   index,
+      //   id,
+      //   extend
+      // })
       // 合并一些请求参数并请求
       await dispatch(
         'getProductOffers',
@@ -623,7 +623,7 @@ export default {
       )
     },
     // 根据商品ID、规格、优惠等参数获取商品订单金额信息
-    async getProductOrderAmount({ commit, getters }, payload) {
+    async getProductOrderAmount({ state, commit, getters }, payload) {
       // 合并一些请求参数
       const params = Object.assign({}, getters.productExtend, payload)
       // 设置加载状态
@@ -643,6 +643,15 @@ export default {
           activity: false,
           amount: false
         })
+        // 获得当前价格后更新商品规格信息
+        let productobj = JSON.parse(JSON.stringify(getters.productSpecInfo))
+        productobj.discountAmount = data?.discountAmount || 0
+        productobj.discountPrice = data?.discountPrice || 0
+        productobj.originalPrice = data?.originalPrice || 0
+        commit(
+          'updateProductSpecInfo',
+          formatProductSpecInfo(productobj, getters.productChoiceOffers)
+        )
       } else {
         if (msg) {
           // 移动端有msg弹窗。由于toast是单例的,msg弹窗会覆盖loading。

+ 21 - 1
apps/bigmember_pc/src/views/order/components/vipsubscribe/info.vue

@@ -930,7 +930,7 @@ export default {
           ? spec.discountPrice
           : spec.originalPrice
       let perDayPrice = 0
-      const giveDay = spec._offers?.time || 0
+      const giveDay = spec._offers?.time ? this.calcGiveDay(spec._offers.time, spec._offers.timeType) : 0
       switch (cycleType) {
         // 1个月
         case 1:
@@ -957,6 +957,26 @@ export default {
 
       return perDayPrice
     },
+    // 计算赠送天数
+    calcGiveDay (time, timeType) {
+      // 只根据当前省份下原价计算单价
+      let giveDay = 0
+      // timeType 时间类型:1/天、2/月,3/年
+      if(timeType){
+        switch (timeType) {
+          case 1:
+            giveDay =  time
+            break
+          case 2:
+            giveDay =  time * 30
+            break
+          case 3:
+            giveDay =   time * 365
+            break
+        }
+      }
+      return giveDay
+    },
     iWantGlobal() {
       this.$toast('已为您自动选择升级区域')
       this.setRadioNum(this.radioMax)