chore(小程序): 初始化工程仓库

This commit is contained in:
leon_mac
2026-10-18 15:11:44 +08:00
commit e1975a1abf
49 changed files with 10515 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { api, storeId, network } from '../../services/api'
import { goPage } from '../../core/navigation'
import { useVisit } from '../../stores/visit'
import SettingRow from '../../components/ui/SettingRow.vue'
import type { Store } from '../../core/types'
let flow = useVisit(), store = ref<Store | null>(null), loading = ref(false), error = ref('')
let tableStatus = computed(() => flow.visit ? flow.visit.tableCode + ' 桌 · 已确认' : '尚未确认桌位')
async function load() {
if (loading.value) return
loading.value = true; error.value = ''
try {
let [stores, currentVisit] = await Promise.allSettled([api<Store[]>('/stores'), flow.refreshVisit()])
if (stores.status === 'fulfilled') store.value = stores.value.find(item => item.id === storeId) || null
else throw stores.reason
if (currentVisit.status === 'rejected') throw currentVisit.reason
} catch (e) { error.value = e instanceof Error ? e.message : '门店信息暂不可用' }
finally { loading.value = false }
}
onShow(load)
</script>
<template>
<view class="page">
<view class="page-heading"><view class="eyebrow">YOUR SLOW AFTERNOON</view><view class="title">在店里的时光</view><view class="muted">入座后,把需要的帮助交给我们。</view></view>
<view v-if="error" class="error" role="alert">{{ error }}<button class="mt" :disabled="loading" @tap="load">重新获取门店信息</button></view>
<view v-if="loading && !store" class="empty" role="status">正在获取门店信息…</view>
<view v-else-if="!store && !error" class="empty">暂无门店信息,请稍后再来。</view>
<view v-if="store" class="panel">
<view class="row spread"><text class="store-name">{{ store.name }}</text><text class="chip">{{ network.mode === 'local' ? '店内直连' : '在线服务' }}</text></view>
<view class="muted mt">{{ store.address }}</view><view class="muted">营业时间 {{ store.hours }}</view>
<view class="hint mt">{{ store.notice || '慢慢拼,需要帮助时随时呼叫我们。' }}</view>
</view>
<view class="panel"><text class="muted">当前桌位</text><view class="table-status">{{ tableStatus }}</view><view class="muted">{{ flow.visit ? '本次服务会送到这个桌位。' : '请先核对桌面上的桌位码。' }}</view></view>
<view class="settings-group">
<SettingRow label="确认到店" :value="flow.visit ? flow.visit.tableCode + ' 桌' : '未确认'" description="核对座位,或结束本次到店" @activate="goPage('packages/store/visit')" />
<SettingRow label="申请服务" value="选择服务" description="选择需要的帮助,再确认提交" @activate="goPage('packages/store/request')" />
<SettingRow label="服务记录" value="查看处理进度" description="等待接单时,可在记录中取消申请" @activate="goPage('packages/store/records')" />
</view>
</view>
</template>
<style scoped>
.store-name{font-size:18px;font-weight:600;min-width:0;overflow-wrap:anywhere}.table-status{font-size:22px;font-weight:600;margin:6px 0;overflow-wrap:anywhere}.row.spread{align-items:flex-start;flex-wrap:wrap}
</style>