2025-12-28 10:23:57 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="page-container-flex">
|
|
|
|
|
|
<!-- 顶部导航栏 -->
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<van-nav-bar title="账单" placeholder>
|
2025-12-28 10:23:57 +08:00
|
|
|
|
<template #right>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-button
|
2025-12-28 10:23:57 +08:00
|
|
|
|
v-if="tabActive === 'email'"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
size="small"
|
|
|
|
|
|
type="primary"
|
2025-12-28 10:23:57 +08:00
|
|
|
|
:loading="syncing"
|
|
|
|
|
|
@click="emailRecordRef.handleSync()"
|
|
|
|
|
|
>
|
|
|
|
|
|
立即同步
|
|
|
|
|
|
</van-button>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-icon
|
|
|
|
|
|
v-if="tabActive === 'message'"
|
|
|
|
|
|
name="passed"
|
|
|
|
|
|
size="20"
|
|
|
|
|
|
@click="messageViewRef?.handleMarkAllRead()"
|
2026-01-06 20:55:11 +08:00
|
|
|
|
/>
|
2025-12-28 10:23:57 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</van-nav-bar>
|
2026-01-16 11:15:44 +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>
|
|
|
|
|
|
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<TransactionsRecord v-if="tabActive === 'balance'" ref="transactionsRecordRef" />
|
2025-12-28 10:23:57 +08:00
|
|
|
|
<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-16 11:15:44 +08:00
|
|
|
|
import { ref, watch } from 'vue'
|
|
|
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
|
import TransactionsRecord from './TransactionsRecord.vue'
|
|
|
|
|
|
import EmailRecord from './EmailRecord.vue'
|
|
|
|
|
|
import MessageView from './MessageView.vue'
|
2026-01-06 20:55:11 +08:00
|
|
|
|
|
2026-01-16 11:15:44 +08:00
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
const tabActive = ref(route.query.tab || 'balance')
|
2026-01-06 20:55:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 监听路由参数变化,用于从 tabbar 点击时切换 tab
|
2026-01-16 11:15:44 +08:00
|
|
|
|
watch(
|
|
|
|
|
|
() => route.query.tab,
|
|
|
|
|
|
(newTab) => {
|
|
|
|
|
|
if (newTab) {
|
|
|
|
|
|
tabActive.value = newTab
|
|
|
|
|
|
}
|
2026-01-06 20:55:11 +08:00
|
|
|
|
}
|
2026-01-16 11:15:44 +08:00
|
|
|
|
)
|
2025-12-28 10:23:57 +08:00
|
|
|
|
|
2026-01-16 11:15:44 +08:00
|
|
|
|
const transactionsRecordRef = ref(null)
|
|
|
|
|
|
const emailRecordRef = ref(null)
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
2026-01-16 11:15:44 +08:00
|
|
|
|
</style>
|