Procházet zdrojové kódy

style(KIP-7551): 选择优惠页面

John-Hong před 2 roky
rodič
revize
e8069eac1f

+ 68 - 49
src/components/wx-points-commit/wx-points-commit.vue

@@ -1,33 +1,33 @@
 <template>
-  <view class="authorize-hz" v-if="show" catchtouchmove="ture">
-    <view class="mid">
-      <view class="authorize-box">
-        <view class="bold">{{ title }}</view>
-        <view class="other">
+  <div class="authorize-hz" v-if="show">
+    <div class="mid">
+      <div class="authorize-box">
+        <div class="bold">{{ title }}</div>
+        <div class="other">
           感谢您{{ lbsName }}的信任!请您仔细阅读并充分理解我们最新更新的
-          <text
+          <sapn
             v-if="!privacyReminder"
             style="color: #627ecf"
             @click="gotoProtocol('privacyPolicy')"
-            >《{{ brandInfo.privacyPolicyName }}》</text
+            >《{{ brandInfo.privacyPolicyName }}》</sapn
           >&nbsp;
-          <text
+          <sapn
             v-if="!protocolReminder"
             style="color: #627ecf"
             @click="gotoProtocol('protocol')"
-            >《{{ brandInfo.protocolName }}》</text
+            >《{{ brandInfo.protocolName }}》</sapn
           >。
           新的协议政策将不影响您现有的会员权益,您点击“同意”按钮后,将视为同意本次协议更新。
-        </view>
-      </view>
-      <view class="authorize-footer">
+        </div>
+      </div>
+      <div class="authorize-footer">
         <uni-button class="disagree_btn" @click="handleDisagree"
           >不同意</uni-button
         >
         <uni-button class="agree_btn" @click="handleConfirm">同意</uni-button>
-      </view>
-    </view>
-  </view>
+      </div>
+    </div>
+  </div>
 </template>
 
 <script>
@@ -38,10 +38,11 @@ import {
   kipAgreementCheck,
   kipAgreementSave,
 } from '@/utils/api-kip.js';
-import MemberCacheTool from '@/utils/member-cache-tool.js';
-import KipCacheTool from '@/utils/kip-cache-tool.js';
+
 import CacheTool from '@/utils/cache-tool.js';
 import { isKOMiniApp } from '@/utils/utils.js';
