Przeglądaj źródła

feat: 微服务接入改造15%

John-Hong 2 lat temu
rodzic
commit
14116d9224

+ 1 - 3
package.json

@@ -17,8 +17,6 @@
     "js-md5": "^0.7.3",
     "lodash": "^4.17.21",
     "moment": "^2.29.4",
-    "sa-sdk-javascript": "^1.23.3",
-    "sa-sdk-miniprogram": "^1.17.12",
     "uuid": "^9.0.0",
     "vant": "^2.12.50",
     "vue": "^2.7.14",
@@ -47,7 +45,7 @@
     "postcss-nested": "^5.0.6",
     "postcss-px-to-viewport": "^1.1.1",
     "postcss-style-px-to-viewport": "^2.9.1",
-    "prettier": "^2.7.1",
+    "prettier": "^2.8.3",
     "sass": "^1.56.2",
     "sass-loader": "^10.4.1",
     "vue-template-compiler": "^2.7.14",

+ 19 - 59
src/App.vue

@@ -23,34 +23,16 @@
 </template>
 <script>
 import { createAxiosByinterceptors } from "@/api/request";
-import { KIP_API_CODE } from '@/common/js/config';
 import Stomp from '@/lib/stompjs';
 import loginMinix from '@/mixins/login';
-import {
-  kipCheckToken,
-  kipGetNewAccessTokenByRefreshToken,
-} from '@/utils/api-kip';
-import CacheTool from '@/utils/cache-tool';
 import { Decrypt, Encrypt } from '@/utils/crypto';
 import { getIsMin, getIsWxh5, getUrlParams } from '@/utils/index.js';
-import KipCacheTool from '@/utils/kip-cache-tool';
-import log from '@/utils/log';
 import SockJS from '@/utils/sockjs';
 import uni from '@/utils/uniHooks';
 import { getAppIdByGroupIdAndMallId } from '@/utils/index.js';
