소스 검색

调整积分和电子券内容的展示逻辑

john.hong 2 년 전
부모
커밋
b0cccfb860

+ 8 - 3
src/pages/parkingFee/components/base/parkingFeeDetail.vue

@@ -51,7 +51,9 @@
             <img style="width: 26px; height: 26px" :src="`${require('../../static/images/arrows.png')}`" />
           </div>
         </div>
-        <div class="warp_index warp_index_da" v-if="enablePoints">
+        <!-- v-if="enablePoints" -->
+        <!-- 用户登录时展示 -->
+        <div class="warp_index warp_index_da" v-if="orderDetail && orderDetail.discountInfo">
           <div>积分减免</div>
           <div class="warp_index_color" @click="showPointsMathPopup('bottom')">
             <div style="margin-right: 10px" :class="integralDesc === '今日已达上限' ? 'text-disable' : 'text-red'">
@@ -60,10 +62,13 @@
             <img style="width: 26px; height: 26px" :src="`${require('../../static/images/arrows.png')}`" />
           </div>
         </div>
-        <div class="warp_index warp_index_da" v-if="enableCoupon">
+        <!-- v-if="enableCoupon" -->
+        <!-- 用户登录时展示 -->
+        <div class="warp_index warp_index_da" v-if="orderDetail && orderDetail.discountInfo">
           <div>优惠劵</div>
           <div class="warp_index_color" @click="coupon">
-            <div style="margin-right: 10px" :class="maxOneDayCoupons > 0 ? 'text-red' : 'text-disable'">
+            <!-- maxOneDayCoupons > 0 && -->
+            <div style="margin-right: 10px" :class="coupons.length > 0 ? 'text-red' : 'text-disable'">
               {{ couponDesc }}
             </div>
             <img style="width: 26px; height: 26px" :src="`${require('../../static/images/arrows.png')}`" />

+ 1 - 0
src/pages/parkingFee/mixins/parkingFee.js

@@ -273,6 +273,7 @@ export default {
       this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
         name: 'parkingFeeDetail',
       });
+
       this.$nextTick(() => {
         this.$router.push({
           path: 'parkingFeeDetail',

+ 23 - 16
src/pages/parkingFee/mixins/parkingFeeDetail.js

@@ -72,22 +72,22 @@ export default {
       // 当存在待支付金额 或者 用户登陆
       return !this.orderDetail?.parkingRecord?.totalFeeInYuan || (JSON.stringify(this.member) !== '{}' && !this.orderDetail.parkInfo);
     },
-    integralDesc() {
-      if (this.pointsTime > 0) {
-        // 深圳特殊处理(单位:金额)
-        if (this.orderDetail.parkInfo.parkMallCode === 5 || this.orderDetail.parkInfo.parkMallCode === 999) {
-          return `已选择兑换${this.pointsTime}元`;
-        }
-        return `已选择兑换${this.pointsTime}小时`;
-      }
-      if (this.bonusCopy < this.integral) {
-        return `${this.integral}积分可停车1小时`;
-      }
-      if (this.orderDetail.parkInfo.parkMallCode === 3 && app.globalData.member?.currnentintegral >= this.integral && !this.bonus) {
-        return `今日已达上限`;
-      }
-      return `${this.available}积分可减免`;
-    },
+    // integralDesc() {
+    //   if (this.pointsTime > 0) {
+    //     // 深圳特殊处理(单位:金额)
+    //     if (this.orderDetail.parkInfo.parkMallCode === 5 || this.orderDetail.parkInfo.parkMallCode === 999) {
+    //       return `已选择兑换${this.pointsTime}元`;
+    //     }
+    //     return `已选择兑换${this.pointsTime}小时`;
+    //   }
+    //   if (this.bonusCopy < this.integral) {
+    //     return `${this.integral}积分可停车1小时`;
+    //   }
+    //   if (this.orderDetail.parkInfo.parkMallCode === 3 && app.globalData.member?.currnentintegral >= this.integral && !this.bonus) {
+    //     return `今日已达上限`;
+    //   }
+    //   return `${this.available}积分可减免`;
+    // },
   },
   filters: {
     parkingTime(val) {
@@ -386,6 +386,13 @@ export default {
       return 1;
     },
     coupon() {
+      // 如果没有电子券的话,提示用户
+      if (this.coupon.length === 0) {
+      uni.showToast({
+        title: '暂无可使用的优惠券,请前往积分商城兑换优惠券'
+      })
+        return
+      }
       this.$router.push({
         path: 'parkingFeeCoupon',
       });

+ 4 - 1
src/store/order.js

@@ -269,7 +269,7 @@ const actions = {
     commit('setMaxOneDayDiscountFee', maxOneDayDiscountFee);
     commit('setPointsPerHour', pointsPerUnit);
     commit('setUnitAmount', unitAmount);
-    commit('setIntegralDesc', label);
+    commit('setIntegralDesc', discountFee ? label : `${pointsPerUnit}积分可停车1小时`);
   },
   // 当前最大可选优惠时间
   /*
@@ -476,6 +476,7 @@ const actions = {
         }
       });
       commit('setCouponCount', couponCount);
+      console.log(479, couponCount);
       if (couponCount > 0) {
         return commit('setCouponDesc', `已选择${couponCount}张优惠劵`);
       } else {
@@ -484,6 +485,8 @@ const actions = {
         }
         return commit('setCouponDesc', `暂无可用优惠券`);
       }
+    } else {
+      commit('setCouponDesc', `暂无可用优惠券`);
     }
   },