This commit is contained in:
xiaozhiyong
2024-04-25 15:41:07 +08:00
parent 83d0c894b2
commit e416e23f09
10 changed files with 105 additions and 101 deletions

View File

@@ -17,7 +17,7 @@
import ChargingStation from "../ChargingStation/index.vue"
import order from "../order/index.vue"
import personal from "../personal/index.vue"
import x from "./index.js"
import x from "./index.js"
export default {
components: {
tabBar,
@@ -36,69 +36,71 @@
}
},
watch: {
tabBarIndex(n,o) {
tabBarIndex(n, o) {
let that = this
if(n==1){
if (n == 1) {
this.$refs.ChargingStation.onshow()
}else if(n==2){
} else if (n == 2) {
this.readyScanCode({
success(){
success() {
that.scanCode();
},
fail(){
if(n!==o) that.tabBarIndex = o;
if(n==o) that.tabBarIndex=0;
fail() {
if (n !== o) that.tabBarIndex = o;
if (n == o) that.tabBarIndex = 0;
}
})
}
}
}
},
created() {
this.init()
},
onLoad() {
this.onOrderUpdate();
this.onOrderUpdate();
},
onShow() {
onShow() {
this.showInit()
},
methods: {
readyScanCode({success,fail}){
if(!this.user){
readyScanCode({
success,
fail
}) {
if (!this.user) {
uni.showModal({
title: '提示',
content: '登录后才可扫码下单哦',
confirmText:'去登陆',
success: function (res) {
if (res.confirm) {
confirmText: '去登陆',
success: function(res) {
if (res.confirm) {
uni.reLaunch({
url: '/pages/login/index'
})
} else if (res.cancel) {
} else if (res.cancel) {
fail()
}
}
});
});
return
}
try{
try {
success()
}catch(e){
fail()
} catch (e) {
fail()
}
},
async scanCode() {
let res = await this.tool.scanCode().catch(err=>{
console.log('取消');
this.tabBarIndex = 0
let res = await this.tool.scanCode().catch(err => {
// console.log('取消');
this.tabBarIndex = 0
});
if (res?.result) {
let routingParameter = this.tool.routingParameterGeneration({
type:'qrCode',
qrCode:encodeURIComponent(res.result),
pointTo:'activeScanCode'
if (res?.result) {
let routingParameter = this.tool.routingParameterGeneration({
type: 'qrCode',
qrCode: encodeURIComponent(res.result),
pointTo: 'activeScanCode'
})
uni.navigateTo({
url: `/ChargingStation/pages/placeOrder/index${routingParameter}`
@@ -114,8 +116,8 @@
})
},
showInit() {
this.tool.getCards();
if(this.tabBarIndex==2){
this.tool.getCards();
if (this.tabBarIndex == 2) {
this.tabBarIndex = 0
}
},

View File

@@ -16,12 +16,12 @@
this.init(e)
},
created() {
this.imgURL = `${this.baseImgURL}/start.png`
this.imgURL = `${this.baseImgURL}/start-color.png`
},
methods: {
Interceptor(id) {
let taht = this
console.log(`%c 检测到参数拦截器启动`, 'color:red;font-size:50px');
// console.log(`%c 检测到参数拦截器启动`, 'color:red;font-size:50px');
wxCode.getQrCodeType({
qrCode: id
}).then(res => {
@@ -46,6 +46,7 @@
uni.redirectTo({
url:'/pages/index/index'
})
// uni.redirectTo({
// url:'/pages/login/index'
// })