From 66f0b1ca240a90ba8be15792c1e92c6dbbad07a7 Mon Sep 17 00:00:00 2001 From: QIU SHENGMING Date: Mon, 1 Dec 2025 12:33:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A9=E8=B4=A2=E5=8A=A1=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E6=9B=B4=E8=AF=A6=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/expenses.astro | 75 ++++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/src/pages/expenses.astro b/src/pages/expenses.astro index 77c8160..f0a9d44 100644 --- a/src/pages/expenses.astro +++ b/src/pages/expenses.astro @@ -2,8 +2,8 @@ import MainGridLayout from "@layouts/MainGridLayout.astro"; import { Icon } from "astro-icon/components"; -// --- 配置支出项目 --- -const expenses = [ +// --- 1. 固定支出项目配置 (用于顶部概览) --- +const fixedExpenses = [ { name: "Cloudflare Argo Smart Routing", price: "5.00", @@ -27,18 +27,38 @@ const expenses = [ }, ]; -// 自动计算总额 -const totalMonthly = expenses.reduce((acc, item) => { +// 自动计算每月固定预估 (顶部大数字) +const totalMonthly = fixedExpenses.reduce((acc, item) => { let price = parseFloat(item.price); if (item.isYearly) { price = price / 12; } return acc + price; }, 0).toFixed(2); + + +// --- 2. 历史详细账单 (在这里添加每月的实际数据) --- +// 格式:{ date: 'YYYY/MM', cost: '支出金额', income: '赞助金额', items: '消费内容' } +const historyData = [ + { + date: "2025/11", + cost: "5.8", + income: "0.00", + items: "Argo 订阅费" + }, + { + date: "2025/10", + cost: "5.20", + income: "0.80", + items: "Argo 流量费" + }, + // 可以在这里继续添加... +]; ---
+
@@ -48,7 +68,7 @@ const totalMonthly = expenses.reduce((acc, item) => {
-
每月预估总支出
+
每月预估固定支出
${totalMonthly} / 月
@@ -57,6 +77,9 @@ const totalMonthly = expenses.reduce((acc, item) => {
+

+ 固定支出项目 +

@@ -66,7 +89,7 @@ const totalMonthly = expenses.reduce((acc, item) => { - {expenses.map((item) => ( + {fixedExpenses.map((item) => (
{item.name}
@@ -85,14 +108,12 @@ const totalMonthly = expenses.reduce((acc, item) => {
-
+
-

支持我的创作

你的支持是我持续更新的最大动力!哪怕是一杯咖啡的钱,也能让我开心很久。非常感谢!

- @@ -100,11 +121,37 @@ const totalMonthly = expenses.reduce((acc, item) => {
-
-

- - 说明:Cloudflare Argo 费用为预估值,实际费用取决于当月流量。 -

+
+

+ 历史收支明细 +

+
+ + + + + + + + + + + {historyData.map((row) => ( + + + + + + + ))} + +
日期消费内容支出赞助
{row.date}{row.items}-${row.cost} + {parseFloat(row.income) > 0 ? `+$${row.income}` : '-'} +
+
+
+ * 收支数据通常在次月月初更新 +