支付接口调用

This commit is contained in:
duan
2024-05-21 16:59:31 +08:00
parent 07a6425ec4
commit 75ac4e967c
20 changed files with 512 additions and 245 deletions

View File

@@ -276,27 +276,13 @@
if (e.q) {
this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
uni.cache.set('tableCode', this.tableCode)
// this.scanCodehandle()
this.scanCodehandle()
} else {
this.tableCode = e.tableCode
uni.cache.set('tableCode', this.tableCode)
// this.handlemessage()
}
let res = await this.api.productqueryShopIdByTableCode({
code: uni.cache.get('tableCode')
})
try {
if (res.data) {
uni.cache.set('shopUser', res.data)
if (e.q) {
this.scanCodehandle()
} else {
this.handlemessage()
}
}
} catch (e) {
//TODO handle the exception
this.productqueryShopIdByTableCode()//获取shop User id
}
uni.$on('message', this.getMessage)
this.$nextTick(() => {
@@ -308,7 +294,21 @@
uni.$off('message')
},
methods: {
getMessage(msg) {
// 单独获取他的shopUserid
async productqueryShopIdByTableCode() {
let res = await this.api.productqueryShopIdByTableCode({
code: uni.cache.get('tableCode')
})
try {
if (res.data) {
uni.cache.set('shopUser', res.data)
this.handlemessage()
}
} catch (e) {
//TODO handle the exception
}
},
getMessage(msg) { //wss 回显数据
if (msg.status != 'success') {
uni.showToast({
title: msg.msg,
@@ -348,12 +348,12 @@
this.cartLists = msg
this.productqueryProduct() //list 数据
break;
case 'createOrder': //去结算
let item = JSON.stringify(msg.data)
uni.redirectTo({
url: '/pages/order_detail/order_detail?tableId=' + item
});
break;
// case 'createOrder': //去结算
// let item = JSON.stringify(msg.data)
// uni.redirectTo({
// url: '/pages/order_detail/order_detail?tableId=' + item
// });
// break;
case 'queryCart': //待提交
// let queryCart = JSON.stringify(msg.data)
// uni.pro.navigateTo('order_detail/order_detail', {
@@ -399,7 +399,7 @@
}
},
scanCodehandle(e) {
// #ifdef MP-WEIXIN || MP-ALIPAY
uni.login({ //alipay weixin
provider: 'weixin',
@@ -423,8 +423,7 @@
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
// uni.cache.set('shopUser', res.data.shopUser);
this.handlemessage()
this.productqueryShopIdByTableCode()//获取shop User id
}
},
fail: (err) => {