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

This commit is contained in:
孙诚
2026-01-16 12:08:11 +08:00
parent 319f8f7d7b
commit 04e4946f3d
2 changed files with 91 additions and 64 deletions

View File

@@ -1,4 +1,4 @@
{ {
"name": "email-bill", "name": "email-bill",
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,

View File

@@ -153,7 +153,10 @@
</div> </div>
</div> </div>
<!-- 分类统计 --> <!-- 分类统计 -->
<div class="common-card"> <div
class="common-card"
style="padding-bottom: 10px;"
>
<div class="card-header"> <div class="card-header">
<h3 class="card-title"> <h3 class="card-title">
支出分类 支出分类
@@ -179,18 +182,13 @@
</div> </div>
<!-- 分类列表 --> <!-- 分类列表 -->
<div <div
v-if="expenseCategoriesSimpView.length > 0"
class="category-list" class="category-list"
> >
<div <div
v-for="category in expenseCategoriesSimpView" v-for="category in expenseCategoriesSimpView"
:key="category.isOther ? 'other' : category.classify" :key="category.classify"
class="category-item clickable" class="category-item clickable"
@click=" @click="goToCategoryBills(category.classify, 0)"
category.isOther
? (showAllExpense = true)
: goToCategoryBills(category.classify, 0)
"
> >
<div class="category-info"> <div class="category-info">
<div <div
@@ -211,13 +209,21 @@
</div> </div>
</div> </div>
<van-icon <van-icon
:name="category.isOther ? 'arrow-down' : 'arrow'" name="arrow"
class="category-arrow" class="category-arrow"
/> />
</div> </div>
<!-- 展开/收起按钮 -->
<div
v-if="expenseCategoriesView.length > 1"
class="expand-toggle"
@click="showAllExpense = !showAllExpense"
>
<van-icon :name="showAllExpense ? 'arrow-up' : 'arrow-down'" />
</div>
</div> </div>
<van-empty <van-empty
v-else v-if="!expenseCategoriesView || !expenseCategoriesView.length"
description="本月暂无支出记录" description="本月暂无支出记录"
image="search" image="search"
/> />
@@ -241,14 +247,10 @@
<div class="category-list"> <div class="category-list">
<div <div
v-for="category in incomeCategoriesView" v-for="category in incomeCategoriesSimpView"
:key="category.isOther ? 'other' : category.classify" :key="category.classify"
class="category-item clickable" class="category-item clickable"
@click=" @click="goToCategoryBills(category.classify, 1)"
category.isOther
? (showAllIncome = true)
: goToCategoryBills(category.classify, 1)
"
> >
<div class="category-info"> <div class="category-info">
<div class="category-color income-color" /> <div class="category-color income-color" />
@@ -266,10 +268,18 @@
</div> </div>
</div> </div>
<van-icon <van-icon
:name="category.isOther ? 'arrow-down' : 'arrow'" name="arrow"
class="category-arrow" class="category-arrow"
/> />
</div> </div>
<!-- 展开/收起按钮 -->
<div
v-if="incomeCategoriesView.length > 1"
class="expand-toggle"
@click="showAllIncome = !showAllIncome"
>
<van-icon :name="showAllIncome ? 'arrow-up' : 'arrow-down'" />
</div>
</div> </div>
</div> </div>
<!-- 不计收支分类统计 --> <!-- 不计收支分类统计 -->
@@ -291,14 +301,10 @@
<div class="category-list"> <div class="category-list">
<div <div
v-for="category in noneCategoriesView" v-for="category in noneCategoriesSimpView"
:key="category.isOther ? 'other' : category.classify" :key="category.classify"
class="category-item clickable" class="category-item clickable"
@click=" @click="goToCategoryBills(category.classify, 2)"
category.isOther
? (showAllNone = true)
: goToCategoryBills(category.classify, 2)
"
> >
<div class="category-info"> <div class="category-info">
<div class="category-color none-color" /> <div class="category-color none-color" />
@@ -316,10 +322,18 @@
</div> </div>
</div> </div>
<van-icon <van-icon
:name="category.isOther ? 'arrow-down' : 'arrow'" name="arrow"
class="category-arrow" class="category-arrow"
/> />
</div> </div>
<!-- 展开/收起按钮 -->
<div
v-if="noneCategoriesView.length > 1"
class="expand-toggle"
@click="showAllNone = !showAllNone"
>
<van-icon :name="showAllNone ? 'arrow-up' : 'arrow-down'" />
</div>
</div> </div>
</div> </div>
<!-- 其他统计 --> <!-- 其他统计 -->
@@ -498,21 +512,16 @@ const noneCategories = ref([])
const expenseCategoriesSimpView = computed(() => { const expenseCategoriesSimpView = computed(() => {
const list = expenseCategoriesView.value const list = expenseCategoriesView.value
if (showAllExpense.value || list.length <= 7) { if (showAllExpense.value) {
return list return list
} }
const top = list.slice(0, 6) // 只展示未分类
const rest = list.slice(6) const unclassified = list.filter((c) => c.classify === '未分类' || !c.classify)
top.push({ if (unclassified.length > 0) {
classify: '其他', return [...unclassified]
amount: rest.reduce((s, c) => s + c.amount, 0), }
count: rest.reduce((s, c) => s + c.count, 0), return []
percent: parseFloat(rest.reduce((s, c) => s + c.percent, 0).toFixed(1)),
color: '#AAB7B8',
isOther: true
})
return top
}) })
const expenseCategoriesView = computed(() => { const expenseCategoriesView = computed(() => {
@@ -526,6 +535,21 @@ const expenseCategoriesView = computed(() => {
return list return list
}) })
const incomeCategoriesSimpView = computed(() => {
const list = incomeCategoriesView.value
if (showAllIncome.value) {
return list
}
// 只展示未分类
const unclassified = list.filter((c) => c.classify === '未分类' || !c.classify)
if (unclassified.length > 0) {
return [...unclassified]
}
return []
})
const incomeCategoriesView = computed(() => { const incomeCategoriesView = computed(() => {
const list = [...incomeCategories.value] const list = [...incomeCategories.value]
const unclassifiedIndex = list.findIndex((c) => !c.classify) const unclassifiedIndex = list.findIndex((c) => !c.classify)
@@ -534,20 +558,22 @@ const incomeCategoriesView = computed(() => {
list.unshift(unclassified) list.unshift(unclassified)
} }
if (showAllIncome.value || list.length <= 7) { return list
})
const noneCategoriesSimpView = computed(() => {
const list = noneCategoriesView.value
if (showAllNone.value) {
return list return list
} }
const top = list.slice(0, 6) // 只展示未分类
const rest = list.slice(6) const unclassified = list.filter((c) => c.classify === '未分类' || !c.classify)
top.push({ if (unclassified.length > 0) {
classify: '其他', return [...unclassified]
amount: rest.reduce((s, c) => s + c.amount, 0), }
count: rest.reduce((s, c) => s + c.count, 0), return []
percent: parseFloat(rest.reduce((s, c) => s + c.percent, 0).toFixed(1)),
isOther: true
})
return top
}) })
const noneCategoriesView = computed(() => { const noneCategoriesView = computed(() => {
@@ -558,20 +584,7 @@ const noneCategoriesView = computed(() => {
list.unshift(unclassified) list.unshift(unclassified)
} }
if (showAllNone.value || list.length <= 7) { return list
return list
}
const top = list.slice(0, 6)
const rest = list.slice(6)
top.push({
classify: '其他',
amount: rest.reduce((s, c) => s + c.amount, 0),
count: rest.reduce((s, c) => s + c.count, 0),
percent: parseFloat(rest.reduce((s, c) => s + c.percent, 0).toFixed(1)),
isOther: true
})
return top
}) })
// 趋势数据 // 趋势数据
@@ -1701,6 +1714,20 @@ onBeforeUnmount(() => {
flex-shrink: 0; flex-shrink: 0;
} }
.expand-toggle {
display: flex;
justify-content: center;
align-items: center;
padding-top: 10px;
color: var(--van-text-color-3);
font-size: 20px;
cursor: pointer;
}
.expand-toggle:active {
opacity: 0.7;
}
.category-amount { .category-amount {
font-size: 15px; font-size: 15px;
font-weight: 600; font-weight: 600;