Ver Fonte

Merge pull request #275 from John-Hong/John/release-2.18.0/KIP-12320

fix(KIP-12320): 【DE】【C端】临时停车。当有牌车和无牌车(进场时间更早)都在场内时,不会跳转到无牌车tab页下
Tron há 1 ano atrás
pai
commit
16e1e8ebad
1 ficheiros alterados com 57 adições e 23 exclusões
  1. 57 23
      src/pages/parkingFee/mixins/parkingFee.js

+ 57 - 23
src/pages/parkingFee/mixins/parkingFee.js

@@ -1,10 +1,10 @@
 import plateNumber from '@/components/plate-number/plateNumber.vue';
-import { REG_SOURCE } from '@/constants';
+import {LICENSE_PLATE_TYPE_ARR, REG_SOURCE} from '@/constants';
 import LoginDom from '@/components/Login/Login.vue';
 import { mapState } from 'vuex';
 import { initWxJsSdkConfig } from '@/utils/login';
 import { getPlatform,requestInit } from '@/utils/index';
-import { wxToLoginCallback, getUrlParams, theCommunicationBetweenWechatAndH5IsNormal } from '@/utils';
+import { wxToLoginCallback, getUrlParams, theCommunicationBetweenWechatAndH5IsNormal, isHZ } from '@/utils';
 import {getAccessH5} from '@/utils/api-crm-member'
 import wxPointsAuth from '@/components/wx-points-auth/wx-points-auth.vue'
 const app = {
@@ -17,7 +17,7 @@ import uni from '@/utils/uniHooks';
 // import greenCom from '../components/green/home.vue';
 // import officeBlueCom from '../components/officeBlue/home.vue';
 // import purpleCom from '../components/purple/home.vue';
-import { parkingLots, qrCodes, unlicensedCarCheckIn, getConfValueOfKey, getVehicles } from '@/api/parking';
+import { parkingLots, qrCodes, unlicensedCarCheckIn, getConfValueOfKey, getVehicles, parkingRecord } from '@/api/parking';
 import { reject } from 'lodash';
 
 export default {
@@ -196,29 +196,63 @@ export default {
     }
   },
   methods: {
-    // 获取会员绑定的车牌列表
     async getVehiclesINTMP() {
-      const res = await getVehicles(this.kipUserId)
-      this.licensePlateList = this.setLicensePlateList(res.content);
-      if (this.licensePlateList.length > 0 && this.mallId == "8a84853b7c91ac5b017c961a9b2a030d") {
-        console.log('this.licensePlateList::', this.licensePlateList, this.licensePlateList[this.licensePlateList.length - 1])
-        this.numArr[0] = this.licensePlateList[this.licensePlateList.length - 1].charAt(0)
-        this.numArr[1] = this.licensePlateList[this.licensePlateList.length - 1].charAt(1)
-        this.numArr[2] = this.licensePlateList[this.licensePlateList.length - 1].charAt(2)
-        this.numArr[3] = this.licensePlateList[this.licensePlateList.length - 1].charAt(3)
-        this.numArr[4] = this.licensePlateList[this.licensePlateList.length - 1].charAt(4)
-        this.numArr[5] = this.licensePlateList[this.licensePlateList.length - 1].charAt(5)
-      if (this.licensePlateList[this.licensePlateList.length - 1].charAt(6)) {
-        this.numArr[6] = this.licensePlateList[this.licensePlateList.length - 1].charAt(6)
+      /*杭州*/
+      if (!isHZ(this.mallId)) return
+      try {
+        if(this.$route.query.isLogin === 'loginDenied') {
+          throw new Error('设置默认参数')
+        }
+        let vehicles = []
+        // 获取用户车场在停车辆数据集
+        vehicles = await parkingRecord({
+          userId: this.kipUserId,
+          lbsId: this.mallId
+        })
+        // 获取用户的所有车牌
+        // const userVehicles = await getVehicles(this.kipUserId)
+        if (!vehicles.length) {
+          throw new Error('设置默认参数')
+          // vehicles = userVehicles.content
+        }
+        if (vehicles.length) {
+          // 判断是否存在无牌车
+          const vehicleNo = vehicles[0].vehicleNo
+          // 设置车牌类型
+          this.setVehicleNoType(vehicleNo, vehicles)
+          // 赋值
+          this.numArr = vehicles[0].vehicleNo.split('');
+          this.vehicleNumber = vehicles[0].vehicleNo;
+        } else {
+          throw new Error('设置默认参数')
+        }
+      } catch (e) {
+        // 设置默认参数
+        this.numArr  = '浙,A,,,,,'.split(',')
       }
-      // this.disabledBtn = false
-      } else if (this.licensePlateList.length === 0 && this.mallId == "8a84853b7c91ac5b017c961a9b2a030d") {
-        this.numArr[0] = '浙'
-        this.numArr[1] = 'A'
+    },
+    setVehicleNoType(vehicleNo, vehicles) {
+      // this.isUnlicensed(vehicles) // Kerry plus 没有无牌车功能
+      const item = vehicles.filter(e => e.vehicleNo === vehicleNo)
+      if(item.length) {
+        if(item[0].vehicleNo.indexOf('临') > -1) {
+          return true
+        }
+        let label = LICENSE_PLATE_TYPE_ARR.filter(e => e.value == item[0].licensePlateType)
+        const index = ['燃油车牌', '新能源', '特殊车牌'].indexOf(label[0].name)
+        this.$refs['k-tab'].changeTab(index)
+        return true
+      }
+      return false
+    },
+    isUnlicensed(vehicles) {
+      const unlicensed = vehicles.filter(elm => elm.vehicleNo.indexOf('临') > -1)
+      if(unlicensed.length) {
+        this.tabbarActiveEvent('无牌缴费');
+        // this.tabbarActive = '无牌缴费'
       }
-      console.log(219, this.numArr);
     },
-    setLicensePlateList (arr) {
+    setLicensePlateList(arr) {
       var array = []
       arr.forEach(element => {
         array.push(element.vehicleNo)
@@ -229,7 +263,7 @@ export default {
       this.ind = 0;
       this.active = 0;
       this.carType = carType;
-      this.currentTabType = carType
+      // this.currentTabType = carType
       if (carType === 1) {
         this.numArr = [
           this.numArr[0],