2025-12-28 10:23:57 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="page-container-flex">
|
2026-01-13 19:11:37 +08:00
|
|
|
|
|
2025-12-28 10:23:57 +08:00
|
|
|
|
<!-- 顶部导航栏 -->
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<van-nav-bar title="账单" placeholder>
|
2025-12-28 10:23:57 +08:00
|
|
|
|
<template #right>
|
|
|
|
|
|
<van-button
|
|
|
|
|
|
v-if="tabActive === 'email'"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
:loading="syncing"
|
|
|
|
|
|
@click="emailRecordRef.handleSync()"
|
|
|
|
|
|
>
|
|
|
|
|
|
立即同步
|
|
|
|
|
|
</van-button>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<van-icon
|
|
|
|
|
|
v-if="tabActive === 'message'"
|
|
|
|
|
|
name="passed"
|
|
|
|
|
|
size="20"
|
|
|
|
|
|
@click="messageViewRef?.handleMarkAllRead()"
|
|
|
|
|
|
/>
|
2025-12-28 10:23:57 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</van-nav-bar>
|
2026-01-14 12:05:20 +08:00
|
|
|
|
<van-tabs v-model:active="tabActive" type="card" style="margin: 12px 0 2px 0;">
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<van-tab title="账单" name="balance" />
|
|
|
|
|
|
<van-tab title="邮件" name="email" />
|
|
|
|
|
|
<van-tab title="消息" name="message" />
|
2025-12-28 10:23:57 +08:00
|
|
|
|
</van-tabs>
|
|
|
|
|
|
|
|
|
|
|
|
<TransactionsRecord v-if="tabActive === 'balance'" ref="transactionsRecordRef"/>
|
|
|
|
|
|
<EmailRecord v-else-if="tabActive === 'email'" ref="emailRecordRef" />
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<MessageView v-else-if="tabActive === 'message'" ref="messageViewRef" :is-component="true" />
|
2025-12-28 10:23:57 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
import { ref, watch } from 'vue';
|
|
|
|
|
|
import { useRoute } from 'vue-router';
|
2025-12-28 10:23:57 +08:00
|
|
|
|
import TransactionsRecord from './TransactionsRecord.vue';
|
|
|
|
|
|
import EmailRecord from './EmailRecord.vue';
|
2026-01-06 20:55:11 +08:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-12-28 10:23:57 +08:00
|
|
|
|
|
|
|
|
|
|
const transactionsRecordRef = ref(null);
|
|
|
|
|
|
const emailRecordRef = ref(null);
|
2026-01-06 20:55:11 +08:00
|
|
|
|
const messageViewRef = ref(null);
|
2025-12-28 10:23:57 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
:deep(.van-pull-refresh) {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 设置页面容器背景色 */
|
|
|
|
|
|
:deep(.van-nav-bar) {
|
|
|
|
|
|
background: transparent !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|