John-Hong 2 năm trước cách đây
mục cha
commit
ec3fd20e77

+ 30 - 5
src/App.vue

@@ -1,7 +1,8 @@
 <template>
   <div>
-    <!--    <div @click="send">send</div>-->
-    <router-view></router-view>
+    <keep-alive :include="cachedViews" :max="15">
+      <router-view :key="key" />
+    </keep-alive>
   </div>
 </template>
 <script>
@@ -26,6 +27,33 @@
 // import { KIP_API_CODE } from '@/common/js/config';
 // import qs from 'qs';
 export default {
+  computed: {
+    cachedViews() {
+      return this.$store.state.cachedViews.cachedViews;
+    },
+    key() {
+      return this.$route.path;
+    },
+  },
+  watch: {
+    cachedViews() {
+      console.log(49, 'cachedViews', this.cachedViews);
+    },
+    $route: {
+      immediate: true,
+      handler(route) {
+        const {
+          name,
+          meta: { keepAlive },
+        } = route;
+        if (name && keepAlive) {
+          console.log(5353535353);
+          console.log(name, keepAlive);
+          this.$store.commit('cachedViews/ADD_CACHED_VIEW', route);
+        }
+      },
+    },
+  },
   // data() {
   //   return {
   //     ws: null,
@@ -102,14 +130,12 @@ export default {
   //       this.$store.commit('SET_USER_INFO', uni.getStorageSync('member'));
   //       this.$store.commit('SET_MEMBER', uni.getStorageSync('member'));
   //     }
-
   //     // 如果是微信小程序入口,先把 传过来的 token 和 pageId 保存下来
   //     if (platform === 'miniprogram' && !uni.getStorageSync('pageId')) {
   //       const { pageId, token } = query;
   //       uni.setStorageSync('pageId', pageId);
   //       uni.setStorageSync('token', token);
   //     }
-
   //     // 如果用户没有openid
   //     const openid = uni.getStorageSync('openid');
   //     // console.log(949494, openid);
@@ -244,7 +270,6 @@ export default {
   //       return;
   //     }
   //     // 当前页面是否是在微信公众号运行:end
-
   //     // 当判断缓存中存在 pageId, token,并且地址栏中不存在 pageId, token。我们需要刷新页面,确保用户在微信小程序和H5公众号中使用的 open ID 保存一致
   //     if (
   //       uni.getStorageSync('pageId') &&

+ 1 - 1
src/components/uni-number-box/uni-number-box.vue

@@ -138,7 +138,7 @@ export default {
 .uni-numbox__value {
   background-color: #ffffff;
   width: 40px;
-  height: 35px;
+  height: 33px;
   text-align: center;
   font-size: 32px;
   border-width: 1px;

+ 12 - 4
src/pages/parkingFee/parkingFee.vue

@@ -275,6 +275,11 @@ export default {
       userInfo: (state) => state.userInfo,
       member: (state) => state.member, */
   },
+  // beforeRouteLeave(to, from, next) {
+  //   // 设置下一个路由的 meta
+  //   to.meta.keepAlive = false; // 让 A 缓存,即不刷新
+  //   next();
+  // },
   watch: {
     userInfo() {
       this.initPage();
@@ -559,7 +564,9 @@ export default {
           uni.hideLoading();
           if (res.data.code === 0) {
             // 清理旧数据
-            this.parkingFeeDetailInit()
+            this.parkingFeeDetailInit();
+            uni.setStorageSync('isReload', '3');
+            // this.$destroy();
             this.$router.push({
               path: '/parkingFeeDetail',
               query: {
@@ -640,6 +647,7 @@ export default {
 
       // 纸质优惠券
       uni.removeStorageSync('paperCouponInfo');
+      // uni.removeStorageSync('isReload');
     },
     // 车牌号校验
     // isVehicleNumber(vehicleNumber) {
@@ -677,7 +685,7 @@ export default {
       // this.$router.push({
       //   path: './parkingFeeList',
       // })
-      uni.removeStorageSync('passLogin')
+      uni.removeStorageSync('passLogin');
       this.$router.push({ path: '/parkingFeeList' });
       this.sensorsClick('$ClickParkRouter', {
         cta_itemno: '',
@@ -687,7 +695,7 @@ export default {
     },
     // 车牌管理
     doRouter2: function () {
-      uni.removeStorageSync('passLogin')
+      uni.removeStorageSync('passLogin');
       this.$router.push({ path: '/vehicleManagement' });
       this.sensorsClick('$ClickParkRouter', {
         cta_itemno: '',
@@ -697,7 +705,7 @@ export default {
     },
     //停车发票
     doRouter1: function () {
-      uni.removeStorageSync('passLogin')
+      uni.removeStorageSync('passLogin');
       // 北京停车场开票
       // if (this.parkInfoEntity.parkMallCode === 3) {
       //   uni.navigateToMiniProgram({

+ 53 - 13
src/pages/parkingFee/parkingFeeCoupon.vue

@@ -43,14 +43,14 @@
             :src="require('./static/images/no-card.png')"
           />
         </van-checkbox-group>
-        <div class="guide-box mgb-110">
+        <div class="guide-box mgb-110" v-if="platform === 'miniprogram'">
           <div class="guide-title">优惠券兑换指导</div>
           <div class="guide-desc">
             停车优惠券可直接使用,若您还没有兑换或继续兑换,可前往<wx-open-launch-weapp
               username=""
               path=""
               env-version=""
-              ><span class="guide-mini"
+              ><span class="guide-mini" @click="navigateToMiniProgram"
                 >嘉里中心小程序>积分商城</span
               ></wx-open-launch-weapp
             >进行兑换
@@ -88,7 +88,10 @@
 <script>
 import { mapState } from 'vuex';
 import uni from '@/utils/uniHooks';
-import { initWxJsSdkConfig } from '@/utils/login';
+// import { initWxJsSdkConfig } from '@/utils/login';
+import { Toast } from 'vant';
+import { getPlatform } from '@/utils/index';
+
 export default {
   created() {
     // 纸质优惠券
@@ -104,8 +107,14 @@ export default {
       this.parkDiscountTotal.feeCopy -= this.couponInfo.couponfee;
     }
     // console.log('定位报错原因', uni.getStorageSync('checkedCouponList'));
-    this.checkedCouponList =
-      JSON.parse(uni.getStorageSync('checkedCouponList')) || [];
+    const checkedCouponList = uni.getStorageSync('checkedCouponList');
+    console.log('定位报错原因', checkedCouponList);
+    this.checkedCouponList = checkedCouponList
+      ? typeof checkedCouponList === 'string'
+        ? JSON.parse(checkedCouponList)
+        : checkedCouponList
+      : [];
+    // JSON.parse(uni.getStorageSync('checkedCouponList')) || [];
   },
   mounted() {
     // initWxJsSdkConfig([], ['wx-open-launch-weapp']);
@@ -122,6 +131,7 @@ export default {
       ? this.parkFee.parkInfoEntity.useReduceTime
       : 0;
     this.parkMallCode = this.parkFee.parkInfoEntity.parkMallCode;
+    console.log('parkMallCode', this.parkMallCode);
     // 上限金额
     this.maxonetimediscountFee =
       this.parkFee.parkInfoEntity.maxonetimediscount *
@@ -172,6 +182,7 @@ export default {
       }
     } else {
       this.list = this.parkFee.memberTicketList;
+      console.log(181, this.list);
       this.list.forEach((item) => {
         item.disabled = false;
         item.checked = false;
@@ -214,6 +225,7 @@ export default {
       maxonedaydiscountFee: 0, // 每天优惠上限金额
       parkMallCode: 1, // 0静安 1浦东 2杭州 3北京 4沈阳 5深圳
       paperCouponFee: 0, // 纸质优惠金额
+      platform: getPlatform(),
     };
   },
   computed: {
@@ -328,10 +340,14 @@ export default {
               e.checked = true;
             }
           });
-          return uni.showToast({
-            title: `电子券每天最多可使用${this.parkFee.parkInfoEntity.useTicketNum}张`,
+          return Toast({
+            message: `电子券每天最多可使用${this.parkFee.parkInfoEntity.useTicketNum}张`,
             icon: 'none',
           });
+          // return uni.showToast({
+          //   title: `电子券每天最多可使用${this.parkFee.parkInfoEntity.useTicketNum}张`,
+          //   icon: 'none',
+          // });
         } else {
           this.list.forEach((e) => {
             e.disabled = false;
@@ -366,6 +382,7 @@ export default {
         } else {
           e.checked = false;
         }
+        // console.log(376, item.superpositionrule);
         // superpositionrule  叠加使用规则 (1不可叠加,2仅同类型可叠加,3可叠加)
         if (item.superpositionrule == '1') {
           if (e.couponCode !== item.couponCode) {
@@ -409,6 +426,15 @@ export default {
       return this.checkedCouponList.findIndex((e) => e == val) !== -1;
     },
 
+    // 跳转小程序
+    navigateToMiniProgram() {
+      if (this.platform === 'miniprogram') {
+        window.toWXSendMsg({
+          type: 'navigateToMiniProgram',
+          options: {},
+        });
+      }
+    },
     // 超限提示
     crossMessage() {
       let totalFee = this.parkDiscountTotal.feeCopy;
@@ -418,10 +444,15 @@ export default {
         this.parkMallCode === 1 &&
         totalFee - this.paperCouponFee >= this.maxonetimediscountFee
       ) {
-        return uni.showToast({
-          title: `超出抵扣上限,每次最高可抵扣${this.parkFee.parkInfoEntity.maxonetimediscount}小时`,
+        //  uni.showToast({
+        //   title: `超出抵扣上限,每次最高可抵扣${this.parkFee.parkInfoEntity.maxonetimediscount}小时`,
+        //   icon: 'none',
+        // });
+        return Toast({
+          message: `超出抵扣上限,每次最高可抵扣${this.parkFee.parkInfoEntity.maxonetimediscount}小时`,
           icon: 'none',
         });
+        return;
       }
       // 沈阳超限处理(maxonedaydiscountFee 会员、消费、电子券减免)
       if (
@@ -429,17 +460,25 @@ export default {
         totalFee - this.paperCouponFee - this.parkDiscountTotal.bonusfee >=
           this.maxonedaydiscountFee
       ) {
-        return uni.showToast({
-          title: `(会员等级、消费、电子券)每日最高可抵扣${this.parkFee.parkInfoEntity.maxOneDayHour}小时`,
+        return Toast({
+          message: `(会员等级、消费、电子券)每日最高可抵扣${this.parkFee.parkInfoEntity.maxOneDayHour}小时`,
           icon: 'none',
         });
+        // return uni.showToast({
+        //   title: `(会员等级、消费、电子券)每日最高可抵扣${this.parkFee.parkInfoEntity.maxOneDayHour}小时`,
+        //   icon: 'none',
+        // });
       }
       // 深圳超限处理
       if (this.parkMallCode === 5 && totalFee >= this.maxonedaydiscountFee) {
-        return uni.showToast({
-          title: `每日最高可抵扣${this.parkFee.parkInfoEntity.maxOneDayHour}元`,
+        return Toast({
+          message: `每日最高可抵扣${this.parkFee.parkInfoEntity.maxOneDayHour}元`,
           icon: 'none',
         });
+        // return uni.showToast({
+        //   title: `每日最高可抵扣${this.parkFee.parkInfoEntity.maxOneDayHour}元`,
+        //   icon: 'none',
+        // });
       }
     },
 
@@ -662,6 +701,7 @@ export default {
   background-color: #fff;
   position: fixed;
   bottom: 0;
+  position: fixed;
   font-size: 30px;
   display: flex;
   align-items: center;

+ 63 - 199
src/pages/parkingFee/parkingFeeDetail.vue

@@ -265,11 +265,8 @@
 </template>
 
 <script>
-// const app = getApp()
-const app = {};
 import moment from 'moment';
 import { mapState } from 'vuex';
-// import MemberCacheTool from '@/utils/member-cache-tool.js';
 import log from '@/utils/log.js';
 import { compare } from '@/utils/location.js';
 import uni from '@/utils/uniHooks';
@@ -278,6 +275,7 @@ import { getPlatform } from '@/utils/index';
 import { Dialog } from 'vant';
 
 export default {
+  name: 'parkingFeeDetail',
   data() {
     return {
       bindflag: '',
@@ -289,7 +287,7 @@ export default {
       params: {},
       integral: 0, // 积分
       bonus: 0, // 当前积分
-      bonusCopy: 0, // 积分备份
+      // bonusCopy: 0, // 积分备份
       bonusfee: 0, // 积分减免金额
       hourMoney: 15,
       payCarno: '',
@@ -318,8 +316,19 @@ export default {
       popup: false,
       integralToValue: 0, // 深圳前海停车500积分兑换5元
       integralMaxMoney: 0, // 深圳前海停车积分上限
+      // 是否重载
+      // isReload: '1',
     };
   },
+  beforeRouteLeave(to, from, next) {
+    // 设置下一个路由的 meta
+    if (/index|home/.test(to.name)) {
+      // 不在缓存列表中,从cachedViews缓存列表中移除
+      this.$store.commit('cachedViews/DEL_CACHED_VIEW', from);
+      
+    }
+    next();
+  },
   computed: {
     // 支付按钮状态
     payBtnDisabled() {
@@ -368,7 +377,6 @@ export default {
       if (this.bonusCopy < this.integral) {
         return `${this.integral}积分可停车1小时`;
       }
-      // console.log(354, this.member);
       if (
         this.parkMallCode === 3 &&
         this.member?.currnentintegral >= this.integral &&
@@ -457,14 +465,19 @@ export default {
       groupId: (state) => state.groupId,
       mobile: (state) => state.mobile,
       projectId: (state) => state.projectId,
+      bonusCopy: (state) => state.bonusCopy,
     }),
   },
   async created() {
+    console.log('469 我终于知道为什么了', uni.getStorageSync('isReload'));
+    // if (uni.getStorageSync('isReload') === '4') {
+    //   return;
+    // }
+    // uni.setStorageSync('isReload', '2');
     const platform = getPlatform();
     if (platform === 'micromessenger') {
       initWxJsSdkConfig(['chooseWXPay']);
       if (window.wxJsSdkConfigInitPromise) {
-        // console.log(397, window.wxJsSdkConfigInitPromise);
         await window.wxJsSdkConfigInitPromise;
       }
     }
@@ -473,55 +486,28 @@ export default {
     this.payCarno = option.carno;
     this.orderno = option.orderno;
     this.id = option.id;
-    // 场景二维码记录(是否扫码进入)
-    // app.globalData.paramsScene = {};
-    // this.$saveSceneQrcodeDetail(
-    //   'page',
-    //   'parkingFeeDetail:' + option.id,
-    //   '缴费详情',
-    //   '',
-    //   '',
-    //   '',
-    //   ''
-    // );
     this.init();
-    // if (JSON.stringify(app.globalData.userInfo) !== "{}" && JSON.stringify(app.globalData.member) !== "{}") {
     this.createParkOrder();
-    // } else {
-    // 	this.$refs.authorize.login("/pages/parkingFee/parkingFeeDetail", () => {
-    // 		this.createParkOrder();
-    // 	});
+    console.log('created', this.parkInfo);
+    // if (uni.getStorageSync('isReload') === '3') {
+    //   console.log(487);
+    //   this.$router.push({
+    //     path: '/jump',
+    //     query: this.$route.query,
+    //   });
+    //   return;
     // }
-    // 埋点本地化
-    // this.preUrl = uni.getStorageSync('previousUrl');
-    // uni.setStorageSync('previousUrl', '/pages/parkingFee/parkingFeeDetail.vue');
   },
-  /* watch: {
-    isInit() {
-      console.log(
-        493493493,
-        this.isInit,
-        this.isInit?.projectId,
-        this.isInit?.member?.vipcode
-      );
-      if (
-        this.isInit &&
-        this.isInit?.projectId &&
-        this.isInit?.member?.vipcode
-      ) {
-        this.init();
-        this.createParkOrder();
-      }
-    },
-    // member() {
-    //   this.init();
-    //   this.createParkOrder();
-    // },
-    // projectId() {
-    //   console.log(490490490, this.projectId)
+  activated() {
+    console.log('activated', uni.getStorageSync('isReload'));
+    // if (uni.getStorageSync('isReload') === '3') {
+    //   console.log(487);
+    //   this.$router.push({
+    //     path: '/jump',
+    //     query: this.$route.query,
+    //   });
+    //   return;
     // }
-  }, */
-  mounted() {
     setTimeout(() => {
       uni.setNavigationBarTitle({
         title: '停车支付',
@@ -531,6 +517,7 @@ export default {
     log.info('订单时间:' + this.orderCreateTime);
     this.isPageHide = false;
     // 如果订单时间+3分钟-当前时间<=0 刷新订单
+    console.log(this.orderCreateTime, '----544----');
     if (this.orderCreateTime) {
       const countDownTime = moment(this.orderCreateTime)
         .add(180, 's')
@@ -546,6 +533,7 @@ export default {
 
     // 优惠减免(首停、会员、消费)
     const checkedTotal = uni.getStorageSync('checkedTotal');
+    console.log(550, checkedTotal);
     this.checkedTotal =
       checkedTotal === 'null' || !checkedTotal ? 0 : checkedTotal;
     const discountTotal = uni.getStorageSync('discountTotal');
@@ -571,7 +559,7 @@ export default {
   methods: {
     // 页面初始清空缓存
     init() {
-      console.log('清理数据');
+      console.log('清理数据, 到底在执行几次?');
       // 优惠减免(首停、会员、消费)
       uni.removeStorageSync('checkedList'); // 选中list
       uni.removeStorageSync('checkedTotal'); // 选中count数
@@ -606,13 +594,10 @@ export default {
 
     // 创建订单
     async createParkOrder() {
-      // console.log(519);
       try {
-        // return;
         uni.showLoading({
           title: '加载中',
         });
-        // const openId = MemberCacheTool.getOpenId(app);
         const params = {
           carno: this.payCarno,
           mallid: this.mallid,
@@ -623,135 +608,13 @@ export default {
           groupId: this.groupId,
           createuser: 'sys_miniprogram',
         };
-
-        // const params = {"carno":"沪K99118","createuser":"sys_miniprogram","groupId":"8a8884e77cc9e70a017cca14d07e0002","mallid":"8a88835c7cd96d31017cda3f77e80003","mobile":"13901890884","openId":"ozdsB4_V8HXo0pwmyMc612j8CUY0","vipcode":"01900734052"}
-        // const params = {
-        //   carno: '皖EEEEEE',
-
-        //   mallid: '8aaa80b47c784020017c78b00d060022',
-
-        //   openId: 'ozdsB4yx3I7ez2Ba3DgEmeSR-CFY',
-
-        //   vipcode: 'KERRY100212801',
-
-        //   mobile: '15267617473',
-
-        //   groupId: '8aaa81947c6e1ca0017c7201e82d0001',
-
-        //   createuser: 'sys_miniprogram',
-        // };
         this.$md(params);
-        // console.log(623);
-        // console.log(567, this.$baseURL + 'api/1.0/park/createParkOrderAndCarFee')
-        // console.log({
-        //   // path: this.$baseURL + 'api/1.0/park/createParkOrder',
-        //   path: this.$baseURL + 'api/1.0/park/createParkOrderAndCarFee',
-        //   // path: 'http://172.21.90.87:8083/xcrm-api/api/1.0/park/createParkOrderAndCarFee',
-        //   data: params,
-        //   method: 'POST',
-        //   header: JSON.parse(uni.getStorageSync('handleUser')),
-        // });
         const res = await this.$request({
           url: this.$baseURL + 'api/1.0/park/createParkOrderAndCarFee',
-          // path: 'http://172.21.90.87:8083/xcrm-api/api/1.0/park/createParkOrderAndCarFee',
           data: params,
           method: 'POST',
           header: JSON.parse(uni.getStorageSync('handleUser')),
         });
-
-        /* const res = {
-          data: {
-            code: 0,
-            msg: 'success',
-            data: {
-              id: null,
-              parkServiceFee: null,
-              noCarNo: null,
-              parkPayFee: null,
-              addFee: null,
-              outTradeNo: null,
-              isUseFree: null,
-              type: null,
-              openTime: null,
-              parkname: null,
-              parkcode: 'kerry_bj_park',
-              parksign: null,
-              channel: null,
-              orderno: null,
-              tradeId: '90C01E53-874E-4B44-ABED-D2E43B71518E',
-              accountId: null,
-              merchantAccount: null,
-              status: 1,
-              remark: null,
-              carno: '浙C12410',
-              mobile: null,
-              vipcode: null,
-              vipName: null,
-              memberGrade: null,
-              entertime: '2022-08-31 10:03:30',
-              outtime: '2022-09-13 15:07:38',
-              serviceMin: 19024.0,
-              servicehour: 317.07,
-              servicefee: 18825,
-              bonusfee: null,
-              bonus: null,
-              newMemberBonus: null,
-              newMemberBonusMin: null,
-              bonusFeeMin: null,
-              couponfee: null,
-              couponfeeMin: null,
-              otherfee: 0,
-              consumeFee: null,
-              consumeFeeHour: null,
-              consumeFeeMin: null,
-              consumeTicket: null,
-              useConsumeFee: null,
-              memberGradeFee: null,
-              memberGradeFeeHour: null,
-              memberGradeFeeMin: null,
-              paperCouponFee: null,
-              paperCouponFeeMin: null,
-              paperCoupons: null,
-              paperCouponCode: null,
-              firstParkFee: null,
-              firstParkFeeMin: null,
-              payfee: null,
-              doflag: null,
-              totalfee: null,
-              usetotalfee: null,
-              paytype: null,
-              paykind: null,
-              paychannel: null,
-              integraladjustid: null,
-              refundIntegralAdjustId: null,
-              couponcode: null,
-              mallid: null,
-              createuser: null,
-              updateuser: null,
-              deptId: null,
-              groupId: null,
-              creator: null,
-              createDate: null,
-              updater: null,
-              updateDate: null,
-              openId: null,
-              refundNo: null,
-              wxState: null,
-              isInvoice: null,
-              invoiceId: null,
-              payStatus: null,
-              notifyStatus: null,
-              timeoutStatus: null,
-              refundStatus: null,
-              parkMallCode: null,
-              projectId: null,
-              pspName: null,
-              newMemeberBonusFee: null,
-            },
-          },
-        }; */
-        // console.log('590590590res', res);
-        // return;
         uni.hideLoading();
         if (res.data.code === 0) {
           this.bindflag = res.data.data.bind;
@@ -762,15 +625,6 @@ export default {
           uni.setStorageSync('orderno', this.parkInfo.orderno);
           if (!this.parkInfo.servicefee && this.initFlag) {
             this.initFlag = false;
-            //  uni.showModal({
-            //   showCancel: false,
-            //   title: '提示',
-            //   content: '当前无需缴费',
-            //   complete: () => {
-            //     // this.createParkOrder();
-            //     this.$router.back();
-            //   },
-            // });
             Dialog.alert({
               title: '提示',
               message: '当前无需缴费',
@@ -781,9 +635,7 @@ export default {
             });
             return;
           }
-          // console.log(629, this.member);
           if (this.member) {
-            // console.log(639);
             this.getDiscount();
           } else {
             // 未登录状态显示纸质券
@@ -854,7 +706,8 @@ export default {
                     this.durationCopy = this.duration;
                   }
                 }
-                this.bonusCopy = this.bonus;
+                // this.bonusCopy = this.bonus;
+                this.$store.commit('SET_BONUS_COPY', this.bonus);
               }
               if (!this.parkFee.parkInfoEntity) {
                 return;
@@ -983,7 +836,8 @@ export default {
 
     // 积分确认
     confirm() {
-      this.bonusCopy = this.bonus;
+      // this.bonusCopy = this.bonus;
+      this.$store.commit('SET_BONUS_COPY', this.bonus);
       this.durationCopy = this.duration;
       // this.$refs.popup.close();
       this.popup = false;
@@ -1107,10 +961,13 @@ export default {
     // 跳转首停、会员、消费减免页面
     discounts() {
       if (!this.hasDiscount && this.parkMallCode !== 2) {
-        return uni.showToast({
-          title: '暂无可用优惠',
-          icon: 'none',
+        return Toast({
+          message: '暂无可用优惠',
         });
+        // return uni.showToast({
+        //   title: '暂无可用优惠',
+        //   icon: 'none',
+        // });
       }
       this.$router.push({
         path: '/parkingFeeDiscounts',
@@ -1119,7 +976,7 @@ export default {
 
     // 自动勾选优惠 优先级:会员/消费->电子券->积分
     autoCheckDiscounts() {
-      // console.log('首次进来', this.parkFee);
+      console.log('首次进来', this.parkFee);
       // console.log('首次进来', this.parkInfo);
       if (!this.parkFee || !this.parkInfo.servicefee) {
         return;
@@ -1132,7 +989,7 @@ export default {
         this.parkFee.parkConsumeReducesEntityList[0] &&
         this.parkFee.parkConsumeReducesEntityList[0].recuceContent
       ) {
-        // console.log(1095);
+        console.log(1095);
         this.autoConsume(serviceFee);
       }
 
@@ -1158,7 +1015,7 @@ export default {
 
     // 自动选取消费减免
     autoConsume(serviceFee) {
-      // console.log('自动选取消费减免', serviceFee);
+      console.log('自动选取消费减免', serviceFee);
       let consumeTime =
         +this.parkFee.parkConsumeReducesEntityList[0].recuceContent || 0; // 消费减免时长
       let consumeFee = 0; // 消费减免费用
@@ -1241,15 +1098,21 @@ export default {
         time: consumeTime,
         fee: consumeFee,
       };
-      // console.log('用于子页面停车优惠画面显示', this.checkedTotal);
       // 存入缓存(用于子页面停车优惠画面显示)
-      uni.setStorageSync('checkedList', ['reduces']);
+      const checkedList = uni.getStorageSync('checkedList');
+      console.log('用于子页面停车优惠画面显示', checkedList);
+      if (checkedList) {
+        uni.setStorageSync('checkedList', checkedList);
+      } else {
+        uni.setStorageSync('checkedList', ['reduces']);
+      }
       uni.setStorageSync('checkedTotal', this.checkedTotal || 0);
       uni.setStorageSync('discountTotal', this.discountTotal);
     },
 
     // 自动选取会员等级减免
     autoMember() {
+      console.log('我想看看', this.checkedList);
       // 支付金额0 则无需后续减免
       if (!this.actualFee) {
         return;
@@ -1292,7 +1155,7 @@ export default {
         };
         checkedList = ['member'];
       }
-      // console.log('判断是否有执行', this.checkedTotal);
+      console.log('判断是否有执行', this.checkedList);
       this.checkedTotal++;
 
       // 存入缓存(用于子页面停车优惠画面显示)
@@ -1607,7 +1470,8 @@ export default {
         this.bonusfee = this.duration * this.hourMoney;
       }
       this.durationCopy = this.duration;
-      this.bonusCopy = this.bonus;
+      // this.bonusCopy = this.bonus;
+      this.$store.commit('SET_BONUS_COPY', this.bonus);
     },
 
     // 节流函数

+ 95 - 73
src/pages/parkingFee/parkingFeeDiscounts.vue

@@ -1,79 +1,80 @@
 <template>
-  <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>
+    <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>
-        </div>
-        <van-checkbox
-          value="member"
-          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 }}
+          <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>
-          <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
-          value="reduces"
-          color="#fff"
-          :disabled="
-            (!isCheck('reduces') && isDiscountDisabled) ||
-            !reducesDiscount.recuceContent
-          "
-        />
-        <!-- :checked="isCheck('reduces')" -->
-      </div>
-      <div class="flewx">
-        <div class="flewx-content">
-          合计<span
-            style="
-              color: #333;
-              font-weight: 600;
-              font-size: 36px;
-              padding-left: 0px;
+        <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
             "
-            >{{ actualFee | currency }}</span
-          >
-          元
-          <span style="color: #999; padding-left: 0px; font-size: 28px"
-            >已优惠{{ discountFee | currency }}元</span
-          >
+          />
+          <!-- :checked="isCheck('reduces')" -->
         </div>
-        <div class="flewx_index3" @click="confirm">确定</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>
-    </van-checkbox-group>
-  </scroll-view>
+      <div class="flewx_index3" @click="confirm">确定</div>
+    </div>
+  </div>
 </template>
 
 <script>
@@ -94,8 +95,11 @@ export default {
     if (uni.getStorageSync('couponInfo')) {
       this.couponFee = uni.getStorageSync('couponInfo').couponfee || 0;
     }
-    this.servicefee = uni.getStorageSync('servicefee'); // 应缴金额
+    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'));
     // 重置优惠 防止二次叠加
     this.discountTotal = uni.getStorageSync('discountTotal');
     if (this.discountTotal) {
@@ -175,10 +179,15 @@ export default {
       this.reduceHours =
         this.discountTotal.consumeFee / this.parkInfoEntity.needmoney || 0;
     }
-    const checkedList = JSON.parse(uni.getStorageSync('checkedList'));
+    const checkedList = uni.getStorageSync('checkedList');
+    console.log('反显处理', checkedList);
     if (checkedList && checkedList.length) {
-      this.checkedList = checkedList;
-    } /* else {
+      this.checkedList = JSON.parse(checkedList);
+    } else {
+      this.checkedList = [];
+    }
+    console.log('反显处理', this.checkedList);
+    /* else {
 			if (this.memberDiscount.reduceContent > 0) {
 				// 浦东上限控制
 				if (this.parkMallCode === 1) {
@@ -238,6 +247,12 @@ export default {
     // 超限提示
     this.crossMessage();
   },
+  // beforeRouteLeave(to, from, next) {
+  //   console.log(251251251251251251, to, from,);
+  //   // 设置下一个路由的 meta
+  //   to.meta.keepAlive = true; // 让 A 不缓存,即刷新
+  //   next();
+  // },
   data() {
     return {
       parkFee: {}, // 停车规则信息及优惠信息
@@ -349,10 +364,12 @@ export default {
       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;
     },
     // 首停、会员、消费优惠总计时长
@@ -361,12 +378,15 @@ export default {
     },
     // 实际支付金额
     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) {
@@ -394,6 +414,7 @@ export default {
   methods: {
     // 选择回调
     checkboxChange(e) {
+      console.log(this.checkedList);
       // console.log('checkboxChange');
       // console.log('paperCouponFee------>', this.paperCouponFee);
       // 浦东上限控制
@@ -519,6 +540,7 @@ export default {
           useConsumeFee = this.reducesDiscount.consumerLimit;
         }
       }
+
       uni.setStorageSync('checkedList', this.checkedList);
       uni.setStorageSync('checkedTotal', this.checkedTotal);
       uni.setStorageSync('discountTotal', {

+ 34 - 29
src/pages/parkingFee/parkingReceipt/parkingApplication.vue

@@ -251,7 +251,7 @@ export default {
     );
   },
   mounted() {
-    console.log(253, this.ids);
+    // console.log(253, this.ids);
     setTimeout(() => {
       uni.setNavigationBarTitle({
         title: '发票申请',
@@ -259,15 +259,15 @@ export default {
     }, 300);
     // console.clear();
     const query = getUrlParams();
-    console.log('是否重新回到改页面', this.pageOptions);
-    console.log('是否重新回到改页面', query);
-    console.log(260, this.$route.query);
-    this.pageOptions = query
+    // console.log('是否重新回到改页面', this.pageOptions);
+    // console.log('是否重新回到改页面', query);
+    // console.log(260, this.$route.query);
+    this.pageOptions = query;
     if (this.pageOptions) {
       const options = this.pageOptions;
-      console.log('===>onShow', options);
-      console.log('===>onShow', options.ids);
-      
+      // console.log('===>onShow', options);
+      // console.log('===>onShow', options.ids);
+
       if (options.type && options.money) {
         this.type = options.type;
         this.invoiceAmount = options.money;
@@ -277,10 +277,15 @@ export default {
         if (ids.indexOf(',') > -1) {
           this.ids = ids.split(',');
         } else {
-          this.ids = ids;
+          this.ids =
+            typeof ids === 'string'
+              ? ids.indexOf('[') > -1
+                ? JSON.parse(ids)
+                : [ids]
+              : ids;
         }
         this.orderQuantity = this.ids.length;
-        console.log('获取订单信息');
+        // console.log('获取订单信息');
         this.getParkOrderInfo();
         this.getInvoiceEmailInfo();
       }
@@ -336,19 +341,19 @@ export default {
         vipcode: this.member?.vipcode,
       };
       self.$md(params);
-      console.log(265, '开票信息', params);
-      console.log(
-        265,
-        '开票信息 path: ',
-        self.$baseURL + 'api/1.0/invoiceTitle/page'
-      );
+      // console.log(265, '开票信息', params);
+      // console.log(
+      //   265,
+      //   '开票信息 path: ',
+      //   self.$baseURL + 'api/1.0/invoiceTitle/page'
+      // );
       uni.request({
         url: self.$baseURL + 'api/1.0/invoiceTitle/page',
         method: 'GET',
         data: params,
         header: JSON.parse(uni.getStorageSync('handleUser')),
         success: (res) => {
-          console.log('开票信息', res.data);
+          // console.log('开票信息', res.data);
           if (res.data.code === 0) {
             const list = res.data.data;
             let currentIndex = 0;
@@ -357,7 +362,7 @@ export default {
             });
             const headerInfo = list[currentIndex] || {};
             self.headerInfo = headerInfo;
-            console.log('发票抬头--', self.headerInfo);
+            // console.log('发票抬头--', self.headerInfo);
           } else {
             uni.showToast({
               title: res.data.msg,
@@ -379,12 +384,12 @@ export default {
       // 如果当前是活动开票的话,则不差详情
       if (this.type) return;
       const self = this;
-      console.log('根据选中的停车缴费记录id获取详情信息', this.ids);
+      // console.log('根据选中的停车缴费记录id获取详情信息', this.ids);
       self.$md(this.ids);
-      console.log(
-        'getParkOrderInfo',
-        self.$baseURL + 'api/1.0/invoice/myParkOrderListByIds'
-      );
+      // console.log(
+      //   'getParkOrderInfo',
+      //   self.$baseURL + 'api/1.0/invoice/myParkOrderListByIds'
+      // );
       // return;
       uni.request({
         url: self.$baseURL + 'api/1.0/invoice/myParkOrderListByIds',
@@ -424,11 +429,11 @@ export default {
         vipcode: this.member?.vipcode,
       };
       self.$md(data);
-      console.log(
-        '获取用户邮箱信息',
-        self.$baseURL + 'api/1.0/invoice/getInvoiceEmailInfo'
-      );
-      console.log(421, data);
+      // console.log(
+      //   '获取用户邮箱信息',
+      //   self.$baseURL + 'api/1.0/invoice/getInvoiceEmailInfo'
+      // );
+      // console.log(421, data);
       uni.request({
         url: self.$baseURL + 'api/1.0/invoice/getInvoiceEmailInfo',
         method: 'POST',
@@ -490,7 +495,7 @@ export default {
 
       params.openid = this.openid;
       params.groupId = this.groupId;
-      params.vipcode = this.member?.vipcode
+      params.vipcode = this.member?.vipcode;
       // console.log('提交发票请求的入参', params);
       self.$md(params);
       if (self.isSubmitFlag) {

+ 170 - 162
src/pages/parkingFee/parkingReceipt/parkingChangeHeader.vue

@@ -1,113 +1,120 @@
 <template>
-  <scroll-view class="scroll-Y" scroll-y>
-    <div class="part top">
-      <div class="invoice-header">
-        <div class="part-item header-type lines">
-          <span class="part-item-key">抬头类型</span>
-          <van-radio-group v-model="condition.invoiceTitleType" direction="horizontal" class="part-item-value" @change="radioChange">
-            <van-radio
-              v-for="item in items"
-              :key="item.name+item.value"
-              checked-color="#064C8A"
-              :name="item.value"
+  <div>
+    <scroll-view class="scroll-Y" scroll-y>
+      <div class="part top">
+        <div class="invoice-header">
+          <div class="part-item header-type lines">
+            <span class="part-item-key">抬头类型</span>
+            <van-radio-group
+              v-model="condition.invoiceTitleType"
+              direction="horizontal"
+              class="part-item-value"
+              @change="radioChange"
             >
-              {{ item.name }}
-            </van-radio>
-          </van-radio-group>
-        </div>
-        <div class="part-item lines">
-          <span class="part-item-key">抬头名称</span>
-          <div class="part-item-value">
-            <!-- <input
+              <van-radio
+                v-for="item in items"
+                :key="item.name + item.value"
+                checked-color="#064C8A"
+                :name="item.value"
+              >
+                {{ item.name }}
+              </van-radio>
+            </van-radio-group>
+          </div>
+          <div class="part-item lines">
+            <span class="part-item-key">抬头名称</span>
+            <div class="part-item-value">
+              <!-- <input
               type="text"
               placeholder="请输入抬头名称"
               v-model="condition.invoiceTitleName"
             /> -->
-            <van-field
-              v-model="condition.invoiceTitleName"
-              right-icon="arrow"
-              input-align="right"
-              placeholder="请输入抬头名称"
-            />
-          </div>
-        </div>
-        <div class="part-item lines" v-if="isCompany">
-          <span class="part-item-key">公司税号</span>
-          <div class="part-item-value">
-            <!-- <input
-              type="text"
-              placeholder="请输入公司税号"
-              v-model="condition.corporationTax"
-            /> -->
-            <van-field
-              v-model="condition.corporationTax"
-              right-icon="arrow"
-              input-align="right"
-              placeholder="请输入公司税号"
-            />
-          </div>
-        </div>
-        <div class="part-item lines">
-          <span class="part-item-key">设为默认</span>
-          <div class="part-item-value">
-            <van-switch
-              active-color="#064C8A"
-              v-model="isDefault"
-              @change="switch1Change"
-            />
-          </div>
-        </div>
-      </div>
-      <div class="invoice-more" v-if="isCompany">
-        <div class="tab-title">更多信息(以下为选填内容)</div>
-        <div class="company-box">
-          <div class="part-item lines">
-            <span class="part-item-key">公司地址</span>
-            <div class="part-item-value">
               <van-field
-                v-model="condition.companyAddress"
+                v-model="condition.invoiceTitleName"
                 right-icon="arrow"
                 input-align="right"
-                placeholder="请输入公司地址"
+                placeholder="请输入抬头名称"
               />
             </div>
           </div>
-          <div class="part-item lines">
-            <span class="part-item-key">公司电话</span>
+          <div class="part-item lines" v-if="isCompany">
+            <span class="part-item-key">公司税号</span>
             <div class="part-item-value">
+              <!-- <input
+              type="text"
+              placeholder="请输入公司税号"
+              v-model="condition.corporationTax"
+            /> -->
               <van-field
-                v-model="condition.companyTel"
+                v-model="condition.corporationTax"
                 right-icon="arrow"
                 input-align="right"
-                placeholder="请输入公司电话"
+                placeholder="请输入公司税号"
               />
             </div>
           </div>
           <div class="part-item lines">
-            <span class="part-item-key">开户银行</span>
+            <span class="part-item-key">设为默认</span>
             <div class="part-item-value">
-              <van-field
-                v-model="condition.depositBank"
-                right-icon="arrow"
-                input-align="right"
-                placeholder="请输入开户银行"
+              <van-switch
+                active-color="#064C8A"
+                v-model="isDefault"
+                @change="switch1Change"
               />
             </div>
           </div>
-          <div class="part-item lines" style="border: none">
-            <span class="part-item-key">开户账户</span>
-            <div class="part-item-value">
-              <van-field
-                v-model="condition.accountNumber"
-                right-icon="arrow"
-                input-align="right"
-                placeholder="请输入开户账户"
-              />
+        </div>
+        <div class="invoice-more" v-if="isCompany">
+          <div class="tab-title">更多信息(以下为选填内容)</div>
+          <div class="company-box">
+            <div class="part-item lines">
+              <span class="part-item-key">公司地址</span>
+              <div class="part-item-value">
+                <van-field
+                  v-model="condition.companyAddress"
+                  right-icon="arrow"
+                  input-align="right"
+                  placeholder="请输入公司地址"
+                />
+              </div>
+            </div>
+            <div class="part-item lines">
+              <span class="part-item-key">公司电话</span>
+              <div class="part-item-value">
+                <van-field
+                  v-model="condition.companyTel"
+                  right-icon="arrow"
+                  input-align="right"
+                  placeholder="请输入公司电话"
+                />
+              </div>
+            </div>
+            <div class="part-item lines">
+              <span class="part-item-key">开户银行</span>
+              <div class="part-item-value">
+                <van-field
+                  v-model="condition.depositBank"
+                  right-icon="arrow"
+                  input-align="right"
+                  placeholder="请输入开户银行"
+                />
+              </div>
+            </div>
+            <div class="part-item lines" style="border: none">
+              <span class="part-item-key">开户账户</span>
+              <div class="part-item-value">
+                <van-field
+                  v-model="condition.accountNumber"
+                  right-icon="arrow"
+                  input-align="right"
+                  placeholder="请输入开户账户"
+                />
+              </div>
             </div>
           </div>
         </div>
       </div>
-    </div>
+    </scroll-view>
     <div class="part footer">
       <div
         :class="{
@@ -116,18 +123,19 @@
           'green-push-again-btn': custTypeId === 2,
         }"
         @click="submit"
-      >保存
+      >
+        保存
       </div>
     </div>
-  </scroll-view>
+  </div>
 </template>
 
 <script>
 // const app = getApp()
-const app = {}
-import { mapState } from 'vuex'
-import MemberCacheTool from '@/utils/member-cache-tool.js'
-import uni from '@/utils/uniHooks'
+const app = {};
+import { mapState } from 'vuex';
+import MemberCacheTool from '@/utils/member-cache-tool.js';
+import uni from '@/utils/uniHooks';
 
 export default {
   data() {
@@ -137,8 +145,8 @@ export default {
       id: '',
       globalData: app.globalData,
       items: [
-        {value: 0,name: '单位'},
-        {value: 1,name: '个人/非企业单位'},
+        { value: 0, name: '单位' },
+        { value: 1, name: '个人/非企业单位' },
       ],
       isDefault: true, // 记录
       condition: {
@@ -154,114 +162,117 @@ export default {
         createUser: '', // |String|是|创建人
         creator: '', // |Long|是|创建者id
         updateUser: this.member?.nickname, // |String|是|更新人
-        updater: this.member?.id, // |Long|是|更新人id
-        mobile: this.member?.mobile, // |String|是|手机号
-        vipcode: this.member?.vipcode, // |String|是|会员号
+        // updater: this.member?.id, // |Long|是|更新人id
+        // mobile: this.member?.mobile, // |String|是|手机号
+        // vipcode: this.member?.vipcode, // |String|是|会员号
         // openid: MemberCacheTool.getOpenId(app), // |String|是|openid
       },
       preUrl: '',
-    }
+    };
   },
   computed: {
     isCompany: function () {
-      return this.condition.invoiceTitleType == 0
+      return this.condition.invoiceTitleType == 0;
     },
     ...mapState({
-      custTypeId: ( state ) => state.custTypeId,
-      member: ( state ) => state.member,
-      openid: ( state ) => state.openid,// |String|是|openid
+      custTypeId: (state) => state.custTypeId,
+      member: (state) => state.member,
+      openid: (state) => state.openid, // |String|是|openid
     }),
   },
   created() {
     const options = this.$route.query;
-    console.log(this.globalData)
-    if ( options.type ) this.type = options.type
-    if ( options.id ) ( this.id = options.id ), this.getInvoiceTitleById()
+    console.log(this.globalData);
+    if (options.type) this.type = options.type;
+    if (options.id) (this.id = options.id), this.getInvoiceTitleById();
     // 埋点本地化
-    this.preUrl = uni.getStorageSync('previousUrl')
+    this.preUrl = uni.getStorageSync('previousUrl');
     uni.setStorageSync(
       'previousUrl',
       '/pages/parkingFee/parkingReceipt/parkingChangeHeader.vue'
-    )
+    );
   },
   mounted() {
     setTimeout(() => {
       uni.setNavigationBarTitle({
-        title: "发票抬头"
-      })
-    }, 300)
+        title: '发票抬头',
+      });
+    }, 300);
   },
   methods: {
-    radioChange: function ( e ) {
-      for ( let i = 0; i < this.items.length; i++ ) {
-        if ( this.items[i].value === e.detail.value ) {
-          this.condition.invoiceTitleType = i
-          break
+    radioChange: function (e) {
+      for (let i = 0; i < this.items.length; i++) {
+        if (this.items[i].value === e.detail.value) {
+          this.condition.invoiceTitleType = i;
+          break;
         }
       }
     },
-    switch1Change: function ( e ) {
-      console.log('switch1 发生 change 事件,携带值为',e.target.value)
-      this.isDefault = e.target.value
+    switch1Change: function (e) {
+      console.log('switch1 发生 change 事件,携带值为', e.target.value);
+      this.isDefault = e.target.value;
     },
     // 根据抬头ID获取抬头详情信息  api/1.0/invoiceTitle/{id}
     getInvoiceTitleById() {
-      const self = this
+      const self = this;
       const params = {
         id: this.id,
-      }
-      self.$md(params)
+      };
+      self.$md(params);
       uni.request({
         url: self.$baseURL + 'api/1.0/invoiceTitle/' + this.id,
         method: 'GET',
         data: params,
         header: JSON.parse(uni.getStorageSync('handleUser')),
-        success: ( res ) => {
-          console.log('获取抬头详情信息',res.data)
-          if ( res.data.code === 0 ) {
-            self.condition = res.data.data
+        success: (res) => {
+          console.log('获取抬头详情信息', res.data);
+          if (res.data.code === 0) {
+            self.condition = res.data.data;
             // 单独对默认选项进行赋值
-            self.isDefault = res.data.data.setDefault === 1 ? true : false
+            self.isDefault = res.data.data.setDefault === 1 ? true : false;
           } else {
             uni.showToast({
               title: res.data.msg,
               duration: 2000,
               icon: 'none',
-            })
+            });
           }
         },
         fail: () => {
           uni.showToast({
             title: '服务器开小差了呢,请您稍后再试',
             icon: 'none',
-          })
+          });
         },
-      })
+      });
     },
     // 添加、编辑抬头信息
     submit() {
-      const self = this
+      const self = this;
       const url =
-        self.type === 'add' ? 'api/1.0/invoiceTitle' : 'api/1.0/invoiceTitle'
-      const methodType = self.type === 'add' ? 'POST' : 'PUT'
-      if ( self.type === 'add' ) {
-        self.condition.createUser = self.globalData.wxMember.nickname
-        self.condition.creator = self.globalData.wxMember.id
+        self.type === 'add' ? 'api/1.0/invoiceTitle' : 'api/1.0/invoiceTitle';
+      const methodType = self.type === 'add' ? 'POST' : 'PUT';
+      if (self.type === 'add') {
+        self.condition.createUser = self.$store.state.userInfo.nickname;
+        self.condition.creator = self.$store.state.userInfo.id;
       }
-      self.condition.setDefault = self.isDefault ? 1 : 0
+      self.condition.setDefault = self.isDefault ? 1 : 0;
       const params = {
         ...self.condition,
-      }
-      console.log('提交信息',params)
-      self.$md(params)
+        updater: this.member?.id, // |Long|是|更新人id
+        mobile: this.member?.mobile, // |String|是|手机号
+        vipcode: this.member?.vipcode, // |String|是|会员号
+      };
+      console.log('提交信息', params);
+      self.$md(params);
       uni.request({
         url: self.$baseURL + url,
         method: methodType,
         data: params,
         header: JSON.parse(uni.getStorageSync('handleUser')),
-        success: ( res ) => {
-          console.log(res.data)
-          if ( res.data.code === 0 ) {
+        success: (res) => {
+          console.log(271, res.data);
+          if (res.data.code === 0) {
             // 保存结果埋点
             // self.sensorsClick('$ClickSubmitHeader',{
             //   redirect_url: '',
@@ -274,27 +285,27 @@ export default {
             //       ? 'SetAsDefaultClose'
             //       : 'SetAsDefaultOpen',
             // })
-            this.$router.back()
+            this.$router.back();
             // uni.navigateBack({delta: 1})
           } else {
             uni.showToast({
               title: res.data.msg,
               duration: 2000,
               icon: 'none',
-            })
+            });
           }
         },
         fail: () => {
           uni.showToast({
             title: '服务器开小差了呢,请您稍后再试',
             icon: 'none',
-          })
+          });
         },
-      })
+      });
     },
     // 埋点方法
-    sensorsClick( eventName,params ) {
-      let optionsQuery = uni.getStorageSync('options_query')
+    sensorsClick(eventName, params) {
+      let optionsQuery = uni.getStorageSync('options_query');
       let fixedParams = {
           cta_itemno: '',
           cta_name: '',
@@ -309,11 +320,11 @@ export default {
           $utm_function: optionsQuery.utm_function || '',
           $utm_user: optionsQuery.utm_user || '',
         },
-        finalParams = Object.assign(fixedParams,params)
-      this.$sensors.track(eventName,finalParams)
+        finalParams = Object.assign(fixedParams, params);
+      this.$sensors.track(eventName, finalParams);
     },
   },
-}
+};
 </script>
 
 <style lang="less" scoped>
@@ -324,7 +335,7 @@ export default {
   flex-direction: column;
   height: 100vh;
   // background: #f2f2f2;
-  background: #F4F7FF;
+  background: #f4f7ff;
   //padding: 30px 30px 30px 30px;
 
   .part {
@@ -374,9 +385,9 @@ export default {
     }
 
     .company-box {
-      background: #FAFBFF;
+      background: #fafbff;
       border-radius: 4px;
-      border: 1px solid #D8DAE0;
+      border: 1px solid #d8dae0;
     }
 
     .lines {
@@ -388,16 +399,15 @@ export default {
     }
 
     .invoice-header {
-      background: #FAFBFF;
+      background: #fafbff;
       border-radius: 4px;
-      border: 1px solid #D8DAE0;
+      border: 1px solid #d8dae0;
     }
   }
 
   .top {
-     margin-top: 30px;
+    margin-top: 30px;
     margin-left: 30px;
-
   }
 
   .middle {
@@ -408,13 +418,15 @@ export default {
     }
   }
 
-  .footer {
+  
+}
+.footer {
     width: 100%;
     height: 150px;
     position: fixed;
     bottom: 0px;
-     padding-bottom: constant(safe-area-inset-bottom);
-     padding-bottom: env(safe-area-inset-bottom);
+    padding-bottom: constant(safe-area-inset-bottom);
+    padding-bottom: env(safe-area-inset-bottom);
     //padding-bottom: 20px;
     box-shadow: 0 0 10px 0 hsla(0, 6%, 58%, 0.6);
     -webkit-box-shadow: 0 0 20px 0 hsla(0, 6%, 58%, 0.6);
@@ -448,7 +460,7 @@ export default {
     .push-again-btn {
       margin: 25px 30px;
       //background-image: linear-gradient(to right, #7d4ea1, #40397c);
-      background: #064C8A;
+      background: #064c8a;
       border-radius: 45px;
       //border-radius: 50px;
       color: #ffffff;
@@ -464,8 +476,4 @@ export default {
       .color-background-color('green');
     }
   }
-}
 </style>
-
-
-

+ 36 - 32
src/pages/parkingFee/parkingReceipt/parkingChooseHeader.vue

@@ -206,7 +206,13 @@ export default {
       // };
       // prePage.$vm.pageOptions = options;
       // this.$router.back();
-      this.$router.replace({ path: '/parkingApplication?ids=' + this.ids + '&header=' + JSON.stringify(item) });
+      this.$router.replace({
+        path:
+          '/parkingApplication?ids=' +
+          this.ids +
+          '&header=' +
+          JSON.stringify(item),
+      });
     },
     // 查询全部抬头列表信息
     getInvoiceTitle() {
@@ -336,7 +342,7 @@ export default {
   .noData {
     position: relative;
     top: 20%;
-    transform: translateY(-50%);
+    // transform: translateY(-50%);
     color: #cccccc;
     text-align: center;
 
@@ -345,40 +351,38 @@ export default {
       margin-bottom: 20px;
     }
   }
+}
+.lines {
+  border-bottom: 2px solid #ececec;
+}
+.footer {
+  width: 100%;
+  background-color: #ffffff;
+  position: fixed;
+  bottom: 0;
+  box-shadow: 0 0 10px 0 hsla(0, 6%, 58%, 0.6);
+  -webkit-box-shadow: 0 0 20px 0 hsla(0, 6%, 58%, 0.6);
+  -moz-box-shadow: 0 0 20px 0 hsla(0, 6%, 58%, 0.6);
+  // padding-bottom: constant(safe-area-inset-bottom);
+  // padding-bottom: env(safe-area-inset-bottom);
+  padding-bottom: 20px;
 
-  .footer {
-    width: 100%;
-    background-color: #ffffff;
-    position: fixed;
-    bottom: 0;
-    box-shadow: 0 0 10px 0 hsla(0, 6%, 58%, 0.6);
-    -webkit-box-shadow: 0 0 20px 0 hsla(0, 6%, 58%, 0.6);
-    -moz-box-shadow: 0 0 20px 0 hsla(0, 6%, 58%, 0.6);
-    // padding-bottom: constant(safe-area-inset-bottom);
-    // padding-bottom: env(safe-area-inset-bottom);
-    padding-bottom: 20px;
-
-    .push-again-btn {
-      margin: 20px 60px;
-      color: #ffffff;
-      // background-image: linear-gradient(to right, #7d4ea1, #40397c);
-      background-color: #064c8a;
-      border-radius: 50px;
-      text-align: center;
-      padding: 20px 0;
-    }
-
-    .blue-push-again-btn {
-      .color-background-color('blue');
-    }
+  .push-again-btn {
+    margin: 20px 60px;
+    color: #ffffff;
+    // background-image: linear-gradient(to right, #7d4ea1, #40397c);
+    background-color: #064c8a;
+    border-radius: 50px;
+    text-align: center;
+    padding: 20px 0;
+  }
 
-    .green-push-again-btn {
-      .color-background-color('green');
-    }
+  .blue-push-again-btn {
+    .color-background-color('blue');
   }
 
-  .lines {
-    border-bottom: 2px solid #ececec;
+  .green-push-again-btn {
+    .color-background-color('green');
   }
 }
 </style>

+ 41 - 5
src/routes/index.js

@@ -2,106 +2,142 @@ import VueRouter from 'vue-router';
 import qs from 'qs';
 import Home from '@/pages/parkingFee/parkingFee.vue'
 const routes = [
-  { path: '/', name: '首页', component: Home },
-  { path: '/home', name: '首页', component: Home },
+  { path: '/', name: 'index', component: Home },
+  { path: '/home', name: 'home', component: Home },
   {
     path: '/parkingFeePayment',
     component: () => import('@/pages/parkingFee/parkingFeePayment.vue'),
-  }, {
+  },
+  {
     path: '/parkingFeeDetail',
+    name: 'parkingFeeDetail',
     component: () => import('@/pages/parkingFee/parkingFeeDetail.vue'),
-  }, {
+  }, 
+  {
     path: '/parkingFeeCoupon',
+    name: 'parkingFeeCoupon',
     component: () => import('@/pages/parkingFee/parkingFeeCoupon.vue'),
   },
   {
     path: '/parkingFeeDetailSuccess',
+    name: 'parkingFeeDetailSuccess',
     component: () => import('@/pages/parkingFee/parkingFeeDetailSuccess.vue'),
   },
   {
     path: '/parkingFeePaperCoupon',
+    name: 'parkingFeePaperCoupon',
     component: () => import('@/pages/parkingFee/parkingFeePaperCoupon.vue'),
   },
   {
     path: '/parkingFeeList',
+    name: 'parkingFeeList',
     component: () => import('@/pages/parkingFee/parkingFeeList.vue'),
   },
   {
     path: '/pointsMall',
+    name: 'pointsMall',
     component: () => import('@/pages/pointsMall/pointsMall.vue'),
   },
   {
     path: '/parkingReceipt',
+    name: 'parkingReceipt',
     component: () =>
       import('@/pages/parkingFee/parkingReceipt/parkingReceipt.vue'),
   },
   {
     path: '/vehicleManagement',
+    name: 'vehicleManagement',
     component: () => import('@/pages/parkingFee/vehicleManagement.vue'),
   },
   {
     path: '/vehicleAddOrEdit',
+    name: 'vehicleAddOrEdit',
     component: () => import('@/pages/parkingFee/vehicleAddOrEdit.vue'),
   },
   {
     path: '/parkingFeeSuccess',
+    name: 'parkingFeeSuccess',
     component: () => import('@/pages/parkingFee/parkingFeeSuccess.vue'),
   },
   {
     path: '/cryptojs',
+    name: 'cryptojs',
     component: () => import('@/pages/cryptojs/cryptojs.vue'),
   },
   {
     path: '/parkingFeeDiscounts',
+    name: 'parkingFeeDiscounts',
     component: () => import('@/pages/parkingFee/parkingFeeDiscounts.vue'),
   },
   {
     path: '/parkingFeePaperCoupon',
+    name: 'parkingFeePaperCoupon',
     component: () => import('@/pages/parkingFee/parkingFeePaperCoupon.vue'),
   },
   {
     path: '/parkingInvoice',
+    name: 'parkingInvoice',
     component: () => import('@/pages/parkingFee/parkingReceipt/parkingInvoice.vue'),
   },
   {
     path: '/parkingHeaderDetail',
+    name: 'parkingHeaderDetail',
     component: () => import('@/pages/parkingFee/parkingReceipt/parkingHeaderDetail.vue'),
   },
   {
     path: '/parkingInvoiceImage',
+    name: 'parkingInvoiceImage',
     component: () => import('@/pages/parkingFee/parkingReceipt/parkingInvoiceImage.vue'),
   },
   {
     path: '/parkingOrderDetail',
+    name: 'parkingOrderDetail',
     component: () => import('@/pages/parkingFee/parkingReceipt/parkingOrderDetail.vue'),
   },
   {
     path: '/parkingApplication',
+    name: 'parkingApplication',
     component: () => import('@/pages/parkingFee/parkingReceipt/parkingApplication.vue'),
   },
   {
     path: '/parkingChooseHeader',
+    name: 'parkingChooseHeader',
     component: () => import('@/pages/parkingFee/parkingReceipt/parkingChooseHeader.vue'),
   },
   {
     path: '/parkingChangeHeader',
+    name: 'parkingChangeHeader',
     component: () => import('@/pages/parkingFee/parkingReceipt/parkingChangeHeader.vue'),
   },
   // 登录
   {
     path: '/login',
+    name: 'login',
     component: () => import('@/pages/login/login'),
   },
   // 微信授权回调
   {
     path: '/openWx',
+    name: 'openWx',
     component: () => import('@/pages/login/openWx'),
   },
   // { path: '/bar', component: 'Bar' }
 ];
 
 const router = new VueRouter({
-  routes, // short for `routes: routes`
+  routes: routes.map(item => {
+    let keepAlive = false
+    if (/\/parkingFeeDetail/.test(item.path)) {
+      keepAlive = true
+    }
+    item = {
+      ...item,
+      meta: {
+        keepAlive // 不需要被缓存
+      },
+    }
+    return item
+  }),
 });
 
 router.beforeEach((to, from, next) => {

+ 27 - 0
src/store/cachedViews.js

@@ -0,0 +1,27 @@
+const state = {
+  cachedViews: [], // 示例 ['TemplateB', 'TemplateC']
+}
+
+const mutations = {
+  // 添加缓存
+  ADD_CACHED_VIEW: (state, view) => {
+    if (state.cachedViews.includes(view.name)) {
+      return
+    }
+    state.cachedViews.push(view.name)
+  },
+  // 移除缓存
+  DEL_CACHED_VIEW: (state, view) => {
+    const index = state.cachedViews.indexOf(view.name)
+    index > -1 && state.cachedViews.splice(index, 1)
+  },
+
+}
+
+export default {
+  //开启命名模块
+  namespaced: true,
+  state,
+  mutations,
+}
+

+ 15 - 4
src/store/index.js

@@ -4,6 +4,7 @@ import { Encrypt, Decrypt } from '@/utils/crypto';
 import { crmQueryMemberInfo } from '@/utils/api-crm-member';
 import uni from '@/utils/uniHooks';
 import { kipAllCities, kipGetUserDetail } from '@/utils/api-kip';
+import cachedViews from './cachedViews'
 
 Vue.use(Vuex);
 function getValue(state, key) {
@@ -36,7 +37,9 @@ const store = new Vuex.Store({
     projectId: '',
     passLogin: false,
     accessToken: '', // 用户的token
-    tempParkingOrder: {}
+    tempParkingOrder: {},
+    // 停车缴费
+    bonusCopy: 0,
   },
   mutations: {
     SET_GROUP_ID(state, payload) {
@@ -92,6 +95,10 @@ const store = new Vuex.Store({
     },
     setTempParkingOrder(state, payload) {
       state.tempParkingOrder = payload;
+    },
+    // setbonusCopy
+    SET_BONUS_COPY(state, payload) {
+      state.bonusCopy = payload;
     }
   },
   actions: {
@@ -136,7 +143,7 @@ const store = new Vuex.Store({
         const marketListRes = await kipAllCities();
         if (memberRes.code === 0) {
           dispatch('getUserDetail')
-          commit('SET_USER_INFO', memberRes.data);
+          
           commit('SET_MEMBER', memberRes.data);
         }
         console.log(929292, marketListRes);
@@ -148,7 +155,8 @@ const store = new Vuex.Store({
     },
     async getUserDetail({ commit }) {
       const res = await kipGetUserDetail();
-      console.log('user_info', res);
+      commit('SET_USER_INFO', res.data);
+      // console.log('user_info', res);
     },
     async initH5({ commit }) {
       if (uni.getStorageSync('groupId')) {
@@ -197,7 +205,10 @@ const store = new Vuex.Store({
     member(state) {
       return getValue(state, 'member')
     },
-  }
+  },
+  modules: {
+    cachedViews,
+  },
 });
 
 export default store;