文件
yjyf/yjyf-app/pages/order/list.vue
MiAn f71a12f5fa feat(app): 重构底部导航为原生 tabbar 并优化页面跳转逻辑
- 新增底部导航栏配置,替换原有多页切换逻辑
- 统一页面跳转使用 switchTab 替代 reLaunch,优化性能
- 新增未读消息角标自动更新功能
- 修复登录后跳转逻辑,兼容旧版 tab 参数
- 调整页面高度为 100vh,修复安全区域适配问题
- 优化订单列表页加载逻辑,支持状态参数传递
2026-11-28 11:29:43 +08:00

76 行
1.7 KiB
Vue

<template>
<view class="user-orders-page">
<UserOrdersView ref="ordersRef" :initial-status="initialStatus" />
<YjyfPrivacyPopup />
</view>
</template>
<script setup>
import { ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import UserOrdersView from '@/components/user/UserOrdersView.vue';
import YjyfPrivacyPopup from '@/components/YjyfPrivacyPopup.vue';
const ordersRef = ref(null);
const initialStatus = ref('all');
let initialShown = false;
const STATUS_MAP = {
0: 'pending_pay',
1: 'pending_accept',
2: 'quoting',
3: 'select_master',
4: 'scheduled',
6: 'serving',
7: 'pending_verify',
8: 'completed',
9: 'cancelled'
};
function consumePendingStatus() {
try {
const val = uni.getStorageSync('yjyf_pending_order_status');
if (val) {
uni.removeStorageSync('yjyf_pending_order_status');
return String(val);
}
} catch (e) {}
return '';
}
onLoad((query) => {
const pending = consumePendingStatus();
const fromQuery = query && query.tab !== undefined && STATUS_MAP[query.tab]
? STATUS_MAP[query.tab]
: ((query && query.status) ? String(query.status) : '');
initialStatus.value = fromQuery || pending || 'all';
});
onShow(() => {
const pending = consumePendingStatus();
uni.$emit('yjyf:refreshUnread');
if (!initialShown) {
initialShown = true;
if (pending) {
initialStatus.value = pending;
}
return;
}
if (pending && ordersRef.value?.switchTab) {
ordersRef.value.switchTab(pending);
return;
}
if (ordersRef.value?.load) {
ordersRef.value.load();
}
});
</script>
<style scoped>
.user-orders-page {
height: 100vh;
overflow: hidden;
background: #F5F6F8;
}
</style>