+import uni from '@/utils/uniHooks'
+import { mapState } from "vuex";
 const YES = '1';
 const NO = '0';
 export default {
@@ -55,8 +56,8 @@ export default {
   data() {
     return {
       show: false,
-      curMarket: null,
-      brandInfo: null,
+      // curMarket: null,
+      // brandInfo: null,
       cacheKey: '',
       privacyReminder: true,
       protocolReminder: true,
@@ -71,13 +72,26 @@ export default {
       const lbsName = this.curMarket?.name || '';
       return lbsName ? `对${lbsName}` : '';
     },
+    ...mapState({
+      curMarket: (state) => state.curMarket,
+      brandInfo: (state) => state.brandInfo,
+      groupId: (state) => state.groupId,
+      mallid: (state) => state.mallId,
+    }),
   },
   methods: {
     gotoProtocol(type) {
-      const brandId = app.globalData.groupId || uni.getStorageSync('groupId');
-      const lbsId = app.globalData.mallid || uni.getStorageSync('mallid');
-      uni.navigateTo({
-        url: `/pages/protocol/protocol?type=${type}&brandId=${brandId}&lbsId=${lbsId}&noBtn=1`,
+      const brandId = this.groupId || uni.getStorageSync('groupId');
+      const lbsId = this.mallid || uni.getStorageSync('mallid');
+      // uni.navigateTo({
+      //   url: `/pages/protocol/protocol?type=${type}&brandId=${brandId}&lbsId=${lbsId}&noBtn=1`,
+      // });
+      window.toWXSendMsg({
+        type: 'toPage',
+        options: {
+          fnName: 'navigateTo',
+          url: `/pages/protocol/protocol?type=${type}&brandId=${brandId}&lbsId=${lbsId}&noBtn=1`
+        },
       });
     },
     handleConfirm() {
@@ -88,9 +102,9 @@ export default {
     },
     open() {
       // 获取当前商场
-      const { brandInfo, curMarket } = app.globalData;
-      const mallid = app.globalData.mallid || uni.getStorageSync('mallid');
-      const groupId = app.globalData.groupId || uni.getStorageSync('groupId');
+      const { brandInfo, curMarket } = this;
+      const mallid = this.mallid || uni.getStorageSync('mallid');
+      const groupId = this.groupId || uni.getStorageSync('groupId');
       if (!groupId || !mallid) {
         console.warn('===>groupId活mallid不存在');
         this.show = false;
@@ -159,11 +173,16 @@ export default {
           if (result && (result.code == '000000' || result.code == '300000')) {
             // 用户不同意协议直接静默退出
             // 清除所有缓存,跳转到首页
-            MemberCacheTool.cleanMemberCache(app);
-            KipCacheTool.cleanKipCache();
-            uni.redirectTo({
-              url: '/pages/automatic/automaticIndex',
+            // MemberCacheTool.cleanMemberCache(app);
+            // KipCacheTool.cleanKipCache();
+            // uni.redirectTo({
+            //   url: '/pages/automatic/automaticIndex',
+            // });
+            window.toWXSendMsg({
+              type: 'logout',
+              options: {},
             });
+
           } else {
             uni.showToast({
               title: result.message,
@@ -275,10 +294,10 @@ export default {
     top: 50%;
     left: 50%;
     transform: translateX(-50%) translateY(-50%);
-    width: 588rpx;
+    width: 588px;
     background: #fff;
-    border-radius: 17rpx;
-    padding: 56rpx 44rpx;
+    border-radius: 17px;
+    padding: 56px 44px;
 
     .authorize-box {
       width: 100%;
@@ -286,13 +305,13 @@ export default {
       .bold {
         text-align: center;
         color: #333333;
-        padding-bottom: 44rpx;
+        padding-bottom: 44px;
       }
 
       .other {
         color: #666666;
-        line-height: 48rpx;
-        font-size: 28rpx;
+        line-height: 48px;
+        font-size: 28px;
         color: #666666;
         opacity: 1;
       }
@@ -301,7 +320,7 @@ export default {
         display: flex;
         justify-content: flex-start;
         align-items: flex-start;
-        margin-top: 40rpx;
+        margin-top: 40px;
 
         .popup-a {
           color: #4e99ff;
@@ -314,27 +333,27 @@ export default {
       display: flex;
       justify-content: space-between;
       color: #ffffff;
-      margin-top: 56rpx;
+      margin-top: 56px;
 
       .disagree_btn {
-        width: 176rpx;
-        height: 68rpx;
-        line-height: 68rpx;
-        border: 2rpx solid #b3b3b3;
-        border-radius: 34rpx;
+        width: 176px;
+        height: 68px;
+        line-height: 68px;
+        border: 2px solid #b3b3b3;
+        border-radius: 34px;
         color: #999999;
-        font-size: 30rpx;
+        font-size: 30px;
       }
 
       .agree_btn {
-        width: 286rpx;
-        height: 68rpx;
-        line-height: 68rpx;
+        width: 286px;
+        height: 68px;
+        line-height: 68px;
         background: linear-gradient(90deg, #662d91 0%, #1b1464 100%);
         opacity: 0.83;
-        border-radius: 34rpx;
+        border-radius: 34px;
         color: #ffffff;
-        font-size: 30rpx;
+        font-size: 30px;
       }
 
       .disabled {

+ 25 - 13
src/pages/parkingFee/components/base/parkingFeeDetail.vue

@@ -174,19 +174,15 @@
         <span style="color: #8d8d8d; padding-left: 30px; font-size: 28px"
         >已优惠{{ discountTotalFee | currency }}元</span
         >
-        <uni-countdown
-          v-if="payCarno"
-          splitorColor="#FF0000"
-          color="#FF0000"
-          :show-day="false"
-          :show-hour="false"
-          :second="refreshTime"
-          @timeup="resetCountDown()"
-        >
-              <span style="align-self: center; font-size: 26px; color: #ff0000"
-              >后同步最新费用</span
-              >
-        </uni-countdown>
+        <div class="count-down-box">
+          <van-count-down
+            v-if="payCarno"
+            format="mm:ss"
+            :time="refreshTime * 1000"
+            @finish="resetCountDown()"
+          />
+          <span class="desc">后同步最新费用</span>
+        </div>
       </div>
       <div
         :class="{
@@ -1029,6 +1025,22 @@ export default {
   .flewx-content {
     position: absolute;
     left: 16px;
+    .count-down-box {
+      padding-left: 10px;
+      display: flex;
+      font-weight: 400;
+      align-items: center;
+      .van-count-down {
+        font-size: 25px;
+        color: #FF0000;
+        margin-right: 10px;
+      }
+
+      .desc {
+        font-size: 25px;
+        color: #FF0000;
+      }
+    }
   }
   .flewx_index3 {
     width: 150px;

+ 217 - 0
src/pages/parkingFee/components/base/parkingFeeDiscounts.vue

@@ -0,0 +1,217 @@
+<template>
+  <scroll-view scroll-y="true" class="scroll-Y">
+    <wx-points-commit ref="wxPointsCommit"></wx-points-commit>
+    <van-checkbox-group
+      @change="checkboxChange"
+      v-model="checkedList"
+      checked-color="#EA3323"
+    >
+      <div class="container" v-if="false">
+        <!--todo: 杭州首停不显示暂时根据groupId写死-->
+        <div class="item">
+          <div class="title">首停优惠</div>
+          <div class="content">
+            首停减免{{ parkInfoEntity.parkHour }}小时。可优惠{{
+              firstParkDiscountFee
+            }}元
+          </div>
+        </div>
+        <van-checkbox
+          value="firstPark"
+          color="#fff"
+          :checked="isCheck('firstPark')"
+        />
+      </div>
+
+      <div class="container" v-if="parkInfoEntity.memberLevelReduce">
+        <div class="item">
+          <div class="title">会员等级减免</div>
+          <div class="content">
+            {{ memberDiscount.memberOrderdesc || '' }}减免{{
+              memberDiscount.reduceContent || 0
+            }}小时。可优惠{{ memberDiscountFee || 0 }}元
+          </div>
+        </div>
+        <van-checkbox
+          name="member"
+          color="#fff"
+          :disabled="
+            (!isCheck('member') && isDiscountDisabled) ||
+            isMemberDiscountDisabled ||
+            memberDiscount.reduceContent <= 0
+          "
+          :checked="isCheck('member')"
+        />
+        <div class="member-discount-info" v-if="isMemberDiscountDisabled">
+          当日已使用
+        </div>
+      </div>
+      <div class="container" v-if="isShowReduceDiscount">
+        <div class="item">
+          <div class="title">消费减免</div>
+          <!-- <div class="content" v-if="parkInfoEntity.parkMallCode === 1 && parkInfoEntity.expirationDate">{{reduceDiscountMessage}}</div> -->
+          <div class="content" v-if="parkInfoEntity.parkMallCode !== 1">
+            {{ todayReduceDiscountMessage }}
+          </div>
+          <uni-number-box
+            v-if="parkInfoEntity.isSplit === 0 && maxReduceDiscount > 0"
+            :min="1"
+            :max="maxReduceDiscount"
+            v-model="reduceHours"
+            @input="reducesChange"
+          ></uni-number-box>
+        </div>
+        <van-checkbox
+          name="reduces"
+          color="#fff"
+          :disabled="
+            (!isCheck('reduces') && isDiscountDisabled) ||
+            !reducesDiscount.recuceContent
+          "
+          :checked="isCheck('reduces')"
+        />
+      </div>
+      <div class="flewx">
+        <div class="flewx-content">
+          应付<span style="color: red; font-size: 32px; padding-left: 20px">{{
+            actualFee | currency
+          }}</span>
+          元
+          <span style="color: #8d8d8d; padding-left: 30px; font-size: 28px"
+            >已优惠{{ discountFee | currency }}元</span
+          >
+        </div>
+        <div
+          :class="{
+            flewx_index3: true,
+            blue_flewx_index3: custTypeId === 1,
+            green_flewx_index3: custTypeId === 2,
+            'btn-disabled': !parkInfo.servicefee,
+          }"
+          @click="confirm"
+        >
+          确定
+        </div>
+      </div>
+    </van-checkbox-group>
+  </scroll-view>
+</template>
+
+<script>
+import parkingFeeDiscountsJs from '../../mixins/parkingFeeDiscounts';
+
+export default {
+  mixins: [parkingFeeDiscountsJs],
+};
+</script>
+
+<style lang="less" scoped>
+//@import '../../styles/common.less';
+.scroll-Y {
+  width: 100%;
+  display: flex;
+  flex-direction: column;
+  height: 100vh;
+  background: #f1f1f1;
+}
+
+.container {
+  background-color: #fff;
+  width: 650px;
+  margin: 25px 30px;
+  padding-left: 40px;
+  border-radius: 10px;
+  display: flex;
+  align-items: center;
+  line-height: 70px;
+  position: relative;
+
+  .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;
+
+    image {
+      width: 50px;
+      height: 50px;
+      margin-left: -1px;
+    }
+  }
+}
+
+.flewx {
+  width: 100%;
+  height: 100px;
+  background-color: #fff;
+  position: fixed;
+  bottom: 0;
+  font-size: 30px;
+  display: flex;
+  align-items: center;
+  justify-content: space-around;
+  // padding-bottom: constant(safe-area-inset-bottom);
+  // padding-bottom: env(safe-area-inset-bottom);
+  padding-bottom: 20px;
+
+  .flewx-content {
+    position: absolute;
+    left: 16px;
+  }
+
+  .flewx_index3 {
+    width: 150px;
+    height: 70px;
+    border-radius: 50px;
+    text-align: center;
+    font-size: 28px;
+    line-height: 70px;
+    color: #fff;
+    background-image: linear-gradient(to right, #7e4fa1, #433c7f);
+    box-shadow: 2px 3px 5px #888888;
+    position: absolute;
+    right: 16px;
+  }
+
+  .blue_flewx_index3 {
+    .color-background-color('blue');
+  }
+
+  .green_flewx_index3 {
+    .color-background-color('green');
+  }
+}
+
+/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;
+}
+</style>

+ 200 - 0
src/pages/parkingFee/components/officeBlue/parkingFeeDiscounts.vue

@@ -0,0 +1,200 @@
+<template>
+  <div>
+    <scroll-view scroll-y="true" class="scroll-Y">
+      <van-checkbox-group
+        v-model="checkedList"
+        @change="checkboxChange"
+        checked-color="#064C8A"
+      >
+        <div class="container" v-if="parkInfoEntity.memberLevelReduce">
+          <div class="item">
+            <div class="title">会员等级减免</div>
+            <div class="content">
+              {{ memberDiscount.memberOrderdesc || '' }}减免{{
+                memberDiscount.reduceContent || 0
+              }}小时。可优惠{{ memberDiscountFee || 0 }}元
+            </div>
+          </div>
+          <van-checkbox
+            color="#fff"
+            name="member"
+            :disabled="
+              (!isCheck('member') && isDiscountDisabled) ||
+              isMemberDiscountDisabled ||
+              memberDiscount.reduceContent <= 0
+            "
+          />
+          <!-- :checked="isCheck('member')" -->
+          <div class="member-discount-info" v-if="isMemberDiscountDisabled">
+            当日已使用
+          </div>
+        </div>
+        <div class="container" v-if="isShowReduceDiscount">
+          <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="parkInfoEntity.parkMallCode !== 1">
+              {{ todayReduceDiscountMessage }}
+            </div>
+            <uni-number-box
+              v-if="parkInfoEntity.isSplit === 0 && maxReduceDiscount > 0"
+              :min="1"
+              :max="maxReduceDiscount"
+              v-model="reduceHours"
+              @input="reducesChange"
+            ></uni-number-box>
+          </div>
+          <van-checkbox
+            name="reduces"
+            color="#fff"
+            :disabled="
+              (!isCheck('reduces') && isDiscountDisabled) ||
+              !reducesDiscount.recuceContent
+            "
+          />
+          <!-- :checked="isCheck('reduces')" -->
+        </div>
+      </van-checkbox-group>
+    </scroll-view>
+    <div class="flewx">
+      <div class="flewx-content">
+        合计<span
+          style="
+            color: #333;
+            font-weight: 600;
+            font-size: 36px;
+            padding-left: 0px;
+          "
+          >{{ actualFee | currency }}</span
+        >
+        元
+        <span style="color: #999; padding-left: 0px; font-size: 28px"
+          >已优惠{{ discountFee | currency }}元</span
+        >
+      </div>
+      <div class="flewx_index3" @click="confirm">确定</div>
+    </div>
+  </div>
+</template>
+
+<script>
+import parkingFeeDiscountsJs from '../../mixins/parkingFeeDiscounts'
+export default {
+  mixins:[parkingFeeDiscountsJs]
+}
+</script>
+
+<style lang="less" scoped>
+//@import '../../styles/common.less';
+
+.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 {
+  width: 100%;
+  height: 130px;
+  background-color: #fff;
+  position: fixed;
+  bottom: 0;
+  font-size: 30px;
+  display: flex;
+  align-items: center;
+  justify-content: space-around;
+  // padding-bottom: constant(safe-area-inset-bottom);
+  // padding-bottom: env(safe-area-inset-bottom);
+  padding-bottom: 20px;
+
+  .flewx-content {
+    position: absolute;
+    left: 16px;
+  }
+
+  .flewx_index3 {
+    width: 150px;
+    height: 70px;
+    border-radius: 45px;
+    text-align: center;
+    font-size: 30px;
+    line-height: 70px;
+    color: #fff;
+    // background-image: linear-gradient(to right, #7e4fa1, #433c7f);
+    background: #064c8a;
+    box-shadow: 2px 3px 5px #888888;
+    position: absolute;
+    right: 16px;
+  }
+
+  .blue_flewx_index3 {
+    .color-background-color('blue');
+  }
+
+  .green_flewx_index3 {
+    .color-background-color('green');
+  }
+}
+
+/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;
+}
+</style>

+ 496 - 0
src/pages/parkingFee/mixins/parkingFeeDiscounts.js

@@ -0,0 +1,496 @@
+import { mapState } from 'vuex';
+import uniNumberBox from '@/components/uni-number-box/uni-number-box.vue';
+import uni from '@/utils/uniHooks';
+// const app = getApp()
+export default {
+  components: { uniNumberBox },
+  created() {
+    setTimeout(() => {
+      uni.setNavigationBarTitle({
+        title: '选择优惠',
+      });
+    }, 300);
+    console.log('103,', uni.getStorageSync('paperCouponInfo'));
+    // 纸质优惠券
+    if (uni.getStorageSync('paperCouponInfo')) {
+      this.paperCouponFee =
+        uni.getStorageSync('paperCouponInfo').paperDiscountFee || 0;
+    }
+    // 电子券
+    if (uni.getStorageSync('couponInfo')) {
+      this.couponFee = uni.getStorageSync('couponInfo').couponfee || 0;
+    }
+    const servicefee = uni.getStorageSync('servicefee'); // 应缴金额
+    this.servicefee = servicefee ? Number.parseInt(servicefee) : 0;
+    console.log(10101, uni.getStorageSync('servicefee'));
+    this.parkDiscountTotal = uni.getStorageSync('parkingTotal'); // 总停车优惠
+    console.log('电子券', uni.getStorageSync('parkingTotal'));
+    // 重置优惠 防止二次叠加
+    try {
+      this.discountTotal = uni.getStorageSync('discountTotal');
+
+      if (this.discountTotal) {
+        this.parkDiscountTotal.feeCopy -= this.discountTotal.fee;
+      }
+    } catch (err) {
+      console.log('discountTotal 异常', err);
+    }
+
+    const parkFee = uni.getStorageSync('parkFee');
+    this.parkFee = parkFee ? JSON.parse(uni.getStorageSync('parkFee')) : {};
+
+    const parkInfo = uni.getStorageSync('parkInfo');
+    this.parkInfo = parkInfo ? JSON.parse(uni.getStorageSync('parkInfo')) : {};
+
+
+    console.log('116, 尝试定位问题', this.parkFee);
+    this.parkInfoEntity = this.parkFee.parkInfoEntity;
+    this.parkInfoEntity.useReduceTime = this.parkInfoEntity.useReduceTime
+      ? this.parkInfoEntity.useReduceTime
+      : 0; // 已用优惠时长
+    this.parkInfoEntity.remainReduceTime =
+      this.parkInfoEntity.remainReduceTime > 0
+        ? this.parkInfoEntity.remainReduceTime
+        : 0; // 剩余可用优惠时长
+    this.parkMallCode = this.parkInfoEntity.parkMallCode;
+    // 浦东每次上限处理
+    if (
+      this.parkMallCode === 1 &&
+      this.parkInfoEntity.remainReduceTime >
+      this.parkInfoEntity.maxonetimediscount
+    ) {
+      this.parkInfoEntity.remainReduceTime =
+        this.parkInfoEntity.maxonetimediscount;
+    }
+
+    // 沈阳上限处理
+    if (this.parkMallCode === 4) {
+      this.parkInfoEntity.remainReduceTime =
+        this.parkInfoEntity.maxOneDayHour -
+        this.parkInfoEntity.ticketandMemeberGradeAndConsumeUseHour;
+      if (this.couponFee) {
+        this.parkInfoEntity.remainReduceTime -=
+          this.couponFee / this.parkInfoEntity.needmoney;
+      }
+    }
+
+    // 上限金额
+    this.maxonetimediscountFee =
+      this.parkInfoEntity.maxonetimediscount * this.parkInfoEntity.needmoney;
+    this.maxonedaydiscountFee =
+      (this.parkInfoEntity.maxOneDayHour -
+        this.parkInfoEntity.ticketandMemeberGradeAndConsumeUseHour) *
+      this.parkInfoEntity.needmoney || 0;
+    if (this.maxonedaydiscountFee < 0) {
+      this.maxonedaydiscountFee = 0;
+    }
+
+    // 会员优惠
+    if (
+      this.parkFee.parkMemberOrderReducesEntityList &&
+      this.parkFee.parkMemberOrderReducesEntityList[0]
+    ) {
+      this.memberDiscount = this.parkFee.parkMemberOrderReducesEntityList[0];
+    }
+
+    // 消费减免
+    if (
+      this.parkFee.parkConsumeReducesEntityList &&
+      this.parkFee.parkConsumeReducesEntityList.length
+    ) {
+      this.reducesDiscount = this.parkFee.parkConsumeReducesEntityList[0];
+    } else {
+      this.reducesDiscount = { consumerLimit: 0, recuceContent: 0 };
+    }
+
+    // 消费减免可拆分上限
+    this.maxReduceDiscount = this.reducesDiscount.recuceContent;
+    if (this.maxReduceDiscount > this.parkInfoEntity.remainReduceTime) {
+      this.maxReduceDiscount = this.parkInfoEntity.remainReduceTime;
+    }
+    this.reduceHours = this.maxReduceDiscount;
+
+    // 反显处理
+    if (this.discountTotal.consumeFee) {
+      this.reduceHours =
+        this.discountTotal.consumeFee / this.parkInfoEntity.needmoney || 0;
+    }
+    const checkedList = uni.getStorageSync('checkedList');
+    console.log('反显处理', checkedList);
+    if (checkedList && checkedList.length) {
+      this.checkedList = JSON.parse(checkedList);
+    } else {
+      this.checkedList = [];
+    }
+    console.log('反显处理', this.checkedList);
+    /* else {
+     if (this.memberDiscount.reduceContent > 0) {
+     // 浦东上限控制
+     if (this.parkMallCode === 1) {
+     if (!this.crossMessage()) {
+     this.checkedList = ['member'];
+     this.maxReduceDiscount = this.parkInfoEntity.remainReduceTime - this.memberDiscount.reduceContent - (this.discountTotal.time || 0);
+     this.reduceHours = this.maxReduceDiscount;
+     }
+     } else {
+     this.checkedList = ['member'];
+     }
+     } else {
+     if (this.parkMallCode === 1) {
+     if (!this.isCheck('reduces')) {
+     this.maxReduceDiscount = this.parkInfoEntity.remainReduceTime - (this.parkDiscountTotal.time || 0);
+     this.reduceHours = this.maxReduceDiscount;
+     }
+     }
+     }
+     }*/
+    // 浦东上限控制
+    if (this.parkMallCode === 1 || this.parkMallCode === 4) {
+      if (this.discountTotal.memberGradeFee) {
+        this.maxReduceDiscount =
+          this.parkInfoEntity.remainReduceTime -
+          this.discountTotal.memberGradeFee / this.parkInfoEntity.needmoney;
+        if (
+          this.parkMallCode === 4 &&
+          this.maxReduceDiscount > this.reducesDiscount.recuceContent
+        ) {
+          this.maxReduceDiscount = this.reducesDiscount.recuceContent;
+        }
+      }
+      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;
+        }
+      }
+    }
+
+    // 会员优惠每天只可使用一次
+    if (this.parkInfoEntity.memberLevelFlag == 1) {
+      this.isMemberDiscountDisabled = true;
+      const memberIndex = this.checkedList.indexOf('member');
+      if (memberIndex !== -1) {
+        this.checkedList.splice(memberIndex, 1);
+      }
+    }
+
+    // 超限提示
+    this.crossMessage();
+  },
+  // beforeRouteLeave(to, from, next) {
+  //   console.log(251251251251251251, to, from,);
+  //   // 设置下一个路由的 meta
+  //   to.meta.keepAlive = true; // 让 A 不缓存,即刷新
+  //   next();
+  // },
+  data() {
+    return {
+      parkInfo: {}, // 订单详情
+      parkFee: {}, // 停车规则信息及优惠信息
+      parkInfoEntity: {}, // 停车规则信息
+      memberDiscount: {}, // 会员优惠
+      isMemberDiscountDisabled: false, // 会员等级减免是否可用(当天仅限使用一次)
+      isDiscountDisabled: false, // 浦东减免是否超限
+      reducesDiscount: {}, // 消费优惠
+      checkedList: [], // 已选优惠列表
+      firstPark: 0, // 首停减免金额
+      member: 0, // 会员优惠金额
+      reduces: 0, // 消费减免金额
+      reduceHours: 0, // 消费减免拆分时长
+      maxReduceDiscount: 0, // 消费减免规则最大优惠
+      servicefee: 0, // 应缴金额
+      parkDiscountTotal: {}, // 总停车优惠
+      discountTotal: {}, // 首停、会员、消费优惠合计
+      // groupId: app.globalData.groupId,
+      maxonetimediscountFee: 0, // 每次优惠上限金额
+      maxonedaydiscountFee: 0, // 每天优惠上限金额
+      parkMallCode: 1, // 0静安 1浦东 2杭州 3北京 4沈阳 5深圳
+      paperCouponFee: 0, // 纸质优惠金额
+      couponFee: 0, // 电子券优惠金额
+      active: 'a',
+    };
+  },
+  computed: {
+    // 是否显示消费减免
+    isShowReduceDiscount() {
+      if (
+        this.parkInfoEntity.parkMallCode === 0 ||
+        this.parkInfoEntity.parkMallCode === 1
+      ) {
+        return (
+          this.parkInfoEntity.consumeReduce &&
+          this.reducesDiscount.consumerLimit
+        );
+      }
+      return this.parkInfoEntity.consumeReduce;
+    },
+    // 首停减免金额
+    firstParkDiscountFee() {
+      return this.parkInfoEntity.parkHour * this.parkInfoEntity.needmoney;
+    },
+    // 会员减免金额
+    memberDiscountFee() {
+      return this.memberDiscount.reduceContent * this.parkInfoEntity.needmoney;
+    },
+    // 消费减免金额
+    reducesDiscountFee() {
+      return this.reduceHours * this.parkInfoEntity.needmoney;
+    },
+    // 浦东有效期内消费提示
+    reduceDiscountMessage() {
+      return (
+        this.parkInfoEntity.expirationDate +
+        '日内消费了' +
+        this.parkInfoEntity.totalAmont +
+        '元,已使用' +
+        parseInt(
+          this.parkInfoEntity.useConsumeFee / this.parkInfoEntity.needmoney
+        ) +
+        '小时满减抵扣。'
+      );
+    },
+    // 消费减免(拆分部分)提示文本
+    reduceSplitMessage() {
+      if (this.parkInfoEntity.isSplit === 0) {
+        return `选择${this.reduceHours}小时,`;
+      }
+      return '';
+    },
+    // 当日消费提示
+    todayReduceDiscountMessage() {
+      if (
+        this.parkInfoEntity.remainReduceTime ||
+        this.parkInfoEntity.maxOneDayHour -
+        this.parkInfoEntity.ticketandMemeberGradeAndConsumeUseHour
+      ) {
+        if (this.reducesDiscount.consumerLimit) {
+          if (this.parkMallCode === 0) {
+            return `今日可减免${this.reducesDiscount.recuceContent}小时`;
+          }
+          // 沈阳提示信息
+          if (this.parkMallCode === 4) {
+            return `未达上限时今日可减免${this.reducesDiscount.recuceContent}小时`;
+          }
+          if (
+            this.reducesDiscount.recuceContent >
+            this.parkInfoEntity.remainReduceTime
+          ) {
+            return `消费已满${this.reducesDiscount.consumerLimit}元,减免${this.reducesDiscount.recuceContent}小时。超出优惠上限,可减免${this.maxReduceDiscount}小时,${this.reduceSplitMessage}可优惠${this.reducesDiscountFee}元`;
+          }
+          return `消费已满${this.reducesDiscount.consumerLimit}元,减免${this.reducesDiscount.recuceContent}小时。${this.reduceSplitMessage}可优惠${this.reducesDiscountFee}元`;
+        }
+        return '消费金额未达到最低优惠要求';
+      }
+      if (this.parkInfoEntity.dateReduceUpperliLimit) {
+        return `您今日消费减免已达${this.parkInfoEntity.dateReduceUpperliLimit}小时上限`;
+      }
+    },
+    // 选择优惠数量
+    checkedTotal() {
+      return this.checkedList.length;
+    },
+    // 首停、会员、消费优惠总计金额
+    totalFee() {
+      this.first = 0;
+      this.member = 0;
+      this.reduces = 0;
+      let total = 0;
+      console.log(360, this.checkedList);
+      this.checkedList.forEach((item) => {
+        this[item] = this[item + 'DiscountFee'];
+        total += this[item + 'DiscountFee'];
+      });
+      console.log(364, total);
+      return total;
+    },
+    // 首停、会员、消费优惠总计时长
+    totalTime() {
+      return this.totalFee / this.parkInfoEntity.needmoney;
+    },
+    // 实际支付金额
+    actualFee() {
+      console.log('实际支付金额', this.servicefee, this.discountFee);
+      const fee = this.servicefee - this.discountFee;
+      console.log('实际支付金额', fee);
+      return fee > 0 ? fee : 0;
+    },
+    // 已优惠金额
+    discountFee() {
+      let total = this.parkDiscountTotal.feeCopy + this.totalFee;
+      console.log(380, this.parkDiscountTotal.feeCopy, this.totalFee);
+      // 超出上限按上限计算
+      if (this.parkMallCode === 1) {
+        if (total - this.paperCouponFee > this.maxonetimediscountFee) {
+          total = this.maxonetimediscountFee + this.paperCouponFee;
+        }
+      }
+      if (this.parkMallCode === 4) {
+        if (
+          total - this.paperCouponFee - this.parkDiscountTotal.bonusfee >
+          this.maxonedaydiscountFee
+        ) {
+          total =
+            this.maxonedaydiscountFee +
+            this.parkDiscountTotal.bonusfee +
+            this.paperCouponFee;
+        }
+      }
+      return total;
+    },
+    ...mapState({
+      custTypeId: (state) => state.custTypeId,
+      groupId: (state) => state.groupId,
+    }),
+  },
+  methods: {
+    // 选择回调
+    checkboxChange(e) {
+      console.log(this.checkedList);
+      // console.log('checkboxChange');
+      // console.log('paperCouponFee------>', this.paperCouponFee);
+      // 浦东上限控制
+      if (this.parkMallCode === 1) {
+        if (this.isCheck('member')) {
+          this.maxReduceDiscount =
+            this.parkInfoEntity.remainReduceTime -
+            (this.discountFee - this.paperCouponFee - this.reduces) /
+            this.parkInfoEntity.needmoney;
+          this.reduceHours = this.maxReduceDiscount;
+        } else {
+          if (this.isCheck('reduces')) {
+            this.maxReduceDiscount =
+              this.parkInfoEntity.remainReduceTime -
+              (this.discountFee - this.paperCouponFee - this.reduces) /
+              this.parkInfoEntity.needmoney;
+          } else {
+            this.maxReduceDiscount =
+              this.parkInfoEntity.remainReduceTime -
+              (this.discountFee - this.paperCouponFee) /
+              this.parkInfoEntity.needmoney;
+            this.reduceHours = this.maxReduceDiscount;
+          }
+        }
+      }
+      // 沈阳上限控制
+      if (this.parkMallCode === 4) {
+        if (this.isCheck('member')) {
+          this.maxReduceDiscount =
+            this.parkInfoEntity.remainReduceTime -
+            this.memberDiscount.reduceContent;
+          if (this.maxReduceDiscount < 0) {
+            this.maxReduceDiscount = 0;
+          }
+          if (this.maxReduceDiscount > this.reducesDiscount.recuceContent) {
+            this.maxReduceDiscount = this.reducesDiscount.recuceContent;
+          }
+          this.reduceHours = this.maxReduceDiscount;
+        } else {
+          this.maxReduceDiscount = this.parkInfoEntity.remainReduceTime;
+          if (this.maxReduceDiscount > this.reducesDiscount.recuceContent) {
+            this.maxReduceDiscount = this.reducesDiscount.recuceContent;
+          }
+          this.reduceHours = this.maxReduceDiscount;
+        }
+      }
+      this.crossMessage();
+    },
+
+    // 是否选中
+    isCheck(val) {
+      return this.checkedList.findIndex((e) => e == val) !== -1;
+    },
+
+    // 计数器回调
+    reducesChange() {
+      console.log('reducesChange');
+      if (this.isCheck('reduces')) {
+        this.crossMessage();
+      }
+    },
+
+    // 超限提示
+    crossMessage() {
+      let totalFee = this.parkDiscountTotal.feeCopy;
+      const remainReduceFee =
+        this.parkInfoEntity.remainReduceTime * this.parkInfoEntity.needmoney;
+      // if (this.discountTotal && this.discountTotal.fee !== 0) {
+      // 	totalFee += this.totalFee - this.discountTotal.fee;
+      // } else {
+      // 	totalFee += this.totalFee;
+      // }
+      totalFee += this.totalFee;
+      // 浦东每次总优惠上限
+      this.isDiscountDisabled = false;
+      if (
+        this.parkMallCode === 1 &&
+        totalFee - this.paperCouponFee >= this.maxonetimediscountFee
+      ) {
+        this.isDiscountDisabled = true;
+        return uni.showToast({
+          title: `超出抵扣上限,每次最高可抵扣${this.parkInfoEntity.maxonetimediscount}小时`,
+          icon: 'none',
+        });
+      }
+      // 沈阳超限处理(maxonedaydiscountFee 会员、消费、电子券减免)
+      if (
+        this.parkMallCode === 4 &&
+        totalFee - this.paperCouponFee - this.parkDiscountTotal.bonusfee >=
+        this.maxonedaydiscountFee
+      ) {
+        this.isDiscountDisabled = true;
+        return uni.showToast({
+          title: `(会员等级、消费、电子券)每日最高可抵扣${this.parkInfoEntity.maxOneDayHour}小时`,
+          icon: 'none',
+        });
+      }
+      // 消费每天优惠上限(非浦东、沈阳)
+      if (
+        this.parkMallCode !== 1 &&
+        this.parkMallCode !== 4 &&
+        this.reduces > remainReduceFee
+      ) {
+        this.reduces = remainReduceFee;
+        return uni.showToast({
+          title: `超出抵扣上限,消费减免每天最高可抵扣${this.parkInfoEntity.dateReduceUpperliLimit}小时,可使用${this.parkInfoEntity.remainReduceTime}小时`,
+          icon: 'none',
+        });
+      }
+    },
+
+    // 确认
+    confirm() {
+      // 计算单价
+      const cost =
+        this.reducesDiscount.consumerLimit / this.reducesDiscount.recuceContent;
+      // 算出消费减免在哪个档
+      let useConsumeFee = 0;
+      if (this.reduces) {
+        if (this.parkInfoEntity.isSplit === 0) {
+          useConsumeFee = this.reduceHours * cost;
+        } else {
+          useConsumeFee = this.reducesDiscount.consumerLimit;
+        }
+      }
+
+      uni.setStorageSync('checkedList', this.checkedList);
+      uni.setStorageSync('checkedTotal', this.checkedTotal);
+      uni.setStorageSync('discountTotal', {
+        firstParkFee: this.firstPark,
+        memberGradeFee: this.member,
+        consumeFee: this.reduces,
+        useConsumeFee: useConsumeFee,
+        time: this.totalTime,
+        fee: this.totalFee,
+      });
+      this.$nextTick(() => {
+        this.$router.back();
+      });
+    },
+  },
+};

+ 8 - 671
src/pages/parkingFee/parkingFeeDiscounts.vue

@@ -1,681 +1,18 @@
 <template>
   <div>
-    <scroll-view scroll-y="true" class="scroll-Y">
-      <van-checkbox-group
-        v-model="checkedList"
-        @change="checkboxChange"
-        checked-color="#064C8A"
-      >
-        <div class="container" v-if="parkInfoEntity.memberLevelReduce">
-          <div class="item">
-            <div class="title">会员等级减免</div>
-            <div class="content">
-              {{ memberDiscount.memberOrderdesc || '' }}减免{{
-                memberDiscount.reduceContent || 0
-              }}小时。可优惠{{ memberDiscountFee || 0 }}元
-            </div>
-          </div>
-          <van-checkbox
-            color="#fff"
-            name="member"
-            :disabled="
-              (!isCheck('member') && isDiscountDisabled) ||
-              isMemberDiscountDisabled ||
-              memberDiscount.reduceContent <= 0
-            "
-          />
-          <!-- :checked="isCheck('member')" -->
-          <div class="member-discount-info" v-if="isMemberDiscountDisabled">
-            当日已使用
-          </div>
-        </div>
-        <div class="container" v-if="isShowReduceDiscount">
-          <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="parkInfoEntity.parkMallCode !== 1">
-              {{ todayReduceDiscountMessage }}
-            </div>
-            <uni-number-box
-              v-if="parkInfoEntity.isSplit === 0 && maxReduceDiscount > 0"
-              :min="1"
-              :max="maxReduceDiscount"
-              v-model="reduceHours"
-              @input="reducesChange"
-            ></uni-number-box>
-          </div>
-          <van-checkbox
-            name="reduces"
-            color="#fff"
-            :disabled="
-              (!isCheck('reduces') && isDiscountDisabled) ||
-              !reducesDiscount.recuceContent
-            "
-          />
-          <!-- :checked="isCheck('reduces')" -->
-        </div>
-      </van-checkbox-group>
-    </scroll-view>
-    <div class="flewx">
-      <div class="flewx-content">
-        合计<span
-          style="
-            color: #333;
-            font-weight: 600;
-            font-size: 36px;
-            padding-left: 0px;
-          "
-          >{{ actualFee | currency }}</span
-        >
-        元
-        <span style="color: #999; padding-left: 0px; font-size: 28px"
-          >已优惠{{ discountFee | currency }}元</span
-        >
-      </div>
-      <div class="flewx_index3" @click="confirm">确定</div>
-    </div>
+    <component :is="componentName"></component>
   </div>
 </template>
 
 <script>
-import { mapState } from 'vuex';
-import uniNumberBox from '@/components/uni-number-box/uni-number-box.vue';
-import uni from '@/utils/uniHooks';
-// const app = getApp()
+import officeBlueCom from './components/officeBlue/parkingFeeDiscounts.vue';
+import baseParkingFeeCom from './components/base/parkingFeeDiscounts.vue';
+import baseMixins from './mixins/base'
 export default {
-  components: { uniNumberBox },
-  created() {
-    console.log('103,', uni.getStorageSync('paperCouponInfo'));
-    // 纸质优惠券
-    if (uni.getStorageSync('paperCouponInfo')) {
-      this.paperCouponFee =
-        uni.getStorageSync('paperCouponInfo').paperDiscountFee || 0;
-    }
-    // 电子券
-    if (uni.getStorageSync('couponInfo')) {
-      this.couponFee = uni.getStorageSync('couponInfo').couponfee || 0;
-    }
-    const servicefee = uni.getStorageSync('servicefee'); // 应缴金额
-    this.servicefee = servicefee ? Number.parseInt(servicefee) : 0;
-    console.log(10101, uni.getStorageSync('servicefee'));
-    this.parkDiscountTotal = uni.getStorageSync('parkingTotal'); // 总停车优惠
-    console.log('电子券', uni.getStorageSync('parkingTotal'));
-    // 重置优惠 防止二次叠加
-    try {
-      this.discountTotal = uni.getStorageSync('discountTotal');
-
-      if (this.discountTotal) {
-        this.parkDiscountTotal.feeCopy -= this.discountTotal.fee;
-      }
-    } catch (err) {
-      console.log('discountTotal 异常', err);
-    }
-
-    const parkFee = uni.getStorageSync('parkFee');
-    this.parkFee = parkFee ? JSON.parse(uni.getStorageSync('parkFee')) : {};
-      console.log('116, 尝试定位问题', this.parkFee);
-      this.parkInfoEntity = this.parkFee.parkInfoEntity;
-      this.parkInfoEntity.useReduceTime = this.parkInfoEntity.useReduceTime
-        ? this.parkInfoEntity.useReduceTime
-        : 0; // 已用优惠时长
-      this.parkInfoEntity.remainReduceTime =
-        this.parkInfoEntity.remainReduceTime > 0
-          ? this.parkInfoEntity.remainReduceTime
-          : 0; // 剩余可用优惠时长
-      this.parkMallCode = this.parkInfoEntity.parkMallCode;
-      // 浦东每次上限处理
-      if (
-        this.parkMallCode === 1 &&
-        this.parkInfoEntity.remainReduceTime >
-          this.parkInfoEntity.maxonetimediscount
-      ) {
-        this.parkInfoEntity.remainReduceTime =
-          this.parkInfoEntity.maxonetimediscount;
-      }
-
-      // 沈阳上限处理
-      if (this.parkMallCode === 4) {
-        this.parkInfoEntity.remainReduceTime =
-          this.parkInfoEntity.maxOneDayHour -
-          this.parkInfoEntity.ticketandMemeberGradeAndConsumeUseHour;
-        if (this.couponFee) {
-          this.parkInfoEntity.remainReduceTime -=
-            this.couponFee / this.parkInfoEntity.needmoney;
-        }
-      }
-
-      // 上限金额
-      this.maxonetimediscountFee =
-        this.parkInfoEntity.maxonetimediscount * this.parkInfoEntity.needmoney;
-      this.maxonedaydiscountFee =
-        (this.parkInfoEntity.maxOneDayHour -
-          this.parkInfoEntity.ticketandMemeberGradeAndConsumeUseHour) *
-          this.parkInfoEntity.needmoney || 0;
-      if (this.maxonedaydiscountFee < 0) {
-        this.maxonedaydiscountFee = 0;
-      }
-
-      // 会员优惠
-      if (
-        this.parkFee.parkMemberOrderReducesEntityList &&
-        this.parkFee.parkMemberOrderReducesEntityList[0]
-      ) {
-        this.memberDiscount = this.parkFee.parkMemberOrderReducesEntityList[0];
-      }
-
-      // 消费减免
-      if (
-        this.parkFee.parkConsumeReducesEntityList &&
-        this.parkFee.parkConsumeReducesEntityList.length
-      ) {
-        this.reducesDiscount = this.parkFee.parkConsumeReducesEntityList[0];
-      } else {
-        this.reducesDiscount = { consumerLimit: 0, recuceContent: 0 };
-      }
-
-      // 消费减免可拆分上限
-      this.maxReduceDiscount = this.reducesDiscount.recuceContent;
-      if (this.maxReduceDiscount > this.parkInfoEntity.remainReduceTime) {
-        this.maxReduceDiscount = this.parkInfoEntity.remainReduceTime;
-      }
-      this.reduceHours = this.maxReduceDiscount;
-
-      // 反显处理
-      if (this.discountTotal.consumeFee) {
-        this.reduceHours =
-          this.discountTotal.consumeFee / this.parkInfoEntity.needmoney || 0;
-      }
-      const checkedList = uni.getStorageSync('checkedList');
-      console.log('反显处理', checkedList);
-      if (checkedList && checkedList.length) {
-        this.checkedList = JSON.parse(checkedList);
-      } else {
-        this.checkedList = [];
-      }
-      console.log('反显处理', this.checkedList);
-      /* else {
-			if (this.memberDiscount.reduceContent > 0) {
-				// 浦东上限控制
-				if (this.parkMallCode === 1) {
-					if (!this.crossMessage()) {
-						this.checkedList = ['member'];
-						this.maxReduceDiscount = this.parkInfoEntity.remainReduceTime - this.memberDiscount.reduceContent - (this.discountTotal.time || 0);
-						this.reduceHours = this.maxReduceDiscount;
-					}
-				} else {
-					this.checkedList = ['member'];
-				}
-			} else {
-				if (this.parkMallCode === 1) {
-					if (!this.isCheck('reduces')) {
-						this.maxReduceDiscount = this.parkInfoEntity.remainReduceTime - (this.parkDiscountTotal.time || 0);
-						this.reduceHours = this.maxReduceDiscount;
-					}
-				}
-			}
-		}*/
-      // 浦东上限控制
-      if (this.parkMallCode === 1 || this.parkMallCode === 4) {
-        if (this.discountTotal.memberGradeFee) {
-          this.maxReduceDiscount =
-            this.parkInfoEntity.remainReduceTime -
-            this.discountTotal.memberGradeFee / this.parkInfoEntity.needmoney;
-          if (
-            this.parkMallCode === 4 &&
-            this.maxReduceDiscount > this.reducesDiscount.recuceContent
-          ) {
-            this.maxReduceDiscount = this.reducesDiscount.recuceContent;
-          }
-        }
-        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;
-          }
-        }
-      }
-
-      // 会员优惠每天只可使用一次
-      if (this.parkInfoEntity.memberLevelFlag == 1) {
-        this.isMemberDiscountDisabled = true;
-        const memberIndex = this.checkedList.indexOf('member');
-        if (memberIndex !== -1) {
-          this.checkedList.splice(memberIndex, 1);
-        }
-      }
-
-      // 超限提示
-      this.crossMessage();
-  },
-  // beforeRouteLeave(to, from, next) {
-  //   console.log(251251251251251251, to, from,);
-  //   // 设置下一个路由的 meta
-  //   to.meta.keepAlive = true; // 让 A 不缓存,即刷新
-  //   next();
-  // },
-  data() {
-    return {
-      parkFee: {}, // 停车规则信息及优惠信息
-      parkInfoEntity: {}, // 停车规则信息
-      memberDiscount: {}, // 会员优惠
-      isMemberDiscountDisabled: false, // 会员等级减免是否可用(当天仅限使用一次)
-      isDiscountDisabled: false, // 浦东减免是否超限
-      reducesDiscount: {}, // 消费优惠
-      checkedList: [], // 已选优惠列表
-      firstPark: 0, // 首停减免金额
-      member: 0, // 会员优惠金额
-      reduces: 0, // 消费减免金额
-      reduceHours: 0, // 消费减免拆分时长
-      maxReduceDiscount: 0, // 消费减免规则最大优惠
-      servicefee: 0, // 应缴金额
-      parkDiscountTotal: {}, // 总停车优惠
-      discountTotal: {}, // 首停、会员、消费优惠合计
-      // groupId: app.globalData.groupId,
-      maxonetimediscountFee: 0, // 每次优惠上限金额
-      maxonedaydiscountFee: 0, // 每天优惠上限金额
-      parkMallCode: 1, // 0静安 1浦东 2杭州 3北京 4沈阳 5深圳
-      paperCouponFee: 0, // 纸质优惠金额
-      couponFee: 0, // 电子券优惠金额
-      active: 'a',
-    };
-  },
-  computed: {
-    // 是否显示消费减免
-    isShowReduceDiscount() {
-      if (
-        this.parkInfoEntity.parkMallCode === 0 ||
-        this.parkInfoEntity.parkMallCode === 1
-      ) {
-        return (
-          this.parkInfoEntity.consumeReduce &&
-          this.reducesDiscount.consumerLimit
-        );
-      }
-      return this.parkInfoEntity.consumeReduce;
-    },
-    // 首停减免金额
-    firstParkDiscountFee() {
-      return this.parkInfoEntity.parkHour * this.parkInfoEntity.needmoney;
-    },
-    // 会员减免金额
-    memberDiscountFee() {
-      return this.memberDiscount.reduceContent * this.parkInfoEntity.needmoney;
-    },
-    // 消费减免金额
-    reducesDiscountFee() {
-      return this.reduceHours * this.parkInfoEntity.needmoney;
-    },
-    // 浦东有效期内消费提示
-    reduceDiscountMessage() {
-      return (
-        this.parkInfoEntity.expirationDate +
-        '日内消费了' +
-        this.parkInfoEntity.totalAmont +
-        '元,已使用' +
-        parseInt(
-          this.parkInfoEntity.useConsumeFee / this.parkInfoEntity.needmoney
-        ) +
-        '小时满减抵扣。'
-      );
-    },
-    // 消费减免(拆分部分)提示文本
-    reduceSplitMessage() {
-      if (this.parkInfoEntity.isSplit === 0) {
-        return `选择${this.reduceHours}小时,`;
-      }
-      return '';
-    },
-    // 当日消费提示
-    todayReduceDiscountMessage() {
-      if (
-        this.parkInfoEntity.remainReduceTime ||
-        this.parkInfoEntity.maxOneDayHour -
-          this.parkInfoEntity.ticketandMemeberGradeAndConsumeUseHour
-      ) {
-        if (this.reducesDiscount.consumerLimit) {
-          if (this.parkMallCode === 0) {
-            return `今日可减免${this.reducesDiscount.recuceContent}小时`;
-          }
-          // 沈阳提示信息
-          if (this.parkMallCode === 4) {
-            return `未达上限时今日可减免${this.reducesDiscount.recuceContent}小时`;
-          }
-          if (
-            this.reducesDiscount.recuceContent >
-            this.parkInfoEntity.remainReduceTime
-          ) {
-            return `消费已满${this.reducesDiscount.consumerLimit}元,减免${this.reducesDiscount.recuceContent}小时。超出优惠上限,可减免${this.maxReduceDiscount}小时,${this.reduceSplitMessage}可优惠${this.reducesDiscountFee}元`;
-          }
-          return `消费已满${this.reducesDiscount.consumerLimit}元,减免${this.reducesDiscount.recuceContent}小时。${this.reduceSplitMessage}可优惠${this.reducesDiscountFee}元`;
-        }
-        return '消费金额未达到最低优惠要求';
-      }
-      if (this.parkInfoEntity.dateReduceUpperliLimit) {
-        return `您今日消费减免已达${this.parkInfoEntity.dateReduceUpperliLimit}小时上限`;
-      }
-    },
-    // 选择优惠数量
-    checkedTotal() {
-      return this.checkedList.length;
-    },
-    // 首停、会员、消费优惠总计金额
-    totalFee() {
-      this.first = 0;
-      this.member = 0;
-      this.reduces = 0;
-      let total = 0;
-      console.log(360, this.checkedList);
-      this.checkedList.forEach((item) => {
-        this[item] = this[item + 'DiscountFee'];
-        total += this[item + 'DiscountFee'];
-      });
-      console.log(364, total);
-      return total;
-    },
-    // 首停、会员、消费优惠总计时长
-    totalTime() {
-      return this.totalFee / this.parkInfoEntity.needmoney;
-    },
-    // 实际支付金额
-    actualFee() {
-      console.log('实际支付金额', this.servicefee, this.discountFee);
-      const fee = this.servicefee - this.discountFee;
-      console.log('实际支付金额', fee);
-      return fee > 0 ? fee : 0;
-    },
-    // 已优惠金额
-    discountFee() {
-      let total = this.parkDiscountTotal.feeCopy + this.totalFee;
-      console.log(380, this.parkDiscountTotal.feeCopy, this.totalFee);
-      // 超出上限按上限计算
-      if (this.parkMallCode === 1) {
-        if (total - this.paperCouponFee > this.maxonetimediscountFee) {
-          total = this.maxonetimediscountFee + this.paperCouponFee;
-        }
-      }
-      if (this.parkMallCode === 4) {
-        if (
-          total - this.paperCouponFee - this.parkDiscountTotal.bonusfee >
-          this.maxonedaydiscountFee
-        ) {
-          total =
-            this.maxonedaydiscountFee +
-            this.parkDiscountTotal.bonusfee +
-            this.paperCouponFee;
-        }
-      }
-      return total;
-    },
-    ...mapState({
-      custTypeId: (state) => state.custTypeId,
-      groupId: (state) => state.groupId,
-    }),
-  },
-  methods: {
-    // 选择回调
-    checkboxChange(e) {
-      console.log(this.checkedList);
-      // console.log('checkboxChange');
-      // console.log('paperCouponFee------>', this.paperCouponFee);
-      // 浦东上限控制
-      if (this.parkMallCode === 1) {
-        if (this.isCheck('member')) {
-          this.maxReduceDiscount =
-            this.parkInfoEntity.remainReduceTime -
-            (this.discountFee - this.paperCouponFee - this.reduces) /
-              this.parkInfoEntity.needmoney;
-          this.reduceHours = this.maxReduceDiscount;
-        } else {
-          if (this.isCheck('reduces')) {
-            this.maxReduceDiscount =
-              this.parkInfoEntity.remainReduceTime -
-              (this.discountFee - this.paperCouponFee - this.reduces) /
-                this.parkInfoEntity.needmoney;
-          } else {
-            this.maxReduceDiscount =
-              this.parkInfoEntity.remainReduceTime -
-              (this.discountFee - this.paperCouponFee) /
-                this.parkInfoEntity.needmoney;
-            this.reduceHours = this.maxReduceDiscount;
-          }
-        }
-      }
-      // 沈阳上限控制
-      if (this.parkMallCode === 4) {
-        if (this.isCheck('member')) {
-          this.maxReduceDiscount =
-            this.parkInfoEntity.remainReduceTime -
-            this.memberDiscount.reduceContent;
-          if (this.maxReduceDiscount < 0) {
-            this.maxReduceDiscount = 0;
-          }
-          if (this.maxReduceDiscount > this.reducesDiscount.recuceContent) {
-            this.maxReduceDiscount = this.reducesDiscount.recuceContent;
-          }
-          this.reduceHours = this.maxReduceDiscount;
-        } else {
-          this.maxReduceDiscount = this.parkInfoEntity.remainReduceTime;
-          if (this.maxReduceDiscount > this.reducesDiscount.recuceContent) {
-            this.maxReduceDiscount = this.reducesDiscount.recuceContent;
-          }
-          this.reduceHours = this.maxReduceDiscount;
-        }
-      }
-      this.crossMessage();
-    },
-
-    // 是否选中
-    isCheck(val) {
-      return this.checkedList.findIndex((e) => e == val) !== -1;
-    },
-
-    // 计数器回调
-    reducesChange() {
-      console.log('reducesChange');
-      if (this.isCheck('reduces')) {
-        this.crossMessage();
-      }
-    },
-
-    // 超限提示
-    crossMessage() {
-      let totalFee = this.parkDiscountTotal.feeCopy;
-      const remainReduceFee =
-        this.parkInfoEntity.remainReduceTime * this.parkInfoEntity.needmoney;
-      // if (this.discountTotal && this.discountTotal.fee !== 0) {
-      // 	totalFee += this.totalFee - this.discountTotal.fee;
-      // } else {
-      // 	totalFee += this.totalFee;
-      // }
-      totalFee += this.totalFee;
-      // 浦东每次总优惠上限
-      this.isDiscountDisabled = false;
-      if (
-        this.parkMallCode === 1 &&
-        totalFee - this.paperCouponFee >= this.maxonetimediscountFee
-      ) {
-        this.isDiscountDisabled = true;
-        return uni.showToast({
-          title: `超出抵扣上限,每次最高可抵扣${this.parkInfoEntity.maxonetimediscount}小时`,
-          icon: 'none',
-        });
-      }
-      // 沈阳超限处理(maxonedaydiscountFee 会员、消费、电子券减免)
-      if (
-        this.parkMallCode === 4 &&
-        totalFee - this.paperCouponFee - this.parkDiscountTotal.bonusfee >=
-          this.maxonedaydiscountFee
-      ) {
-        this.isDiscountDisabled = true;
-        return uni.showToast({
-          title: `(会员等级、消费、电子券)每日最高可抵扣${this.parkInfoEntity.maxOneDayHour}小时`,
-          icon: 'none',
-        });
-      }
-      // 消费每天优惠上限(非浦东、沈阳)
-      if (
-        this.parkMallCode !== 1 &&
-        this.parkMallCode !== 4 &&
-        this.reduces > remainReduceFee
-      ) {
-        this.reduces = remainReduceFee;
-        return uni.showToast({
-          title: `超出抵扣上限,消费减免每天最高可抵扣${this.parkInfoEntity.dateReduceUpperliLimit}小时,可使用${this.parkInfoEntity.remainReduceTime}小时`,
-          icon: 'none',
-        });
-      }
-    },
-
-    // 确认
-    confirm() {
-      // 计算单价
-      const cost =
-        this.reducesDiscount.consumerLimit / this.reducesDiscount.recuceContent;
-      // 算出消费减免在哪个档
-      let useConsumeFee = 0;
-      if (this.reduces) {
-        if (this.parkInfoEntity.isSplit === 0) {
-          useConsumeFee = this.reduceHours * cost;
-        } else {
-          useConsumeFee = this.reducesDiscount.consumerLimit;
-        }
-      }
-
-      uni.setStorageSync('checkedList', this.checkedList);
-      uni.setStorageSync('checkedTotal', this.checkedTotal);
-      uni.setStorageSync('discountTotal', {
-        firstParkFee: this.firstPark,
-        memberGradeFee: this.member,
-        consumeFee: this.reduces,
-        useConsumeFee: useConsumeFee,
-        time: this.totalTime,
-        fee: this.totalFee,
-      });
-      this.$nextTick(() => {
-        this.$router.back();
-      });
-    },
+  mixins:[baseMixins],
+  components: {
+    officeBlueCom,
+    baseParkingFeeCom,
   },
 };
 </script>
-
-<style lang="less" scoped>
-@import '../../styles/common.less';
-
-.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 {
-  width: 100%;
-  height: 130px;
-  background-color: #fff;
-  position: fixed;
-  bottom: 0;
-  font-size: 30px;
-  display: flex;
-  align-items: center;
-  justify-content: space-around;
-  // padding-bottom: constant(safe-area-inset-bottom);
-  // padding-bottom: env(safe-area-inset-bottom);
-  padding-bottom: 20px;
-
-  .flewx-content {
-    position: absolute;
-    left: 16px;
-  }
-
-  .flewx_index3 {
-    width: 150px;
-    height: 70px;
-    border-radius: 45px;
-    text-align: center;
-    font-size: 30px;
-    line-height: 70px;
-    color: #fff;
-    // background-image: linear-gradient(to right, #7e4fa1, #433c7f);
-    background: #064c8a;
-    box-shadow: 2px 3px 5px #888888;
-    position: absolute;
-    right: 16px;
-  }
-
-  .blue_flewx_index3 {
-    .color-background-color('blue');
-  }
-
-  .green_flewx_index3 {
-    .color-background-color('green');
-  }
-}
-
-/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;
-}
-</style>

+ 18 - 4
src/store/index.js

@@ -43,6 +43,8 @@ const store = new Vuex.Store({
     // 停车缴费
     bonusCopy: 0,
     source: '', // 访问方:微信小程序:(CRM|KIP)
+    brandInfo: {},
+    curMarket: {}
   },
   mutations: {
     SET_GROUP_ID(state, payload) {
@@ -122,7 +124,15 @@ const store = new Vuex.Store({
     SET_APPID(state, payload) {
       // uni.setStorageSync('appId', payload);
       state.appId = payload;
-    }
+    },
+    SET_BRAND_INFO(state, payload) {
+      uni.setStorageSync('brandInfo', payload);
+      state.brandInfo = payload;
+    },
+    SET_CUR_MARKET(state, payload) {
+      uni.setStorageSync('curMarket', payload);
+      state.curMarket = payload;
+    },
   },
   actions: {
     async baseInit({ commit, dispatch }, { options, callback }) {
@@ -149,7 +159,11 @@ const store = new Vuex.Store({
           isLogin = false,
           accessToken = '',
           source = '',
-          appId = ''
+          appId = '',
+
+          // CRM
+          brandInfo = {},
+          curMarket = {}
         } = options;
         // console.log(8181, options);
         commit('SET_SOURCE', source)
@@ -163,8 +177,8 @@ const store = new Vuex.Store({
 
         if ( source === 'CRM' ) {
           commit('SET_CUST_TYPE_ID', custTypeId)
-          commit('SET_APPID', appId)
-
+          commit('SET_CUR_MARKET', curMarket)
+          commit('SET_BRAND_INFO', brandInfo)
         }
         // 如果为 false,则表示当前用户是从小程序端未登录进入的
         if (!isLogin) {

+ 37 - 0
src/utils/cache-tool.js

@@ -124,6 +124,43 @@ export default {
     }
     return marketList;
   },
+  isCurMallidByEnvConstKey (curMallid, cacheKey) {
+    if (!curMallid || curMallid.trim() == '') {
+      console.error("=>[isCurMallidByEnvConstKey]curMallid is null")
+      return false;
+    }
+    if (!cacheKey || cacheKey.trim() == '') {
+      console.error("=>[isCurMallidByEnvConstKey]cacheKey is null")
+      return false;
+    }
+    const curEnvConst = this.getCurEnvConst();
+    if (!curEnvConst) {
+      console.error("=>[isCurMallidByEnvConstKey]curEnvConst is null")
+      return false;
+    }
+    const result = curMallid == curEnvConst[cacheKey];
+    return result;
+  },
+  isTianJinMallid (curMallid) {
+    const result = this.isCurMallidByEnvConstKey(curMallid,'TIANJIN_LBS_ID');
+    return result;
+  },
+  isBeiJingMallid (curMallid) {
+    const result = this.isCurMallidByEnvConstKey(curMallid,'BEIJING_LBS_ID');
+    return result;
+  },
+  isJingAnMallid (curMallid) {
+    const result = this.isCurMallidByEnvConstKey(curMallid,'JINGAN_LBS_ID');
+    return result;
+  },
+  isShenZhenMallid (curMallid) {
+    const result = this.isCurMallidByEnvConstKey(curMallid,'SHENZHEN_LBS_ID');
+    return result;
+  },
+  isShenYangMallid(curMallid) {
+    const result = this.isCurMallidByEnvConstKey(curMallid,'SHENYANG_LBS_ID');
+    return result;
+  },
 }
 
 function isKerryOnAppid() {