Sfoglia il codice sorgente

Merge pull request #405 from John-Hong/release-3.1.0

feat(KIP-13391): 深圳-深圳嘉里建设广场优惠规则适配
Tron 1 anno fa
parent
commit
887c4345ad

+ 9 - 9
src/pages/parkingFee/mixins/parkingFeeCoupon.js

@@ -81,7 +81,7 @@ export default {
         this.remainPrice = this.remainPrice - this.orderDetail.discountInfo.points[0].discountFee
       }   
       // 如果前海开启无积分上限的话,则
-      if ( parkMallCode === 5 && this.unLimitWeekendPoints && this.orderDetail.discountInfo?.points[0]?.discountFee) {
+      if ( [5, 10].indexOf(parkMallCode) > -1 && this.unLimitWeekendPoints && this.orderDetail.discountInfo?.points[0]?.discountFee) {
         this.remainPrice = this.remainPrice - this.orderDetail?.discountInfo?.points[0]?.discountFee
       }
       this.newAvailableDiscountFee = this.availableDiscountFee
@@ -166,7 +166,7 @@ export default {
       const { parkMallCode } = parkInfo;
       const {maxOneTimeDiscountTime,oneTimeLimitation,oneDayLimitation,hourPrice,remainConsumeTime} = parkingRule
       // 设置深圳的达到优惠金额的上限,置灰剩下未选择的金额
-      if ( parkMallCode === 5 && this.remainPrice >= this.newAvailableDiscountFee) {
+      if ( [5, 10].indexOf(parkMallCode) > -1 && this.remainPrice >= this.newAvailableDiscountFee) {
         this.couponList = this.couponList.map((elm,iemi) => {
           if ( !elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
             elm.disabled = true
@@ -176,7 +176,7 @@ export default {
         return true
       }
       // 单日上限限制
-      if ( oneDayLimitation  && parkMallCode !== 5) {
+      if ( oneDayLimitation  && [5,10].indexOf(parkMallCode) < 0) {
         const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
         const remainConsumeTimeFee = remainConsumeTime * hourPrice
         
@@ -193,7 +193,7 @@ export default {
         }
       }
       // 单次上限限制
-      if ( oneTimeLimitation && parkMallCode !== 5 ) {
+      if ( oneTimeLimitation && [ 5, 10 ].indexOf(parkMallCode) < 0 ) {
         const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
         // const remainConsumeTimeFee = remainConsumeTime * hourPrice
         // 计算单日剩余 remainConsumeTime
@@ -295,7 +295,7 @@ export default {
       }
 
       // 浦东每次缴费超限控制、沈阳每日超限控制
-      if ((parkMallCode === 1 || parkMallCode === 4 || parkMallCode === 5 || parkMallCode === 999 || parkMallCode === 6) && this.crossMessage(showMsg)) {
+      if ([1, 4, 5, 999, 6, 10].indexOf(parkMallCode) > -1 && this.crossMessage(showMsg)) {
         this.couponList = this.couponList.map((e, i) => {
           if (this.checkedCouponList.findIndex((c) => c === `coupon${i}`) === -1) {
             e.disabled = true;
@@ -327,13 +327,13 @@ export default {
       } = this.orderDetail.parkingRecord;
       // 剩余可使用的优惠金额,支持动态计算; 优惠时长,不可能全部使用,不能超过车费减去优惠的金额;不能超过单次的应付金额
       let remainPrice = remainConsumeTime * hourPrice;
-      if (parkMallCode === 5) {
+      if (parkMallCode === 5 || parkMallCode === 10) {
         if (remainPrice - this.paperDiscountFee > actualPayFee) {
           remainPrice = actualPayFee;
         }
       }
       // 深圳超限处理
-      if (parkMallCode === 5 && this.remainPrice  >= this.availableDiscountFee) {
+      if ([5, 10].indexOf(parkMallCode) > -1 && this.remainPrice  >= this.availableDiscountFee) {
         if ( showMsg ) return true
         return Toast({
           message: `优惠券已达当日使用上限,不可再用`,
@@ -345,13 +345,13 @@ export default {
       if (oneDayLimitation && this.remainPrice >= this.availableDiscountFee) {
         if ( showMsg ) return true
         return Toast({
-          message: parkMallCode === 5 ? '当日优惠已达上限,不可再用' : `每日最高可抵扣${maxOneDayDiscountFee}元`,
+          message: [5, 10].indexOf(parkMallCode) > -1 ? '当日优惠已达上限,不可再用' : `每日最高可抵扣${maxOneDayDiscountFee}元`,
           icon: 'none',
         });
       }
       const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
       // 单次上限限制
-      if ( oneTimeLimitation && parkMallCode !== 5 && this.remainPrice >= maxOneTimeDiscountFee) {
+      if ( oneTimeLimitation && [5, 10].indexOf(parkMallCode) < 0 && this.remainPrice >= maxOneTimeDiscountFee) {
         if ( showMsg ) return true
         return Toast({
           message: `超出抵扣上限,每次最高可抵扣${maxOneTimeDiscountTime}小时`,

+ 3 - 3
src/pages/parkingFee/parkingFeeDetail.vue

@@ -133,14 +133,14 @@
         <div class="popue_box_index1">积分减免</div>
         <div class="popue_box_index">
           <div>减免规则</div>
-          <div style="color: #989898">{{ pointsPerHour }}积分抵扣{{ orderDetail.parkInfo.parkMallCode === 5 ? unitAmount + '元' : '1小时' }}</div>
+          <div style="color: #989898">{{ pointsPerHour }}积分抵扣{{ [5, 10].indexOf(orderDetail.parkInfo.parkMallCode)> -1 ? unitAmount + '元' : '1小时' }}</div>
         </div>
         <div class="popue_box_index">
           <div>可用积分</div>
           <div style="color: #999999">{{ available }}分</div>
         </div>
         <div class="popue_box_index">
-          <div>抵扣{{ orderDetail.parkInfo.parkMallCode === 5 ? '金额' : '时长' }}</div>
+          <div>抵扣{{ [5, 10].indexOf(orderDetail.parkInfo.parkMallCode)> -1 ? '金额' : '时长' }}</div>
           <div class="popue_box_index" style="width: 335px">
             <div class="popue_box_index4_xs van-hairline--surround">
               <div class="popue_box_index4_xs_index1" @click="$store.dispatch('order/pointsMath',{type: 'minus', callback: pointsMathCallback})">
@@ -152,7 +152,7 @@
               </div>
             </div>
             <div style="color: #808080">
-              {{ orderDetail.parkInfo.parkMallCode === 5 ? '元' : '小时' }}
+              {{ [5, 10].indexOf(orderDetail.parkInfo.parkMallCode)> -1 ? '元' : '小时' }}
             </div>
           </div>
         </div>

+ 9 - 9
src/pages/parkingFeeV2/mixins/parkingFeeCoupon.js

@@ -81,7 +81,7 @@ export default {
         this.remainPrice = this.remainPrice - this.orderDetail.discountInfo.points[0].discountFee
       }   
       // 前海积分不参与当前电子券优惠上限
-      if ( parkMallCode === 5 && this.orderDetail.discountInfo?.points[0]?.discountFee) {
+      if ( [ 5, 10 ].indexOf(parkMallCode) > -1 && this.orderDetail.discountInfo?.points[0]?.discountFee) {
         this.remainPrice = this.remainPrice - this.orderDetail?.discountInfo?.points[0]?.discountFee
       }
       this.newAvailableDiscountFee = this.availableDiscountFee
@@ -167,7 +167,7 @@ export default {
       const { parkMallCode } = parkInfo;
       const {maxOneTimeDiscountTime,oneTimeLimitation,oneDayLimitation,hourPrice,remainConsumeTime} = parkingRule
       // 设置深圳的达到优惠金额的上限,置灰剩下未选择的金额
-      if ( parkMallCode === 5 && this.remainPrice >= this.newAvailableDiscountFee) {
+      if ( [5, 10].indexOf(parkMallCode) > -1 && this.remainPrice >= this.newAvailableDiscountFee) {
         this.couponList = this.couponList.map((elm,iemi) => {
           if ( !elm.disabled && this.checkedCouponList.indexOf(`coupon${iemi}`) < 0) {
             elm.disabled = true
@@ -177,7 +177,7 @@ export default {
         return true
       }
       // 单日上限限制
-      if ( oneDayLimitation  && parkMallCode !== 5) {
+      if ( oneDayLimitation  && [5, 10].indexOf(parkMallCode) < 0) {
         const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
         const remainConsumeTimeFee = remainConsumeTime * hourPrice
         
@@ -194,7 +194,7 @@ export default {
         }
       }
       // 单次上限限制
-      if ( oneTimeLimitation && parkMallCode !== 5 ) {
+      if ( oneTimeLimitation && [5,10].indexOf(parkMallCode) < 0 ) {
         const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
         // const remainConsumeTimeFee = remainConsumeTime * hourPrice
         // 计算单日剩余 remainConsumeTime
@@ -296,7 +296,7 @@ export default {
       }
 
       // 浦东每次缴费超限控制、沈阳每日超限控制
-      if ((parkMallCode === 1 || parkMallCode === 4 || parkMallCode === 5 || parkMallCode === 999 || parkMallCode === 6) && this.crossMessage(showMsg)) {
+      if ([1,4,5,999,6,10].indexOf(parkMallCode) > -1 && this.crossMessage(showMsg)) {
         this.couponList = this.couponList.map((e, i) => {
           if (this.checkedCouponList.findIndex((c) => c === `coupon${i}`) === -1) {
             e.disabled = true;
@@ -328,13 +328,13 @@ export default {
       } = this.orderDetail.parkingRecord;
       // 剩余可使用的优惠金额,支持动态计算; 优惠时长,不可能全部使用,不能超过车费减去优惠的金额;不能超过单次的应付金额
       let remainPrice = remainConsumeTime * hourPrice;
-      if (parkMallCode === 5) {
+      if (parkMallCode === 5 || parkMallCode === 10) {
         if (remainPrice - this.paperDiscountFee > actualPayFee) {
           remainPrice = actualPayFee;
         }
       }
       // 深圳超限处理
-      if (parkMallCode === 5 && this.remainPrice  >= this.availableDiscountFee) {
+      if ([5, 10].indexOf(parkMallCode) > -1 && this.remainPrice  >= this.availableDiscountFee) {
         if ( showMsg ) return true
         return Toast({
           message: `优惠券已达当日使用上限,不可再用`,
@@ -346,13 +346,13 @@ export default {
       if (oneDayLimitation && this.remainPrice >= this.availableDiscountFee) {
         if ( showMsg ) return true
         return Toast({
-          message: parkMallCode === 5 ? '当日优惠已达上限,不可再用' : `每日最高可抵扣${maxOneDayDiscountFee}元`,
+          message: [5, 10].indexOf(parkMallCode) > -1 ? '当日优惠已达上限,不可再用' : `每日最高可抵扣${maxOneDayDiscountFee}元`,
           icon: 'none',
         });
       }
       const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice
       // 单次上限限制
-      if ( oneTimeLimitation && parkMallCode !== 5 && this.remainPrice >= maxOneTimeDiscountFee) {
+      if ( oneTimeLimitation && [5, 10].indexOf(parkMallCode) < 0 && this.remainPrice >= maxOneTimeDiscountFee) {
         if ( showMsg ) return true
         return Toast({
           message: `超出抵扣上限,每次最高可抵扣${maxOneTimeDiscountTime}小时`,

+ 3 - 3
src/pages/parkingFeeV2/parkingFeeDetail.vue

@@ -133,14 +133,14 @@
         <div class="popue_box_index1">积分减免</div>
         <div class="popue_box_index">
           <div>减免规则</div>
-          <div style="color: #989898">{{ pointsPerHour }}积分抵扣{{ orderDetail.parkInfo.parkMallCode === 5 ? unitAmount + '元' : '1小时' }}</div>
+          <div style="color: #989898">{{ pointsPerHour }}积分抵扣{{ [ 5, 10 ].indexOf(orderDetail.parkInfo.parkMallCode) > -1 ? unitAmount + '元' : '1小时' }}</div>
         </div>
         <div class="popue_box_index">
           <div>可用积分</div>
           <div style="color: #999999">{{ available }}分</div>
         </div>
         <div class="popue_box_index">
-          <div>抵扣{{ orderDetail.parkInfo.parkMallCode === 5 ? '金额' : '时长' }}</div>
+          <div>抵扣{{ [ 5,10 ].indexOf(orderDetail.parkInfo.parkMallCode) > -1 ? '金额' : '时长' }}</div>
           <div class="popue_box_index" style="width: 335px">
             <div class="popue_box_index4_xs van-hairline--surround">
               <div class="popue_box_index4_xs_index1" @click="$store.dispatch('order/pointsMath',{type: 'minus', callback: pointsMathCallback})">
@@ -152,7 +152,7 @@
               </div>
             </div>
             <div style="color: #808080">
-              {{ orderDetail.parkInfo.parkMallCode === 5 ? '元' : '小时' }}
+              {{ [ 5,10 ].indexOf(orderDetail.parkInfo.parkMallCode) > -1 ? '元' : '小时' }}
             </div>
           </div>
         </div>

+ 9 - 9
src/store/order/points.js

@@ -46,7 +46,7 @@ export default {
     commit('setMaxDiscountFee',maxDiscountFee);
     let pointsTime = 0
     // 深圳
-    if ( parkMallCode === 5 ) {
+    if ( parkMallCode === 5 || parkMallCode === 10) {
       pointsTime = discountFee || 0
     } else  {
       pointsTime = discountFee ?  discountFee / unitAmount: 0
@@ -64,7 +64,7 @@ export default {
       commit('setIntegralDesc', '今日积分已达上限');
       return
     }
-    commit('setIntegralDesc',pointsTime ? `已选择兑换${ pointsTime }${parkMallCode === 5 ? '元' : '小时'}` : available > pointsPerUnit ? `${ available }积分可减免` : `${ pointsPerUnit }积分可停车1小时`); // 积分优惠处的描述
+    commit('setIntegralDesc',pointsTime ? `已选择兑换${ pointsTime }${parkMallCode === 5 || parkMallCode === 10 ? '元' : '小时'}` : available > pointsPerUnit ? `${ available }积分可减免` : `${ pointsPerUnit }积分可停车1小时`); // 积分优惠处的描述
   },
   // 当前最大可选优惠时间
   /*
@@ -132,7 +132,7 @@ export default {
       maxPointsTime = state.availableDiscountFee
     }
     // if ( parkMallCode === 5 && state.unlimitUsePoints === 'LIMIT' ) {
-    if ( parkMallCode === 5 && !state.unLimitWeekendPoints ) {
+    if ( [ 5, 10 ].indexOf(parkMallCode) > -1 && !state.unLimitWeekendPoints ) {
       if ( type === 'add' && (state.pointsTime >= maxPointsTime || state.usingTotalDiscount >= state.availableDiscountFee) ) {
         // 以下是深圳积分上限规则
         // 超出抵扣上限,每日最高可抵扣${this.parkFee.parkInfoEntity.maxOneDayHour}元 '优惠金额' >= '每日最高可抵扣'
@@ -146,7 +146,7 @@ export default {
       }
     }
     // 单日上限限制
-    if ( oneDayLimitation && !msg && parkMallCode !== 5 && parkMallCode !== 4 && parkMallCode !== 2 && type === 'add') {
+    if ( oneDayLimitation && !msg && [5,4,2, 10].indexOf(parkMallCode) < 0 && type === 'add') {
       // const maxOneTimeDiscountFee = maxOneDayDiscountFee
       // const remainConsumeTimeFee = remainConsumeTime * hourPrice
       // 计算单日剩余 remainConsumeTime
@@ -158,7 +158,7 @@ export default {
       }
     }
     // 单次上限限制
-    if ( oneTimeLimitation && !msg && parkMallCode !== 5 && parkMallCode !== 4 && parkMallCode !== 2 && type === 'add') {
+    if ( oneTimeLimitation && !msg && [5, 10].indexOf(parkMallCode) < 0 && parkMallCode !== 4 && parkMallCode !== 2 && type === 'add') {
       const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice // 计算时间对应的金额
       // const remainConsumeTimeFee = remainConsumeTime * hourPrice
       // 计算单日剩余 remainConsumeTime
@@ -202,7 +202,7 @@ export default {
       //   return
       // }
       let pointsTime = 0;
-      pointsTime = state.pointsTime + (parkMallCode === 5 ? state.unitAmount : state.unitHour);
+      pointsTime = state.pointsTime + ([5,10].indexOf(parkMallCode) > -1 ? state.unitAmount : state.unitHour);
       const available = state.available - state.pointsPerUnit;
       const usingTotalDiscount = state.usingTotalDiscount + (state?.unitHour ? state.unitHour * hourPrice : state.unitAmount); // 重新计算已经使用的优惠逻辑
       if ( available > -1 ) {
@@ -213,7 +213,7 @@ export default {
       }
     }
     if ( type === 'minus' && state.pointsTime > 0 ) {
-      const pointsTime = state.pointsTime - (parkMallCode === 5 ? state.unitAmount : state.unitHour);
+      const pointsTime = state.pointsTime - ([5,10].indexOf(parkMallCode) > -1 ? state.unitAmount : state.unitHour);
       const usingTotalDiscount = state.usingTotalDiscount - (state?.unitHour ? state.unitHour * hourPrice : state.unitAmount); // 重新计算已经使用的优惠逻辑
       // 如果是深圳车场
       commit('setAvailable',state.available + state.pointsPerUnit);
@@ -235,7 +235,7 @@ export default {
     }
     let pointsTime = 0
     // 深圳
-    if ( parkMallCode === 5 ) {
+    if ( parkMallCode === 5 || parkMallCode === 10) {
       pointsTime = discountFee || 0
     } else  {
       pointsTime = discountFee ?  discountFee / unitAmount : 0
@@ -260,7 +260,7 @@ export default {
       setSelected(['memberGrade','consume','paperCoupons','coupons','newMemberPoints'],orderDetail)
       // 计算积分修改之后的金额,返回给后端
       // orderDetail.discountInfo.points[0].discountFee = state.pointsTime * orderDetail.discountInfo.points[0].unitAmount;
-      orderDetail.discountInfo.points[0].discountFee = parkMallCode === 5 ? state.pointsTime : state.pointsTime * orderDetail.discountInfo.points[0].unitAmount;
+      orderDetail.discountInfo.points[0].discountFee = [5,10].indexOf(parkMallCode) > -1 ? state.pointsTime : state.pointsTime * orderDetail.discountInfo.points[0].unitAmount;
       orderDetail.discountInfo.points[0].available = state.available;
       orderDetail.discountInfo.points[0].selected = true;
       /* 其他优惠统计 */

+ 1 - 1
src/store/order/state.js

@@ -36,7 +36,7 @@ export default  {
   // 无牌车逻辑
   unlicensedCar: '',
   // 车场相关
-  parkMallCode: '', // 车场唯一编号 0静安 1浦东 2杭州 3北京 4沈阳 5深圳 6天津 7合集一期 8福州 9合集三期
+  parkMallCode: '', // 车场唯一编号 0静安 1浦东 2杭州 3北京 4沈阳 5深圳 6天津 7合集一期 8福州 9合集三期 10 深圳建设广场
   /* 纸质优惠券相关 */
   paperCoupons: [], // 可选纸质优惠券数量
   paperCouponCount: 0, // 已选纸质择优惠券