|
@@ -18,6 +18,12 @@ import uni from '@/utils/uniHooks';
|
|
|
import { parkingLots, qrCodes, unlicensedCarCheckIn } from '@/api/parking';
|
|
|
|
|
|
export default {
|
|
|
+ props:{
|
|
|
+ theme:{
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
components: {
|
|
|
plateNumber,
|
|
|
LoginDom,
|
|
@@ -69,6 +75,10 @@ export default {
|
|
|
member: (state) => state.member,
|
|
|
mobile: (state) => state.mobile,
|
|
|
custTypeId: (state) => state.custTypeId,
|
|
|
+ unlicensedCar: (state) => state.order.unlicensedCar,
|
|
|
+ // 如果是扫码进入的无牌车
|
|
|
+ unlicensedInfo: (state) => state.unlicensedInfo,
|
|
|
+ endlessLoop: (state) => state.endlessLoop,
|
|
|
}),
|
|
|
},
|
|
|
beforeRouteLeave(to, from, next) {
|
|
@@ -76,17 +86,13 @@ export default {
|
|
|
next();
|
|
|
},
|
|
|
watch: {
|
|
|
- userInfo() {
|
|
|
- this.initPage();
|
|
|
- },
|
|
|
openid() {
|
|
|
if (this.openid) {
|
|
|
this.getParkInfo();
|
|
|
this.showSq = false;
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
- async created(params) { },
|
|
|
async mounted() {
|
|
|
setTimeout(() => {
|
|
|
uni.setNavigationBarTitle({
|
|
@@ -97,7 +103,13 @@ export default {
|
|
|
if (platform === 'micromessenger') {
|
|
|
await initWxJsSdkConfig(['checkJsApi', 'scanQRCode']);
|
|
|
}
|
|
|
-
|
|
|
+ // 不论是否出入场,都使用此函数获取 gateId(闸口机器的ID)
|
|
|
+ if (this.unlicensedInfo?.type && /unlicensedOut|unlicensedIn/.test(this.unlicensedInfo.type) && this.endlessLoop.length === 0) {
|
|
|
+ console.log('用户是扫码进来的97', this.unlicensedInfo);
|
|
|
+ // 此处记录扫码流程执行次数。如果超过一次则不再执行
|
|
|
+ this.$store.commit('SET_ENDLESS_LOOP', this.unlicensedInfo.type);
|
|
|
+ this.qrCodesRule(this.unlicensedInfo.code)
|
|
|
+ }
|
|
|
if (this.openid) {
|
|
|
this.getParkInfo();
|
|
|
this.showSq = false;
|
|
@@ -114,39 +126,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- async initPage() {
|
|
|
- // ws()
|
|
|
- console.time('time');
|
|
|
- const name = {
|
|
|
- a: 'label',
|
|
|
- c: 'label',
|
|
|
- };
|
|
|
- // const nameD = Encrypt(JSON.stringify(name))
|
|
|
- // this.options = params;
|
|
|
- // await this.$onLaunched;
|
|
|
- this.localimgPic = this.$staticPicUrl + '/wxminilocalimg/parkingFee/';
|
|
|
- // app.globalData.pullVipcode = params.pullVipcode || '';
|
|
|
- // app.globalData.mallid = params.mallid || app.globalData.mallid
|
|
|
- if (this.userInfo) {
|
|
|
- // this.getParkInfo();
|
|
|
- return;
|
|
|
- // app.globalData.isNewMember = '';
|
|
|
- // 场景二维码记录(是否扫码进入)
|
|
|
- // app.globalData.paramsScene = {};
|
|
|
- // this.$saveSceneQrcodeDetail(
|
|
|
- // 'page',
|
|
|
- // 'parkingFee',
|
|
|
- // '停车缴费',
|
|
|
- // '',
|
|
|
- // '',
|
|
|
- // '',
|
|
|
- // ''
|
|
|
- // );
|
|
|
- }
|
|
|
- // 埋点本地化
|
|
|
- this.preUrl = uni.getStorageSync('previousUrl');
|
|
|
- uni.setStorageSync('previousUrl', '/pages/parkingFee/home.vue');
|
|
|
- },
|
|
|
toggleType(carType) {
|
|
|
this.ind = 0;
|
|
|
this.active = 0;
|
|
@@ -179,102 +158,17 @@ export default {
|
|
|
uni.showLoading({
|
|
|
title: '加载中',
|
|
|
});
|
|
|
- /*const openid = uni.getStorageSync('openid') || this.openId;
|
|
|
- let params = {
|
|
|
- // mallid: '8a84853b7c91ac5b017c961a9b2a030d',
|
|
|
- // groupId: '8a84853b7c91ac5b017c962dab55030e',
|
|
|
- mallid: this.mallId,
|
|
|
- groupId: this.groupId,
|
|
|
- openid: openid,
|
|
|
- vipcode: this.member?.vipcode,
|
|
|
- };
|
|
|
- console.log(342, params);
|
|
|
- this.$md(params);
|
|
|
- this.$request({
|
|
|
- url: this.$baseURL + 'api/1.0/park/parkInfo',
|
|
|
- data: params,
|
|
|
- method: 'POST',
|
|
|
- header: JSON.parse(uni.getStorageSync('handleUser')),
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (res.data.code === 0) {
|
|
|
- const data = res.data.data || {};
|
|
|
- this.carList = data.carList;
|
|
|
- this.parkInfoEntity = data.parkInfoEntity;
|
|
|
- this.hourMoney =
|
|
|
- parseFloat(this.parkInfoEntity.needmoney) /
|
|
|
- parseFloat(this.parkInfoEntity.tohours);
|
|
|
- let reg = /[;;]/g;
|
|
|
- this.parkInfoEntity.payinstruction =
|
|
|
- this.parkInfoEntity.payinstruction.replace(reg, '\r\n');
|
|
|
- this.parkInfoEntity.hourMoney = this.hourMoney;
|
|
|
- uni.setStorageSync('parkinfo', JSON.stringify(this.parkInfoEntity));
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: res.data.msg,
|
|
|
- duration: 2000,
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- uni.showToast({
|
|
|
- title: '网络超时请稍后再试',
|
|
|
- duration: 2000,
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- console.log(err);
|
|
|
- });*/
|
|
|
try {
|
|
|
- console.log(222222);
|
|
|
- // const res = await parkingLots('8aaa83397bf7310e017bf7c8fb740009');
|
|
|
- // const res = await parkingLots('8aaa87bc7ce98224017ce995fd8a0002');
|
|
|
const res = await parkingLots('8aaa82ea804d07cd0180516ff03b0008'); // TODO: 临时写死
|
|
|
- /*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');
|
|
|
let reg = /[;;]/g;
|
|
|
this.description = res.description.replace(reg, '\r\n').replace(/\r\n/g, '<br/>');
|
|
|
- // console.log(238238238238238238238, this.description);
|
|
|
- // const data = res.data.data || {};
|
|
|
- // 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) /
|
|
|
- // parseFloat(this.parkInfoEntity.tohours);
|
|
|
- // let reg = /[;;]/g;
|
|
|
- // this.parkInfoEntity.payinstruction =
|
|
|
- // this.parkInfoEntity.payinstruction.replace(reg, '\r\n');
|
|
|
- // this.parkInfoEntity.hourMoney = this.hourMoney;
|
|
|
- // uni.setStorageSync('parkinfo', JSON.stringify(this.parkInfoEntity));
|
|
|
-
|
|
|
- // console.log(233, res);
|
|
|
} catch (e) {
|
|
|
console.log(225225, e);
|
|
|
}
|
|
|
- // return;
|
|
|
- // const data = res.data || {};
|
|
|
- // this.carList = data.carList;
|
|
|
- // this.parkInfoEntity = data.parkInfoEntity;
|
|
|
- // this.hourMoney =
|
|
|
- // parseFloat(this.parkInfoEntity.needmoney) /
|
|
|
- // parseFloat(this.parkInfoEntity.tohours);
|
|
|
- // let reg = /[;;]/g;
|
|
|
- // this.parkInfoEntity.payinstruction =
|
|
|
- // this.parkInfoEntity.payinstruction.replace(reg, '\r\n');
|
|
|
- // this.parkInfoEntity.hourMoney = this.hourMoney;
|
|
|
- // uni.setStorageSync('parkinfo', JSON.stringify(this.parkInfoEntity));
|
|
|
},
|
|
|
//缴费说明隐藏显示
|
|
|
top_display() {
|
|
@@ -497,20 +391,16 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
// uni.removeStorageSync('passLogin');
|
|
|
- // 北京停车场开票
|
|
|
- // if (this.parkInfoEntity.parkMallCode === 3) {
|
|
|
- // uni.navigateToMiniProgram({
|
|
|
- // appId: this.$etcpAppId,
|
|
|
- // path: this.$etcpAppInvoicePath,
|
|
|
- // envVersion: 'release',
|
|
|
- // })
|
|
|
- // return
|
|
|
- // }
|
|
|
- // this.$router.push({
|
|
|
- // path: './parkingReceipt/parkingReceipt',
|
|
|
- // })
|
|
|
- if (this.$store.state.passLogin) {
|
|
|
+ // TODO: 北京停车场开票
|
|
|
+ /* if (this.parkInfoEntity.parkMallCode === 3) {
|
|
|
+ uni.navigateToMiniProgram({
|
|
|
+ appId: this.$etcpAppId,
|
|
|
+ path: this.$etcpAppInvoicePath,
|
|
|
+ envVersion: 'release',
|
|
|
+ })
|
|
|
+ return
|
|
|
}
|
|
|
+ */
|
|
|
this.$router.push({ path: 'parkingReceipt' });
|
|
|
},
|
|
|
//停车券兑换
|
|
@@ -528,113 +418,121 @@ export default {
|
|
|
},
|
|
|
tabbarActiveEvent(name) {
|
|
|
this.tabbarActive = name
|
|
|
- this.$store.dispatch('order/unlicensedRule', (code) => {
|
|
|
- // CAR_NOT_FOUND 车场扫描道闸入口,发现无车
|
|
|
- if (code === 'CAR_NOT_FOUND') {
|
|
|
+ if (name === '无牌缴费') {
|
|
|
+ this.$store.dispatch('order/unlicensedRule', (code) => {
|
|
|
+ // CAR_NOT_FOUND 车场扫描道闸入口,发现无车
|
|
|
+ if (code === 'CAR_NOT_FOUND') {
|
|
|
|
|
|
- }
|
|
|
- // CAR_HAS_PLATE 车场扫描道闸入口,发现有牌车
|
|
|
- if (code === 'CAR_HAS_PLATE') {
|
|
|
+ }
|
|
|
+ // CAR_HAS_PLATE 车场扫描道闸入口,发现有牌车
|
|
|
+ if (code === 'CAR_HAS_PLATE') {
|
|
|
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
// 无牌车闸机扫码
|
|
|
async scanCarCode() {
|
|
|
- // 模拟失败
|
|
|
- /* this.$router.push({
|
|
|
- path: 'parkingFeeMsg',
|
|
|
- query:{
|
|
|
- type: 'success'
|
|
|
- }
|
|
|
- }) */
|
|
|
- this.qrCodesRule('e41d4d9dd5534f4aa3de88326a2e6f85')
|
|
|
- return
|
|
|
- const runScanFn = (res) => {
|
|
|
- if (res.scanType == 'QR_CODE' && res.scanType) {
|
|
|
- console.log(res.result);
|
|
|
- // 获取二维码参数之后,模拟提取参数
|
|
|
- const url = res.result;
|
|
|
- if (url.indexOf('auth/') === -1) { // 单纯的code
|
|
|
- console.log('提取到的参数', res.result);
|
|
|
- // this.getPaperCouponInfo(res.result);
|
|
|
- } else { // 从url中提取参数
|
|
|
- const start = url.indexOf('auth/');
|
|
|
- const end = url.indexOf('?');
|
|
|
- const params = url.slice(start, end).split('/');
|
|
|
- if (params && params.length) {
|
|
|
- const couponCode = params[1];
|
|
|
- console.log('提取到的参数', couponCode);
|
|
|
- // this.getPaperCouponInfo(couponCode);
|
|
|
+ try {
|
|
|
+ this.qrCodesRule('e41d4d9dd5534f4aa3de88326a2e6f85')
|
|
|
+ return
|
|
|
+ const runScanFn = (res) => {
|
|
|
+ if (res.scanType == 'QR_CODE' && res.scanType) {
|
|
|
+ console.log(res.result);
|
|
|
+ // 获取二维码参数之后,模拟提取参数
|
|
|
+ const url = res.result;
|
|
|
+ if (url.indexOf('auth/') === -1) { // 单纯的code
|
|
|
+ console.log('提取到的参数', res.result);
|
|
|
+ this.qrCodesRule(res.result)
|
|
|
+ // this.getPaperCouponInfo(res.result);
|
|
|
+ } else { // 从url中提取参数
|
|
|
+ const start = url.indexOf('auth/');
|
|
|
+ const end = url.indexOf('?');
|
|
|
+ const params = url.slice(start, end).split('/');
|
|
|
+ if (params && params.length) {
|
|
|
+ const couponCode = params[1];
|
|
|
+ console.log('提取到的参数', couponCode);
|
|
|
+ this.qrCodesRule(couponCode)
|
|
|
+ // this.getPaperCouponInfo(couponCode);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ };
|
|
|
+ // 微信小程序
|
|
|
+ const platform = getPlatform();
|
|
|
+ if (platform === 'miniprogram') {
|
|
|
+ window.toWXSendMsg({
|
|
|
+ type: 'scanQRCode',
|
|
|
+ });
|
|
|
+ window.subscribe('scanQRCodeOver', (options) => {
|
|
|
+ console.log('微信扫码结束之后的返回参数', options);
|
|
|
+ runScanFn(options);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$wx.scanQRCode({
|
|
|
+ desc: 'scanQRCode desc',
|
|
|
+ needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
|
+ // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
|
|
|
+ success: (res) => {
|
|
|
+ console.log('H5页面扫码获取到的参数——成功', res);
|
|
|
+ runScanFn(res);
|
|
|
+ // this.formMsg.deviceCode = res.resultStr;
|
|
|
+ },
|
|
|
+ error: (res) => {
|
|
|
+ console.log('H5页面扫码获取到的参数——失败', res);
|
|
|
+ // console.log(242, res);
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
- };
|
|
|
- // 微信小程序
|
|
|
- const platform = getPlatform();
|
|
|
- if (platform === 'miniprogram') {
|
|
|
- window.toWXSendMsg({
|
|
|
- type: 'scanQRCode',
|
|
|
- });
|
|
|
- window.subscribe('scanQRCodeOver', (options) => {
|
|
|
- console.log('微信扫码结束之后的返回参数', options);
|
|
|
- runScanFn(options);
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$wx.scanQRCode({
|
|
|
- desc: 'scanQRCode desc',
|
|
|
- needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
|
- // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
|
|
|
- success: (res) => {
|
|
|
- console.log('H5页面扫码获取到的参数——成功', res);
|
|
|
- runScanFn(res);
|
|
|
- // this.formMsg.deviceCode = res.resultStr;
|
|
|
- },
|
|
|
- error: (res) => {
|
|
|
- console.log('H5页面扫码获取到的参数——失败', res);
|
|
|
- // console.log(242, res);
|
|
|
- },
|
|
|
- });
|
|
|
+ } catch (err) {
|
|
|
+ console.log(624, err);
|
|
|
}
|
|
|
|
|
|
- /* uni.scanCode({
|
|
|
- onlyFromCamera: false,
|
|
|
- scanType: ['qrCode'],
|
|
|
- success: (res) => {
|
|
|
- console.log('扫码', res);
|
|
|
- if (res.scanType == 'QR_CODE' && res.scanType) {
|
|
|
- console.log(res.result);
|
|
|
- const url = res.result;
|
|
|
- if (url.indexOf('auth/') === -1) {
|
|
|
- this.getPaperCouponInfo(res.result);
|
|
|
- } else {
|
|
|
- const start = url.indexOf('auth/');
|
|
|
- const end = url.indexOf('?');
|
|
|
- const params = url.slice(start, end).split('/');
|
|
|
- if (params && params.length) {
|
|
|
- const couponCode = params[1];
|
|
|
- this.getPaperCouponInfo(couponCode);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- }); */
|
|
|
},
|
|
|
- // 处理扫码结果
|
|
|
+ // 处理扫码结果: 组装参数,剩余流程,在 缴费支付页面 实现
|
|
|
async qrCodesRule(code) {
|
|
|
try {
|
|
|
const qrCodesres = await qrCodes(code); // 无牌车扫码
|
|
|
- console.log(626, qrCodesres);
|
|
|
+ // 记录buildingId,确保 buildingId 是最新的数据
|
|
|
window.localStorage.setItem('buildingId', qrCodesres.buildingId);
|
|
|
+ // 如果是无牌车扫码:出场
|
|
|
+ console.log('模拟出场', this.unlicensedInfo.type);
|
|
|
+ // return
|
|
|
+ if (this.unlicensedInfo?.type === 'unlicensedOut') {
|
|
|
+ // 查询用户是否存在车牌
|
|
|
+ this.$store.dispatch('order/unlicensedRule', (vehicleNo) => {
|
|
|
+ // 出场前,扫码缴费
|
|
|
+ this.$router.push({
|
|
|
+ path: 'parkingFeeDetail',
|
|
|
+ query: {
|
|
|
+ type: 'success',
|
|
|
+ gateId: qrCodesres.gateId,
|
|
|
+ vehicleNo: vehicleNo
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 如果是无牌车扫码:入场
|
|
|
const unlicensedCarCheckInres = await unlicensedCarCheckIn({ // 获取无牌车牌
|
|
|
gateId: qrCodesres.gateId
|
|
|
});
|
|
|
- console.log(630, unlicensedCarCheckInres);
|
|
|
+ // 前往 缴费支付页面
|
|
|
+ this.$router.push({
|
|
|
+ path: 'parkingFeeMsg',
|
|
|
+ query: {
|
|
|
+ type: 'success',
|
|
|
+ vehicleNo: unlicensedCarCheckInres.vehicleNo
|
|
|
+ }
|
|
|
+ })
|
|
|
} catch (err) {
|
|
|
- console.log(633, err);
|
|
|
- // if(err?.code === "VALIDATION_FAILED") {
|
|
|
-
|
|
|
- // }
|
|
|
+ // 车场扫描道闸入口,发现无车/车场扫描道闸入口,发现有牌车 >>> 停止往下执行,默认提示报错信息
|
|
|
+ if (/CAR_NOT_FOUND|CAR_HAS_PLATE/.test(err.code)) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ console.log('模拟出场的报错', err);
|
|
|
+ return
|
|
|
+ // 如果是其他错误的话,则继续往下执行
|
|
|
this.$router.push({
|
|
|
path: 'parkingFeeMsg',
|
|
|
query: {
|
|
@@ -642,6 +540,10 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ },
|
|
|
+ // 前往支付
|
|
|
+ unlicensedToPay() {
|
|
|
+ this.toHandleSearch(this.unlicensedCar)
|
|
|
}
|
|
|
},
|
|
|
};
|