-import { Toast } from 'vant';
-import { pathToRegexp, parse, compile } from 'path-to-regexp';
 
 export default {
   mixins: [loginMinix],
-  data() {
-    return {
-      ws: null,
-      stompClient: null,
-      isInit: true,
-      Toastloading: null,
-    };
-  },
   created() {
     console.log('重新打包');
     this.initEnv();
@@ -68,10 +50,13 @@ export default {
     key() {
       return this.$route.path;
     },
+    isInit() {
+      return this.$store.state.isInit;
+    }
   },
   watch: {
     cachedViews() {
-      console.log(49, 'cachedViews', this.cachedViews);
+      console.log('cachedViews(打印已经缓存的页面)', this.cachedViews);
     },
     $route: {
       immediate: true,
@@ -91,31 +76,22 @@ export default {
       uni.setStorageSync('env', window.env);
       // 如果是微信小程序。初始化wss
       if (getIsMin()) {
-        // this.Toastloading = Toast.loading({
-        //   message: '加载中',
-        //   duration: 0,
-        //   forbidClick: true,
-        // });
-        console.log('触发重新发布功能 22?');
-        console.log('触发重新发布功能 22?');
+        // 保留 carList
+        const carList = uni.getStorageSync('carList');
         // 每次进入页面清空 缓存数据
         window.localStorage.clear();
-        this.isInit = false;
-        console.log(window.location.href);
-        console.log(56, this.$route);
-        console.log('触发重新发布功能 6?');
+        uni.setStorageSync('carList', JSON.parse(carList));
+        this.$store.commit('SET_IS_INIT', false);
         window.token = `${window.location.href}`.replace(
           /.*wx\/(.*)\/.*/g,
           '$1'
         );
         try {
           const options = await this.wss();
-          console.log(8383, options);
           this.$store.dispatch('baseInit', {
             options,
             callback: () => {
-              // this.Toastloading.clear();
-              this.isInit = true;
+              this.$store.commit('SET_IS_INIT', true);
             },
           });
         } catch (err) {
@@ -134,7 +110,6 @@ export default {
           const socket = new SockJS(
             `${this.getUrl()}/hafengWebsocket?token=${window.token}`
           );
-          console.log(136)
           window.stompClient = Stomp.over(socket);
           window.stompClient.debug = null;
           this.windowSendInit();
@@ -144,7 +119,6 @@ export default {
               type: 'getProjectId',
               options: {},
             });
-            console.log('146, projectId')
             window.subscribe('projectId', (options) => {
               resolve(options);
             });
@@ -224,8 +198,8 @@ export default {
         // window.profileApi = 'https://qa-apim.kerryplus.com/c/api';
         // window.api = 'qaApi';
         window.env = 'dev';
-        window.profileApi = 'https://dev-gateway-kip.kerryonvip.com/c/api';
-        window.api = 'qaApi';
+        window.profileApi = 'https://dev-gateway-kip.kerryonvip.com/api';
+        window.api = 'devApi';
         return;
       }
       if (/qa-/.test(href)) {
@@ -240,25 +214,11 @@ export default {
     },
     requestInit() {
       window.requestms = createAxiosByinterceptors({
-        baseURL: `${window.profileApi}/temporary-parking-service`,
+        // baseURL: `https://dev-kip-service-internal.kerryonvip.com/`,
+        // baseURL: `http://tp.hht.test/`,
+        baseURL: `/msApi`,
       });
     },
-    send() {
-      const token = window.token;
-      window.stompClient.send(
-        '/sendToWechat',
-        {},
-        JSON.stringify({
-          token: token,
-          data: Encrypt(
-            JSON.stringify({
-              type: 'openWxPay',
-              options: {},
-            })
-          ),
-        })
-      );
-    },
     // websocket 链接
     getUrl() {
       // 如果 kerry+ 这边的访问环境是 sl 或者 lt,需要把 wss 指向 qa 环境。
@@ -273,7 +233,7 @@ export default {
       return `https://crm.kerryplus.com/xcrm-api`;
     },
     micromessengerInit() {
-      this.isInit = false;
+      this.$store.commit('SET_IS_INIT', false);
       let path = '';
       let [groupId, mallId] = window.location.pathname
         .split('/')
@@ -308,18 +268,18 @@ export default {
       // return;
       // 设置openid
       this.$nextTick(() => {
-        this.isInit = true;
+        this.$store.commit('SET_IS_INIT', true);
         if (openid && openid !== 'undefined') {
           this.$store.commit('SET_OPENID', openid);
           // 用户选择不登录
           if (this.isLogin !== '3') {
-            this.isInit = false;
+            this.$store.commit('SET_IS_INIT', false);
             setTimeout(() => {
-              this.isInit = true;
+              this.$store.commit('SET_IS_INIT', true);
             }, 700);
             // 判断用户是否需要登录
             this.checkIsLogin(() => {
-              this.isInit = true;
+              this.$store.commit('SET_IS_INIT', true);
               // window.location.reload();
               this.$store.dispatch('getUserDetail');
               this.$store.commit('SET_MEMBER', uni.getStorageSync('member'));

+ 75 - 0
src/api/mockData/check-out.response.json

@@ -0,0 +1,75 @@
+{
+  "parkingRecord": {
+    "vehicleNo": "粤BDF1412",
+    "enterTime": "2023-01-06 19:24:50",
+    "serviceMin": 84,
+    "totalFee": 2000,
+    "actualPayFee": 0.0,
+    "totalFeeInYuan": 20.00
+  },
+  "discountInfo": {
+    "usingTotalDiscount": 22,
+    "memberLevelDiscount": false,
+    "points": [
+      {
+        "available": 1234,
+        "maxDiscountFee": 20,
+        "pointsPerUnit": 500,
+        "unitAmount": 5,
+        "newMember": false,
+        "label": "1234积分可减免"
+      }
+    ],
+    "coupons": [
+      {
+        "code": "couponCode1",
+        "name": "6元券",
+        "expirationDate": "2023-01-08 13:15:11",
+        "discountFee": 6,
+        "defaultSelected": true
+      },
+      {
+        "code": "couponCode2",
+        "name": "6元券",
+        "expirationDate": "2023-01-08 13:15:11",
+        "discountFee": 6,
+        "defaultSelected": true
+      },
+      {
+        "code": "couponCode3",
+        "name": "5元券",
+        "expirationDate": "2023-01-08 13:15:11",
+        "discountFee": 5,
+        "defaultSelected": true
+      },
+      {
+        "code": "couponCode4",
+        "name": "5元券",
+        "expirationDate": "2023-01-08 13:15:11",
+        "discountFee": 5,
+        "defaultSelected": true
+      },
+      {
+        "code": "couponCode5",
+        "name": "5元券",
+        "expirationDate": "2023-01-08 13:15:11",
+        "discountFee": 5
+      }
+    ]
+  },
+  "parkingRule": {
+    "maxOneDayDiscountFee": 20,
+    "enableNewMemberPoints": false,
+    "enablePoints": true,
+    "enableCoupon": true,
+    "enablePaperCoupons": false,
+    "enableConsume": false,
+    "enableConsumeSplit": false,
+    "remainConsumeTime": 20
+  },
+  "parkInfo": {
+    "parkName": "计费基础规则:15分钟内免费,首小时15元,其后每小时5元,全天封顶60元。",
+    "description": "深圳收费描述",
+    "parkMallCode": 5
+  }
+}

+ 6 - 4
src/api/parking/index.js

@@ -9,16 +9,18 @@
 //   baseURL: `${window.profileApi}/temporary-parking-service`,
 // });
 
-export function parkingLots(params) {
-  return window.requestms.get(`/parking-lots`, { params, loading: true });
+export function parkingLots(buildingsId) {
+  return window.requestms.get(`/parking-lots/buildings/${buildingsId}`, { loading: true });
+  // return window.requestms.get(`/`, { params, loading: true });
 }
 
 
-
 // 1.6 查询车辆是否在场及停车费用: https://kerryprops.atlassian.net/wiki/spaces/TAIC/pages/94076936/1.6
 // 新接口路径:https://{kip-service-host}/c/api/temporary-parking-service/parking/check-out?vehicleNo={{vehicleNo}}
 export function checkOut(vehicleNo) {
-  return window.requestms.get(`/check-out?vehicleNo=${vehicleNo}`, {  loading: true });
+  console.log(212121, vehicleNo);
+  // 'https://dev-kip-service-internal.kerryonvip.com/temporary-parking-service/parking/check-out?vehicleNo=浙
+  return window.requestms.get(`/parking/check-out?vehicleNo=${vehicleNo}`, {  loading: true });
 }
 
 

+ 19 - 14
src/api/request.js

@@ -83,6 +83,7 @@ export const createAxiosByinterceptors = (config) => {
   const instance = axios.create({
     timeout: 1000, //超时配置
     baseURL: `${window.profileApi}/temporary-parking-service`,
+    // baseURL: `https://dev-kip-service-internal.kerryonvip.com/temporary-parking-service`,
     withCredentials: true, //跨域携带cookie
     ...config, // 自定义配置覆盖基本配置
   });
@@ -98,20 +99,21 @@ export const createAxiosByinterceptors = (config) => {
         ...config.headers,
         ...handleConfig().header,
         'X-Conversation-Id': uuidv4(),
-        'X-User': JSON.stringify({
-          userId: store.state.member.id, // K+用户ID
-          sourceType: 'WECHAT', // 登录来源: WECHAT/ALIPAY/H5/APP
-          cId: store.state.openId, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
-          projectId: store.state.member.groupId, // 楼盘id
-          // projectId: 'ZYJXQV2', // 楼盘id
-          buildingId: store.state.member.mallid, // 楼栋id
-          // buildingId: '%E6%B2%AAA99999', // 楼栋id
-          mobile: store.state.mobile, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
-          vipCode: store.state.member.vipcode, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
-        })
+        // 'X-User': JSON.stringify({
+        //   userId: store.state.member.id, // K+用户ID
+        //   sourceType: 'WECHAT', // 登录来源: WECHAT/ALIPAY/H5/APP
+        //   cId: store.state.openId, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
+        //   // projectId: store.state.member.groupId, // 楼盘id
+        //   projectId: '4028e3817c2b3f79017c2b48c54c0000', // 楼盘id
+        //   // buildingId: store.state.member.mallid, // 楼栋id
+        //   // buildingId: '8aaa80b47c784020017c78b00d060022', // 楼栋id
+        //   buildingId: 'shenzhen01', // 楼栋id
+        //   mobile: store.state.mobile, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
+        //   vipCode: store.state.member.vipcode, // 终端用户ID, 微信端传openId, 支付宝小程序传阿里userId, APP传KIP的userId
+        // })
       }
       // console.log(111111, config.headers, handleConfig().header)
-      console.log(111111, handleConfig().header)
+      // console.log(111111, handleConfig().header)
       return config;
     },
     function (error) {
@@ -129,7 +131,10 @@ export const createAxiosByinterceptors = (config) => {
       if (loading) cancelLoading();
       const { code, data, message } = response.data;
       console.log('62response', response);
-      if (code === 200) return data;
+      // TODO: 临时注释
+      // Promise.reject(response.data)
+      return response.data
+      /*if (code === 200) return data;
       else if (code === 401) {
         // 跳转到登陆
         // jumpLogin();
@@ -140,7 +145,7 @@ export const createAxiosByinterceptors = (config) => {
           message: message,
         });
         return Promise.reject(response.data);
-      }
+      }*/
     },
     function (error) {
       // 对响应错误做点什么

+ 90 - 0
src/common/js/clientInit.js

@@ -0,0 +1,90 @@
+// H5
+// 微信小程序: KIP
+// 微信小程序: CRM
+/*
+* 1、如果是小程序的话,接入 socket
+* 2、如果是h5,获取用户的 openid
+* 3、初始化 socket
+* */
+
+import { createAxiosByinterceptors } from "@/api/request";
+import Stomp from '@/lib/stompjs';
+import loginMinix from '@/mixins/login';
+import { Decrypt, Encrypt } from '@/utils/crypto';
+import { getIsMin, getIsWxh5, getUrlParams } from '@/utils/index.js';
+import SockJS from '@/utils/sockjs';
+import uni from '@/utils/uniHooks';
+import { getAppIdByGroupIdAndMallId } from '@/utils/index.js';
+
+
+export function initEnv() {
+  const href = window.location.href;
+  console.log('当前页面的url地址  ', href);
+  if (/dev-|8080/.test(href)) {
+    // window.env = 'qa';
+    // window.profileApi = 'https://qa-apim.kerryplus.com/c/api';
+    // window.api = 'qaApi';
+    window.env = 'dev';
+    window.profileApi = 'https://dev-gateway-kip.kerryonvip.com/api';
+    window.api = 'devApi';
+    return;
+  }
+  if (/qa-/.test(href)) {
+    window.env = 'qa';
+    window.api = 'qaApi';
+    window.profileApi = 'https://qa-apim.kerryplus.com/c/api';
+    return;
+  }
+  window.env = 'prod';
+  window.profileApi = 'https://apim.kerryplus.com/c/api';
+  window.api = 'api';
+}
+export function requestInit() {
+  window.requestms = createAxiosByinterceptors({
+    baseURL: `${window.profileApi}/temporary-parking-service`,
+  });
+}
+
+// websocket 链接
+export function  getUrl() {
+  // 如果 kerry+ 这边的访问环境是 sl 或者 lt,需要把 wss 指向 qa 环境。
+  const href = `${window.location.href}`;
+  if (/dev-|8080/.test(href)) {
+    return 'https://qa-crm-kpl.kerryprops.com.cn/xcrm-api';
+  }
+  if (/qa-/.test(href)) {
+    return 'https://qa-crm-kpl.kerryprops.com.cn/xcrm-api';
+  }
+  // return 'https://qa-crm-kpl.kerryprops.com.cn/xcrm-api';
+  return `https://crm.kerryplus.com/xcrm-api`;
+}
+
+export function  createWS() {
+  return new Promise((resolve, reject) => {
+    try {
+      const socket = new SockJS(
+        `${this.getUrl()}/hafengWebsocket?token=${window.token}`
+      );
+      window.stompClient = Stomp.over(socket);
+      window.stompClient.debug = null;
+      this.windowSendInit();
+      window.stompClient.connect({}, (frame) => {
+        // 请求 projectId
+        window.toWXSendMsg({
+          type: 'getProjectId',
+          options: {},
+        });
+        window.subscribe('projectId', (options) => {
+          resolve(options);
+        });
+      });
+    } catch (err) {
+      reject(err);
+    }
+  });
+}
+
+
+export function  clientInit() {
+
+}

+ 13 - 19
src/main.js

@@ -1,12 +1,11 @@
 import Vue from 'vue';
+import VueRouter from 'vue-router';
+
 import './plugins/install';
-// 设置环境变量
-import uni from './utils/uniHooks';
-// uni.setStorageSync('env', process.env.NODE_ENV);
 import App from './App.vue';
-import sensors from 'sa-sdk-javascript';
 import store from './store/index.js';
-import VueRouter from 'vue-router';
+
+// ui 组件
 import {
   Icon,
   Checkbox,
@@ -19,29 +18,24 @@ import {
   Switch,
   Skeleton,
 } from 'vant';
-import router from './routes/index.js';
-import wx from '@/utils/js_sdk/weixin';
+import router from './routes/index.js'; // 注册页面路由
+import wx from '@/utils/js_sdk/weixin'; // 接入微信JSDK
+import '@/utils/filters'; // 注册 vue 过滤器
+import request from '@/utils/request.js'; //
 
-// import authorize from 'components/authorize/authorize.vue'
+// 项目整体初始化逻辑
+import {clientInit} from '@/common/js/clientInit'
+clientInit();
 
-import '@/utils/filters';
-
-import request from '@/utils/request.js';
+// 注册全局组件
 import componentsInstall from './components/install';
-// import uni from '@/utils/uniHooks';
-// import './styles/quill.snow.css'
 
-// console.log(17, process.env.NODE_ENV)
-// console.log('process.env.NODE_ENV', process.env.NODE_ENV)
-// Vue.component('authorize', authorize)
-// 注册全局组件
-// Vue.use(plugins);
 Vue.use(componentsInstall);
+
 window.wx = wx;
 Vue.prototype.$wx = window.wx;
 Vue.prototype.$store = store;
 Vue.prototype.$request = request;
-Vue.prototype.$sensors = sensors;
 //
 Vue.config.productionTip = false;
 App.mpType = 'app';

+ 0 - 23
src/pages/login/login.vue

@@ -240,7 +240,6 @@ export default {
           $utm_user: optionsQuery.utm_user || '',
         },
         finalParams = Object.assign(fixedParams, params);
-      this.$sensors.track(eventName, finalParams);
     },
     // 获取验证码
     onCode: function () {
@@ -598,28 +597,6 @@ export default {
               this.$store.commit('SET_USER_INFO', member);
               this.$store.commit('SET_MEMBER', member);
               callback && callback();
-              // TODO: 埋点公共属性重新赋值
-              // _this.$sensors.registerApp({
-              //   $open_id: _this.globalData?.member?.openId || '',
-              //   $profile_id:
-              //     _this.globalData?.member?.kipUserId ||
-              //     member?.kipUserId ||
-              //     '',
-              //   $member_id: _this.globalData?.member?.id || member?.id || '',
-              //   $union_id: _this.globalData?.member?.unionid || '',
-              //   // $location: _this.globalData?.mallid,
-              //   // $brand_id: _this.globalData?.groupId,
-              //   // $utm_source: JSON.stringify(uni.getStorageSync('options_query')) || '',
-              //   // $channel: optionsQuery?.channel || '',
-              //   $utm_lbs: optionsQuery?.utm_lbs || '',
-              //   // $utm_channel: optionsQuery?.utm_channel || '',
-              //   // $utm_method: optionsQuery?.utm_method || '',
-              //   // $utm_source: optionsQuery?.utm_source || '',
-              //   // $utm_function: optionsQuery?.utm_function || '',
-              //   // $utm_user: optionsQuery?.utm_user || '',
-              // });
-              // MemberCacheTool.setMemberInfoCache(app, member, kipMemberInfo);
-              // _this.checkIsNewUser();
             } else {
               uni.hideLoading();
               log.error(`获取crm会员请求失败`);

+ 44 - 27
src/pages/parkingFee/mixins/home.js

@@ -172,8 +172,8 @@ export default {
       uni.showLoading({
         title: '加载中',
       });
-      const openid = uni.getStorageSync('openid') || this.openId;
-      /*let params = {
+      /*const openid = uni.getStorageSync('openid') || this.openId;
+       let params = {
        // mallid: '8a84853b7c91ac5b017c961a9b2a030d',
        // groupId: '8a84853b7c91ac5b017c962dab55030e',
        mallid: this.mallId,
@@ -219,19 +219,26 @@ export default {
        console.log(err);
        });*/
       try {
-        const res = await parkingLots();
+        console.log(222222);
+        const res = await parkingLots('shenzhen01');
         console.log('223,2323', res);
-        const data = {
-          "parkName": "杭州停车场",
-          "parkCode": "hz01",
-          "carList": [],
-          "description": "计费基础规则:10元每小时,上不封顶 ;\n线上缴费渠道:CRM小程序 (分会员通道及非会员通道);1\n会员等级减免:铂金卡当日可免费停车4小时,金卡当时可免费停车2小时,银卡无减免 (当日仅限使用1次,可与其它减免共享);\n积分抵扣:1000积分抵扣10元(手动输入抵扣积分);\n消费减免:消费200元可减免2小时,消费400元可减免4小时,消费800元可减免6小时 。仅限会员,当日有效,当日可多次享受该减免,当日最多可享受消费减免6小时。;\n        消费减免举例:;\n        (1) 某顾客第一次进场,消费230元  离场时可看到减免2小时的选项,默认为选中;\n        (2) 如果顾客未使用减免,顾客第二次进场,消费+270  离场时可看到减免金额提高到4小时;\n         如果顾客使用减免:顾客第二次进场,消费+270  离场时可看到还是只能减免2小时;\n        (3) CRM小程序缴费页面停留时长1分钟,1分钟后自动刷新获取最新缴费金额;\n纸质优惠券核销: 顾客在CRM小程序手动扫码获取优惠券金额;\n会员活动及积分兑换优惠 :通过CRM系统获取(详细情况由CRM另行描述)!"
-        }
+        /*const data = {
+         parkName: '杭州停车场',
+         parkCode: 'hz01',
+         carList: [],
+         description:
+         '计费基础规则:10元每小时,上不封顶 ;\n线上缴费渠道:CRM小程序 (分会员通道及非会员通道);1\n会员等级减免:铂金卡当日可免费停车4小时,金卡当时可免费停车2小时,银卡无减免 (当日仅限使用1次,可与其它减免共享);\n积分抵扣:1000积分抵扣10元(手动输入抵扣积分);\n消费减免:消费200元可减免2小时,消费400元可减免4小时,消费800元可减免6小时 。仅限会员,当日有效,当日可多次享受该减免,当日最多可享受消费减免6小时。;\n        消费减免举例:;\n        (1) 某顾客第一次进场,消费230元  离场时可看到减免2小时的选项,默认为选中;\n        (2) 如果顾客未使用减免,顾客第二次进场,消费+270  离场时可看到减免金额提高到4小时;\n         如果顾客使用减免:顾客第二次进场,消费+270  离场时可看到还是只能减免2小时;\n        (3) CRM小程序缴费页面停留时长1分钟,1分钟后自动刷新获取最新缴费金额;\n纸质优惠券核销: 顾客在CRM小程序手动扫码获取优惠券金额;\n会员活动及积分兑换优惠 :通过CRM系统获取(详细情况由CRM另行描述)!',
+         };*/
         // let reg = /[;;]/g;
         // this.parkInfoEntity.description = data.description.replace(reg, '\r\n');
-        this.description = data.description;
+        this.description = res.description;
         // const data = res.data.data || {};
-        this.carList = data.carList;
+        // console.log(236, uni.getStorageSync('carList'));
+        const carList = uni.getStorageSync('carList');
+        if (carList) {
+          this.carList = JSON.parse(carList);
+        }
+        console.log(238, this.carList);
         // this.parkInfoEntity = data.parkInfoEntity;
         // this.hourMoney =
         //   parseFloat(this.parkInfoEntity.needmoney) /
@@ -288,7 +295,6 @@ export default {
           $utm_user: optionsQuery?.utm_user || '',
         },
         finalParams = Object.assign(fixedParams, params);
-      this.$sensors.track(eventName, finalParams);
     },
     // 唤起键盘
     clickShowKeyboard(index) {
@@ -332,18 +338,29 @@ export default {
 
     // 校验车牌号
     preHandleSearch() {
-      this.throttle(() => {
-        this.handleSearch(this.vehicleNumber);
-      }, 3000);
+      uni.setStorageSync('carList', [
+        ...new Set([this.vehicleNumber, ...this.carList]),
+      ]);
+      this.$router.push({
+        path: 'parkingFeeDetail',
+        query: {
+          carno: this.vehicleNumber,
+        },
+      });
+
+      // this.throttle(() => {
+      //   this.handleSearch(this.vehicleNumber);
+      // }, 3000);
     },
     // 历史车牌快速查询
     toHandleSearch(carno) {
-      this.throttle(() => {
-        this.handleSearch(carno, '$ClickHistoryAndPayment');
-      }, 3000);
+      uni.getStorageSync('carList');
+      // this.throttle(() => {
+      //   this.handleSearch(carno, '$ClickHistoryAndPayment');
+      // }, 3000);
     },
     // 查询车费信息
-   async handleSearch(carno, clickEvent = '$ClickQueryAndPayment') {
+    async handleSearch(carno, clickEvent = '$ClickQueryAndPayment') {
       this.vehicleNumber = carno;
       const params = {
         carno,
@@ -370,14 +387,14 @@ export default {
       // this.sensorsClick(clickEvent, { $car_type: carTypeName })
       // TODO: 暂定埋点传参为车牌类型,是否需要其他参数比如车牌号码;埋点位置是否要放在查询接口回调函数中
       this.$md(params);
-      console.log(539, uni.getStorageSync('handleUser'));
-      try {
-        const res = await checkOut(carno)
-        console.log(res)
-      } catch ( err ) {
-        console.log('errerrerrerr',err)
-      }
-      return
+      // console.log(539, uni.getStorageSync('handleUser'));
+      // try {
+      //   const res = await checkOut(carno)
+      //   console.log(res)
+      // } catch ( err ) {
+      //   console.log('errerrerrerr',err)
+      // }
+      // return
       this.$request({
         // url: this.$baseURL + 'api/1.0/park/checkCarIsInPark',
         url: this.$baseURL + 'api/1.0/park/checkCarIsInParkAndCarFee',

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

@@ -4,12 +4,10 @@ import log from '@/utils/log.js';
 import { compare } from '@/utils/location.js';
 import uni from '@/utils/uniHooks';
 import { initWxJsSdkConfig } from '@/utils/login';
-import {
-  getAppIdByGroupIdAndMallId,
-  getIsWxh5,
-  getPlatform,
-} from '@/utils';
+import { getAppIdByGroupIdAndMallId, getIsWxh5, getPlatform } from '@/utils';
 import { Dialog, Toast } from 'vant';
+import { checkOut } from '@/api/parking';
+import checkOutResponse from '@/api/mockData/check-out.response.json'
 
 export default {
   name: 'parkingFeeDetail',
@@ -237,1598 +235,23 @@ export default {
       appId: (state) => state.appId,
     }),
   },
-  async created() {
-    setTimeout(() => {
-      uni.setNavigationBarTitle({
-        title: '停车支付',
-      });
-      // this.launchPathInit();
-    }, 300);
-    // console.log('469 我终于知道为什么了', uni.getStorageSync('isReload'));
-    // if (uni.getStorageSync('isReload') === '4') {
-    //   return;
-    // }
-    // uni.setStorageSync('isReload', '2');
-    const option = this.$route.query;
-    this.picUrl = this.$picUrl;
-    this.payCarno = option.carno;
-    this.orderno = option.orderno;
-    this.id = option.id;
-    this.init();
-    // debugger;
-    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;
-    // }
-  },
-  async activated() {
-    console.log('activated', uni.getStorageSync('isReload'));
-    const platform = getPlatform();
-    if (platform === 'micromessenger') {
-      await initWxJsSdkConfig(['chooseWXPay', 'scanQRCode']);
-      try {
-        // if (window.wxJsSdkConfigInitPromise) {
-        //   // console.log(window.wxJsSdkConfigInitPromise);
-        //   // window.wxJsSdkConfigInitPromise;
-        // }
-      } catch (e) {
-        console.log(487, e);
-      }
-    }
-    // if (uni.getStorageSync('isReload') === '3') {
-    //   console.log(487);
-    //   this.$router.push({
-    //     path: '/jump',
-    //     query: this.$route.query,
-    //   });
-    //   return;
-    // }
-    setTimeout(() => {
-      uni.setNavigationBarTitle({
-        title: '停车支付',
-      });
-    }, 300);
-    // console.log('订单时间:' + this.orderCreateTime);
-    log.info('订单时间:' + this.orderCreateTime);
-    this.isPageHide = false;
-    // 如果订单时间+3分钟-当前时间<=0 刷新订单
-    if (this.orderCreateTime) {
-      const countDownTime = moment(this.orderCreateTime)
-        .add(180, 's')
-        .diff(moment(), 's');
-      log.info('剩余时间:' + countDownTime);
-      if (countDownTime <= 0) {
-        this.createParkOrder();
-      } else {
-        this.refreshTime = countDownTime;
-      }
-    }
-
-    // 优惠减免(首停、会员、消费)
-    const checkedTotal = uni.getStorageSync('checkedTotal');
-    this.checkedTotal = checkedTotal === 'null' || !checkedTotal ? 0 : checkedTotal;
-    const discountTotal = uni.getStorageSync('discountTotal');
-    this.discountTotal = discountTotal ? discountTotal : {};
-
-    // 电子券减免(停车券)
-    const couponInfo = uni.getStorageSync('couponInfo');
-    this.couponInfo = couponInfo
-      ? typeof couponInfo === 'string'
-        ? JSON.parse(couponInfo)
-        : couponInfo
-      : {};
-    const checkedCouponList = uni.getStorageSync('checkedCouponList');
-    this.checkedCouponCount = checkedCouponList?.length
-      ? JSON.parse(uni.getStorageSync('checkedCouponList')).length
-      : 0;
-    // console.log('电子券减免, 报错地址', checkedCouponList);
-
-    // 纸质优惠券
-    // console.log(547, uni.getStorageSync('paperCouponInfo'));
-    this.paperCouponInfo = uni.getStorageSync('paperCouponInfo') || {};
+  created() {
+    this.pageInit();
   },
   methods: {
-    // 页面初始清空缓存
-    init() {
-      console.log('清理数据, 到底在执行几次?');
-      // 优惠减免(首停、会员、消费)
-      uni.removeStorageSync('checkedList'); // 选中list
-      uni.removeStorageSync('checkedTotal'); // 选中count数
-      uni.removeStorageSync('discountTotal'); // 减免信息(时长、费用)
-
-      // 停车减免(优惠、积分、停车券)
-      uni.removeStorageSync('parkFee');
-
-      // 电子券优惠信息
-      uni.removeStorageSync('checkedCouponList'); // 选中list
-      uni.removeStorageSync('couponInfo'); // 减免信息(时长、费用)
-      uni.removeStorageSync('list'); // 电子券list
-
-      // 总停车优惠信息(时长、费用)
-      uni.removeStorageSync('parkingTotal');
-
-      // 应缴金额
-      uni.removeStorageSync('servicefee');
-
-      // 订单号
-      uni.removeStorageSync('orderno');
-
-      // 纸质优惠券
-      uni.removeStorageSync('paperCouponInfo');
-    },
-
-    // 重置倒计时
-    resetCountDown() {
-      this.refreshTime = 0;
-      this.createParkOrder();
-    },
-
-    // 创建订单
-    async createParkOrder() {
+    toPay() {},
+    durationMinus() {},
+    durationAdd() {},
+    // 初始化
+    async pageInit() {
+      console.log(247, checkOutResponse);
       try {
-        uni.showLoading({
-          title: '加载中',
-        });
-        const params = {
-          carno: this.payCarno,
-          mallid: this.mallid,
-          openId: this.openId,
-          vipcode:
-            this.member?.vipcode || uni.getStorageSync('member')?.vipcode,
-          mobile: uni.getStorageSync('userInfo')?.phoneNumber,
-          groupId: this.groupId,
-          createuser: 'sys_miniprogram',
-          // projectId: 'SKC',
-          // appId: uni.getStorageSync('appid'),
-        };
-        if (getIsWxh5()) {
-          // 如果是微信公众号环境
-          const { projectId, appid } = getAppIdByGroupIdAndMallId({
-            groupId: uni.getStorageSync('groupId'),
-            mallId: uni.getStorageSync('mallId'),
-            type: 'all',
-          });
-          params.projectId = projectId;
-          params.appId = appid;
-          params.kipUserId = uni.getStorageSync('userInfo')?.id;
-        }
-
-        this.$md(params);
-        const res = await this.$request({
-          url: this.$baseURL + 'api/1.0/park/createParkOrderAndCarFee',
-          data: params,
-          method: 'POST',
-          header: JSON.parse(uni.getStorageSync('handleUser')),
-        });
-        uni.hideLoading();
-        // console.log(629, res.data);
-        // debugger;
-        if (res.data.code === 0) {
-          this.bindflag = res.data.data.bind;
-          this.parkInfo = res.data.data;
-          this.parkMallCode = this.parkInfo.parkMallCode;
-          this.orderCreateTime = this.parkInfo.createDate;
-          uni.setStorageSync('servicefee', this.parkInfo.servicefee / 100);
-          uni.setStorageSync('orderno', this.parkInfo.orderno);
-          if (!this.parkInfo.servicefee && this.initFlag) {
-            this.initFlag = false;
-            Dialog.alert({
-              title: '提示',
-              message: '当前无需缴费',
-              confirmButtonColor: '#333',
-            }).then(() => {
-              // on confirm
-              this.$router.back();
-            });
-            return;
-          }
-          if (this.member && JSON.stringify(this.member) !== '{}') {
-            this.getDiscount();
-          } else {
-            // 未登录状态显示纸质券
-            this.isShowPapercoupons = true;
-          }
-          this.refreshTime = 180;
-        } else {
-          uni.showModal({
-            showCancel: false,
-            title: '提示',
-            content: res.data.msg,
-            complete(r) {
-              this.$router.back();
-            },
-          });
-        }
-      } catch (err) {
-        console.log(err);
-      }
-    },
-
-    // 获取优惠、停车场相关配置
-    getDiscount() {
-      uni.showLoading({
-        title: '加载中',
-      });
-      // console.log(662, this.member);
-      const params = {
-        carno: this.payCarno,
-        mallid: this.mallid,
-        vipcode: this.member?.vipcode,
-        groupId: this.groupId,
-      };
-      this.$md(params);
-      this.$request({
-        url: this.$baseURL + 'api/1.0/park/discount',
-        data: params,
-        method: 'POST',
-        header: JSON.parse(uni.getStorageSync('handleUser')),
-      })
-        .then((res) => {
-          uni.hideLoading();
-          if (res.data.code === 0) {
-            this.parkFee = res.data.data;
-            this.$nextTick(() => {
-              if (this.parkFee.parkIntegraltomoneyList) {
-                this.integral =
-                  this.parkFee.parkIntegraltomoneyList[0].integral;
-                this.integralToValue =
-                  this.parkFee.parkIntegraltomoneyList[0].value || 0;
-                this.integralMaxMoney =
-                  this.parkFee.parkIntegraltomoneyList[0].integralMaxHour || 0;
-                this.bonus = this.parkFee.parkIntegraltomoneyList[0].bonus;
-                this.discountKind = this.parkFee.discountKind;
-                if (this.parkFee.discountKind === 7) {
-                  // console.log('this.parkFee.parkIntegraltomoneyList[1]::::::', res.data.data.parkIntegraltomoneyList)
-                  this.integralNew =
-                    _this.parkFee.parkIntegraltomoneyList[1].integral;
-                  this.integralNewToValue =
-                    this.parkFee.parkIntegraltomoneyList[1].value || 0;
-                  this.integralNewMaxMoney =
-                    this.parkFee.parkIntegraltomoneyList[1].integralMaxHour || 0;
-                }
-                // 深圳特殊处理(单位:金额)
-                if (this.parkMallCode === 5) {
-                  if (this.duration) {
-                    this.bonus -=
-                      (this.duration * this.integral) / this.integralToValue;
-                    this.bonusfee = this.duration;
-                    this.durationCopy = this.duration;
-                  }
-                } else {
-                  if (this.duration) {
-                    this.bonus -= this.duration * this.integral;
-                    this.bonusfee = this.duration * this.hourMoney;
-                    this.durationCopy = this.duration;
-                  }
-                }
-                // this.bonusCopy = this.bonus;
-                this.$store.commit('SET_BONUS_COPY', this.bonus);
-              }
-              if (!this.parkFee.parkInfoEntity) {
-                return;
-              }
-              const reg = /[;;]/g;
-              this.parkFee.parkInfoEntity.payinstruction =
-                this.parkFee.parkInfoEntity.payinstruction.replace(reg, '\r\n');
-              this.hourMoney = this.parkFee.parkInfoEntity.needmoney;
-              this.parkMallCode = this.parkFee.parkInfoEntity.parkMallCode;
-              if (this.parkFee.memberTicketList) {
-                this.couponCount = this.parkFee.memberTicketList.length;
-              }
-              // 上限金额
-              this.maxonetimediscountFee =
-                this.parkFee.parkInfoEntity.maxonetimediscount * this.hourMoney;
-              // 深圳特殊处理(单位:金额)
-              if (this.parkMallCode === 5) {
-                this.maxonedaydiscountFee =
-                  this.parkFee.parkInfoEntity.maxOneDayHour -
-                  this.parkFee.parkInfoEntity
-                    .ticketandMemeberGradeAndConsumeUseHour || 0;
-              } else {
-                this.maxonedaydiscountFee =
-                  (this.parkFee.parkInfoEntity.maxOneDayHour -
-                    this.parkFee.parkInfoEntity
-                      .ticketandMemeberGradeAndConsumeUseHour) *
-                  this.hourMoney || 0;
-              }
-              if (this.maxonedaydiscountFee < 0) {
-                this.maxonedaydiscountFee = 0;
-              }
-              uni.setStorageSync('parkFee', JSON.stringify(this.parkFee));
-              // 如果有可使用会员减免、消费减免,追加弹框提示
-              if (
-                this.parkFee.parkInfoEntity.consumeReduce ||
-                this.parkFee.parkInfoEntity.memberLevelReduce
-              ) {
-                if (
-                  (this.parkFee.parkMemberOrderReducesEntityList &&
-                    this.parkFee.parkMemberOrderReducesEntityList[0]) ||
-                  (this.parkFee.parkConsumeReducesEntityList &&
-                    this.parkFee.parkConsumeReducesEntityList[0])
-                ) {
-                  this.hasDiscount = true;
-                  // if (!this.parkInfo.servicefee) {
-                  // 	return;
-                  // }
-                  // let confirmColor = '#703a98';
-                  // if (this.custTypeId === 1) {
-                  // 	confirmColor = '#023694';
-                  // }
-                  // if (this.custTypeId === 2) {
-                  // 	confirmColor = '#0B683A';
-                  // }
-                  // if (this.checkedTotal || this.isPageHide || this.isShowPopup) {
-                  // 	return;
-                  // }
-                  // this.isShowPopup = true;
-                  // uni.showModal({
-                  // 	title: '停车优惠',
-                  // 	content: '您有停车优惠可使用, 前往使用!',
-                  // 	cancelText: '返回',
-                  // 	confirmText: '点击查看',
-                  // 	confirmColor: confirmColor,
-                  // 	success: res => {
-                  // 		if (res.confirm) {
-                  // 			this.discounts();
-                  // 		}
-                  // 		this.isShowPopup = false;
-                  // 	}
-                  // })
-                }
-              }
-              // 自动勾选优惠
-              if (
-                !this.discountTotalFee &&
-                (this.hasDiscount ||
-                  this.bonusCopy >= this.integral ||
-                  this.bonusCopy >= this.integralNew ||
-                  this.couponCount)
-              ) {
-                this.autoCheckDiscounts();
-              }
-            });
-          } else {
-            uni.showModal({
-              showCancel: false,
-              title: '提示',
-              content: res.data.msg,
-              complete(r) {
-                // this.$router.back();
-              },
-            });
-          }
-        })
-        .catch((err) => {
-          console.log(err);
-        });
-    },
-
-    // 积分取消:flag: 1(普通积分) 2(新会员积分)
-    cancel(flag) {
-      if (flag === 1) {
-        this.duration = this.durationCopy;
-        this.bonus = this.bonusCopy;
-        // 深圳特殊处理(单位:金额)
-        if (this.parkMallCode === 5) {
-          this.bonusfee = this.duration;
-        } else {
-          this.bonusfee = this.duration * this.hourMoney;
-        }
-        this.popup = false;
-      }
-      if (flag === 2) {
-        // 北京新会员积分减免操作后取消
-        this.durationNew = this.durationCopy2;
-        this.bonus = this.bonusCopy;
-        this.newBonusfee = this.durationNew * this.hourMoney;
-        this.newpopup = false;
-      }
-    },
-
-    // 积分确认 flag: 1(普通积分) 2(新会员积分)
-    confirm(flag) {
-      if (flag === 1) {
-        this.$store.commit('SET_BONUS_COPY', this.bonus);
-        this.durationCopy = this.duration;
-        // this.$refs.popup.close();
-        this.popup = false;
-      }
-      if ( flag === 2 ) {
-        // this.bonusCopy = this.bonus;
-        this.$store.commit('SET_BONUS_COPY', this.bonus);
-        this.durationCopy2 = this.durationNew;
-        this.newpopup = false;
-      }
-    },
-
-    // 减积分
-    durationMinus() {
-      if (this.duration > 0) {
-        // 深圳特殊处理(单位:金额)
-        if (this.parkMallCode === 5) {
-          this.duration -= this.integralToValue;
-        } else {
-          this.duration--;
-        }
-        this.bonus += this.integral;
-      }
-      // 深圳特殊处理(单位:金额)
-      if (this.parkMallCode === 5) {
-        this.bonusfee = this.duration;
-      } else {
-        this.bonusfee = this.duration * this.hourMoney;
-      }
-    },
-
-    // 加积分
-    durationAdd() {
-      // 浦东每次缴费超限控制
-      if (
-        this.parkMallCode === 1 &&
-        this.discountTotalFee >= this.maxonetimediscountFee
-      ) {
-        return uni.showToast({
-          title: `超出抵扣上限,每次最高可抵扣${this.parkFee.parkInfoEntity.maxonetimediscount}小时`,
-          icon: 'none',
-        });
-      }
-      // 北京积分上限控制
-      if (this.parkMallCode === 3) {
-        const bonusMax =
-          this.parkFee.parkInfoEntity.integralMaxHour -
-          this.parkFee.parkInfoEntity.integralUseHour || 0;
-        if (this.duration >= bonusMax) {
-          return uni.showToast({
-            title: `超出抵扣上限,每日最高可抵扣${this.parkFee.parkInfoEntity.integralMaxHour}小时`,
-            icon: 'none',
-          });
-        }
-      }
-      // 深圳积分上限控制
-      if (this.parkMallCode === 5) {
-        if (this.discountTotalFee >= this.maxonedaydiscountFee) {
-          return uni.showToast({
-            title: `超出抵扣上限,每日最高可抵扣${this.parkFee.parkInfoEntity.maxOneDayHour}元`,
-            icon: 'none',
-          });
-        }
-        if (this.duration >= this.integralMaxMoney) {
-          return uni.showToast({
-            title: `超出抵扣上限,每次最高可抵扣${this.integralMaxMoney}元`,
-            icon: 'none',
-          });
-        }
-      }
-
-      if (this.bonus - this.integral >= 0) {
-        this.bonus -= this.integral;
-        // 深圳特殊处理(单位:金额)
-        if (this.parkMallCode === 5) {
-          this.duration += this.integralToValue;
-        } else {
-          this.duration++;
-        }
-      } else {
-        uni.showToast({
-          title: '积分不足',
-          icon: 'none',
-        });
-      }
-      // 深圳特殊处理(单位:金额)
-      if (this.parkMallCode === 5) {
-        this.bonusfee = this.duration;
-      } else {
-        this.bonusfee = this.duration * this.hourMoney;
-      }
-    },
-    // 北京新会员加积分
-    durationAddNew() {
-      const bonusMaxNew =
-        this.parkFee.parkIntegraltomoneyList[1].integralMaxHour -
-        this.parkFee.parkIntegraltomoneyList[1].integralUseHour || 0;
-      if (this.durationNew >= bonusMaxNew) {
-        return uni.showToast({
-          title: `超出抵扣上限,每日最高可抵扣${this.parkFee.parkIntegraltomoneyList[1].integralMaxHour}小时`,
-          icon: 'none',
-        });
-      }
-      if (this.bonus - this.integralNew >= 0) {
-        this.bonus -= this.integralNew;
-        this.durationNew++;
-        this.newBonusfee = this.durationNew * this.hourMoney;
-      } else {
-        uni.showToast({
-          title: '积分不足',
-          icon: 'none',
-        });
-      }
-    },
-    // 北京新会员减积分
-    durationMinusNew() {
-      if (this.durationNew > 0) {
-        this.bonus += this.integralNew;
-        this.durationNew--;
-        this.newBonusfee = this.durationNew * this.hourMoney;
-      }
-    },
-    // 积分减免弹出
-    toggle(type) {
-      if (
-        this.parkFee.parkIntegraltomoneyList &&
-        this.parkFee.parkIntegraltomoneyList.length
-      ) {
-        this.popup = true;
-      }
-    },
-    // 积分减免弹出
-    newToggle(type) {
-      if (
-        this.parkFee.parkIntegraltomoneyList &&
-        this.parkFee.parkIntegraltomoneyList.length
-      ) {
-        this.newpopup = true;
-      }
-    },
-    // 跳转纸质优惠
-    paperCoupon() {
-      this.$router.push({
-        path: 'parkingFeePaperCoupon',
-        query: {
-          parkInfo: this.parkInfo,
-        },
-      });
-    },
-
-    // 电子优惠劵
-    coupon() {
-      // if (!this.couponCount) {
-      //   return uni.showToast({
-      //     title: '暂无可使用的优惠券,请前往积分商城兑换优惠券',
-      //     icon: 'none',
-      //   });
-      // }
-      this.$router.push({
-        path: 'parkingFeeCoupon',
-      });
-    },
-
-    // 跳转首停、会员、消费减免页面
-    discounts() {
-      if (!this.hasDiscount && this.parkMallCode !== 2) {
-        return Toast({
-          message: '暂无可用优惠',
-        });
-      }
-      this.$router.push({
-        path: 'parkingFeeDiscounts',
-      });
-    },
-
-    // 自动勾选优惠 优先级:会员/消费->电子券->积分
-    autoCheckDiscounts() {
-      console.log('首次进来', this.parkFee);
-      // console.log('首次进来', this.parkInfo);
-      if (!this.parkFee || !this.parkInfo.servicefee) {
-        return;
-      }
-      const serviceFee = this.parkInfo.servicefee / 100; // 应缴费用
-
-      // 自动选取消费减免
-      if (
-        this.parkFee.parkConsumeReducesEntityList &&
-        this.parkFee.parkConsumeReducesEntityList[0] &&
-        this.parkFee.parkConsumeReducesEntityList[0].recuceContent
-      ) {
-        this.autoConsume(serviceFee);
-      }
-
-      // 自动选取会员等级减免
-      if (
-        this.parkFee.parkMemberOrderReducesEntityList &&
-        this.parkFee.parkMemberOrderReducesEntityList[0] &&
-        this.parkFee.parkMemberOrderReducesEntityList[0].reduceContent &&
-        Number.parseInt(
-          this.parkFee.parkMemberOrderReducesEntityList[0].reduceContent
-        ) > 0
-      ) {
-        this.autoMember();
-      }
-
-      // 自动选取电子券减免
-      if (this.couponCount) {
-        this.autoCoupon(serviceFee);
-      }
-
-      // 自动选取北京新会员积分减免
-      if (this.discountKind === 7) {
-        // console.log('this.bonusCopy::::::',this.bonusCopy, this.integral)
-        if (this.bonusCopy >= this.integralNew) {
-          this.newMemberautoBonus(serviceFee);
-        }
-      }
-      // 自动选取积分减免
-      if (this.bonusCopy > this.integral) {
-        this.autoBonus(serviceFee);
-      }
-    },
-
-    // 自动选取消费减免
-    autoConsume(serviceFee) {
-      console.log('自动选取消费减免', serviceFee);
-      let consumeTime =
-        +this.parkFee.parkConsumeReducesEntityList[0].recuceContent || 0; // 消费减免时长
-      let consumeFee = 0; // 消费减免费用
-      const isSplit = this.parkFee.parkInfoEntity.isSplit === 0 ? 0 : 1; // 是否拆分 0: 可拆 1: 不可拆
-      const serviceTime = Math.ceil(serviceFee / this.hourMoney); // 停车时长(防止有小数情况向上取整)
-
-      /*************************************************** 静安 ***************************************************/
-      if (this.parkMallCode === 0) {
-        // 超过上限取上限
-        if (consumeTime > this.parkFee.parkInfoEntity.remainReduceTime) {
-          consumeTime = this.parkFee.parkInfoEntity.remainReduceTime;
-        }
-        // 拆分消费减免
-        if (isSplit === 0) {
-          // 减免时长超出停车时长取停车时长
-          if (consumeTime > serviceTime) {
-            consumeTime = serviceTime;
-          }
-        }
-        // 消费减免费用
-        consumeFee = consumeTime * this.hourMoney;
-      }
-
-      /*************************************************** 浦东 ***************************************************/
-      if (this.parkMallCode === 1) {
-        // 可用消费减免时长上限
-        let remainReduceTime = this.parkFee.parkInfoEntity.remainReduceTime;
-        if (remainReduceTime > this.parkFee.parkInfoEntity.maxonetimediscount) {
-          remainReduceTime = this.parkFee.parkInfoEntity.maxonetimediscount;
-        }
-        // 超过上限取上限
-        if (consumeTime > remainReduceTime) {
-          consumeTime = remainReduceTime;
-        }
-        // 拆分消费减免
-        if (isSplit === 0) {
-          // 减免时长超出停车时长取停车时长
-          if (consumeTime > serviceTime) {
-            consumeTime = serviceTime;
-          }
-        }
-        // 消费减免费用
-        consumeFee = consumeTime * this.hourMoney;
-      }
-
-      /*************************************************** 杭州 ***************************************************/
-      if (this.parkMallCode === 2) {
-        // 超过上限取上限
-        if (consumeTime > this.parkFee.parkInfoEntity.remainReduceTime) {
-          consumeTime = this.parkFee.parkInfoEntity.remainReduceTime;
-        }
-        // 消费减免费用
-        consumeFee = consumeTime * this.hourMoney;
-      }
-
-      /*************************************************** 沈阳 ***************************************************/
-      if (this.parkMallCode === 4) {
-        // 超过上限取上限
-        if (
-          consumeTime >
-          this.parkFee.parkInfoEntity.maxOneDayHour -
-          this.parkFee.parkInfoEntity.ticketandMemeberGradeAndConsumeUseHour
-        ) {
-          consumeTime =
-            this.parkFee.parkInfoEntity.maxOneDayHour -
-            this.parkFee.parkInfoEntity.ticketandMemeberGradeAndConsumeUseHour;
-        }
-        // 消费减免费用
-        consumeFee = consumeTime * this.hourMoney;
-      }
-
-      // 实时显示
-      this.checkedTotal++;
-      this.discountTotal = {
-        memberGradeFee: 0,
-        consumeFee: consumeFee,
-        useConsumeFee: this.parkFee.parkConsumeReducesEntityList[0].consumerLimit,
-        time: consumeTime,
-        fee: consumeFee,
-      };
-      // 存入缓存(用于子页面停车优惠画面显示)
-      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;
-      }
-
-      const memberGradeTime =
-        +this.parkFee.parkMemberOrderReducesEntityList[0].reduceContent || 0; // 会员等级减免时长
-      const memberGradeFee = memberGradeTime * this.hourMoney; // 会员等级减免费用
-
-      // 浦东每次超限
-      if (this.parkMallCode === 1) {
-        // 超出每次减免上限 则无需后续
-        if (this.discountTotalFee >= this.maxonetimediscountFee) {
-          return;
-        }
-      }
-
-      // 沈阳(会员等级+消费+电子券)、深圳每日超限
-      if (this.parkMallCode === 4 || this.parkMallCode === 5) {
-        // 超出每日减免上限 则无需后续
-        if (this.discountTotalFee >= this.maxonedaydiscountFee) {
-          return;
-        }
-      }
-
-      // 实时显示
-      let checkedList = [];
-      if (uni.getStorageSync('discountTotal')) {
-        this.discountTotal.memberGradeFee = memberGradeFee;
-        this.discountTotal.time += memberGradeTime;
-        this.discountTotal.fee += memberGradeFee;
-        checkedList = ['reduces', 'member'];
-      } else {
-        this.discountTotal = {
-          memberGradeFee: memberGradeFee,
-          consumeFee: 0,
-          useConsumeFee: 0,
-          time: memberGradeTime,
-          fee: memberGradeFee,
-        };
-        checkedList = ['member'];
-      }
-      console.log('判断是否有执行', this.checkedList);
-      this.checkedTotal++;
-
-      // 存入缓存(用于子页面停车优惠画面显示)
-      uni.setStorageSync('checkedList', checkedList);
-      uni.setStorageSync('checkedTotal', this.checkedTotal || 0);
-      uni.setStorageSync('discountTotal', this.discountTotal);
-    },
-
-    // 自动选取电子券减免
-    autoCoupon(serviceFee) {
-      // console.log('查看 actualFee 的状态', this.actualFee);
-      // 支付金额0 则无需后续减免
-      if (!this.actualFee) {
-        return;
-      }
-
-      // 浦东 超出每次减免上限 则无需后续
-      if (
-        this.parkMallCode === 1 &&
-        this.discountTotalFee >= this.maxonetimediscountFee
-      ) {
-        return;
-      }
-
-      // 沈阳(会员等级+消费+电子券)、深圳 超出每日减免上限 则无需后续
-      if (
-        (this.parkMallCode === 4 || this.parkMallCode === 5) &&
-        this.discountTotalFee >= this.maxonedaydiscountFee
-      ) {
-        return;
-      }
-
-      // 杭州 超出电子券使用数量上限 则无需后续
-      if (
-        this.parkMallCode === 2 &&
-        this.parkFee.parkInfoEntity.useTicketNum ===
-        this.parkFee.parkInfoEntity.couponcodeNum
-      ) {
-        return;
-      }
-
-      const checkedCouponList = []; // 所选电子券
-      let couponList = this.parkFee.memberTicketList; // 所有电子券
-      let couponFee = 0;
-      let couponCode = '';
-
-      // 电子券价值统一转换金额方便后续排序 type 1: 金额 2: 时长
-      couponList.forEach((e) => {
-        e.disabled = true;
-        e.checked = false;
-        if (e.carType == '2') {
-          e.value = e.parktime * this.hourMoney;
-        } else if (e.carType == '1') {
-          e.value = e.ticketValue;
-        }
-      });
-
-      // 电子券按叠加规则分组
-      const couponListRule1 = couponList.filter(
-        (e) => e.superpositionrule == '1'
-      ); // 不可叠加
-      const couponListRule2 = couponList.filter(
-        (e) => e.superpositionrule == '2'
-      ); // 同类型可叠加
-
-      // 电子券按价值排序
-      if (couponListRule1 && couponListRule1.length > 1) {
-        couponListRule1.sort(compare('value'));
-      }
-      if (couponListRule2 && couponListRule2.length > 1) {
-        couponListRule2.sort(compare('value'));
-      }
-
-      // 排序后的全部电子券
-      couponList = [...couponListRule1, ...couponListRule2];
-
-      // 如果不可叠加电子券价值大于可叠加总和则使用不可叠加电子券
-      let couponListRule1Max = 0;
-      if (couponListRule1 && couponListRule1.length) {
-        couponListRule1Max = couponListRule1[couponListRule1.length - 1].value;
-      }
-      let couponListRule2Sum = 0;
-      if (couponListRule2 && couponListRule2.length) {
-        couponListRule2.forEach((e) => {
-          couponListRule2Sum += e.value;
-        });
-      }
-      let isCheckedRule1 = false;
-      if (
-        couponListRule1Max >= couponListRule2Sum &&
-        couponListRule2Sum < serviceFee - this.discountTotalFee
-      ) {
-        isCheckedRule1 = true;
-      }
-
-      // 使用不可叠加电子券
-      if (isCheckedRule1 && couponListRule1 && couponListRule1.length) {
-        for (let i = 0; i < couponListRule1.length; i++) {
-          const coupon = couponListRule1[i];
-          const checkedIndex = couponList.findIndex(
-            (e) => e.couponCode === coupon.couponCode
-          );
-
-          // 浦东每次上限处理
-          if (this.parkMallCode === 1) {
-            if (
-              this.discountTotalFee + coupon.value >
-              this.maxonetimediscountFee
-            ) {
-              couponList[checkedIndex - 1].checked = true;
-              couponList[checkedIndex - 1].disabled = false;
-              checkedCouponList.push(checkedIndex - 1);
-              couponFee += coupon.value;
-              couponCode += coupon.couponCode + '#';
-              break;
-            }
-          }
-
-          // 沈阳(会员等级+消费+电子券)、深圳 超出每日减免上限处理
-          if (this.parkMallCode === 4 || this.parkMallCode === 5) {
-            if (
-              this.discountTotalFee + coupon.value >
-              this.maxonedaydiscountFee
-            ) {
-              couponList[checkedIndex - 1].checked = true;
-              couponList[checkedIndex - 1].disabled = false;
-              checkedCouponList.push(checkedIndex - 1);
-              couponFee += coupon.value;
-              couponCode += coupon.couponCode + '#';
-              break;
-            }
-          }
-
-          // 若当前减免已经使费用减免为0则跳出循环
-          if (coupon.value >= serviceFee - this.discountTotalFee) {
-            couponList[checkedIndex].checked = true;
-            couponList[checkedIndex].disabled = false;
-            checkedCouponList.push(checkedIndex);
-            couponFee += coupon.value;
-            couponCode += coupon.couponCode + '#';
-            break;
-          }
-
-          // 循环到最后一张券
-          if (i === couponListRule1.length - 1) {
-            couponList[checkedIndex].checked = true;
-            couponList[checkedIndex].disabled = false;
-            checkedCouponList.push(checkedIndex);
-            couponFee += coupon.value;
-            couponCode += coupon.couponCode + '#';
-          }
-        }
-      }
-
-      // console.log('打印优惠券', couponListRule2);
-      // 未使用规则1的电子券则继续
-      if (!isCheckedRule1 && couponListRule2 && couponListRule2.length) {
-        // 使用同类型可叠加电子券
-        let sum = 0; // 电子券价值累加
-        for (const coupon of couponListRule2) {
-          sum += coupon.value;
-          // 浦东每次上限处理
-          if (
-            this.parkMallCode === 1 &&
-            this.discountTotalFee + sum > this.maxonetimediscountFee
-          ) {
-            break;
-          }
-          // 沈阳(会员等级+消费+电子券)、深圳每日上限处理
-          if (
-            (this.parkMallCode === 4 || this.parkMallCode === 5) &&
-            this.discountTotalFee + sum > this.maxonedaydiscountFee
-          ) {
-            break;
-          }
-          const checkedIndex = couponList.findIndex(
-            (e) => e.couponCode === coupon.couponCode
-          );
-          couponList[checkedIndex].checked = true;
-          couponList[checkedIndex].disabled = false;
-          checkedCouponList.push(checkedIndex);
-          couponFee = sum;
-          couponCode += coupon.couponCode + '#';
-          // 杭州电子券使用数量上限处理
-          if (
-            this.parkMallCode === 2 &&
-            checkedCouponList.length ===
-            this.parkFee.parkInfoEntity.useTicketNum -
-            this.parkFee.parkInfoEntity.couponcodeNum
-          ) {
-            break;
-          }
-
-          // 若当前减免已经使费用减免为0则跳出循环
-          if (sum >= serviceFee - this.discountTotalFee) {
-            break;
-          }
-        }
-      }
-
-      // 实时显示
-      if (couponCode.lastIndexOf('#') === couponCode.length - 1) {
-        couponCode = couponCode.slice(0, couponCode.length - 1);
-      }
-      this.couponInfo = {
-        couponfee: couponFee,
-        couponcode: couponCode,
-      };
-      // console.log('验证', checkedCouponList);
-      this.checkedCouponCount = checkedCouponList.length;
-
-      // 存入缓存(用于子页面停车优惠画面显示)
-      // console.log('将 checkedCouponList 写入缓存----》');
-      uni.setStorageSync('checkedCouponList', checkedCouponList);
-      uni.setStorageSync('list', couponList);
-      uni.setStorageSync('couponInfo', this.couponInfo);
-    },
-
-    // 自动选取积分减免
-    autoBonus(serviceFee) {
-      // 支付金额0 则无需后续减免
-      if (!this.actualFee) {
-        return;
-      }
-
-      // 浦东 超出每次减免上限 则无需后续
-      if (
-        this.parkMallCode === 1 &&
-        this.discountTotalFee >= this.maxonetimediscountFee
-      ) {
-        return;
-      }
-
-      // 深圳积分特殊处理(金额计算) 其它停车场小时计算
-      if (this.parkMallCode === 5) {
-        if (this.discountTotalFee >= this.maxonedaydiscountFee) {
-          return;
-        }
-        let bonus = this.bonus;
-        // 剩余可减免金额
-        const remainDiscountFee =
-          this.maxonedaydiscountFee - this.discountTotalFee;
-        // 剩余停车金额
-        let remainFee = serviceFee - this.discountTotalFee;
-        if (remainFee > remainDiscountFee) {
-          remainFee = remainDiscountFee;
-        }
-        let bonusAll = (remainFee * this.integral) / this.integralToValue; // 全部减免所需积分
-        if (bonusAll < this.integral) {
-          bonusAll = this.integral;
-        }
-        // 取余
-        const remainBonus = bonusAll % this.integral;
-        const remainMyBonus = this.bonus % this.integral;
-        // 如果有余数 做倍数处理
-        if (remainBonus) {
-          bonusAll = bonusAll - remainBonus + this.integral;
-        }
-        if (remainMyBonus) {
-          bonus = this.bonus - remainMyBonus;
-        }
-        if (bonus <= bonusAll) {
-          // 积分可兑换多少金额 小数向下取整
-          this.duration = Math.floor(
-            (bonus * this.integralToValue) / this.integral
-          );
-        } else {
-          this.duration = (bonusAll * this.integralToValue) / this.integral;
-        }
-        if (this.duration > this.integralMaxMoney) {
-          this.duration = this.integralMaxMoney;
-        }
-      } else {
-        // 剩余停车时长(有小数情况因此向上取整)
-        const serviceTime = Math.ceil(
-          (serviceFee - this.discountTotalFee) / this.hourMoney
-        );
-        const bonusAll = serviceTime * this.integral; // 全部减免所需积分
-        if (this.bonus <= bonusAll) {
-          // 积分不够兑换整小时 向下取整
-          this.duration = Math.floor(this.bonus / this.integral);
-        } else {
-          this.duration = serviceTime;
-        }
-      }
-      // 浦东每次减免上限处理
-      if (this.parkMallCode === 1) {
-        const bonusMax = Math.floor(
-          (this.maxonetimediscountFee - this.discountTotalFee) / this.hourMoney
-        );
-        if (this.duration > bonusMax) {
-          this.duration = bonusMax;
-        }
-      }
-
-      // 北京积分减免每日上限处理
-      if (this.parkMallCode === 3) {
-        const bonusMax =
-          this.parkFee.parkInfoEntity.integralMaxHour -
-          this.parkFee.parkInfoEntity.integralUseHour || 0;
-        if (this.duration > bonusMax) {
-          this.duration = bonusMax;
-        }
-      }
-
-      // 深圳特殊处理(单位:金额)
-      if (this.parkMallCode === 5) {
-        this.bonus -= (this.duration * this.integral) / this.integralToValue;
-        this.bonusfee = this.duration;
-      } else {
-        this.bonus -= this.duration * this.integral;
-        this.bonusfee = this.duration * this.hourMoney;
-      }
-      this.durationCopy = this.duration;
-      // this.bonusCopy = this.bonus;
-      this.$store.commit('SET_BONUS_COPY', this.bonus);
-    },
-    // 北京新会员自动选取积分减免
-    newMemberautoBonus(serviceFee) {
-      const serviceTime = Math.ceil(
-        (serviceFee - this.discountTotalFee) / this.hourMoney
-      );
-      const bonusAll = serviceTime * this.integralNew; // 全部减免所需积分
-      if (this.bonus <= bonusAll) {
-        // 积分不够兑换整小时 向下取整
-        this.durationNew = Math.floor(this.bonus / this.integralNew);
-      } else {
-        this.durationNew = serviceTime;
-      }
-
-      const bonusMaxNew =
-        this.parkFee.parkIntegraltomoneyList[1].integralMaxHour -
-        this.parkFee.parkIntegraltomoneyList[1].integralUseHour || 0;
-      if (this.durationNew > bonusMaxNew) {
-        this.durationNew = bonusMaxNew;
-      }
-
-      this.bonus -= this.integralNew * this.durationNew;
-      this.durationCopy2 = this.durationNew;
-      this.newBonusfee = this.durationNew * this.hourMoney;
-      // this.bonusCopy = this.bonus;
-      this.$store.commit('SET_BONUS_COPY', this.bonus);
-    },
-    // 节流函数
-    throttle(fc, waitTime = 1500, imme = true) {
-      if (imme) {
-        if (!this.flag) {
-          this.flag = true;
-          typeof fc === 'function' && fc();
-          this.timer = setTimeout(() => {
-            this.flag = false;
-          }, waitTime);
-        }
-      } else {
-        if (!this.flag) {
-          this.flag = true;
-          this.timer = setTimeout(() => {
-            this.flag = false;
-            typeof fc === 'function' && fc();
-          }, waitTime);
-        }
+        const res = await checkOut(this.$route.query.carno)
+        console.log(res)
+      } catch ( err ) {
+        console.log(err)
       }
-    },
-    // 支付前
-    async toPay() {
-      // await this.weixinH5Pay()
-      // return
-      this.throttle(() => {
-        // 北京特殊处理
-        // if (this.parkMallCode === 3 && this.discountTotalFee) {
-        //   return uni.showModal({
-        //     title: '提示',
-        //     content: '请确认是否使用优惠,确认后无法返还!',
-        //     success: (res) => {
-        //       if (res.confirm) {
-        //         this.goPay();
-        //       }
-        //     },
-        //   });
-        // }
-        this.goPay();
-      }, 3000);
-    },
 
-    // 支付
-    goPay() {
-      if (
-        !this.parkInfo.servicefee ||
-        (this.member && !this.parkFee.parkInfoEntity)
-      ) {
-        return;
-      }
-      // console.log(159515951595, this.$kipAppId);
-      // this.kerryPayment()
-      // return
-      // console.log(1580, this.parkMallCode);
-      // window.toWXSendMsg({
-      //   type: 'openWxPay',
-      //   options: { title: '1589', mask: true },
-      // });
-      // window.subscribe('wxPayOver',(options) =>{
-      //   console.log(1596, options)
-      // })
-      // if (
-      //   !this.parkInfo.servicefee ||
-      //   (this.member && !this.parkFee.parkInfoEntity)
-      // ) {
-      //   return;
-      // }
-      this.Toastloading = Toast.loading({
-        message: '加载中',
-        duration: 0,
-        forbidClick: true,
-      });
-      this.btnLoading = true;
-      let bonus = this.duration * this.integral;
-      // 深圳特殊处理(单位:金额)
-      if (this.parkMallCode === 5) {
-        bonus = (this.duration * this.integral) / this.integralToValue;
-      }
-      // const openId = MemberCacheTool.getOpenId(app);
-      // const openId = 'oIUfO5QBRfEmnaqj7To0C4_0JUTA';
-      const openId = uni.getStorageSync('openid');
-      // console.log(1614, this.actualFee);
-      const params = {
-        carno: this.parkInfo.carno,
-        mallid: this.mallid,
-        groupId: this.groupId,
-        openId: openId,
-        vipcode: this.member?.vipcode || uni.getStorageSync('member')?.vipcode,
-        createuser: 'sys_miniprogram',
-        orderno: this.parkInfo.orderno,
-        bonusfee: this.bonusfee * 100,
-        bonus: bonus,
-        couponfee: this.couponInfo.couponfee * 100 || 0,
-        couponfeeMin: (this.couponInfo.couponfee / this.hourMoney) * 60 || 0,
-        couponcode: this.couponInfo.couponcode,
-        paperCoupons: JSON.stringify(this.paperCouponInfo.paperCouponList), // 纸质优惠券券码 多个以#分割
-        paperCouponCode: this.paperCouponInfo.paperCouponcode, // 纸质优惠券券码 多个以#分割
-        paperCouponFee: this.paperCouponInfo.paperDiscountFee * 100 || 0, // 纸质优惠券优惠金额,单位:分
-        paperCouponFeeMin:
-          parseInt(this.paperCouponInfo.paperDiscountTime * 60) || 0, // 纸质优惠券优惠时长,单位:分钟
-        bonusFeeMin: this.duration * 60, // 积分抵扣时长,单位:分钟
-        consumeFeeMin:
-          (this.discountTotal.consumeFee / this.hourMoney) * 60 || 0, // 消费减免时长,单位:分钟
-        firstParkFeeMin:
-          (this.discountTotal.firstParkFee / this.hourMoney) * 60 || 0, // 首停减免时长 单位 分钟
-        memberGradeFeeMin:
-          (this.discountTotal.memberGradeFee / this.hourMoney) * 60 || 0, // 会员等级减免时长,单位:分钟
-        consumeFee: this.discountTotal.consumeFee * 100 || 0,
-        consumeFeeHour: this.discountTotal.consumeFee / this.hourMoney || 0,
-        useConsumeFee:
-          this.parkMallCode === 3 ? '0.0' : this.discountTotal.useConsumeFee,
-        memberGradeFee: this.discountTotal.memberGradeFee * 100 || 0,
-        memberGradeFeeHour:
-          this.discountTotal.memberGradeFee / this.hourMoney || 0,
-        firstParkFee: this.discountTotal.firstParkFee * 100 || 0,
-        usetotalfee:
-          ((this.discountTotal.memberGradeFee || 0) +
-            (this.discountTotal.consumeFee || 0) +
-            this.bonusfee +
-            (this.couponInfo.couponfee || 0) +
-            (this.paperCouponInfo.paperDiscountFee || 0)) *
-          100,
-        payfee: parseFloat((this.actualFee * 100).toFixed(2)),
-        totalfee:
-          this.discountTotalFee * 100 < this.parkInfo.servicefee
-            ? this.discountTotalFee * 100
-            : this.parkInfo.servicefee,
-        paytype: this.actualFee > 0 ? 3 : 1,
-        projectId: this.projectId,
-      };
-      // console.log(1663, this.actualFee);
-      let path =
-        this.actualFee > 0
-          ? 'api/1.0/park/weixinPay'
-          : 'api/1.0/park/notWeixinPay';
-      // 北京特殊处理
-      // if (this.parkMallCode === 3) {
-      //   path = 'api/1.0/park/dealParkOrderBj';
-      // }
-      this.$md(params);
-      this.$request({
-        url: this.$baseURL + path,
-        data: params,
-        method: 'POST',
-        header: JSON.parse(uni.getStorageSync('handleUser')),
-      })
-        .then((res) => {
-          uni.hideLoading();
-          if (res.data.code === 0) {
-            // 北京特殊处理
-            // if (this.parkMallCode === 3 && false) {
-            //   if (!res.data.data.syncId) {
-            //     uni.showToast({
-            //       title: '缴费成功',
-            //       icon: 'none',
-            //     });
-            //     this.$router.back();
-            //     return;
-            //   }
-            //   console.log(this.bindflag, 'bindflag');
-            //   const accountInfo = uni.getAccountInfoSync();
-            //   const {
-            //     miniProgram: { envVersion },
-            //   } = accountInfo;
-
-            //   if (this.bindflag === 0) {
-            //     uni.navigateToMiniProgram({
-            //       appId: 'wx192b7d2e8dcbefd0',
-            //       path: this.$etcpAppPath,
-            //       extraData: {
-            //         params: {
-            //           token: res.data.data.token,
-            //           syncId: res.data.data.syncId,
-            //           payType: 6,
-            //           CarNumber: res.data.data.CarNumber,
-            //           actionId: 1,
-            //           payAcType: 2,
-            //         },
-            //       },
-            //       envVersion: 'trial',
-            //       success: (res) => {
-            //         console.log(res);
-            //         this.$router.back();
-            //       },
-            //     });
-            //   } else if (this.bindflag === 1) {
-            //     uni.navigateToMiniProgram({
-            //       appId: 'wx192b7d2e8dcbefd0',
-            //       path: this.$etcpAppPath,
-            //       extraData: {
-            //         params: {
-            //           token: res.data.data.token,
-            //           syncId: res.data.data.syncId,
-            //           payType: 6,
-            //           CarNumber: res.data.data.CarNumber,
-            //           actionId: 1,
-            //         },
-            //       },
-            //       envVersion: 'trial',
-            //       success: (res) => {
-            //         console.log(res);
-            //         this.$router.back();
-            //       },
-            //     });
-            //   }
-            //   return;
-            // }
-            // console.log(17211721172117211721);
-            if (this.actualFee > 0) {
-              // 微信支付
-              // console.log(1700, res);
-              // return
-              this.kerryPayment(res.data.data, params);
-            } else {
-              // 埋点位置
-              this.sensorsClick('$ClickParkingPay', {
-                car_no: params.carno,
-                pay_fee: params.payfee,
-                total_fee: params.totalfee,
-                redirect_path: 'pages/parkingFee/parkingFeeSuccess',
-              });
-              this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
-                name: 'parkingFeeDetail'
-              });
-              this.$router.replace({
-                path: 'parkingFeeSuccess?carno=' + this.parkInfo.carno,
-              });
-            }
-          } else {
-            uni.showModal({
-              showCancel: false,
-              title: '提示',
-              content: res.data.msg,
-              complete: (r) => {
-                // uni.navigateBack({})
-                this.createParkOrder();
-              },
-            });
-          }
-        })
-        .catch((err) => {
-          console.log(err);
-          uni.hideLoading();
-          uni.showToast({
-            title: JSON.stringify(err),
-            icon: 'none',
-          });
-        });
-    },
-    // 埋点方法
-    sensorsClick(eventName, params) {
-      let optionsQuery = uni.getStorageSync('options_query');
-      let fixedParams = {
-          cta_itemno: '',
-          cta_name: '',
-          previous_path: this.preUrl || '',
-          // 原previous_path: uni.getStorageSync('previousUrl') || ''
-          // previous_path: 使用sdk预置参数$referrer,
-          $brand_id: uni.getStorageSync('groupId'),
-          $location: uni.getStorageSync('mallid'),
-          $channel: optionsQuery.channel || '',
-          // $utm_lbs: this.optionsQuery.utm_lbs || '',
-          $utm_channel: optionsQuery.utm_channel || '',
-          $utm_method: optionsQuery.utm_method || '',
-          $utm_source: optionsQuery.utm_source || '',
-          $utm_function: optionsQuery.utm_function || '',
-          $utm_user: optionsQuery.utm_user || '',
-        },
-        finalParams = Object.assign(fixedParams, params);
-      this.$sensors.track(eventName, finalParams);
-    },
-    // 嘉里第三方支付接口
-    kerryPayment(session = '011cad54-735f-4e92-8f1b-f22bdfe073cd', payParams) {
-      const platform = getPlatform();
-      let appId = uni.getStorageSync('appid');
-      let openId = uni.getStorageSync('openid') || this.openid;
-      if (platform === 'miniprogram') {
-        appId =this.source === 'CRM' ? this.appId : 'wx92c3e55fbef6b2af';
-      }
-      const params = {
-        region: 'cn',
-        payChannel: 'OFFICIAL_ACCOUNT',
-        // payChannel: 'MOBILE_WEB',
-        payOption: 'WECHATPAY',
-        appId: appId,
-        // openId: 'oudWQ5SCDElfn-IQH6eBR5JesOz4', // 下的appid: wxd830fe4d1e04988e
-        openId,
-      };
-      // console.log(1854, params);
-      this.$md(params);
-      // let path = `/profileApi/payment/v1/services/session/${session}/transactions`;
-      let path = `${window.profileApi}/payment/v1/services/session/${session}/transactions`;
-      this.$request({
-        url: path,
-        data: params,
-        method: 'POST',
-        header: JSON.parse(uni.getStorageSync('handleUser')),
-      })
-        .then(async (res) => {
-          this.Toastloading.clear();
-          // console.log(1795, res);
-          if (res.data?.code == '000000') {
-            const prepayJson = res.data.data.params;
-            const platform = getPlatform();
-            // TODO: h5环境判断
-            if (platform === 'micromessenger') {
-              const weixinH5PayRes = await this.weixinH5Pay(prepayJson);
-              // 微信支付完成,判断结果
-              console.log(1784, weixinH5PayRes);
-              //  errMsg: 'requestPayment:ok'
-              if (weixinH5PayRes?.errMsg === 'requestPayment:ok') {
-                this.$store.commit('cachedViews/DEL_CACHED_VIEW', {
-                  name: 'parkingFeeDetail'
-                });
-                this.$router.replace({
-                  path: 'parkingFeeSuccess?carno=' + this.parkInfo.carno,
-                });
-              } else {
-                this.failedParkOrder();
-              }
-            } else {
-              window.toWXSendMsg({
-                type: 'openWxPay',
-                options: {
-                  provider: 'wxpay',
-                  timeStamp: prepayJson.timeStamp,
-                  nonceStr: prepayJson.nonceStr,
-                  package: prepayJson.package,
-                  signType: prepayJson.signType,
-                  paySign: prepayJson.paySign,
-                },
-              });
-              window.subscribe('wxPayOver', (options) => {
-                this.Toastloading.clear();
-                // console.log('微信支付结束之后的返回参数', options);
-                // T-ODO: 在 qa 新发版前,只提示支付成功的信息(已处理成功信息)
-                if (options?.wxPayOver === 'fail') {
-                  // console.log('支付失败');
-                  this.failedParkOrder();
-                } else {
-                  this.btnLoading = false;
-                  this.$router.replace({
-                    path: 'parkingFeeSuccess?carno=' + this.parkInfo.carno,
-                  });
-                }
-              });
-            }
-            return;
-            // 微信支付接口
-            // uni.requestPayment({
-            //   provider: 'wxpay',
-            //   timeStamp: prepayJson.timeStamp,
-            //   nonceStr: prepayJson.nonceStr,
-            //   package: prepayJson.package,
-            //   signType: prepayJson.signType,
-            //   paySign: prepayJson.paySign,
-            //   success: () => {
-            //     uni.showModal({
-            //       showCancel: false,
-            //       title: '提示',
-            //       content: '支付成功',
-            //       complete: () => {
-            //         this.sensorsClick('$ClickParkingPay', {
-            //           car_no: payParams.carno,
-            //           pay_fee: payParams.payfee,
-            //           total_fee: payParams.totalfee,
-            //           redirect_path: 'pages/parkingFee/parkingFeeSuccess',
-            //         });
-            //         this.$router.replace({
-            //           path: './parkingFeeSuccess?carno=' + this.parkInfo.carno,
-            //         });
-            //       },
-            //     });
-            //   },
-            //   fail: () => {
-            //     this.failedParkOrder();
-            //   },
-            // });
-          } else {
-            this.failedParkOrder();
-          }
-        })
-        .catch((err) => {
-          // console.log(1854, err);
-          this.failedParkOrder();
-        });
-    },
-
-    // 支付失败弹框 重新创建订单
-    reCreateParkOrder() {
-      // console.log('支付失败弹框 重新创建订单');
-      Dialog.alert({
-        title: '提示',
-        message: '支付失败',
-        confirmButtonColor: '#333',
-      }).then(() => {
-        this.btnLoading = false;
-        this.createParkOrder();
-      });
-      // uni.showModal({
-      //   showCancel: false,
-      //   title: '提示',
-      //   content: '支付失败',
-      //   complete: (r) => {
-      //     this.createParkOrder();
-      //   },
-      // });
-    },
-
-    // 支付失败后返还优惠券
-    failedParkOrder() {
-      this.Toastloading.clear();
-      const param = {
-        orderno: this.parkInfo.orderno,
-      };
-      this.$md(param);
-      uni
-        .request({
-          url: this.$baseURL + 'api/1.0/park/failedParkOrder',
-          data: param,
-          method: 'POST',
-          header: JSON.parse(uni.getStorageSync('handleUser')),
-        })
-        .then((res) => {
-          this.reCreateParkOrder();
-        })
-        .catch((err) => {
-          this.reCreateParkOrder();
-        });
-    },
-
-    //缴费说明隐藏显示
-    togglePayinstruction() {
-      this.isShow = !this.isShow;
-    },
-    // 微信公众号H5支付
-    async weixinH5Pay(params) {
-      // console.log(1897);
-      if (window?.wxJsSdkConfigInitPromise) {
-        await window.wxJsSdkConfigInitPromise;
-      }
-      return new Promise((resolve, reject) => {
-        this.$wx.chooseWXPay({
-          timestamp: params?.timeStamp,
-          nonceStr: params?.nonceStr,
-          package: params?.package,
-          signType: params?.signType,
-          paySign: params?.paySign,
-          success: function (res) {
-            // alert('success: ' + JSON.stringify(res));
-            // res: {"errMsg":"chooseWXPay:cancel"}
-            if (res.errMsg === 'chooseWXPay:ok') {
-              resolve({ errMsg: 'requestPayment:ok' });
-            } else {
-              reject(res);
-            }
-          },
-          cancel: function (res) {
-            // alert('cancel: ' + JSON.stringify(res));
-            // res: {"errMsg":"chooseWXPay:cancel"}
-            resolve({ errMsg: 'requestPayment:cancel' });
-          },
-          fail: function (err) {
-            // eslint-disable-next-line no-console
-            console.error(err);
-            reject(err);
-          },
-        });
-      });
-    },
-    /*
-     // 验证扫码环节
-     scan() {
-     wx.scanQRCode({
-     desc: 'scanQRCode desc',
-     needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
-     // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
-     success: (res) => {
-     debugger;
-     console.log(1945, res);
-     // runScanFn(res);
-     // this.formMsg.deviceCode = res.resultStr;
-     },
-     error: (res) => {
-     debugger;
-     console.log(1950, res);
-     },
-     });
-     },*/
+    }
   },
 };

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

@@ -386,7 +386,6 @@
   $utm_user: optionsQuery.utm_user || '',
 },
   finalParams = Object.assign(fixedParams, params);
-  this.$sensors.track(eventName, finalParams);
 },
 },
 };

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

@@ -189,7 +189,6 @@ export default {
           $utm_user: optionsQuery.utm_user || '',
         },
         finalParams = Object.assign(fixedParams, params);
-      this.$sensors.track(eventName, finalParams);
     },
   },
 };

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

@@ -84,7 +84,6 @@ export default {
           $utm_user: optionsQuery.utm_user || '',
         },
         finalParams = Object.assign(fixedParams, params);
-      this.$sensors.track(eventName, finalParams);
     },
     // 删除抬头
     delHeader(id) {

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

@@ -146,7 +146,6 @@ export default {
           $utm_user: optionsQuery.utm_user || '',
         },
         finalParams = Object.assign(fixedParams, params);
-      this.$sensors.track(eventName, finalParams);
     },
   },
 };

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

@@ -138,7 +138,6 @@ export default {
           $utm_user: optionsQuery.utm_user || '',
         },
         finalParams = Object.assign(fixedParams, params);
-      this.$sensors.track(eventName, finalParams);
     },
     goToDeatil(item) {
       if (this.tabIndex === 2 && item.status === 2) {

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

@@ -336,7 +336,6 @@ export default {
           $utm_user: optionsQuery.utm_user || '',
         },
         finalParams = Object.assign(fixedParams, params);
-      this.$sensors.track(eventName, finalParams);
     },
   },
 };

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

@@ -307,7 +307,6 @@ export default {
           $utm_user: optionsQuery.utm_user || '',
         },
         finalParams = Object.assign(fixedParams, params);
-      this.$sensors.track(eventName, finalParams);
     },
     cancelDelete() {
       this.deleteDialogSwitch = true;

+ 4 - 0
src/store/index.js

@@ -48,6 +48,7 @@ const store = new Vuex.Store({
     source: '', // 访问方:微信小程序:(CRM|KIP)
     brandInfo: {},
     curMarket: {},
+    isInit: true, // 当内嵌在小程序中的H5页面,没有接收到小程序数据时,默认显示骨架屏幕
   },
   mutations: {
     SET_GROUP_ID(state, payload) {
@@ -136,6 +137,9 @@ const store = new Vuex.Store({
       uni.setStorageSync('curMarket', payload);
       state.curMarket = payload;
     },
+    SET_IS_INIT(state, payload) {
+      state.isInit = payload;
+    }
   },
   actions: {
     async baseInit({ commit, dispatch }, { options, callback }) {

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

@@ -43,10 +43,7 @@ export default {
     let curEnvConst = ENV_LIST.find(item => item.name == curEnvName);
     // 如果是来自 window.injectConfig
     if (window?.injectConfig) {
-      console.log(464646, window?.injectConfig);
-      console.log(474747, key);
       if (key === 'KIP_API') {
-        // return window?.injectConfig?.profileApi
         return window.profileApi
       }
       if (curEnvConst?.constants) {

+ 34 - 29
src/utils/request.js

@@ -1,31 +1,36 @@
-import uni from './uniHooks'
-let reqCount = 0,resCount = 0;//记录请求次数和响应次数
+import uni from './uniHooks';
+
+let reqCount = 0,
+  resCount = 0; //记录请求次数和响应次数
 
 const request = (options) => {
-	reqCount++;
-	uni.showLoading(options?.showLoading || {});
-	return new Promise((resolve, reject) => {
-		uni.request({
-			method: options.method,
-			url: options.url,
-			data: options.data,
-			header: options.header//如需其他配置可在此添加或先转换options.url,然后 ...options
-		}).then((response) => {
-			resCount++
-			if(reqCount === resCount) uni.hideLoading();//防止连续请求多个接口时loading闪现
-			// let [error, res] = response;
-			resolve(response);
-			if(response.status == 581){
-				uni.navigateTo({
-					url: '/pages/errorPage/errorLimit?msg=当前访问太火爆了,稍后试试吧~'
-				})
-			}
-		}).catch(error => {
-			resCount++
-			if(reqCount === resCount) uni.hideLoading();
-			// let [err, res] = error;
-			reject(error)
-		})
-	});
-}
-export default request
+  reqCount++;
+  uni.showLoading(options?.showLoading || {});
+  return new Promise((resolve, reject) => {
+    uni
+      .request({
+        method: options.method,
+        url: options.url,
+        data: options.data,
+        header: options.header, //如需其他配置可在此添加或先转换options.url,然后 ...options
+      })
+      .then((response) => {
+        resCount++;
+        if (reqCount === resCount) uni.hideLoading(); //防止连续请求多个接口时loading闪现
+        // let [error, res] = response;
+        resolve(response);
+        if (response.status == 581) {
+          uni.navigateTo({
+            url: '/pages/errorPage/errorLimit?msg=当前访问太火爆了,稍后试试吧~',
+          });
+        }
+      })
+      .catch((error) => {
+        resCount++;
+        if (reqCount === resCount) uni.hideLoading();
+        // let [err, res] = error;
+        reject(error);
+      });
+  });
+};
+export default request;

+ 11 - 0
vue.config.js

@@ -106,6 +106,17 @@ module.exports = {
           //pathRewrite: {'^/api': '/api'} 重写之后url为 http://192.168.1.16:8085/api/xxxx
         },
       },
+      '/msApi': {
+        target: 'https://dev-kip-service-internal.kerryonvip.com/temporary-parking-service', //代理地址,这里设置的地址会代替axios中设置的baseURL
+        changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
+        //ws: true, // proxy websockets
+        //pathRewrite方法重写url
+        pathRewrite: {
+          '^/msApi': '',
+          //pathRewrite: {'^/api': '/'} 重写之后url为 http://192.168.1.16:8085/xxxx
+          //pathRewrite: {'^/api': '/api'} 重写之后url为 http://192.168.1.16:8085/api/xxxx
+        },
+      }
     },
   },
 };

+ 6 - 11
yarn.lock

@@ -7710,11 +7710,16 @@ prepend-http@^1.0.0:
   resolved "https://nexus-internal.kerryonvip.com/repository/kerry-npm-group/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
   integrity sha512-PhmXi5XmoyKw1Un4E+opM2KcsJInDvKyuOumcjjw3waw86ZNjHwVUOOWLc4bCzLdcKNaWBH9e99sbWzDQsVaYg==
 
-"prettier@^1.18.2 || ^2.0.0", prettier@^2.7.1:
+"prettier@^1.18.2 || ^2.0.0":
   version "2.7.1"
   resolved "https://nexus-internal.kerryonvip.com/repository/kerry-npm-group/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64"
   integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==
 
+prettier@^2.8.3:
+  version "2.8.3"
+  resolved "https://nexus-internal.kerryonvip.com/repository/kerry-npm-group/prettier/-/prettier-2.8.3.tgz#ab697b1d3dd46fb4626fbe2f543afe0cc98d8632"
+  integrity sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==
+
 pretty-error@^2.0.2:
   version "2.1.2"
   resolved "https://nexus-internal.kerryonvip.com/repository/kerry-npm-group/pretty-error/-/pretty-error-2.1.2.tgz#be89f82d81b1c86ec8fdfbc385045882727f93b6"
@@ -8238,16 +8243,6 @@ run-queue@^1.0.0, run-queue@^1.0.3:
   dependencies:
     aproba "^1.1.1"
 
-sa-sdk-javascript@^1.23.3:
-  version "1.23.5"
-  resolved "https://nexus-internal.kerryonvip.com/repository/kerry-npm-group/sa-sdk-javascript/-/sa-sdk-javascript-1.23.5.tgz#bac4b6d1c6b66b651b54b70b1759c7f407578817"
-  integrity sha512-zi/xtwlQLziTYJm4Ejqogv6sm6nNG1c/W1ozY4Umidrl18P45eo5Hljl1YDm58ThBBYTtSA5Ehuk07XnypVHYg==
-
-sa-sdk-miniprogram@^1.17.12:
-  version "1.17.13"
-  resolved "https://nexus-internal.kerryonvip.com/repository/kerry-npm-group/sa-sdk-miniprogram/-/sa-sdk-miniprogram-1.17.13.tgz#4ca0e54bd64f48454f815b9dc1879259fa6e1b30"
-  integrity sha512-XrZlBrp4lztdWK8MlUF9lNZzL14IeSJNo0zQtUF06l0yOdfRPIGJLdfbUVLGkvTMsSlrRxyYGUvvb8Ud3TKWyg==
-
 safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
   version "5.1.2"
   resolved "https://nexus-internal.kerryonvip.com/repository/kerry-npm-group/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"