|
|
@@ -13,10 +13,12 @@
|
|
|
|
|
|
<view class="more-number" @click="addDiners" v-if="diners < 16">查看更多</view>
|
|
|
|
|
|
- <view class="confirm-button" @click="toOrderFood" hover-class="hover-active">确定</view>
|
|
|
+ <view class="confirm-button" @tap.stop="toOrderFood" hover-class="hover-active">确定</view>
|
|
|
|
|
|
- <!-- 未登录时弹出:手机号授权一键登录 -->
|
|
|
- <LoginModal v-model:open="showLoginModal" @success="handleLoginSuccess" @cancel="handleLoginCancel" />
|
|
|
+ <!-- 未登录时弹出:手机号授权一键登录(需高 z-index 盖住其他内容) -->
|
|
|
+ <view class="login-modal-wrapper">
|
|
|
+ <LoginModal v-model:open="showLoginModal" @success="handleLoginSuccess" @cancel="handleLoginCancel" />
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -26,13 +28,12 @@ import { ref } from "vue";
|
|
|
import { go } from "@/utils/utils.js";
|
|
|
import { useUserStore } from "@/store/user.js";
|
|
|
import LoginModal from "@/pages/components/LoginModal.vue";
|
|
|
-import * as diningApi from "@/api/dining.js";
|
|
|
+import { TOKEN } from "@/settings/enums.js";
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
const diners = ref(12);
|
|
|
const currentDiners = ref(1);
|
|
|
const showLoginModal = ref(false);
|
|
|
-const checking = ref(false); // 是否正在查询桌位就餐状态
|
|
|
// 登录成功后要跳转的点餐页参数(手机号授权完成后再跳转)
|
|
|
const pendingNavigate = ref(null);
|
|
|
|
|
|
@@ -64,15 +65,16 @@ const toOrderFood = () => {
|
|
|
const dinersVal = currentDiners.value;
|
|
|
if (tableid) uni.setStorageSync('currentTableId', String(tableid));
|
|
|
|
|
|
- if (!userStore.getToken) {
|
|
|
+ const token = userStore.getToken || uni.getStorageSync(TOKEN) || '';
|
|
|
+ if (!token) {
|
|
|
// 未登录:弹出手机号授权一键登录弹窗,登录成功后再跳转
|
|
|
pendingNavigate.value = { tableid, dinersVal };
|
|
|
showLoginModal.value = true;
|
|
|
return;
|
|
|
}
|
|
|
-uni.reLaunch({
|
|
|
- url: `/pages/orderFood/index?tableid=${tableid}&diners=${dinersVal}`
|
|
|
-});
|
|
|
+ uni.reLaunch({
|
|
|
+ url: `/pages/orderFood/index?tableid=${tableid}&diners=${dinersVal}`
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// 接口由 App.vue 统一调用;App.vue 在 inDining 为 true 且未登录时会重定向到本页并带 inDining=1,此时需弹出登录
|
|
|
@@ -80,7 +82,8 @@ onLoad((options) => {
|
|
|
const inDining = options?.inDining === '1' || options?.inDining === 1;
|
|
|
const tableid = options?.tableid || uni.getStorageSync('currentTableId') || '';
|
|
|
const dinersVal = options?.diners || uni.getStorageSync('currentDiners') || 1;
|
|
|
- if (inDining && tableid && !userStore.getToken) {
|
|
|
+ const token = userStore.getToken || uni.getStorageSync(TOKEN) || '';
|
|
|
+ if (inDining && tableid && !token) {
|
|
|
uni.setStorageSync('currentTableId', tableid);
|
|
|
uni.setStorageSync('currentDiners', dinersVal);
|
|
|
pendingNavigate.value = { tableid, dinersVal };
|
|
|
@@ -150,5 +153,23 @@ onLoad((options) => {
|
|
|
left: 50%;
|
|
|
transform: translateX(-50%);
|
|
|
font-size: 32rpx;
|
|
|
+ z-index: 100;
|
|
|
+}
|
|
|
+
|
|
|
+/* 登录弹窗层级(与 index 一致,确保弹窗可显示) */
|
|
|
+.login-modal-wrapper {
|
|
|
+ position: relative;
|
|
|
+ z-index: 99999;
|
|
|
+
|
|
|
+ :deep(.uni-popup) {
|
|
|
+ z-index: 99999 !important;
|
|
|
+ top: 0 !important;
|
|
|
+ left: 0 !important;
|
|
|
+ right: 0 !important;
|
|
|
+ bottom: 0 !important;
|
|
|
+ }
|
|
|
+ :deep(.uni-popup__wrapper) {
|
|
|
+ z-index: 99999 !important;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|