This commit is contained in:
GaoHao
2024-08-08 17:06:26 +08:00
parent d82bd93033
commit b67f1381ca
4 changed files with 51 additions and 60 deletions

View File

@@ -166,7 +166,7 @@ export default {
return uni.api.get("/product/queryShopIdByTableCode", data);
},
geocodelocation(data) { //根据经纬度获取信息
return uni.api.get("/location/geocode", data);
return uni.api.get("/location/geocode", data, false);
},
// 修改头像和昵称
upUserInfo(data) {

View File

@@ -16,11 +16,11 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
// #endif
// #ifdef APP || MP-WEIXIN
const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
// const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
// const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
// const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
// const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
// #endif
// import VConsole from "./vConsole.js"

View File

@@ -216,9 +216,22 @@
title: "支付成功"
})
uni.hideLoading()
setTimeout(res => {
uni.navigateBack()
}, 500)
let pages = getCurrentPages()
if ( pages.length > 1) {
setTimeout(res => {
uni.navigateBack()
}, 500)
} else {
uni.exitMiniProgram({
success: function () {
console.log('退出成功');
},
fail: function () {
console.log('退出失败');
}
});
}
},
fail: (res) => {
uni.hideLoading()

View File

@@ -424,38 +424,33 @@
scrollTop: 0,
duration: 0
});
if (!uni.cache.get('token')) {
uni.login({
provider: 'weixin',
success: async (data) => {
try {
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
rawData: infoRes.rawData
})
if (res.code == 0) {
uni.cache.set('token', res.data.token);
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
uni.$on('message', this.getMessage)
_this.getLocation()
}
},
fail: (err) => {}
});
} catch (e) {}
}
});
} else {
uni.$on('message', this.getMessage)
_this.getLocation()
}
uni.login({
provider: 'weixin',
success: async (data) => {
try {
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
rawData: infoRes.rawData
})
if (res.code == 0) {
uni.cache.set('token', res.data.token);
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
uni.$on('message', this.getMessage)
_this.getLocation()
}
},
fail: (err) => {}
});
} catch (e) {}
}
});
},
methods: {
navigateBacknav() {
@@ -508,24 +503,7 @@
},
fail: async (err) => {
console.log(err, '获取错误') //测试用于app
let successres = await this.api.geocodelocation({
lng: '',
lat: '',
})
if (successres.code == 0) {
console.log(successres.data.addressComponent.streetNumber.location.split(','))
let res = successres.data.addressComponent.streetNumber.location.split(',')
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent.district, //district: "未央区"
lng: res[0],
lat: res[1],
}
uni.cache.set('getLocationstorage', datastorage);
this.productqueryShop();
}
this.productqueryShop();
}
});
},
@@ -536,8 +514,8 @@
async productqueryShop() {
let res = await this.api.productqueryShop({
code: uni.cache.get('tableCode'),
lng: uni.cache.get('getLocationstorage').lng,
lat: uni.cache.get('getLocationstorage').lat,
lng: uni.cache.get('getLocationstorage').lng?uni.cache.get('getLocationstorage').lng:'',
lat: uni.cache.get('getLocationstorage').lat? uni.cache.get('getLocationstorage').lat:'',
})
if (res.code == 0) {
uni.cache.set('shopUser', res.data.storeInfo.id)