From a2871cb775229c33f5240f348f29749ac1980dec Mon Sep 17 00:00:00 2001 From: SunCheng Date: Wed, 4 Feb 2026 14:33:30 +0800 Subject: [PATCH] v2 --- Web/src/router/index.js | 6 + Web/src/views/calendarV2/Index.vue | 45 +- Web/src/views/statisticsV2/Index.vue | 172 ++++++++ .../statisticsV2/modules/BudgetSection.vue | 256 +++++++++++ .../statisticsV2/modules/CategorySection.vue | 300 +++++++++++++ .../statisticsV2/modules/MetricsCards.vue | 401 ++++++++++++++++++ .../statisticsV2/modules/PeriodSelector.vue | 85 ++++ .../statisticsV2/modules/TrendSection.vue | 224 ++++++++++ 8 files changed, 1483 insertions(+), 6 deletions(-) create mode 100644 Web/src/views/statisticsV2/Index.vue create mode 100644 Web/src/views/statisticsV2/modules/BudgetSection.vue create mode 100644 Web/src/views/statisticsV2/modules/CategorySection.vue create mode 100644 Web/src/views/statisticsV2/modules/MetricsCards.vue create mode 100644 Web/src/views/statisticsV2/modules/PeriodSelector.vue create mode 100644 Web/src/views/statisticsV2/modules/TrendSection.vue diff --git a/Web/src/router/index.js b/Web/src/router/index.js index d628a3c..08b9775 100644 --- a/Web/src/router/index.js +++ b/Web/src/router/index.js @@ -71,6 +71,12 @@ const router = createRouter({ component: () => import('../views/StatisticsView.vue'), meta: { requiresAuth: true } }, + { + path: '/statistics-v2', + name: 'statistics-v2', + component: () => import('../views/statisticsV2/Index.vue'), + meta: { requiresAuth: true } + }, { path: '/bill-analysis', name: 'bill-analysis', diff --git a/Web/src/views/calendarV2/Index.vue b/Web/src/views/calendarV2/Index.vue index 6c36351..1694db5 100644 --- a/Web/src/views/calendarV2/Index.vue +++ b/Web/src/views/calendarV2/Index.vue @@ -65,6 +65,14 @@
+ + + @@ -75,6 +83,8 @@ import { showToast } from 'vant' import CalendarModule from './modules/Calendar.vue' import StatsModule from './modules/Stats.vue' import TransactionListModule from './modules/TransactionList.vue' +import TransactionDetailSheet from '@/components/Transaction/TransactionDetailSheet.vue' +import { getTransactionDetail } from '@/api/transactionRecord' // 定义组件名称(keep-alive 需要通过 name 识别) defineOptions({ @@ -135,12 +145,35 @@ const onDayClick = async (day) => { selectedDate.value = clickedDate } -// 点击交易卡片 - 跳转到详情页 -const onTransactionClick = (txn) => { - router.push({ - path: '/transaction-detail', - query: { id: txn.id } - }) +// 交易详情弹窗相关 +const showTransactionDetail = ref(false) +const currentTransaction = ref(null) + +// 点击交易卡片 - 打开详情弹窗 +const onTransactionClick = async (txn) => { + try { + // 获取完整的交易详情 + const response = await getTransactionDetail(txn.id) + if (response.success && response.data) { + currentTransaction.value = response.data + showTransactionDetail.value = true + } else { + showToast('获取交易详情失败') + } + } catch (error) { + console.error('获取交易详情失败:', error) + showToast('获取交易详情失败') + } +} + +// 保存交易后刷新列表 +const handleTransactionSave = () => { + handleTransactionsChanged() +} + +// 删除交易后刷新列表 +const handleTransactionDelete = () => { + handleTransactionsChanged() } // 点击通知按钮 diff --git a/Web/src/views/statisticsV2/Index.vue b/Web/src/views/statisticsV2/Index.vue new file mode 100644 index 0000000..9398230 --- /dev/null +++ b/Web/src/views/statisticsV2/Index.vue @@ -0,0 +1,172 @@ + + + + + diff --git a/Web/src/views/statisticsV2/modules/BudgetSection.vue b/Web/src/views/statisticsV2/modules/BudgetSection.vue new file mode 100644 index 0000000..59f9eec --- /dev/null +++ b/Web/src/views/statisticsV2/modules/BudgetSection.vue @@ -0,0 +1,256 @@ + + + + + diff --git a/Web/src/views/statisticsV2/modules/CategorySection.vue b/Web/src/views/statisticsV2/modules/CategorySection.vue new file mode 100644 index 0000000..e7eb2aa --- /dev/null +++ b/Web/src/views/statisticsV2/modules/CategorySection.vue @@ -0,0 +1,300 @@ + + + + + diff --git a/Web/src/views/statisticsV2/modules/MetricsCards.vue b/Web/src/views/statisticsV2/modules/MetricsCards.vue new file mode 100644 index 0000000..e7c2fbd --- /dev/null +++ b/Web/src/views/statisticsV2/modules/MetricsCards.vue @@ -0,0 +1,401 @@ + + + + + diff --git a/Web/src/views/statisticsV2/modules/PeriodSelector.vue b/Web/src/views/statisticsV2/modules/PeriodSelector.vue new file mode 100644 index 0000000..18af9a4 --- /dev/null +++ b/Web/src/views/statisticsV2/modules/PeriodSelector.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/Web/src/views/statisticsV2/modules/TrendSection.vue b/Web/src/views/statisticsV2/modules/TrendSection.vue new file mode 100644 index 0000000..0531081 --- /dev/null +++ b/Web/src/views/statisticsV2/modules/TrendSection.vue @@ -0,0 +1,224 @@ + + + + +