支付宝兼容,排队预约修改,订单逻辑修改

This commit is contained in:
GaoHao
2024-09-24 15:22:34 +08:00
parent 861e97b775
commit 5f03e44701
31 changed files with 823 additions and 737 deletions

View File

@@ -244,6 +244,7 @@ const getUserInfo = function (successCallback, failCallback) {
uni.login({
provider: 'weixin',
success: (data) => {
console.log(data)
// 微信小程序环境
uni.getUserInfo({
provider: 'weixin',
@@ -251,23 +252,14 @@ const getUserInfo = function (successCallback, failCallback) {
let res = await Api.userwxlogin({
code: data.code, //临时登录凭证
rawData: infoRes.rawData,
source: 'wechat'
})
if (res.code == 0) {
resolve(res)
// uni.cache.set('token', res.data.token);
// uni.cache.set('miniAppOpenId', res.data.userInfo
// .miniAppOpenId)
// uni.cache.set('userInfo', res.data.userInfo);
// let pages = getCurrentPages()
// let curPage = pages[pages.length -1 ]
// curPage.onLoad(curPage.options)
// curPage.onShow()
// // curPage.mounted()
// curPage.onReady()
}
},
fail: (err) => {}
});
});
}
});
@@ -279,30 +271,21 @@ const getUserInfo = function (successCallback, failCallback) {
my.getAuthCode({
scopes: 'auth_user',
success: (data) => {
console.log(data)
// 支付宝小程序环境
my.getAuthUserInfo({
success: async (infoRes) => {
uni.cache.set('weixincode', data.authCode);
let res = await Api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
rawData: JSON.stringify(infoRes),
})
if (res.code == 0) {
resolve(res)
// uni.cache.set('token', res.data.token);
// uni.cache.set('miniAppOpenId', res.data.userInfo
// .miniAppOpenId)
// uni.cache.set('userInfo', res.data.userInfo);
// let pages = getCurrentPages()
// let curPage = pages[pages.length -1 ]
// curPage.onLoad(curPage.options)
// curPage.onShow()
// // curPage.mounted()
// curPage.onReady()
}
},
fail: (err) => {}
});
// my.getAuthUserInfo({
// success: async (infoRes) => {
// let res = await Api.userwxlogin({
// code: data.authCode, //临时登录凭证
// rawData: JSON.stringify(infoRes),
// source: 'alipay'
// })
// if (res.code == 0) {
// resolve(res)
// }
// },
// fail: (err) => {}
// });
}
});
})

View File

@@ -80,13 +80,13 @@ async function request(options) {
environment: 'app',
// #endif
// #ifdef H5
environment: 'wx',
environment: 'h5',
// #endif
// #ifdef MP-WEIXIN
environment: 'wx',
// #endif
// #ifdef MP-ALIPAY
environment: 'wx',
environment: 'alipay',
// environment: 'alipay',
// #endif
token: uni.cache.get('token'),
@@ -125,21 +125,20 @@ async function request(options) {
uni.cache.set('storage:offset-time', offset, -1)
return await request(options)
} else {
if (options.toast) {
uni.showToast({
title: res.message || res.msg || res.error,
icon: "none",
success: () => {
setTimeout(res => {
if (options.toast) {
// #ifndef MP-WEIXIN || MP-ALIPAY
uni.pro.hideLoading()
// #endif
}
}, 2000)
}
})
}
console.log(options)
uni.showToast({
title: res.message || res.msg || res.error,
icon: "none",
success: () => {
setTimeout(res => {
if (options.toast) {
// #ifndef MP-WEIXIN || MP-ALIPAY
uni.pro.hideLoading()
// #endif
}
}, 2000)
}
})
return res
}
} else {