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