点餐页问题修复
This commit is contained in:
@@ -52,7 +52,7 @@ export default async (params) => {
|
|||||||
//获取成功
|
//获取成功
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.hideToast();
|
// uni.hideToast();
|
||||||
resolve(res.data ? res.data : true);
|
resolve(res.data ? res.data : true);
|
||||||
} else {
|
} else {
|
||||||
switch (res.code) {
|
switch (res.code) {
|
||||||
@@ -135,7 +135,7 @@ export default async (params) => {
|
|||||||
// 不管成功还是失败都会执行
|
// 不管成功还是失败都会执行
|
||||||
setTimeout((res) => {
|
setTimeout((res) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.hideToast();
|
// uni.hideToast();
|
||||||
}, 10000);
|
}, 10000);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -817,11 +817,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 分步取值 + 每层兜底,避免某一环不存在导致 undefined
|
const shopExtend = ref('');
|
||||||
const shopExtendShopTable = uni.cache.get('shopTable') || {}; // 兜底空对象
|
|
||||||
const shopExtendMap = shopExtendShopTable.shopExtendMap || {}; // 兜底空对象
|
|
||||||
// 最终声明:即使 shopinfo_bg 不存在,也兜底为空字符串/默认值
|
|
||||||
const shopExtend = ref(shopExtendMap.shopinfo_bg || '');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用数据合集 end
|
* 通用数据合集 end
|
||||||
@@ -1765,8 +1761,11 @@
|
|||||||
if (Message.operate_type == 'init') {
|
if (Message.operate_type == 'init') {
|
||||||
// cartStore.limitTimeDiscount = Message.time_dis_info;
|
// cartStore.limitTimeDiscount = Message.time_dis_info;
|
||||||
cartInit(Message.data)
|
cartInit(Message.data)
|
||||||
|
try {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
} catch (error) {
|
||||||
|
//TODO handle the exception
|
||||||
|
}
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
|
|
||||||
if (!socketInitFinished) {
|
if (!socketInitFinished) {
|
||||||
@@ -2509,11 +2508,16 @@
|
|||||||
if (e.type) {
|
if (e.type) {
|
||||||
orderType.value = e.type;
|
orderType.value = e.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
await handleMixinOnLoad({
|
await handleMixinOnLoad({
|
||||||
...e,
|
...e,
|
||||||
shopId: e.shopId || uni.cache.get('shopId')
|
shopId: e.shopId || uni.cache.get('shopId')
|
||||||
})
|
})
|
||||||
const userInfo = userStore.userInfo
|
|
||||||
|
if(userStore.shopUserInfo.shopExtendList){
|
||||||
|
shopExtend.value=userStore.shopUserInfo.shopExtendList.find(v=>v.autoKey=='shopinfo_bg')||''
|
||||||
|
}
|
||||||
|
|
||||||
// //获取用户信息
|
// //获取用户信息
|
||||||
// const userInfo = await APIshopUserInfo({
|
// const userInfo = await APIshopUserInfo({
|
||||||
// shopId: uni.cache.get('shopId')
|
// shopId: uni.cache.get('shopId')
|
||||||
@@ -2523,11 +2527,13 @@
|
|||||||
// shopId: uni.cache.get('shopId')
|
// shopId: uni.cache.get('shopId')
|
||||||
// });
|
// });
|
||||||
Object.assign(shopInfo, userStore.shopInfo);
|
Object.assign(shopInfo, userStore.shopInfo);
|
||||||
|
if (e.type == 'beforehand') {
|
||||||
|
uni.cache.set("tableCode", userStore.shopUserInfo.id);
|
||||||
if (userInfo && typeof userInfo === 'object') {
|
options.initMessage.table_code = userStore.shopUserInfo.id
|
||||||
shopUserInfo.value = userInfo
|
|
||||||
}
|
}
|
||||||
|
options.initMessage.shop_id = userStore.shopInfo.id
|
||||||
|
shopUserInfo.value = userStore.shopUserInfo
|
||||||
|
|
||||||
await productqueryProduct();
|
await productqueryProduct();
|
||||||
|
|
||||||
const extraInitPar = {}
|
const extraInitPar = {}
|
||||||
@@ -2539,6 +2545,11 @@
|
|||||||
|
|
||||||
const time_dis_info = await getLimitDiscount()
|
const time_dis_info = await getLimitDiscount()
|
||||||
options.initMessage.time_dis_info = time_dis_info
|
options.initMessage.time_dis_info = time_dis_info
|
||||||
|
|
||||||
|
console.log('options.initMessage', {
|
||||||
|
...options.initMessage,
|
||||||
|
...extraInitPar,
|
||||||
|
})
|
||||||
useSocket.connect({
|
useSocket.connect({
|
||||||
...options.initMessage,
|
...options.initMessage,
|
||||||
...extraInitPar,
|
...extraInitPar,
|
||||||
|
|||||||
@@ -90,11 +90,13 @@ export const useWebSocket = defineStore('socketTask', () => {
|
|||||||
let onMessage = () => {
|
let onMessage = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
function setOnMessage(onMessageBallBack){
|
|
||||||
onMessage=onMessageBallBack
|
function setOnMessage(onMessageBallBack) {
|
||||||
|
onMessage = onMessageBallBack
|
||||||
}
|
}
|
||||||
function chnageInitMessage(data){
|
|
||||||
initMessage=data
|
function chnageInitMessage(data) {
|
||||||
|
initMessage = data
|
||||||
}
|
}
|
||||||
// 连接 WebSocket
|
// 连接 WebSocket
|
||||||
const connect = async (connectMsg, onMessageBallBack) => {
|
const connect = async (connectMsg, onMessageBallBack) => {
|
||||||
@@ -127,6 +129,8 @@ export const useWebSocket = defineStore('socketTask', () => {
|
|||||||
url: uni.conf.baseUrlwws + '?' + Date.now(),
|
url: uni.conf.baseUrlwws + '?' + Date.now(),
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('连接成功');
|
console.log('连接成功');
|
||||||
|
console.log('connectMsg', connectMsg);
|
||||||
|
console.log('initMessage', initMessage);
|
||||||
isConnected.value = true;
|
isConnected.value = true;
|
||||||
// 监听初始化成功在开启心跳
|
// 监听初始化成功在开启心跳
|
||||||
startHeartbeat();
|
startHeartbeat();
|
||||||
@@ -233,7 +237,7 @@ export const useWebSocket = defineStore('socketTask', () => {
|
|||||||
|
|
||||||
// 发送消息
|
// 发送消息
|
||||||
const sendMessage = (data) => {
|
const sendMessage = (data) => {
|
||||||
if(!data){
|
if (!data) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (isConnected.value && data) {
|
if (isConnected.value && data) {
|
||||||
@@ -369,6 +373,8 @@ export const useWebSocket = defineStore('socketTask', () => {
|
|||||||
initNetworkListener,
|
initNetworkListener,
|
||||||
connect,
|
connect,
|
||||||
allowReconnect,
|
allowReconnect,
|
||||||
socketTask,setOnMessage,chnageInitMessage
|
socketTask,
|
||||||
|
setOnMessage,
|
||||||
|
chnageInitMessage
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
@@ -46,10 +46,11 @@ export function bindInvite(args) {
|
|||||||
if (!inviteCode || inviteCode === null || inviteCode === undefined) {
|
if (!inviteCode || inviteCode === null || inviteCode === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const shopUserInfo=uni.cache.get('shopUserInfo')
|
||||||
// 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数
|
// 邀请码有效,调用自动绑定邀请人接口,传递绑定所需参数
|
||||||
autoBindInviteUser({
|
autoBindInviteUser({
|
||||||
id: shopUserId,
|
id: shopUserInfo.id,
|
||||||
shopId,
|
shopId,
|
||||||
inviteCode
|
inviteCode
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user