diff --git a/src/pages-booking/index.vue b/src/pages-booking/index.vue index c4da68f..385c2ad 100644 --- a/src/pages-booking/index.vue +++ b/src/pages-booking/index.vue @@ -265,7 +265,13 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => { // 检查接口返回数据 if (!res || !res.data) { - uni.showToast({ title: res.msg || "订单创建失败,请重试", icon: "none" }); + uni.hideLoading(); + setTimeout(() => { + uni.showToast({ + title: res.msg || "订单创建失败,请重试", + icon: "none", + }); + }, 100); return; } @@ -275,7 +281,9 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => { // 验证支付参数是否完整 if (!nonceStr || !packageVal || !paySign || !signType || !timeStamp) { uni.hideLoading(); - uni.showToast({ title: "支付参数错误,请重试", icon: "none" }); + setTimeout(() => { + uni.showToast({ title: "支付参数错误,请重试", icon: "none" }); + }, 100); return; } @@ -308,9 +316,12 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => { }); } catch (error) { console.error(error); - uni.showToast({ title: "请求出错,请重试", icon: "none" }); + uni.hideLoading(); // 提前关闭 loading,确保 toast 能在安卓正常弹出 + setTimeout(() => { + uni.showToast({ title: "请求出错,请重试", icon: "none" }); + }, 100); } finally { - // 防止某些分支忘记 hide,确保最终关闭 loading(requestPayment 后也可以安全调用 hide) + // 最终兜底关闭 loading uni.hideLoading(); } }, 1000); diff --git a/src/pages-order/order/components/FooterSection/index.vue b/src/pages-order/order/components/FooterSection/index.vue index 56f46c9..aa9e802 100644 --- a/src/pages-order/order/components/FooterSection/index.vue +++ b/src/pages-order/order/components/FooterSection/index.vue @@ -90,7 +90,9 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => { // 检查接口返回数据 if (!res || !res.data) { uni.hideLoading(); - uni.showToast({ title: res.msg || "订单创建失败,请重试", icon: "none" }); + setTimeout(() => { + uni.showToast({ title: res.msg || "订单创建失败,请重试", icon: "none" }); + }, 100); return; } @@ -100,7 +102,9 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => { // 验证支付参数是否完整 if (!nonceStr || !packageVal || !paySign || !signType || !timeStamp) { uni.hideLoading(); - uni.showToast({ title: "支付参数错误,请重试", icon: "none" }); + setTimeout(() => { + uni.showToast({ title: "支付参数错误,请重试", icon: "none" }); + }, 100); return; } diff --git a/src/pages/index/components/chat/ChatMainList/index.vue b/src/pages/index/components/chat/ChatMainList/index.vue index 7a116b7..9303f75 100644 --- a/src/pages/index/components/chat/ChatMainList/index.vue +++ b/src/pages/index/components/chat/ChatMainList/index.vue @@ -848,20 +848,24 @@ const sendMessage = async (message, isInstruct = false) => { // 检查连接是否成功建立 if (!isWsConnected()) { uni.hideLoading(); - uni.showToast({ - title: "连接服务器失败,请稍后重试", - icon: "none", - }); + setTimeout(() => { + uni.showToast({ + title: "连接服务器失败,请稍后重试", + icon: "none", + }); + }, 100); return; } uni.hideLoading(); } catch (error) { console.error("重新连接WebSocket失败:", error); uni.hideLoading(); - uni.showToast({ - title: "连接服务器失败,请稍后重试", - icon: "none", - }); + setTimeout(() => { + uni.showToast({ + title: "连接服务器失败,请稍后重试", + icon: "none", + }); + }, 100); return; } }