Kaynağa Gözat

Merge pull request #320 from John-Hong/John/release-2.19.0/SCRM-4916

feat(SCRM-4916): 重构,静安、浦东、沈阳、天津的消费减免和会员等级减免的优惠限制方案
Tron 1 yıl önce
ebeveyn
işleme
2b975557e1

+ 86 - 0
src/api/mockData/checkout.pd22.response.json

@@ -0,0 +1,86 @@
+{
+  "parkingRecord": {
+    "vehicleNo": "沪A00001",
+    "enterTime": "2023-10-11 10:54:00",
+    "serviceMin": 20075,
+    "totalFee": 7800,
+    "actualPayFee": 54.0,
+    "thirdParkOrderNo": "s2023102509290179bb795006",
+    "createdByQrCode": false,
+    "getTime": "2023-10-25 09:29:02",
+    "totalFeeInYuan": 78.00
+  },
+  "discountInfo": {
+    "usingTotalDiscount": 24,
+    "memberLevelDiscount": false,
+    "memberGrade": [
+      {
+        "selected": false,
+        "discountFee": 0
+      }
+    ],
+    "consume": [
+      {
+        "defaultSelected": true,
+        "selected": true,
+        "defaultDiscountTime": 2,
+        "discountFee": 24,
+        "redeemSalesAmount": 600,
+        "couponCodes": "rfqkki5ipz8_t#mkp0je6lzqf_t"
+      }
+    ],
+    "points": [
+      {
+        "available": 6300,
+        "selected": true,
+        "pointsPerUnit": 1000,
+        "unitAmount": 12,
+        "totalAvailable": 6300,
+        "unitHour": 1,
+        "newMember": false,
+        "label": "6300积分可减免",
+        "discountFee": 0
+      }
+    ],
+    "coupons": [
+      {
+        "code": "ovtahbbtisz_t",
+        "couponId": "7c9573c1042d421988d06eff44d2976b",
+        "selected": false,
+        "status": "available",
+        "name": "可叠加优惠券-Allison",
+        "expirationDate": "2023-10-27 23:59:59",
+        "discountFee": 12,
+        "defaultSelected": false,
+        "superposition": "2",
+        "limitCountPerOrder": 5
+      }
+    ],
+    "paperCoupons": [
+      {
+        "description": "纸质优惠券不限制会员使用。",
+        "selected": false
+      }
+    ]
+  },
+  "parkingRule": {
+    "maxOneTimeDiscountTime": 2,
+    "enableNewMemberPoints": false,
+    "enablePoints": true,
+    "unLimitWeekendPoints": false,
+    "enableCoupon": true,
+    "enablePaperCoupons": true,
+    "enableConsume": true,
+    "enableConsumeNonSplit": false,
+    "remainConsumeTime": 2,
+    "hourPrice": 12,
+    "oneTimeLimitation": true,
+    "oneDayLimitation": false
+  },
+  "parkInfo": {
+    "parkName": "PD",
+    "description": "12元/小时。8-24小时封顶96元。纸质优惠券不限制使用数量。每次最多优惠2小时。积分兑换停车费用1200积分=1小时。积分商城售卖停车电子券的使用类型。单日累计消费满300元赠送1张消费600元赠2张1小时的停车券,不重复发券,消费跨天不累计,",
+    "parkMallCode": 1,
+    "buildingId": "184-100035"
+  }
+}

+ 1 - 1
src/main.js

