|
@@ -84,10 +84,9 @@ export default {
|
|
}),
|
|
}),
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- console.log('二次加载this.$route.query.fromPage', this.$route.query.fromPage, this.$store.state.pageHistory);
|
|
|
|
- console.log('二次加载', this.$route.query.fromPage && !this.$store.state.pageHistory[this.$route.query.fromPage]);
|
|
|
|
-
|
|
|
|
- if(this.$route.query.fromPage && !this.$store.state.pageHistory[this.$route.query.fromPage]) {
|
|
|
|
|
|
+ // console.log('二次加载this.$route.query.fromPage', this.$route.query.fromPage, this.$store.state.pageHistory);
|
|
|
|
+ // console.log('二次加载', this.$route.query.fromPage && !this.$store.state.pageHistory[this.$route.query.fromPage]);
|
|
|
|
+ if(this.$route.query?.fromPage !== 'undefined' && !this.$store.state.pageHistory[this.$route.query.fromPage]) {
|
|
this.$store.commit('setPageHistory', {
|
|
this.$store.commit('setPageHistory', {
|
|
[this.$route.query.fromPage]: 1
|
|
[this.$route.query.fromPage]: 1
|
|
})
|
|
})
|
|
@@ -96,6 +95,20 @@ export default {
|
|
loginCount: 1
|
|
loginCount: 1
|
|
}});
|
|
}});
|
|
}
|
|
}
|
|
|
|
+ const {type= '', code = ''} = this.$route.query
|
|
|
|
+ // 无牌车流程
|
|
|
|
+ if(/unlicensedOut|unlicensedIn/.test(type) && code && !this.$store.state.pageHistory?.unlicensed && !this.endlessLoop) {
|
|
|
|
+ this.$store.commit('setPageHistory', {
|
|
|
|
+ unlicensed: 1
|
|
|
|
+ })
|
|
|
|
+ this.$store.commit('SET_UNLICENSED_INFO', {
|
|
|
|
+ type, code
|
|
|
|
+ });
|
|
|
|
+ this.$store.commit('SET_ENDLESS_LOOP', type);
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.qrCodesRule(code);
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
beforeRouteLeave(to, from, next) {
|
|
beforeRouteLeave(to, from, next) {
|
|
this.$store.commit('cachedViews/DEL_CACHED_VIEW', to);
|
|
this.$store.commit('cachedViews/DEL_CACHED_VIEW', to);
|
|
@@ -108,29 +121,31 @@ export default {
|
|
this.showSq = false;
|
|
this.showSq = false;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- unlicensedInfo:{
|
|
|
|
- handler(){
|
|
|
|
- // const member = uni.getStorageSync('member');
|
|
|
|
- // if(!member) return // 如果用户走未登录流程的话
|
|
|
|
- // 不论是否出入场,都使用此函数获取 gateId(闸口机器的ID)
|
|
|
|
- if (this.unlicensedInfo?.type && /unlicensedOut|unlicensedIn/.test(this.unlicensedInfo.type) && this.endlessLoop.length === 0) {
|
|
|
|
- // 此处记录扫码流程执行次数。如果超过一次则不再执行
|
|
|
|
- this.$store.commit('SET_ENDLESS_LOOP', this.unlicensedInfo.type);
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.qrCodesRule(this.unlicensedInfo.code);
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- immediate:true //true就表示会立即执行
|
|
|
|
- }
|
|
|
|
|
|
+ // unlicensedInfo:{
|
|
|
|
+ // handler(){
|
|
|
|
+ // // const member = uni.getStorageSync('member');
|
|
|
|
+ // // if(!member) return // 如果用户走未登录流程的话
|
|
|
|
+ // // 不论是否出入场,都使用此函数获取 gateId(闸口机器的ID)
|
|
|
|
+ // if (this.unlicensedInfo?.type && /unlicensedOut|unlicensedIn/.test(this.unlicensedInfo.type) && this.endlessLoop.length === 0) {
|
|
|
|
+ // // 此处记录扫码流程执行次数。如果超过一次则不再执行
|
|
|
|
+ // this.$store.commit('SET_ENDLESS_LOOP', this.unlicensedInfo.type);
|
|
|
|
+ // this.$nextTick(() => {
|
|
|
|
+ // this.qrCodesRule(this.unlicensedInfo.code);
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // immediate:true //true就表示会立即执行
|
|
|
|
+ // }
|
|
},
|
|
},
|
|
async mounted() {
|
|
async mounted() {
|
|
- console.log(114, 99999999999);
|
|
|
|
|
|
+ // console.log(114, 99999999999);
|
|
const platform = getPlatform();
|
|
const platform = getPlatform();
|
|
- if (platform === 'micromessenger') {
|
|
|
|
- await initWxJsSdkConfig(['checkJsApi', 'scanQRCode']);
|
|
|
|
- }
|
|
|
|
|
|
+ // if (platform === 'micromessenger') {
|
|
|
|
+ // await initWxJsSdkConfig(['checkJsApi', 'scanQRCode']);
|
|
|
|
+ // }
|
|
|
|
+
|
|
const openid= uni.getStorageSync('openid');
|
|
const openid= uni.getStorageSync('openid');
|
|
|
|
+
|
|
// 如果用户未登录的话,返回之后,重新获取数据用户的基础数据
|
|
// 如果用户未登录的话,返回之后,重新获取数据用户的基础数据
|
|
if (openid) {
|
|
if (openid) {
|
|
this.getParkInfo();
|
|
this.getParkInfo();
|
|
@@ -146,6 +161,13 @@ export default {
|
|
}
|
|
}
|
|
this.showSq = true;
|
|
this.showSq = true;
|
|
}
|
|
}
|
|
|
|
+ try {
|
|
|
|
+ setTimeout(async () => {
|
|
|
|
+ await initWxJsSdkConfig(['checkJsApi', 'scanQRCode']);
|
|
|
|
+ }, 1500)
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e)
|
|
|
|
+ }
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
toggleType(carType) {
|
|
toggleType(carType) {
|
|
@@ -181,10 +203,10 @@ export default {
|
|
title: '加载中',
|
|
title: '加载中',
|
|
});
|
|
});
|
|
try {
|
|
try {
|
|
- console.log('加载车场信息', this.$store.state.lbsId);
|
|
|
|
|
|
+ // console.log('加载车场信息', this.$store.state.lbsId);
|
|
// const res = await parkingLots('8aaa82ea804d07cd0180516ff03b0008'); // TODO: 临时写死
|
|
// const res = await parkingLots('8aaa82ea804d07cd0180516ff03b0008'); // TODO: 临时写死
|
|
const res = await parkingLots(this.$store.state.lbsId); // TODO: 临时写死
|
|
const res = await parkingLots(this.$store.state.lbsId); // TODO: 临时写死
|
|
- console.log(res);
|
|
|
|
|
|
+ // console.log(res);
|
|
let reg = /[;;]/g;
|
|
let reg = /[;;]/g;
|
|
this.description = res?.description?.replace(reg, '\r\n').replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>');
|
|
this.description = res?.description?.replace(reg, '\r\n').replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>');
|
|
this.supportUnlicensed = res.supportUnlicensed || false
|
|
this.supportUnlicensed = res.supportUnlicensed || false
|
|
@@ -249,12 +271,17 @@ export default {
|
|
name: 'parkingFeeDetailV2',
|
|
name: 'parkingFeeDetailV2',
|
|
});
|
|
});
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
- this.$router.push({
|
|
|
|
- path: 'parkingFeeDetail',
|
|
|
|
- query: {
|
|
|
|
|
|
+ const query = {
|
|
...this.$route.query,
|
|
...this.$route.query,
|
|
vehicleNo: this.vehicleNumber,
|
|
vehicleNo: this.vehicleNumber,
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
+ // fromPage && format && unlicensed
|
|
|
|
+ query.fromPage = ''
|
|
|
|
+ query.format = ''
|
|
|
|
+ query.unlicensed = ''
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: 'parkingFeeDetail',
|
|
|
|
+ query,
|
|
});
|
|
});
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -266,12 +293,18 @@ export default {
|
|
});
|
|
});
|
|
|
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
|
|
+ const query = {
|
|
|
|
+ ...this.$route.query,
|
|
|
|
+ vehicleNo: vehicleNo,
|
|
|
|
+ }
|
|
|
|
+ // fromPage && format && unlicensed
|
|
|
|
+ query.fromPage = ''
|
|
|
|
+ query.format = ''
|
|
|
|
+ query.unlicensed = ''
|
|
|
|
+
|
|
this.$router.push({
|
|
this.$router.push({
|
|
path: 'parkingFeeDetail',
|
|
path: 'parkingFeeDetail',
|
|
- query: {
|
|
|
|
- ...this.$route.query,
|
|
|
|
- vehicleNo,
|
|
|
|
- },
|
|
|
|
|
|
+ query,
|
|
});
|
|
});
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -323,12 +356,17 @@ export default {
|
|
this.parkingFeeDetailInit();
|
|
this.parkingFeeDetailInit();
|
|
uni.setStorageSync('isReload', '3');
|
|
uni.setStorageSync('isReload', '3');
|
|
// this.$destroy();
|
|
// this.$destroy();
|
|
|
|
+ const query = {
|
|
|
|
+ ...this.$route.query,
|
|
|
|
+ vehicleNo: carno,
|
|
|
|
+ }
|
|
|
|
+ // fromPage && format && unlicensed
|
|
|
|
+ query.fromPage = ''
|
|
|
|
+ query.format = ''
|
|
|
|
+ query.unlicensed = ''
|
|
this.$router.push({
|
|
this.$router.push({
|
|
path: 'parkingFeeDetail',
|
|
path: 'parkingFeeDetail',
|
|
- query: {
|
|
|
|
- ...this.$route.query,
|
|
|
|
- vehicleNo: carno,
|
|
|
|
- },
|
|
|
|
|
|
+ query,
|
|
});
|
|
});
|
|
parkTime = res.data?.data?.serviceMin;
|
|
parkTime = res.data?.data?.serviceMin;
|
|
redirectUrl = '/pages/parkingFee/parkingFeeDetail.vue';
|
|
redirectUrl = '/pages/parkingFee/parkingFeeDetail.vue';
|
|
@@ -557,7 +595,7 @@ export default {
|
|
console.log('微信扫码之后,处理过的参数', params);
|
|
console.log('微信扫码之后,处理过的参数', params);
|
|
this.$store.commit('SET_UNLICENSED_INFO', params);
|
|
this.$store.commit('SET_UNLICENSED_INFO', params);
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
- this.qrCodesRule(params.code);
|
|
|
|
|
|
+ this.qrCodesRule(params.code, 'scan');
|
|
})
|
|
})
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -569,7 +607,7 @@ export default {
|
|
const params = getUrlParams(`?${decodeURIComponent(res.path.replace(/.*scene=/g, ''))}`)
|
|
const params = getUrlParams(`?${decodeURIComponent(res.path.replace(/.*scene=/g, ''))}`)
|
|
this.$store.commit('SET_UNLICENSED_INFO', params);
|
|
this.$store.commit('SET_UNLICENSED_INFO', params);
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
- this.qrCodesRule(params.code);
|
|
|
|
|
|
+ this.qrCodesRule(params.code, 'scan');
|
|
})
|
|
})
|
|
}
|
|
}
|
|
// 兜底逻辑,如果是其他小程序扫描,则提取rawData,进行解析提取入参
|
|
// 兜底逻辑,如果是其他小程序扫描,则提取rawData,进行解析提取入参
|
|
@@ -581,7 +619,7 @@ export default {
|
|
const obj = { code: match[1], type: match[2] };
|
|
const obj = { code: match[1], type: match[2] };
|
|
this.$store.commit('SET_UNLICENSED_INFO', obj);
|
|
this.$store.commit('SET_UNLICENSED_INFO', obj);
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
- this.qrCodesRule(obj.code);
|
|
|
|
|
|
+ this.qrCodesRule(obj.code, 'scan');
|
|
})
|
|
})
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -625,7 +663,11 @@ export default {
|
|
|
|
|
|
},
|
|
},
|
|
// 处理扫码结果: 组装参数,剩余流程,在 缴费支付页面 实现
|
|
// 处理扫码结果: 组装参数,剩余流程,在 缴费支付页面 实现
|
|
- async qrCodesRule(code) {
|
|
|
|
|
|
+ async qrCodesRule(code, source = '') {
|
|
|
|
+ // source 是为了避免重复刷新
|
|
|
|
+ if(this.$store.state.pageHistory.parkingFeeMsg && !source) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
try {
|
|
try {
|
|
if ( this.qrCodeHistory && this.qrCodeHistory === code ) {
|
|
if ( this.qrCodeHistory && this.qrCodeHistory === code ) {
|
|
return
|
|
return
|
|
@@ -641,14 +683,20 @@ export default {
|
|
});
|
|
});
|
|
// return
|
|
// return
|
|
if (this.unlicensedInfo?.type === 'unlicensedOut') {
|
|
if (this.unlicensedInfo?.type === 'unlicensedOut') {
|
|
|
|
+ const query = {
|
|
|
|
+ ...this.$route.query,
|
|
|
|
+ gateId: qrCodesres.gateId,
|
|
|
|
+ vehicleNo: '',
|
|
|
|
+ type: this.unlicensedInfo.type
|
|
|
|
+ }
|
|
|
|
+ // fromPage && format && unlicensed
|
|
|
|
+ query.fromPage = ''
|
|
|
|
+ query.format = ''
|
|
|
|
+ query.unlicensed = ''
|
|
|
|
+ query.code = ''
|
|
this.$router.push({
|
|
this.$router.push({
|
|
path: 'parkingFeeDetail',
|
|
path: 'parkingFeeDetail',
|
|
- query: {
|
|
|
|
- ...this.$route.query,
|
|
|
|
- gateId: qrCodesres.gateId,
|
|
|
|
- vehicleNo: '',
|
|
|
|
- type: this.unlicensedInfo.type
|
|
|
|
- }
|
|
|
|
|
|
+ query
|
|
})
|
|
})
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -656,14 +704,24 @@ export default {
|
|
const unlicensedCarCheckInres = await unlicensedCarCheckIn({ // 获取无牌车牌
|
|
const unlicensedCarCheckInres = await unlicensedCarCheckIn({ // 获取无牌车牌
|
|
gateId: qrCodesres.gateId
|
|
gateId: qrCodesres.gateId
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ const query = {
|
|
|
|
+ ...this.$route.query,
|
|
|
|
+ type: 'success',
|
|
|
|
+ vehicleNo: unlicensedCarCheckInres.vehicleNo
|
|
|
|
+ }
|
|
|
|
+ // fromPage && format && unlicensed
|
|
|
|
+ query.fromPage = ''
|
|
|
|
+ query.format = ''
|
|
|
|
+ query.unlicensed = ''
|
|
|
|
+ query.code = ''
|
|
|
|
+ this.$store.commit('setPageHistory', {
|
|
|
|
+ parkingFeeMsg: 1
|
|
|
|
+ })
|
|
// 前往 缴费支付页面
|
|
// 前往 缴费支付页面
|
|
this.$router.push({
|
|
this.$router.push({
|
|
path: 'parkingFeeMsg',
|
|
path: 'parkingFeeMsg',
|
|
- query: {
|
|
|
|
- ...this.$route.query,
|
|
|
|
- type: 'success',
|
|
|
|
- vehicleNo: unlicensedCarCheckInres.vehicleNo
|
|
|
|
- }
|
|
|
|
|
|
+ query: query
|
|
})
|
|
})
|
|
} catch (err) {
|
|
} catch (err) {
|
|
// 车场扫描道闸入口,发现无车/车场扫描道闸入口,发现有牌车 >>> 停止往下执行,默认提示报错信息
|
|
// 车场扫描道闸入口,发现无车/车场扫描道闸入口,发现有牌车 >>> 停止往下执行,默认提示报错信息
|
|
@@ -671,13 +729,22 @@ export default {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
if (/CAR_NOT_FOUND|INOUT_FAILED|UNLICENSED_PLATE_ACQUISITION_FAILED/.test(err.code)) {
|
|
if (/CAR_NOT_FOUND|INOUT_FAILED|UNLICENSED_PLATE_ACQUISITION_FAILED/.test(err.code)) {
|
|
|
|
+ const query = {
|
|
|
|
+ ...this.$route.query,
|
|
|
|
+ type: 'fail'
|
|
|
|
+ }
|
|
|
|
+ // fromPage && format && unlicensed
|
|
|
|
+ query.fromPage = ''
|
|
|
|
+ query.format = ''
|
|
|
|
+ query.unlicensed = ''
|
|
|
|
+ query.code = ''
|
|
|
|
+ this.$store.commit('setPageHistory', {
|
|
|
|
+ parkingFeeMsg: 1
|
|
|
|
+ })
|
|
// 如果是其他错误的话,则继续往下执行
|
|
// 如果是其他错误的话,则继续往下执行
|
|
this.$router.push({
|
|
this.$router.push({
|
|
path: 'parkingFeeMsg',
|
|
path: 'parkingFeeMsg',
|
|
- query: {
|
|
|
|
- ...this.$route.query,
|
|
|
|
- type: 'fail'
|
|
|
|
- }
|
|
|
|
|
|
+ query
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|