2026-01-15 21:19:03 +08:00
|
|
|
|
<!-- eslint-disable vue/no-v-html -->
|
|
|
|
|
|
<template>
|
2026-01-07 14:36:30 +08:00
|
|
|
|
<div class="page-container-flex">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-nav-bar
|
|
|
|
|
|
title="预算管理"
|
|
|
|
|
|
placeholder
|
|
|
|
|
|
>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<template #right>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-icon
|
|
|
|
|
|
v-if="
|
|
|
|
|
|
activeTab !== BudgetCategory.Savings && uncoveredCategories.length > 0 && !isArchive
|
|
|
|
|
|
"
|
|
|
|
|
|
name="warning-o"
|
|
|
|
|
|
size="20"
|
2026-01-13 17:00:44 +08:00
|
|
|
|
color="var(--van-danger-color)"
|
2026-01-11 12:33:12 +08:00
|
|
|
|
style="margin-right: 12px"
|
2026-01-12 22:29:39 +08:00
|
|
|
|
title="查看未覆盖预算的分类"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
@click="showUncoveredDetails = true"
|
2026-01-11 12:33:12 +08:00
|
|
|
|
/>
|
2026-01-12 22:29:39 +08:00
|
|
|
|
<van-icon
|
|
|
|
|
|
v-if="isArchive"
|
2026-01-15 21:19:03 +08:00
|
|
|
|
name="comment-o"
|
2026-01-12 22:29:39 +08:00
|
|
|
|
size="20"
|
|
|
|
|
|
title="已归档月份总结"
|
|
|
|
|
|
style="margin-right: 12px"
|
|
|
|
|
|
@click="showArchiveSummary()"
|
|
|
|
|
|
/>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-icon
|
2026-01-07 20:31:12 +08:00
|
|
|
|
v-if="activeTab !== BudgetCategory.Savings"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
name="plus"
|
|
|
|
|
|
size="20"
|
2026-01-12 22:29:39 +08:00
|
|
|
|
title="添加预算"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
@click="budgetEditRef.open({ category: activeTab })"
|
2026-01-07 20:31:12 +08:00
|
|
|
|
/>
|
|
|
|
|
|
<van-icon
|
|
|
|
|
|
v-else
|
2026-01-16 11:15:44 +08:00
|
|
|
|
name="setting-o"
|
|
|
|
|
|
size="20"
|
2026-01-12 22:29:39 +08:00
|
|
|
|
title="储蓄分类配置"
|
2026-01-07 20:31:12 +08:00
|
|
|
|
@click="savingsConfigRef.open()"
|
|
|
|
|
|
/>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</van-nav-bar>
|
|
|
|
|
|
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-tabs
|
|
|
|
|
|
v-model:active="activeTab"
|
|
|
|
|
|
type="card"
|
|
|
|
|
|
class="budget-tabs"
|
|
|
|
|
|
style="margin: 12px 4px"
|
|
|
|
|
|
>
|
|
|
|
|
|
<van-tab
|
|
|
|
|
|
title="支出"
|
|
|
|
|
|
:name="BudgetCategory.Expense"
|
|
|
|
|
|
>
|
|
|
|
|
|
<BudgetSummary
|
2026-01-08 15:16:25 +08:00
|
|
|
|
v-if="activeTab !== BudgetCategory.Savings"
|
2026-01-11 12:41:52 +08:00
|
|
|
|
v-model:date="selectedDate"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
:stats="overallStats"
|
|
|
|
|
|
:title="activeTabTitle"
|
|
|
|
|
|
:get-value-class="getValueClass"
|
2026-01-08 15:16:25 +08:00
|
|
|
|
/>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-pull-refresh
|
|
|
|
|
|
v-model="isRefreshing"
|
|
|
|
|
|
class="scroll-content"
|
|
|
|
|
|
@refresh="onRefresh"
|
|
|
|
|
|
>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<div class="budget-list">
|
|
|
|
|
|
<template v-if="expenseBudgets?.length > 0">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-swipe-cell
|
|
|
|
|
|
v-for="budget in expenseBudgets"
|
|
|
|
|
|
:key="budget.id"
|
|
|
|
|
|
>
|
|
|
|
|
|
<BudgetCard
|
2026-01-07 17:33:50 +08:00
|
|
|
|
:budget="budget"
|
|
|
|
|
|
:progress-color="getProgressColor(budget)"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
:percent-class="{
|
|
|
|
|
|
warning: budget.current / budget.limit > 0.8
|
|
|
|
|
|
}"
|
2026-01-07 17:33:50 +08:00
|
|
|
|
:period-label="getPeriodLabel(budget.type)"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
@click="
|
|
|
|
|
|
budgetEditRef.open({
|
|
|
|
|
|
data: budget,
|
|
|
|
|
|
isEditFlag: true,
|
|
|
|
|
|
category: budget.category
|
|
|
|
|
|
})
|
|
|
|
|
|
"
|
2026-01-07 17:33:50 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #amount-info>
|
|
|
|
|
|
<div class="info-item">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div class="label">
|
|
|
|
|
|
已支出
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="value expense">
|
|
|
|
|
|
¥{{ formatMoney(budget.current) }}
|
|
|
|
|
|
</div>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
2026-01-07 17:33:50 +08:00
|
|
|
|
<div class="info-item">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div class="label">
|
|
|
|
|
|
预算
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="value">
|
|
|
|
|
|
¥{{ formatMoney(budget.limit) }}
|
|
|
|
|
|
</div>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
2026-01-07 17:33:50 +08:00
|
|
|
|
<div class="info-item">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div class="label">
|
|
|
|
|
|
余额
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="value"
|
|
|
|
|
|
:class="budget.limit - budget.current >= 0 ? 'income' : 'expense'"
|
|
|
|
|
|
>
|
2026-01-07 17:33:50 +08:00
|
|
|
|
¥{{ formatMoney(budget.limit - budget.current) }}
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-01-07 17:33:50 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</BudgetCard>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<template #right>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-button
|
|
|
|
|
|
square
|
|
|
|
|
|
text="删除"
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
class="delete-button"
|
|
|
|
|
|
@click="handleDelete(budget)"
|
|
|
|
|
|
/>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</van-swipe-cell>
|
|
|
|
|
|
</template>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-empty
|
|
|
|
|
|
v-else
|
|
|
|
|
|
description="暂无支出预算"
|
|
|
|
|
|
/>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div style="height: calc(50px + env(safe-area-inset-bottom, 0px))" />
|
2026-01-10 23:01:02 +08:00
|
|
|
|
</van-pull-refresh>
|
2026-01-09 15:42:59 +08:00
|
|
|
|
</van-tab>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-tab
|
|
|
|
|
|
title="收入"
|
|
|
|
|
|
:name="BudgetCategory.Income"
|
|
|
|
|
|
>
|
|
|
|
|
|
<BudgetSummary
|
2026-01-09 15:42:59 +08:00
|
|
|
|
v-if="activeTab !== BudgetCategory.Savings"
|
2026-01-11 12:41:52 +08:00
|
|
|
|
v-model:date="selectedDate"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
:stats="overallStats"
|
|
|
|
|
|
:title="activeTabTitle"
|
|
|
|
|
|
:get-value-class="getValueClass"
|
2026-01-09 15:42:59 +08:00
|
|
|
|
/>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-pull-refresh
|
|
|
|
|
|
v-model="isRefreshing"
|
|
|
|
|
|
class="scroll-content"
|
|
|
|
|
|
@refresh="onRefresh"
|
|
|
|
|
|
>
|
2026-01-09 15:42:59 +08:00
|
|
|
|
<div class="budget-list">
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<template v-if="incomeBudgets?.length > 0">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-swipe-cell
|
|
|
|
|
|
v-for="budget in incomeBudgets"
|
|
|
|
|
|
:key="budget.id"
|
|
|
|
|
|
>
|
|
|
|
|
|
<BudgetCard
|
2026-01-07 17:33:50 +08:00
|
|
|
|
:budget="budget"
|
2026-01-14 20:24:32 +08:00
|
|
|
|
:progress-color="getProgressColor(budget)"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
:percent-class="{
|
|
|
|
|
|
income: budget.current / budget.limit >= 1
|
|
|
|
|
|
}"
|
2026-01-07 17:33:50 +08:00
|
|
|
|
:period-label="getPeriodLabel(budget.type)"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
@click="
|
|
|
|
|
|
budgetEditRef.open({
|
|
|
|
|
|
data: budget,
|
|
|
|
|
|
isEditFlag: true,
|
|
|
|
|
|
category: budget.category
|
|
|
|
|
|
})
|
|
|
|
|
|
"
|
2026-01-07 17:33:50 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #amount-info>
|
|
|
|
|
|
<div class="info-item">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div class="label">
|
|
|
|
|
|
已收入
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="value income">
|
|
|
|
|
|
¥{{ formatMoney(budget.current) }}
|
|
|
|
|
|
</div>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
2026-01-07 17:33:50 +08:00
|
|
|
|
<div class="info-item">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div class="label">
|
|
|
|
|
|
目标
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="value">
|
|
|
|
|
|
¥{{ formatMoney(budget.limit) }}
|
|
|
|
|
|
</div>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
2026-01-07 17:33:50 +08:00
|
|
|
|
<div class="info-item">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div class="label">
|
|
|
|
|
|
差额
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="value"
|
|
|
|
|
|
:class="budget.current >= budget.limit ? 'income' : 'expense'"
|
|
|
|
|
|
>
|
2026-01-07 17:33:50 +08:00
|
|
|
|
¥{{ formatMoney(Math.abs(budget.limit - budget.current)) }}
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-01-07 17:33:50 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</BudgetCard>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<template #right>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-button
|
|
|
|
|
|
square
|
|
|
|
|
|
text="删除"
|
|
|
|
|
|
type="danger"
|
|
|
|
|
|
class="delete-button"
|
|
|
|
|
|
@click="handleDelete(budget)"
|
|
|
|
|
|
/>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</van-swipe-cell>
|
|
|
|
|
|
</template>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-empty
|
|
|
|
|
|
v-else
|
|
|
|
|
|
description="暂无收入预算"
|
|
|
|
|
|
/>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div style="height: calc(50px + env(safe-area-inset-bottom, 0px))" />
|
2026-01-10 23:01:02 +08:00
|
|
|
|
</van-pull-refresh>
|
2026-01-09 15:42:59 +08:00
|
|
|
|
</van-tab>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-tab
|
|
|
|
|
|
title="存款"
|
|
|
|
|
|
:name="BudgetCategory.Savings"
|
|
|
|
|
|
>
|
|
|
|
|
|
<van-pull-refresh
|
|
|
|
|
|
v-model="isRefreshing"
|
|
|
|
|
|
class="scroll-content"
|
|
|
|
|
|
style="padding-top: 4px"
|
|
|
|
|
|
@refresh="onRefresh"
|
|
|
|
|
|
>
|
2026-01-09 15:42:59 +08:00
|
|
|
|
<div class="budget-list">
|
2026-01-06 20:55:11 +08:00
|
|
|
|
<template v-if="savingsBudgets?.length > 0">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<BudgetCard
|
|
|
|
|
|
v-for="budget in savingsBudgets"
|
2026-01-09 15:42:59 +08:00
|
|
|
|
:key="budget.id"
|
|
|
|
|
|
:budget="budget"
|
2026-01-14 20:24:32 +08:00
|
|
|
|
:progress-color="getProgressColor(budget)"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
:percent-class="{ income: budget.current / budget.limit >= 1 }"
|
2026-01-09 15:42:59 +08:00
|
|
|
|
:period-label="getPeriodLabel(budget.type)"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
style="margin: 0 12px 12px"
|
2026-01-09 15:42:59 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #amount-info>
|
|
|
|
|
|
<div class="info-item">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div class="label">
|
|
|
|
|
|
已存
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="value income">
|
|
|
|
|
|
¥{{ formatMoney(budget.current) }}
|
|
|
|
|
|
</div>
|
2026-01-09 15:42:59 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="info-item">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div class="label">
|
|
|
|
|
|
目标
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="value">
|
|
|
|
|
|
¥{{ formatMoney(budget.limit) }}
|
|
|
|
|
|
</div>
|
2026-01-09 15:42:59 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="info-item">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div class="label">
|
|
|
|
|
|
还差
|
|
|
|
|
|
</div>
|
2026-01-09 15:42:59 +08:00
|
|
|
|
<div class="value expense">
|
|
|
|
|
|
¥{{ formatMoney(Math.max(0, budget.limit - budget.current)) }}
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
2026-01-09 15:42:59 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 20:00:41 +08:00
|
|
|
|
<template #footer>
|
|
|
|
|
|
<div class="card-footer-actions">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-button
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
icon="arrow-left"
|
|
|
|
|
|
plain
|
2026-01-15 20:00:41 +08:00
|
|
|
|
type="primary"
|
|
|
|
|
|
@click.stop="handleSavingsNav(budget, -1)"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
/>
|
2026-01-15 20:00:41 +08:00
|
|
|
|
<span class="current-date-label">
|
|
|
|
|
|
{{ getSavingsDateLabel(budget) }}
|
|
|
|
|
|
</span>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-button
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
icon="arrow"
|
|
|
|
|
|
plain
|
2026-01-15 20:00:41 +08:00
|
|
|
|
type="primary"
|
|
|
|
|
|
icon-position="right"
|
2026-01-15 20:31:10 +08:00
|
|
|
|
:disabled="disabledSavingsNextNav(budget)"
|
2026-01-15 20:00:41 +08:00
|
|
|
|
@click.stop="handleSavingsNav(budget, 1)"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
/>
|
2026-01-15 20:00:41 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
2026-01-08 15:16:25 +08:00
|
|
|
|
</BudgetCard>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</template>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-empty
|
|
|
|
|
|
v-else
|
|
|
|
|
|
description="暂无存款计划"
|
|
|
|
|
|
/>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div style="height: calc(50px + env(safe-area-inset-bottom, 0px))" />
|
2026-01-10 23:01:02 +08:00
|
|
|
|
</van-pull-refresh>
|
2026-01-09 15:42:59 +08:00
|
|
|
|
</van-tab>
|
|
|
|
|
|
</van-tabs>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<BudgetEditPopup
|
2026-01-07 17:33:50 +08:00
|
|
|
|
ref="budgetEditRef"
|
2026-01-16 11:15:44 +08:00
|
|
|
|
@success="fetchBudgetList"
|
2026-01-07 17:33:50 +08:00
|
|
|
|
/>
|
2026-01-07 20:31:12 +08:00
|
|
|
|
<SavingsConfigPopup
|
|
|
|
|
|
ref="savingsConfigRef"
|
|
|
|
|
|
@success="fetchBudgetList"
|
|
|
|
|
|
/>
|
2026-01-11 12:33:12 +08:00
|
|
|
|
|
|
|
|
|
|
<PopupContainer
|
|
|
|
|
|
v-model="showUncoveredDetails"
|
|
|
|
|
|
title="未覆盖预算的分类"
|
|
|
|
|
|
:subtitle="`本月共 <b style='color:var(--van-primary-color)'>${uncoveredCategories.length}</b> 个分类未设置预算`"
|
|
|
|
|
|
height="60%"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="uncovered-list">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div
|
|
|
|
|
|
v-for="item in uncoveredCategories"
|
|
|
|
|
|
:key="item.category"
|
|
|
|
|
|
class="uncovered-item"
|
|
|
|
|
|
>
|
2026-01-11 12:33:12 +08:00
|
|
|
|
<div class="item-left">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div class="category-name">
|
|
|
|
|
|
{{ item.category }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="transaction-count">
|
|
|
|
|
|
{{ item.transactionCount }} 笔记录
|
|
|
|
|
|
</div>
|
2026-01-11 12:33:12 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="item-right">
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div
|
|
|
|
|
|
class="item-amount"
|
|
|
|
|
|
:class="activeTab === BudgetCategory.Expense ? 'expense' : 'income'"
|
|
|
|
|
|
>
|
2026-01-11 12:33:12 +08:00
|
|
|
|
¥{{ formatMoney(item.totalAmount) }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-11 12:33:12 +08:00
|
|
|
|
<template #footer>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<van-button
|
|
|
|
|
|
block
|
|
|
|
|
|
round
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
@click="showUncoveredDetails = false"
|
|
|
|
|
|
>
|
2026-01-11 12:33:12 +08:00
|
|
|
|
我知道了
|
|
|
|
|
|
</van-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</PopupContainer>
|
2026-01-12 22:29:39 +08:00
|
|
|
|
|
|
|
|
|
|
<PopupContainer
|
|
|
|
|
|
v-model="showSummaryPopup"
|
|
|
|
|
|
title="月份归档总结"
|
|
|
|
|
|
:subtitle="`${selectedDate.getFullYear()}年${selectedDate.getMonth() + 1}月`"
|
2026-01-15 21:19:03 +08:00
|
|
|
|
height="70%"
|
2026-01-12 22:29:39 +08:00
|
|
|
|
>
|
2026-01-16 11:15:44 +08:00
|
|
|
|
<div style="padding: 16px">
|
2026-01-15 21:19:03 +08:00
|
|
|
|
<div
|
2026-01-16 11:15:44 +08:00
|
|
|
|
class="rich-html-content"
|
|
|
|
|
|
v-html="
|
|
|
|
|
|
archiveSummary ||
|
|
|
|
|
|
'<p style=\'text-align:center;color:var(--van-text-color-3)\'>暂无总结</p>'
|
|
|
|
|
|
"
|
2026-01-12 22:29:39 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</PopupContainer>
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-01-07 19:19:53 +08:00
|
|
|
|
import { ref, computed, onMounted, watch } from 'vue'
|
2026-01-06 20:55:11 +08:00
|
|
|
|
import { showToast, showConfirmDialog } from 'vant'
|
2026-01-16 11:15:44 +08:00
|
|
|
|
import {
|
|
|
|
|
|
getBudgetList,
|
|
|
|
|
|
deleteBudget,
|
|
|
|
|
|
getCategoryStats,
|
|
|
|
|
|
getUncoveredCategories,
|
|
|
|
|
|
getArchiveSummary,
|
|
|
|
|
|
getSavingsBudget
|
|
|
|
|
|
} from '@/api/budget'
|
2026-01-06 21:15:02 +08:00
|
|
|
|
import { BudgetPeriodType, BudgetCategory } from '@/constants/enums'
|
2026-01-07 17:33:50 +08:00
|
|
|
|
import BudgetCard from '@/components/Budget/BudgetCard.vue'
|
|
|
|
|
|
import BudgetSummary from '@/components/Budget/BudgetSummary.vue'
|
|
|
|
|
|
import BudgetEditPopup from '@/components/Budget/BudgetEditPopup.vue'
|
2026-01-07 20:31:12 +08:00
|
|
|
|
import SavingsConfigPopup from '@/components/Budget/SavingsConfigPopup.vue'
|
2026-01-11 12:33:12 +08:00
|
|
|
|
import PopupContainer from '@/components/PopupContainer.vue'
|
2026-01-06 20:55:11 +08:00
|
|
|
|
|
2026-01-06 21:15:02 +08:00
|
|
|
|
const activeTab = ref(BudgetCategory.Expense)
|
2026-01-11 12:41:52 +08:00
|
|
|
|
const selectedDate = ref(new Date())
|
2026-01-07 17:33:50 +08:00
|
|
|
|
const budgetEditRef = ref(null)
|
2026-01-07 20:31:12 +08:00
|
|
|
|
const savingsConfigRef = ref(null)
|
2026-01-10 23:01:02 +08:00
|
|
|
|
const isRefreshing = ref(false)
|
2026-01-11 12:33:12 +08:00
|
|
|
|
const showUncoveredDetails = ref(false)
|
|
|
|
|
|
const uncoveredCategories = ref([])
|
2026-01-06 20:55:11 +08:00
|
|
|
|
|
2026-01-12 22:29:39 +08:00
|
|
|
|
const showSummaryPopup = ref(false)
|
|
|
|
|
|
const archiveSummary = ref('')
|
|
|
|
|
|
|
2026-01-06 21:15:02 +08:00
|
|
|
|
const expenseBudgets = ref([])
|
|
|
|
|
|
const incomeBudgets = ref([])
|
|
|
|
|
|
const savingsBudgets = ref([])
|
2026-01-09 15:42:59 +08:00
|
|
|
|
const overallStats = ref({
|
|
|
|
|
|
month: { rate: '0.0', current: 0, limit: 0, count: 0 },
|
|
|
|
|
|
year: { rate: '0.0', current: 0, limit: 0, count: 0 }
|
|
|
|
|
|
})
|
2026-01-06 20:55:11 +08:00
|
|
|
|
|
2026-01-06 21:23:04 +08:00
|
|
|
|
const activeTabTitle = computed(() => {
|
2026-01-16 11:15:44 +08:00
|
|
|
|
if (activeTab.value === BudgetCategory.Expense) {
|
|
|
|
|
|
return '使用'
|
|
|
|
|
|
}
|
2026-01-06 21:23:04 +08:00
|
|
|
|
return '达成'
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-01-12 22:29:39 +08:00
|
|
|
|
const isArchive = computed(() => {
|
|
|
|
|
|
const now = new Date()
|
2026-01-16 11:15:44 +08:00
|
|
|
|
return (
|
|
|
|
|
|
selectedDate.value.getFullYear() < now.getFullYear() ||
|
|
|
|
|
|
(selectedDate.value.getFullYear() === now.getFullYear() &&
|
|
|
|
|
|
selectedDate.value.getMonth() < now.getMonth())
|
|
|
|
|
|
)
|
2026-01-12 22:29:39 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2026-01-09 15:42:59 +08:00
|
|
|
|
watch(activeTab, async () => {
|
2026-01-11 12:33:12 +08:00
|
|
|
|
await Promise.all([fetchCategoryStats(), fetchUncoveredCategories()])
|
2026-01-06 21:23:04 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2026-01-11 12:41:52 +08:00
|
|
|
|
watch(selectedDate, async () => {
|
2026-01-16 11:15:44 +08:00
|
|
|
|
await Promise.all([fetchBudgetList(), fetchCategoryStats(), fetchUncoveredCategories()])
|
2026-01-11 12:41:52 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2026-01-06 21:23:04 +08:00
|
|
|
|
const getValueClass = (rate) => {
|
|
|
|
|
|
const numRate = parseFloat(rate)
|
2026-01-16 11:15:44 +08:00
|
|
|
|
if (numRate === 0) {
|
|
|
|
|
|
return ''
|
|
|
|
|
|
}
|
2026-01-06 21:23:04 +08:00
|
|
|
|
if (activeTab.value === BudgetCategory.Expense) {
|
2026-01-16 11:15:44 +08:00
|
|
|
|
if (numRate >= 100) {
|
|
|
|
|
|
return 'expense'
|
|
|
|
|
|
}
|
|
|
|
|
|
if (numRate >= 80) {
|
|
|
|
|
|
return 'warning'
|
|
|
|
|
|
}
|
2026-01-06 21:23:04 +08:00
|
|
|
|
return 'income'
|
|
|
|
|
|
} else {
|
2026-01-16 11:15:44 +08:00
|
|
|
|
if (numRate >= 100) {
|
|
|
|
|
|
return 'income'
|
|
|
|
|
|
}
|
|
|
|
|
|
if (numRate >= 80) {
|
|
|
|
|
|
return 'warning'
|
|
|
|
|
|
}
|
2026-01-06 21:23:04 +08:00
|
|
|
|
return 'expense'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-06 21:15:02 +08:00
|
|
|
|
const fetchBudgetList = async () => {
|
2026-01-06 20:55:11 +08:00
|
|
|
|
try {
|
2026-01-11 12:41:52 +08:00
|
|
|
|
const res = await getBudgetList(selectedDate.value.toISOString())
|
2026-01-06 20:55:11 +08:00
|
|
|
|
if (res.success) {
|
2026-01-06 21:15:02 +08:00
|
|
|
|
const data = res.data || []
|
2026-01-16 11:15:44 +08:00
|
|
|
|
expenseBudgets.value = data.filter((b) => b.category === BudgetCategory.Expense)
|
|
|
|
|
|
incomeBudgets.value = data.filter((b) => b.category === BudgetCategory.Income)
|
|
|
|
|
|
savingsBudgets.value = data.filter((b) => b.category === BudgetCategory.Savings)
|
2026-01-06 21:15:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error('加载预算列表失败', err)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-10 23:01:02 +08:00
|
|
|
|
const onRefresh = async () => {
|
|
|
|
|
|
try {
|
2026-01-11 12:33:12 +08:00
|
|
|
|
await Promise.all([fetchBudgetList(), fetchCategoryStats(), fetchUncoveredCategories()])
|
2026-01-10 23:01:02 +08:00
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error('刷新失败', err)
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
isRefreshing.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-09 15:42:59 +08:00
|
|
|
|
const fetchCategoryStats = async () => {
|
|
|
|
|
|
try {
|
2026-01-11 12:41:52 +08:00
|
|
|
|
const res = await getCategoryStats(activeTab.value, selectedDate.value.toISOString())
|
2026-01-09 15:42:59 +08:00
|
|
|
|
if (res.success) {
|
|
|
|
|
|
// 转换后端返回的数据格式为前端需要的格式
|
|
|
|
|
|
const data = res.data
|
|
|
|
|
|
overallStats.value = {
|
|
|
|
|
|
month: {
|
|
|
|
|
|
rate: data.month?.rate?.toFixed(1) || '0.0',
|
|
|
|
|
|
current: data.month?.current || 0,
|
|
|
|
|
|
limit: data.month?.limit || 0,
|
|
|
|
|
|
count: data.month?.count || 0
|
|
|
|
|
|
},
|
|
|
|
|
|
year: {
|
|
|
|
|
|
rate: data.year?.rate?.toFixed(1) || '0.0',
|
|
|
|
|
|
current: data.year?.current || 0,
|
|
|
|
|
|
limit: data.year?.limit || 0,
|
|
|
|
|
|
count: data.year?.count || 0
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error('加载分类统计失败', err)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-11 12:33:12 +08:00
|
|
|
|
const fetchUncoveredCategories = async () => {
|
|
|
|
|
|
if (activeTab.value === BudgetCategory.Savings) {
|
|
|
|
|
|
uncoveredCategories.value = []
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
try {
|
2026-01-11 12:41:52 +08:00
|
|
|
|
const res = await getUncoveredCategories(activeTab.value, selectedDate.value.toISOString())
|
2026-01-11 12:33:12 +08:00
|
|
|
|
if (res.success) {
|
|
|
|
|
|
uncoveredCategories.value = res.data || []
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error('获取未覆盖分类失败', err)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-06 21:15:02 +08:00
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
try {
|
2026-01-16 11:15:44 +08:00
|
|
|
|
await Promise.all([fetchBudgetList(), fetchCategoryStats(), fetchUncoveredCategories()])
|
2026-01-06 20:55:11 +08:00
|
|
|
|
} catch (err) {
|
2026-01-06 21:15:02 +08:00
|
|
|
|
console.error('获取初始化数据失败', err)
|
2026-01-06 20:55:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const formatMoney = (val) => {
|
2026-01-16 11:15:44 +08:00
|
|
|
|
return parseFloat(val || 0).toLocaleString(undefined, {
|
|
|
|
|
|
minimumFractionDigits: 0,
|
|
|
|
|
|
maximumFractionDigits: 0
|
|
|
|
|
|
})
|
2026-01-06 20:55:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const getPeriodLabel = (type) => {
|
2026-01-11 12:41:52 +08:00
|
|
|
|
const isCurrent = (date) => {
|
|
|
|
|
|
const now = new Date()
|
|
|
|
|
|
return date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth()
|
|
|
|
|
|
}
|
|
|
|
|
|
const isCurrentYear = (date) => {
|
|
|
|
|
|
const now = new Date()
|
|
|
|
|
|
return date.getFullYear() === now.getFullYear()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (type === BudgetPeriodType.Month) {
|
|
|
|
|
|
return isCurrent(selectedDate.value) ? '本月' : `${selectedDate.value.getMonth() + 1}月`
|
|
|
|
|
|
}
|
|
|
|
|
|
if (type === BudgetPeriodType.Year) {
|
|
|
|
|
|
return isCurrentYear(selectedDate.value) ? '本年' : `${selectedDate.value.getFullYear()}年`
|
2026-01-06 20:55:11 +08:00
|
|
|
|
}
|
2026-01-11 12:41:52 +08:00
|
|
|
|
return '周期'
|
2026-01-06 20:55:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const getProgressColor = (budget) => {
|
2026-01-16 11:15:44 +08:00
|
|
|
|
if (!budget.limit || budget.limit === 0) {
|
|
|
|
|
|
return 'var(--van-primary-color)'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-14 20:24:32 +08:00
|
|
|
|
const ratio = Math.min(Math.max(budget.current / budget.limit, 0), 1)
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 17:12:27 +08:00
|
|
|
|
// 颜色插值辅助函数
|
|
|
|
|
|
const interpolate = (start, end, t) => {
|
|
|
|
|
|
return Math.round(start + (end - start) * t)
|
2026-01-15 11:08:52 +08:00
|
|
|
|
}
|
2026-01-15 17:12:27 +08:00
|
|
|
|
|
|
|
|
|
|
// 多段颜色渐变计算
|
|
|
|
|
|
const getGradientColor = (value, stops) => {
|
|
|
|
|
|
// 找到当前值所在的区间
|
|
|
|
|
|
let startStop = stops[0]
|
|
|
|
|
|
let endStop = stops[stops.length - 1]
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 17:12:27 +08:00
|
|
|
|
for (let i = 0; i < stops.length - 1; i++) {
|
|
|
|
|
|
if (value >= stops[i].p && value <= stops[i + 1].p) {
|
|
|
|
|
|
startStop = stops[i]
|
|
|
|
|
|
endStop = stops[i + 1]
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 17:12:27 +08:00
|
|
|
|
// 计算区间内的相对比例
|
|
|
|
|
|
const range = endStop.p - startStop.p
|
|
|
|
|
|
const t = (value - startStop.p) / range
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 17:12:27 +08:00
|
|
|
|
const r = interpolate(startStop.c.r, endStop.c.r, t)
|
|
|
|
|
|
const g = interpolate(startStop.c.g, endStop.c.g, t)
|
|
|
|
|
|
const b = interpolate(startStop.c.b, endStop.c.b, t)
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 17:12:27 +08:00
|
|
|
|
return `rgb(${r}, ${g}, ${b})`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let stops
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 17:12:27 +08:00
|
|
|
|
if (budget.category === BudgetCategory.Expense) {
|
|
|
|
|
|
// 支出: 这是一个"安全 -> 警示 -> 危险"的过程
|
|
|
|
|
|
// 使用 蓝绿色 -> 黄色 -> 橙红色的渐变,更加自然且具有高级感
|
|
|
|
|
|
stops = [
|
2026-01-16 11:15:44 +08:00
|
|
|
|
{ p: 0, c: { r: 64, g: 169, b: 255 } }, // 0% 清新的蓝色 (Safe/Fresh)
|
|
|
|
|
|
{ p: 0.4, c: { r: 54, g: 207, b: 201 } }, // 40% 青色过渡
|
|
|
|
|
|
{ p: 0.7, c: { r: 250, g: 173, b: 20 } }, // 70% 温暖的黄色 (Warning)
|
|
|
|
|
|
{ p: 1, c: { r: 255, g: 77, b: 79 } } // 100% 柔和的红色 (Danger)
|
2026-01-15 17:12:27 +08:00
|
|
|
|
]
|
2026-01-15 11:08:52 +08:00
|
|
|
|
} else {
|
2026-01-15 17:12:27 +08:00
|
|
|
|
// 收入/存款: 这是一个"开始 -> 积累 -> 达成"的过程
|
|
|
|
|
|
// 采用 红色(未开始) -> 橙色(进行中) -> 绿色(达成) 的经典逻辑,但调整了色值使其更现代
|
|
|
|
|
|
// stops = [
|
|
|
|
|
|
// { p: 0, c: { r: 255, g: 120, b: 117 } }, // 0% 淡红 (Start)
|
|
|
|
|
|
// { p: 0.3, c: { r: 255, g: 197, b: 61 } }, // 30% 金黄 (Progress)
|
|
|
|
|
|
// { p: 0.7, c: { r: 115, g: 209, b: 61 } }, // 70% 草绿 (Good)
|
|
|
|
|
|
// { p: 1, c: { r: 35, g: 120, b: 4 } } // 100% 深绿 (Excellent)
|
|
|
|
|
|
// ]
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 17:12:27 +08:00
|
|
|
|
// 如果用户喜欢"红->蓝"的逻辑,可以尝试这种"红->白->蓝"的冷暖过渡:
|
|
|
|
|
|
stops = [
|
2026-01-16 11:15:44 +08:00
|
|
|
|
{ p: 0, c: { r: 245, g: 34, b: 45 } }, // 深红
|
2026-01-15 17:12:27 +08:00
|
|
|
|
{ p: 0.45, c: { r: 255, g: 204, b: 204 } }, // 浅红
|
2026-01-16 11:15:44 +08:00
|
|
|
|
{ p: 0.5, c: { r: 240, g: 242, b: 245 } }, // 中性灰白
|
2026-01-15 17:12:27 +08:00
|
|
|
|
{ p: 0.55, c: { r: 186, g: 231, b: 255 } }, // 浅蓝
|
2026-01-16 11:15:44 +08:00
|
|
|
|
{ p: 1, c: { r: 24, g: 144, b: 255 } } // 深蓝
|
2026-01-15 17:12:27 +08:00
|
|
|
|
]
|
2026-01-15 11:08:52 +08:00
|
|
|
|
}
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 17:12:27 +08:00
|
|
|
|
return getGradientColor(ratio, stops)
|
2026-01-06 20:55:11 +08:00
|
|
|
|
}
|
2026-01-12 22:29:39 +08:00
|
|
|
|
|
|
|
|
|
|
const showArchiveSummary = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await getArchiveSummary(selectedDate.value.toISOString())
|
|
|
|
|
|
if (res.success) {
|
|
|
|
|
|
archiveSummary.value = res.data || ''
|
|
|
|
|
|
showSummaryPopup.value = true
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error('获取总结失败', err)
|
|
|
|
|
|
showToast('获取总结失败')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 10:53:05 +08:00
|
|
|
|
const handleDelete = async (budget) => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await showConfirmDialog({
|
|
|
|
|
|
title: '删除预算',
|
|
|
|
|
|
message: `确定要删除预算 "${budget.name}" 吗?`
|
|
|
|
|
|
})
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 10:53:05 +08:00
|
|
|
|
const res = await deleteBudget(budget.id)
|
|
|
|
|
|
if (res.success) {
|
|
|
|
|
|
showToast('删除成功')
|
|
|
|
|
|
await fetchBudgetList()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
showToast(res.message || '删除失败')
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
if (err.message !== 'cancel') {
|
|
|
|
|
|
console.error('删除预算失败', err)
|
|
|
|
|
|
showToast('删除预算失败')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-15 20:00:41 +08:00
|
|
|
|
|
|
|
|
|
|
const getSavingsDateLabel = (budget) => {
|
2026-01-16 11:15:44 +08:00
|
|
|
|
if (!budget.periodStart) {
|
|
|
|
|
|
return ''
|
|
|
|
|
|
}
|
2026-01-15 20:00:41 +08:00
|
|
|
|
const date = new Date(budget.periodStart)
|
|
|
|
|
|
if (budget.type === BudgetPeriodType.Year) {
|
|
|
|
|
|
return `${date.getFullYear()}年`
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return `${date.getFullYear()}年${date.getMonth() + 1}月`
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleSavingsNav = async (budget, offset) => {
|
2026-01-16 11:15:44 +08:00
|
|
|
|
if (!budget.periodStart) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 20:00:41 +08:00
|
|
|
|
const date = new Date(budget.periodStart)
|
|
|
|
|
|
let year = date.getFullYear()
|
|
|
|
|
|
let month = date.getMonth() + 1
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 20:00:41 +08:00
|
|
|
|
if (budget.type === BudgetPeriodType.Year) {
|
|
|
|
|
|
year += offset
|
|
|
|
|
|
} else {
|
|
|
|
|
|
month += offset
|
|
|
|
|
|
if (month > 12) {
|
|
|
|
|
|
month = 1
|
|
|
|
|
|
year++
|
|
|
|
|
|
} else if (month < 1) {
|
|
|
|
|
|
month = 12
|
|
|
|
|
|
year--
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-16 11:15:44 +08:00
|
|
|
|
|
2026-01-15 20:00:41 +08:00
|
|
|
|
try {
|
|
|
|
|
|
const res = await getSavingsBudget(year, month, budget.type)
|
|
|
|
|
|
if (res.success && res.data) {
|
|
|
|
|
|
// 找到并更新对应的 budget 对象
|
2026-01-16 11:15:44 +08:00
|
|
|
|
const index = savingsBudgets.value.findIndex((b) => b.id === budget.id)
|
2026-01-15 20:00:41 +08:00
|
|
|
|
if (index !== -1) {
|
|
|
|
|
|
savingsBudgets.value[index] = res.data
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
showToast('获取数据失败')
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error('切换日期失败', err)
|
|
|
|
|
|
showToast('切换日期失败')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-15 20:31:10 +08:00
|
|
|
|
|
|
|
|
|
|
const disabledSavingsNextNav = (budget) => {
|
2026-01-16 11:15:44 +08:00
|
|
|
|
if (!budget.periodStart) {
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
2026-01-15 20:31:10 +08:00
|
|
|
|
const date = new Date(budget.periodStart)
|
|
|
|
|
|
const now = new Date()
|
|
|
|
|
|
if (budget.type === BudgetPeriodType.Year) {
|
|
|
|
|
|
return date.getFullYear() === now.getFullYear()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-01-15 20:00:41 +08:00
|
|
|
|
.card-footer-actions {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
margin-top: 12px;
|
|
|
|
|
|
padding-top: 12px;
|
2026-01-15 20:31:10 +08:00
|
|
|
|
border-top: 1px solid var(--van-border-color);
|
2026-01-15 20:00:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.current-date-label {
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: var(--van-text-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-08 14:41:50 +08:00
|
|
|
|
.budget-tabs {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
overflow: hidden;
|
2026-01-08 15:16:25 +08:00
|
|
|
|
margin-top: 12px;
|
2026-01-14 10:46:23 +08:00
|
|
|
|
min-height: 0;
|
2026-01-08 14:41:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.van-tabs__content) {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
overflow: hidden;
|
2026-01-14 10:46:23 +08:00
|
|
|
|
min-height: 0;
|
2026-01-08 14:41:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.van-tab__panel) {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
overflow: hidden;
|
2026-01-14 10:46:23 +08:00
|
|
|
|
min-height: 0;
|
2026-01-08 14:41:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-06 20:55:11 +08:00
|
|
|
|
.budget-list {
|
|
|
|
|
|
padding-top: 8px;
|
|
|
|
|
|
padding-bottom: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.budget-list :deep(.van-swipe-cell) {
|
|
|
|
|
|
margin: 0 12px 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-10 23:01:02 +08:00
|
|
|
|
.scroll-content {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
overflow-y: auto;
|
2026-01-14 10:46:23 +08:00
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
|
|
overscroll-behavior: contain;
|
2026-01-10 23:01:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-06 20:55:11 +08:00
|
|
|
|
.delete-button {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.van-tabs__nav--card) {
|
|
|
|
|
|
margin: 0 12px;
|
|
|
|
|
|
}
|
2026-01-11 12:33:12 +08:00
|
|
|
|
|
|
|
|
|
|
.uncovered-list {
|
|
|
|
|
|
padding: 12px 16px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.uncovered-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
padding: 16px;
|
2026-01-13 17:00:44 +08:00
|
|
|
|
background-color: var(--van-background-2);
|
2026-01-11 12:33:12 +08:00
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.item-left {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.category-name {
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-weight: 500;
|
2026-01-13 17:00:44 +08:00
|
|
|
|
color: var(--van-text-color);
|
2026-01-11 12:33:12 +08:00
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.transaction-count {
|
|
|
|
|
|
font-size: 12px;
|
2026-01-13 17:00:44 +08:00
|
|
|
|
color: var(--van-text-color-2);
|
2026-01-11 12:33:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.item-right {
|
|
|
|
|
|
text-align: right;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.item-amount {
|
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
font-weight: 600;
|
2026-01-16 11:15:44 +08:00
|
|
|
|
font-family:
|
|
|
|
|
|
DIN Alternate,
|
|
|
|
|
|
system-ui;
|
2026-01-11 12:33:12 +08:00
|
|
|
|
}
|
2026-01-11 16:50:18 +08:00
|
|
|
|
|
|
|
|
|
|
/* 设置页面容器背景色 */
|
|
|
|
|
|
:deep(.van-nav-bar) {
|
|
|
|
|
|
background: transparent !important;
|
|
|
|
|
|
}
|
2026-01-06 20:55:11 +08:00
|
|
|
|
</style>
|