fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 22s
Docker Build & Deploy / Deploy to Production (push) Successful in 5s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

This commit is contained in:
SunCheng
2026-01-21 18:52:31 +08:00
parent b2e903e968
commit 64aa24c07b
6 changed files with 326 additions and 127 deletions

View File

@@ -59,6 +59,7 @@
:overall-stats="overallStats"
:budgets="expenseBudgets"
:active-tab="activeTab"
:selected-date="selectedDate"
/>
</div>
</van-tab>
@@ -72,6 +73,7 @@
:overall-stats="overallStats"
:budgets="incomeBudgets"
:active-tab="activeTab"
:selected-date="selectedDate"
/>
</div>
</van-tab>
@@ -501,6 +503,7 @@
<script setup>
import { ref, computed, onMounted, watch } from 'vue'
import { showToast, showConfirmDialog } from 'vant'
import dayjs from 'dayjs'
import {
getBudgetList,
deleteBudget,
@@ -520,7 +523,7 @@ const activeTab = ref(BudgetCategory.Expense)
const selectedDate = ref(new Date())
const showDatePicker = ref(false)
const minDate = new Date(2020, 0, 1)
const maxDate = new Date(2030, 11, 31)
const maxDate = new Date()
const pickerDate = ref([
selectedDate.value.getFullYear().toString(),
(selectedDate.value.getMonth() + 1).toString().padStart(2, '0')
@@ -597,33 +600,9 @@ const onConfirmDate = ({ selectedValues }) => {
showDatePicker.value = false
}
const getValueClass = (rate) => {
const numRate = parseFloat(rate)
if (numRate === 0) {
return ''
}
if (activeTab.value === BudgetCategory.Expense) {
if (numRate >= 100) {
return 'expense'
}
if (numRate >= 80) {
return 'warning'
}
return 'income'
} else {
if (numRate >= 100) {
return 'income'
}
if (numRate >= 80) {
return 'warning'
}
return 'expense'
}
}
const fetchBudgetList = async () => {
try {
const res = await getBudgetList(selectedDate.value.toISOString())
const res = await getBudgetList(dayjs(selectedDate.value).format('YYYY-MM-DD'))
if (res.success) {
const data = res.data || []
expenseBudgets.value = data.filter((b) => b.category === BudgetCategory.Expense)
@@ -647,7 +626,10 @@ const onRefresh = async () => {
const fetchCategoryStats = async () => {
try {
const res = await getCategoryStats(activeTab.value, selectedDate.value.toISOString())
const res = await getCategoryStats(
activeTab.value,
dayjs(selectedDate.value).format('YYYY-MM-DD')
)
if (res.success) {
// 转换后端返回的数据格式为前端需要的格式
const data = res.data
@@ -679,7 +661,10 @@ const fetchUncoveredCategories = async () => {
return
}
try {
const res = await getUncoveredCategories(activeTab.value, selectedDate.value.toISOString())
const res = await getUncoveredCategories(
activeTab.value,
dayjs(selectedDate.value).format('YYYY-MM-DD')
)
if (res.success) {
uncoveredCategories.value = res.data || []
}
@@ -795,7 +780,7 @@ const getProgressColor = (budget) => {
const showArchiveSummary = async () => {
try {
const res = await getArchiveSummary(selectedDate.value.toISOString())
const res = await getArchiveSummary(dayjs(selectedDate.value).format('YYYY-MM-DD'))
if (res.success) {
archiveSummary.value = res.data || ''
showSummaryPopup.value = true