|
|
@@ -26,6 +26,7 @@ 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";
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
const diners = ref(12);
|
|
|
@@ -73,9 +74,24 @@ uni.reLaunch({
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-onLoad((e) => {
|
|
|
- // let currentDiners = uni.getStorageSync('currentDiners');
|
|
|
- // if (currentDiners) currentDiners.value = currentDiners;
|
|
|
+onLoad(async (e) => {
|
|
|
+ const tableid = uni.getStorageSync('currentTableId') || '';
|
|
|
+ if (!tableid) return;
|
|
|
+ try {
|
|
|
+ const res = await diningApi.GetTableDiningStatus(tableid);
|
|
|
+ const raw = (res && typeof res === 'object') ? res : {};
|
|
|
+ const inDining = raw?.inDining === true;
|
|
|
+ const dinerCount = raw?.dinerCount ?? raw?.diner ?? uni.getStorageSync('currentDiners') ?? 1;
|
|
|
+ if (inDining) {
|
|
|
+ uni.setStorageSync('currentDiners', dinerCount);
|
|
|
+ uni.reLaunch({
|
|
|
+ url: `/pages/orderFood/index?tableid=${encodeURIComponent(tableid)}&diners=${encodeURIComponent(dinerCount)}`
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.warn('查询桌位就餐状态失败,按正常流程', err);
|
|
|
+ }
|
|
|
});
|
|
|
</script>
|
|
|
|