@@ -10,7 +10,7 @@ let debug = false;
 const keys = ['https://dev-','https://qa-','https://lt-','https://sl-','http://127.0.0.1'];
 keys.forEach(key => {
   if(!debug && window.location.origin.indexOf(key) > -1) {
-    debug = true
+    // debug = true
   }
 })
 if (debug) {

+ 354 - 0
src/pages/parkingFeeV2/Discounts/index.js

@@ -0,0 +1,354 @@
+import {Toast} from "vant";
+import {mapState} from 'vuex';
+import uniNumberBox from '@/components/uni-number-box/uni-number-box.vue';
+import {cloneDeep} from 'lodash'
+import baseMixins from '../mixins/base';
+import {waitByTime} from '@/utils'
+import uni from '@/utils/uniHooks';
+// const app = getApp()
+export default {
+  mixins: [baseMixins],
+  components: {uniNumberBox},
+  data() {
+    return {
+      checkedList: [], // 已选优惠列表
+      oldCheckedList: [], // 已选优惠列表备份
+      isMember: false, // member
+      isReduces: false, // reduces
+      memberLevelReduce: [],
+      memberGrade: {},
+      consume: {},
+      // todayReduceDiscountMessage: '',
+      isMemberDiscountDisabled: false,
+      maxDiscountTime: 0,
+      enableConsumeSplit: false,
+      maxReduceDiscount: 0,
+      reduceHours: 0,
+      remainPrice: 0,
+      reduceFee: 0, // 消费减免金额
+      isInit: 1,
+      isDiscountDisabled: false,
+      remainReduceTime: 0,
+      // 
+      usingTotalDiscount: 0
+    };
+  },
+  computed: {
+    ...mapState({
+      orderDetail: (state) => state.order.orderDetail,
+      custTypeId: (state) => state.custTypeId,
+      groupId: (state) => state.groupId,
+      enableConsume: (state) => state.order.enableConsume,
+      actualPayFee: (state) => state.order.actualPayFee,
+      // usingTotalDiscount: (state) => state.order.usingTotalDiscount,
+      memberLevelDiscount: (state) => state.order.memberLevelDiscount,
+      checkedTotal: (state) => state.order.checkedTotal,
+      parkMallCode: (state) => state.order.parkMallCode,
+      paperDiscountTime: (state) => state.order.paperDiscountTime,
+      // paperDiscountFee: (state) => state.order.paperDiscountTime,
+      availableDiscountFee: (state) => state.order.availableDiscountFee,
+      paperDiscountFee: (state) => state.order.paperDiscountFee, // 纸质优惠券
+    }),
+    enableConsumeNonSplit() {
+      return this.orderDetail.parkingRule.enableConsumeNonSplit
+    },
+    stepperMin() {
+      // 如果是合集车场,不存在拆分,默认返回用户可使用的消费抵扣时间
+      if (this.parkMallCode === 7 || this.enableConsumeNonSplit) {
+        return this.reduceHours || 0
+      }
+      // 如果不存消费减免,默认展示 0
+      if (JSON.stringify(this.consume) === '{}') {
+        return 0
+      }
+      // 如果存在消费减免并且是可拆分的,则设置最低拆分单位是 1
+      return 1
+    },
+    // 消费减免(拆分部分)提示文本
+    reduceSplitMessage() {
+      // console.log(106, this.reduceHours);
+      if (!this.enableConsumeNonSplit) {
+        return `选择${this.reduceHours}小时,`;
+      }
+      return '';
+    },
+    // 消费减免金额
+    reducesDiscountFee() {
+      return this.reduceHours * this.orderDetail.parkingRule.hourPrice;
+    },
+    // 消费减免说明文案
+    todayReduceDiscountMessage() {
+      // 静安浦东没有内容
+      if (this.parkMallCode === 0 || this.parkMallCode === 1) {
+        return ''
+      }
+      // 消费减免余额为 0 时
+      if (!this.orderDetail.parkingRule.remainConsumeTime || !this.consume.hasOwnProperty('redeemSalesAmount')) {
+        return `您暂无可用的消费减免`
+        // return `您今日消费减免已达${this.orderDetail.parkingRule.maxConsumeTime}小时上限`
+      }
+      // 消费减免不存在时
+      if (JSON.stringify(this.consume) === '{}') {
+        return '消费金额未达到最低优惠要求'
+      }
+
+      // 静安存在消费减免时
+      if (this.parkMallCode === 0) {
+        return `今日可减免${this.consume.remainConsumeTime}小时`;
+      }
+
+      // 沈阳提示信息
+      if (this.parkMallCode === 4 || this.parkMallCode === 6) {
+        return `未达上限时今日可减免${this.orderDetail.parkingRule.remainConsumeTime}小时`;
+      }
+      if (this.consume.defaultDiscountTime > this.orderDetail.parkingRule.remainConsumeTime) {
+        return `消费已满${this.consume.redeemSalesAmount}元,减免${this.consume.defaultDiscountTime}小时。超出优惠上限,可减免${this.maxReduceDiscount}小时,${this.reduceSplitMessage}可优惠${this.reducesDiscountFee}元`
+      }
+      return `消费已满${this.consume.redeemSalesAmount}元,减免${this.consume.defaultDiscountTime}小时。${this.reduceSplitMessage}可优惠${this.reducesDiscountFee}元`
+    }
+  },
+  async mounted() {
+    try {
+      await waitByTime(200);
+
+      const {usingTotalDiscount, memberGrade = [], consume = []} = this.orderDetail.discountInfo;
+      if (memberGrade.length) {
+        this.memberGrade = memberGrade[0]
+      }
+      if (consume.length) {
+        this.consume = consume[0]
+      }
+      // 开始初始化
+      this.pageInit()
+    } catch (err) {
+      this.$router.back()
+    }
+  },
+
+  methods: {
+    async pageInit() {
+      await waitByTime(200);
+      const {hourPrice = 0, remainConsumeTime = 0, maxOneTimeDiscountTime = 0} = this.orderDetail.parkingRule;
+      const {usingTotalDiscount} = this.orderDetail.discountInfo;
+      this.usingTotalDiscount = usingTotalDiscount
+      /*页面的默认展示*/
+      /*会员等级减免是否选中*/
+      if (JSON.stringify(this.memberGrade) !== '{}' && this.memberGrade && this.memberGrade.hasOwnProperty('selected') ? this.memberGrade.selected : this.memberGrade.defaultSelected) {
+        this.checkedList.push('member');
+      }
+      /*消费减免是否选中*/
+      if (JSON.stringify(this.consume) !== '{}' && this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected !== undefined) {
+        this.checkedList.push('reduces');
+      }
+      // 已用优惠时长 已经拿到了 usingTotalDiscount
+      // 剩余可用优惠时长 remainConsumeTime
+      /*
+      1、浦东每次上限处理
+       如果 剩余可用优惠时长 > 当前可用上限时间
+         则
+       剩余可用优惠时长 = 当前可用上限时间
+      */
+      if (this.parkMallCode === 1 && remainConsumeTime > maxOneTimeDiscountTime) {
+        this.remainConsumeTime = maxOneTimeDiscountTime;
+      }
+      if (this.parkMallCode === 1 && remainConsumeTime > maxOneTimeDiscountTime) {
+        this.remainConsumeTime = maxOneTimeDiscountTime;
+      }
+      // 沈阳、天津上限处理
+      if (this.parkMallCode === 4 || this.parkMallCode === 6) {
+        this.remainReduceTime = this.consume.maxDiscountTime;
+      }
+
+      // 消费减免可拆分上限
+      this.maxReduceDiscount = this.consume.defaultDiscountTime;
+      if (this.maxReduceDiscount > remainConsumeTime) {
+        this.maxReduceDiscount = remainConsumeTime;
+      }
+      this.reduceHours = this.maxReduceDiscount;
+
+      // 反显处理
+      if (this.consume.discountFee) {
+        this.reduceHours = (this.consume.discountFee / hourPrice) || 0;
+      }
+
+      // 浦东上限控制
+      if (this.parkMallCode === 1 || this.parkMallCode === 4 || this.parkMallCode === 6) {
+        if (this.memberGrade.discountFee) {
+          this.maxReduceDiscount = remainConsumeTime - (this.memberGrade.discountFee / hourPrice);
+          if ((this.parkMallCode === 4 || this.parkMallCode === 6) && this.maxReduceDiscount > this.consume.defaultDiscountTime) {
+            this.maxReduceDiscount = this.consume.defaultDiscountTime;
+          }
+        }
+        // this.reduceHours = this.maxReduceDiscount;
+        if (this.crossMessage()) {
+          if (this.isCheck('reduces')) {
+            this.maxReduceDiscount = this.reduceHours;
+          } else {
+            this.maxReduceDiscount = 0;
+            this.reduceHours = 0;
+          }
+        } else {
+          if (!this.isCheck('reduces')) {
+            this.reduceHours = this.maxReduceDiscount;
+          }
+        }
+      }
+    },
+    discountInit() {
+
+    },
+    maxReduceDiscountInit() {
+    },
+    setIsMemberDiscountDisabled() {
+      this.todayReduceDiscountMessage = '当日';
+    },
+    async checkboxChange() {
+      const {hourPrice = 0, remainConsumeTime = 0, maxOneTimeDiscountTime = 0} = this.orderDetail.parkingRule;
+      // const {usingTotalDiscount} = this.orderDetail.discountInfo;
+      // 浦东上限控制
+      if (this.parkMallCode === 1) {
+        if (this.isCheck('member')) {
+          this.maxReduceDiscount = remainConsumeTime - ((this.usingTotalDiscount - this.paperDiscountFee - this.memberGrade?.discountFee || 0) / hourPrice)
+          this.usingTotalDiscount -= this.reduceHours * hourPrice
+          await waitByTime()
+          this.reduceHours = this.maxReduceDiscount
+          this.usingTotalDiscount += this.reduceHours * hourPrice
+        } else {
+          if (this.isCheck('reduces')) {
+            this.maxReduceDiscount = remainConsumeTime - ((this.usingTotalDiscount - this.paperDiscountFee - this.reduceFee) / hourPrice);
+            this.reduceHours = this.maxReduceDiscount;
+            this.usingTotalDiscount += this.reduceHours * hourPrice
+          } else {
+            this.usingTotalDiscount -= this.reduceHours * hourPrice
+            this.maxReduceDiscount = remainConsumeTime - ((this.usingTotalDiscount - this.paperDiscountFee) / hourPrice);
+            this.reduceHours = this.maxReduceDiscount;
+          }
+        }
+      }
+      await waitByTime()
+      // 沈阳、天津上限控制
+      if (this.parkMallCode === 4 || this.parkMallCode === 6) {
+        if (this.isCheck('member')) {
+          this.usingTotalDiscount += this.memberGrade.discountFee
+        } else {
+          this.usingTotalDiscount -= this.memberGrade.discountFee
+          this.maxReduceDiscount = this.consume?.defaultDiscountTime;
+        }
+      }
+      console.log(2525, this.reduceHours, this.maxReduceDiscount)
+      // 超限设置
+      this.crossMessage();
+    },
+    onReduceHoursChange(type) {
+      if (this.isCheck('reduces')) {
+        return
+      }
+      const {hourPrice = 0, remainConsumeTime = 0, maxOneTimeDiscountTime = 0} = this.orderDetail.parkingRule;
+      if (type === 'minus') {
+        this.reduceHours = this.reduceHours - 1
+        this.usingTotalDiscount -= hourPrice
+        console.log(276, this.reduceHours)
+      }
+      if (type === 'plus' && !this.crossMessage()) {
+        this.reduceHours++
+        this.usingTotalDiscount += hourPrice
+      }
+    },
+    memberClick(e) {
+      if((!this.isCheck('member') && this.isDiscountDisabled) || !this.memberGrade.discountFee) {
+        return
+      }
+      if (!this.isCheck('member')) {
+        this.checkedList = [...this.checkedList, 'member']
+      } else {
+        this.checkedList = this.checkedList.filter(elm => elm !== 'member')
+      }
+      this.checkboxChange()
+    },
+    reducesClick() {
+      if((!this.isCheck('reduces') && this.isDiscountDisabled) || !this.consume.defaultDiscountTime) {
+        return
+      }
+      // && !this.crossMessage()
+      if (!this.isCheck('reduces')) {
+        this.checkedList = [...this.checkedList, 'reduces']
+      } else {
+        this.checkedList = this.checkedList.filter(elm => elm !== 'reduces')
+      }
+      this.checkboxChange()
+    },
+    // 超限提示
+    crossMessage(type) {
+      const {
+        hourPrice = 0,
+        remainConsumeTime = 0,
+        maxOneTimeDiscountFee = 0,
+        oneTimeLimitation,
+        oneDayLimitation,
+        maxOneTimeDiscountTime,
+        maxOneDayDiscountFee
+      } = this.orderDetail.parkingRule;
+      // const {usingTotalDiscount} = this.orderDetail.discountInfo;
+      this.isDiscountDisabled = false;
+      // 浦东每次总优惠上限
+      if (oneTimeLimitation && (this.usingTotalDiscount - this.paperDiscountFee) / hourPrice >= maxOneTimeDiscountTime) {
+        this.isDiscountDisabled = true;
+        uni.showToast({
+          title: `超出抵扣上限,每次最高可抵扣${maxOneTimeDiscountTime}小时`,
+          icon: 'none'
+        });
+        return true
+      }
+      // 沈阳、天津
+      if (oneDayLimitation && this.usingTotalDiscount - this.paperDiscountFee >= maxOneDayDiscountFee) {
+        this.isDiscountDisabled = true;
+        uni.showToast({
+          title: `超出抵扣上限,每次最高可抵扣${maxOneDayDiscountFee / hourPrice}小时`,
+          icon: 'none'
+        });
+        return true
+      }
+      // 消费每天优惠上限(非浦东、沈阳)
+      if (this.parkMallCode !== 1 && this.parkMallCode !== 4 && this.parkMallCode !== 6 && this.reduceHours * hourPrice >= remainConsumeTime) {
+        this.reduces = remainConsumeTime;
+        uni.showToast({
+          title: `超出抵扣上限,消费减免每天最高可抵扣${this.parkInfoEntity.dateReduceUpperliLimit}小时,可使用${this.parkInfoEntity.remainReduceTime}小时`,
+          icon: 'none'
+        });
+        return true
+      }
+      return false
+    },
+    // 验证当前的选项是否可选择
+    isCheck(val) {
+      return this.checkedList.findIndex(e => e == val) > -1;
+    },
+    async confirm() {
+      let orderDetail = cloneDeep(this.orderDetail);
+      // 如果初次进来操作的跟原来的不一样则重新计算优惠
+      if (this.checkedList.length !== this.checkedTotal || true) {
+        ['member', 'reduces'].forEach((key) => {
+          if (key === 'member') {
+            this.memberGrade = {
+              ...this.memberGrade,
+              selected: this.checkedList.indexOf(key) > -1,
+            };
+            orderDetail.discountInfo.memberGrade = [this.memberGrade];
+          }
+          if (key === 'reduces') {
+            this.consume = {
+              ...this.consume,
+              discountTime: this.reduceHours,
+              discountFee: this.reduceHours * this.orderDetail.parkingRule.hourPrice,
+              selected: this.checkedList.indexOf(key) > -1,
+            };
+            orderDetail.discountInfo.consume = [this.consume];
+          }
+        });
+        await this.$store.dispatch('order/saveDiscounts', {orderDetail, callback: () => this.$router.back()});
+      } else {
+        this.$router.back();
+      }
+    },
+  },
+};

+ 182 - 0
src/pages/parkingFeeV2/Discounts/index.less

@@ -0,0 +1,182 @@
+.scroll-Y {
+  width: 100%;
+  display: flex;
+  flex-direction: column;
+  height: 100vh;
+  background: #f4f7ff;
+}
+
+.container {
+  background-color: #fafbff;
+  width: calc(100% - 100px);
+  margin: 30px;
+  padding-left: 40px;
+  border-radius: 4px;
+  display: flex;
+  align-items: center;
+  line-height: 70px;
+  position: relative;
+  height: inherit;
+  border: 1px solid #d8dae0;
+
+  .item {
+    width: 570px;
+    padding: 20px 0;
+
+    .title {
+      font-size: 34px;
+    }
+
+    .content {
+      font-size: 28px;
+      color: #989898;
+    }
+  }
+
+  .member-discount-info {
+    font-size: 20px;
+    position: absolute;
+    right: 12px;
+    bottom: 0;
+    color: #989898;
+  }
+
+  .page_img {
+    width: 49px;
+    height: 49px;
+    border: 1px solid #e6e6e6;
+    border-radius: 50%;
+    overflow: hidden;
+
+    img {
+      width: 50px;
+      height: 50px;
+      margin-left: -1px;
+    }
+  }
+}
+
+/*页面底部操作区*/
+.flewx {
+  position: fixed;
+  bottom: 0;
+  right: 0;
+  left: 0;
+  background-color: #fff;
+
+  .control-box {
+    width: 100%;
+    box-sizing: border-box;
+
+    display: flex;
+    align-content: flex-start;
+    align-items: center;
+    //padding-bottom: constant(safe-area-inset-bottom);
+    //padding-bottom: env(safe-area-inset-bottom);
+    padding: 30px 24px 30px 30px;
+    justify-content: space-between;
+
+    .flewx-content {
+      font-size: 28px;
+
+      .fee-box {
+        display: flex;
+        align-items: center;
+        justify-content: flex-start;
+      }
+
+      .actualPayFee {
+        color: #333;
+        font-size: 40px;
+      }
+
+      .usingTotalDiscount {
+        font-family: 'PingFang SC';
+        font-style: normal;
+        font-weight: 400;
+        font-size: 22px;
+        //height: 22px;
+        //line-height: 22px;
+        margin-left: 7px;
+        //border: 1px solid var(--k-color-red-01);
+        background-color: #f4f7ff;
+        border-radius: 2px;
+
+        &::after {
+          border-color: #999999;
+        }
+
+        color: #999999;
+        padding: 1px 3px;
+
+        &.usingTotalDiscount-red {
+          color: var(--k-color-red-01);
+          background-color: var(--k-color-red-06);
+
+          &::after {
+            border-color: var(--k-color-red-01);
+          }
+        }
+      }
+
+      .count-down-box {
+        display: flex;
+        font-weight: 400;
+        align-items: center;
+        color: var(--k-color-red-01);
+        font-family: 'PingFang SC';
+        font-style: normal;
+        font-weight: 400;
+        font-size: 26px;
+        margin-top: 5px;
+
+        .van-count-down {
+          font-size: 30px;
+          color: var(--k-color-red-01);
+        }
+
+        .desc {
+          font-size: 30px;
+        }
+      }
+    }
+
+    .btn-box {
+      display: flex;
+      justify-content: flex-end;
+      margin-left: 35px;
+      flex: 1;
+      max-width: 240px;
+    }
+  }
+}
+
+/deep/ checkbox .wx-checkbox-input.wx-checkbox-input-checked {
+  background-color: red !important;
+  border-radius: 50% !important;
+  border: 1px solid red;
+}
+
+/deep/ checkbox .wx-checkbox-input {
+  border-radius: 50% !important;
+}
+
+/deep/ .van-stepper__input {
+  background-color: #ffffff;
+  font-size: 34px;
+  border: 1px solid #e5e5e5;
+  border-left: 0;
+  border-right: 0;
+  margin-left: 0;
+  margin-right: 0;
+}
+
+/deep/ .van-stepper__minus {
+  border: 1px solid #e5e5e5;
+  border-right: 0;
+}
+
+/deep/ .van-stepper__plus {
+  border: 1px solid #e5e5e5;
+  border-left: 0;
+}

+ 62 - 0
src/pages/parkingFeeV2/Discounts/index.vue

@@ -0,0 +1,62 @@
+<template>
+  <div :class="theme">
+    <div scroll-y="true" :class="['scroll-Y']">
+      <van-checkbox-group :value="checkedList" checked-color="#064C8A">
+        <div class="container" v-if="memberLevelDiscount">
+          <div class="item">
+            <div class="title">会员等级减免</div>
+            <div class="content">{{ memberGrade.memberGradeText || '' }}减免{{ memberGrade.discountTime || 0 }}小时。可优惠{{ memberGrade.discountFee || 0 }}元</div>
+          </div>
+          <van-checkbox color="#fff" name="member" checked-color="var(--k-color-primary)" :disabled="(!isCheck('member') && isDiscountDisabled) || !memberGrade.discountFee" @click="memberClick" />
+          <!-- :checked="isCheck('member')" -->
+          <div class="member-discount-info" v-if="isMemberDiscountDisabled">当日已使用</div>
+        </div>
+        <div class="container" v-if="enableConsume">
+          <div class="item">
+            <div class="title">消费减免</div>
+            <!-- <uni-view class="content" v-if="parkInfoEntity.parkMallCode === 1 && parkInfoEntity.expirationDate">{{reduceDiscountMessage}}</uni-view> -->
+            <div class="content" v-if="orderDetail.parkInfo.parkMallCode !== 1">
+              {{ todayReduceDiscountMessage }}
+            </div>
+            <van-stepper
+              v-if="!enableConsumeNonSplit && maxReduceDiscount > 0 || parkMallCode === 1 || parkMallCode === 0" 
+              :min="stepperMin"
+              name="reduces"
+              :max="maxReduceDiscount"
+              :value="reduceHours"
+              @plus="onReduceHoursChange('plus')"
+              @minus="onReduceHoursChange('minus')"
+            />
+          </div>
+          <van-checkbox name="reduces" color="#fff" checked-color="var(--k-color-primary)" :disabled="(!isCheck('reduces') && isDiscountDisabled) || !consume.defaultDiscountTime" @click="reducesClick" />
+        </div>
+      </van-checkbox-group>
+    </div>
+    <div class="flewx">
+      <div class="control-box">
+        <div class="flewx-content">
+          <div class="fee-box">
+            <div>合计:</div>
+            <div class="actualPayFee">{{ actualPayFee | currency }}</div>
+            <div :class="['van-hairline--surround', 'usingTotalDiscount', usingTotalDiscount > 0 && 'usingTotalDiscount-red']">已优惠{{ usingTotalDiscount | currency }}元</div>
+            <!-- <van-count-down :time="3 * 60 * 1000" /> -->
+          </div>
+        </div>
+        <div class="btn-box">
+          <k-button style="width: 100%; max-width: 240px" title="确定" disabledColor="#D1D2D9" @click="confirm" />
+        </div>
+      </div>
+      <!-- 开启底部安全区适配 -->
+      <van-number-keyboard safe-area-inset-bottom />
+    </div>
+  </div>
+</template>
+
+<script>
+import parkingFeeDiscountsJs from './index.js';
+export default parkingFeeDiscountsJs;
+</script>
+
+<style lang="less" scoped>
+@import "./index.less";
+</style>

Dosya farkı çok büyük olduğundan ihmal edildi
+ 4 - 0
src/pages/parkingFeeV2/Discounts/消费减免逻辑.svg


BIN
src/pages/parkingFeeV2/Discounts/消费减免逻辑.xmind


+ 1 - 1
src/routes/indexV2.js

@@ -65,7 +65,7 @@ export const routes = [
     },{
         path: '/parkingFeeDiscounts',
         name: 'parkingFeeDiscounts',
-        component: () => import('@/pages/parkingFeeV2/parkingFeeDiscounts.vue'),
+        component: () => import('@/pages/parkingFeeV2/Discounts/index.vue'),
     },{
         path: '/parkingFeePaperCoupon',
         name: 'parkingFeePaperCoupon',

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

@@ -1,4 +1,4 @@
-import checkOutQHResponse from "@/api/mockData/checkout.pd21.response.json";
+import checkOutQHResponse from "@/api/mockData/checkout.hz1.response.json";
 import { checkOut,calculateDiscount,ordersAndPrepay,currentUnlicensedPlate,unlicensedCarCheckIn,unlicensedCarCheckout } from '@/api/parking';
 import state from "@/store/order/state";
 import mutations from "@/store/order/mutations";

+ 16 - 1
src/store/order/paperCoupon.js

@@ -53,10 +53,25 @@ export default {
         ...orderDetail,
       });
       dispatch('orderInitRule',res);
+      dispatch('setDiscountFee')
       callback && callback();
     } catch ( err ) {
       console.log('积分修改失败!',err);
       callback && callback();
     }
-  }
+  },
+  setDiscountFee({commit,dispatch,state}) {
+    let paperCouponFee = 0
+    const orderDetail = {...state.orderDetail};
+    // 如果是纸质优惠券的话
+    if ( orderDetail.discountInfo?.paperCoupons?.length ) {
+      orderDetail.discountInfo?.paperCoupons.forEach(elm => {
+        if(elm?.discountFee) {
+          paperCouponFee += elm.discountFee
+        }
+      })
+    }
+    commit('setPaperDiscountFee', paperCouponFee)
+  },
+ 
 }

+ 9 - 0
src/utils/common/function.js

@@ -25,3 +25,12 @@ export function extractValuesFromString(inputString) {
   }
   return false; // 如果没有匹配,返回 null 或者其他适当的值
 }
+
+// 定时器
+export function waitByTime(settime = 100) {
+  return new Promise((resolve) => {
+    setTimeout(() => {
+      resolve()
+    }, settime)
+  })
+}

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor