添加预算管理功能,重构账单和消息视图,优化路由和组件交互
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 16s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s

This commit is contained in:
孙诚
2026-01-06 20:55:11 +08:00
parent 10b02df6e2
commit 0ca7f44e37
5 changed files with 827 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div class="page-container-flex">
<!-- 顶部导航栏 -->
<van-nav-bar title="交易记录" placeholder>
<van-nav-bar title="账单" placeholder>
<template #right>
<van-button
v-if="tabActive === 'email'"
@@ -12,27 +12,46 @@
>
立即同步
</van-button>
<van-icon
v-if="tabActive === 'message'"
name="passed"
size="20"
@click="messageViewRef?.handleMarkAllRead()"
/>
</template>
</van-nav-bar>
<van-tabs v-model:active="tabActive" animated>
<van-tab title="账单记录" name="balance" />
<van-tab title="邮件记录" name="email" />
<van-tab title="账单" name="balance" />
<van-tab title="邮件" name="email" />
<van-tab title="消息" name="message" />
</van-tabs>
<TransactionsRecord v-if="tabActive === 'balance'" ref="transactionsRecordRef"/>
<EmailRecord v-else-if="tabActive === 'email'" ref="emailRecordRef" />
<MessageView v-else-if="tabActive === 'message'" ref="messageViewRef" :is-component="true" />
</div>
</template>
<script setup>
import { ref } from 'vue';
import { ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import TransactionsRecord from './TransactionsRecord.vue';
import EmailRecord from './EmailRecord.vue';
const tabActive = ref('balance');
import MessageView from './MessageView.vue';
const route = useRoute();
const tabActive = ref(route.query.tab || 'balance');
// 监听路由参数变化,用于从 tabbar 点击时切换 tab
watch(() => route.query.tab, (newTab) => {
if (newTab) {
tabActive.value = newTab;
}
});
const transactionsRecordRef = ref(null);
const emailRecordRef = ref(null);
const messageViewRef = ref(null);
</script>
<style scoped>