first commit

This commit is contained in:
2025-11-24 17:23:46 +08:00
commit bc1a909a4d
21 changed files with 2740 additions and 0 deletions

24
src/App.vue Normal file
View File

@@ -0,0 +1,24 @@
<script setup>
import { RouterView } from 'vue-router'
import BottomDock from './components/BottomDock.vue'
</script>
<template>
<!-- 整体应用容器居中展示移动端画布 -->
<div class="min-h-screen bg-warmOffwhite text-stone-800 flex items-center justify-center">
<div
class="h-screen max-h-[844px] max-w-md w-full mx-auto bg-warmOffwhite shadow-2xl relative overflow-hidden flex flex-col"
>
<!-- 顶部状态栏占位 -->
<div class="h-8 w-full shrink-0" />
<!-- 主内容区域 vue-router 控制具体页面 -->
<main class="flex-1 overflow-y-auto hide-scrollbar px-5 pt-2 pb-28 relative">
<RouterView />
</main>
<!-- 底部 Dock 导航栏 -->
<BottomDock />
</div>
</div>
</template>

1
src/assets/vue.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

After

Width:  |  Height:  |  Size: 496 B

View File

@@ -0,0 +1,86 @@
<script setup>
import { computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
// 使用路由信息来高亮当前 Tab而不是从父组件传递状态
const route = useRoute()
const router = useRouter()
const currentTab = computed(() => route.name)
const goTab = (name) => {
if (route.name === name) return
router.push({ name })
}
const openAdd = () => {
router.push({ name: 'add' })
}
</script>
<template>
<div
class="absolute bottom-6 left-4 right-4 h-[72px] bg-white/90 backdrop-blur-md rounded-[24px] shadow-2xl shadow-stone-200/50 flex items-center justify-between px-2 z-20 border border-white/50"
>
<button
class="flex-1 flex flex-col items-center gap-1 transition group"
@click="goTab('home')"
>
<div
class="p-2 rounded-xl transition-all duration-300"
:class="currentTab === 'home' ? 'text-stone-800 bg-stone-100' : 'text-stone-400 bg-transparent'"
>
<i class="text-2xl" :class="currentTab === 'home' ? 'ph-fill ph-house' : 'ph ph-house'" />
</div>
</button>
<button
class="flex-1 flex flex-col items-center gap-1 transition group"
@click="goTab('list')"
>
<div
class="p-2 rounded-xl transition-all duration-300"
:class="currentTab === 'list' ? 'text-stone-800 bg-stone-100' : 'text-stone-400 bg-transparent'"
>
<i class="text-2xl" :class="currentTab === 'list' ? 'ph-fill ph-scroll' : 'ph ph-scroll'" />
</div>
</button>
<!-- 中间主操作按钮跳转到新增记录路由 -->
<div class="relative -top-6">
<button
class="w-16 h-16 bg-gradient-warm rounded-[22px] flex items-center justify-center text-white shadow-xl shadow-orange-300/60 hover:scale-105 active:scale-95 transition-all duration-300 border-[6px] border-[#fffaf8]"
@click="openAdd"
>
<i class="ph-bold ph-plus text-2xl" />
</button>
</div>
<button
class="flex-1 flex flex-col items-center gap-1 transition group"
@click="goTab('analysis')"
>
<div
class="p-2 rounded-xl transition-all duration-300"
:class="currentTab === 'analysis' ? 'text-purple-600 bg-purple-50' : 'text-stone-400 bg-transparent'"
>
<i
class="text-2xl"
:class="currentTab === 'analysis' ? 'ph-fill ph-chat-teardrop-text' : 'ph ph-chat-teardrop-text'"
/>
</div>
</button>
<button
class="flex-1 flex flex-col items-center gap-1 transition group"
@click="goTab('settings')"
>
<div
class="p-2 rounded-xl transition-all duration-300"
:class="currentTab === 'settings' ? 'text-stone-800 bg-stone-100' : 'text-stone-400 bg-transparent'"
>
<i class="text-2xl" :class="currentTab === 'settings' ? 'ph-fill ph-gear' : 'ph ph-gear'" />
</div>
</button>
</div>
</template>

12
src/main.js Normal file
View File

@@ -0,0 +1,12 @@
import { createApp } from 'vue'
import './style.css'
import '@phosphor-icons/web/regular'
import '@phosphor-icons/web/bold'
import '@phosphor-icons/web/fill'
import App from './App.vue'
import router from './router'
// 创建应用根实例并挂载路由
const app = createApp(App)
app.use(router)
app.mount('#app')

47
src/router/index.js Normal file
View File

@@ -0,0 +1,47 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import ListView from '../views/ListView.vue'
import SettingsView from '../views/SettingsView.vue'
import AddEntryView from '../views/AddEntryView.vue'
// TODO: 后续补充真实的分析页实现,这里先占位
const AnalysisView = () => import('../views/AnalysisView.vue').catch(() => null)
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomeView,
meta: { tab: 'home' },
},
{
path: '/list',
name: 'list',
component: ListView,
meta: { tab: 'list' },
},
{
path: '/analysis',
name: 'analysis',
component: AnalysisView,
meta: { tab: 'analysis' },
},
{
path: '/settings',
name: 'settings',
component: SettingsView,
meta: { tab: 'settings' },
},
{
path: '/add',
name: 'add',
component: AddEntryView,
meta: { overlay: true },
},
],
})
export default router

40
src/style.css Normal file
View File

@@ -0,0 +1,40 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
/* 全局基础样式:字体与背景色 */
body {
@apply bg-warmOffwhite text-stone-800;
font-family: theme('fontFamily.sans');
-webkit-tap-highlight-color: transparent;
}
}
@layer utilities {
/* 隐藏滚动条但保留滚动功能 */
.hide-scrollbar::-webkit-scrollbar {
display: none;
}
.hide-scrollbar {
-ms-overflow-style: none;
scrollbar-width: none;
}
/* 暖色玻璃拟态卡片 */
.glass-warm {
background: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 241, 235, 0.6);
}
/* 暖色渐变文字 */
.text-gradient-warm {
background-image: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
-webkit-background-clip: text;
color: transparent;
}
}

View File

@@ -0,0 +1,81 @@
<script setup>
import { useRouter } from 'vue-router'
// 这里将原来的底部弹窗拆分成独立页面,通过路由进入和返回
const router = useRouter()
const handleClose = () => {
router.back()
}
</script>
<template>
<!-- 保持与原弹窗一致的视觉半透明遮罩 + 底部浮起卡片 -->
<div class="absolute inset-0 z-50 flex flex-col justify-end bg-stone-900/30 backdrop-blur-sm">
<div class="bg-white w-full rounded-t-[32px] p-6 pb-10 shadow-2xl">
<div class="w-12 h-1.5 bg-stone-200 rounded-full mx-auto mb-8" />
<h3 class="text-xl font-extrabold text-stone-800 mb-6 px-2">
记录新生活
</h3>
<div class="grid grid-cols-2 gap-4">
<button
class="p-5 rounded-3xl bg-stone-50 border border-stone-100 flex flex-col items-center gap-3 active:bg-stone-100 transition group"
>
<div
class="w-12 h-12 rounded-2xl bg-blue-100 text-blue-600 flex items-center justify-center group-hover:scale-110 transition"
>
<i class="ph-fill ph-pencil-simple text-2xl" />
</div>
<span class="text-sm font-bold text-stone-600">手动记账</span>
</button>
<button
class="p-5 rounded-3xl bg-stone-50 border border-stone-100 flex flex-col items-center gap-3 active:bg-stone-100 transition group"
>
<div
class="w-12 h-12 rounded-2xl bg-emerald-100 text-emerald-600 flex items-center justify-center group-hover:scale-110 transition"
>
<i class="ph-fill ph-receipt text-2xl" />
</div>
<span class="text-sm font-bold text-stone-600">扫描小票</span>
</button>
<button
class="col-span-2 p-6 rounded-3xl bg-gradient-to-r from-orange-50 to-red-50 border border-orange-100 flex items-center justify-between active:scale-[0.98] transition group relative overflow-hidden"
>
<div class="flex items-center gap-4 z-10">
<div
class="w-12 h-12 rounded-2xl bg-orange-500 text-white flex items-center justify-center shadow-lg shadow-orange-200 group-hover:rotate-12 transition"
>
<i class="ph-fill ph-camera text-2xl" />
</div>
<div class="text-left">
<span class="block text-base font-bold text-stone-800">
拍食物 AI 分析
</span>
<span class="text-xs text-stone-400 font-bold">
计算卡路里 &amp; 自动记账
</span>
</div>
</div>
<i class="ph-bold ph-arrow-right text-orange-300 z-10" />
<!-- 装饰圆形光晕 -->
<div
class="absolute right-0 bottom-0 w-32 h-32 bg-orange-100 rounded-full blur-2xl opacity-50 translate-x-10 translate-y-10"
/>
</button>
</div>
<button
class="mt-8 w-full py-4 rounded-2xl text-stone-400 text-sm font-bold hover:bg-stone-50 transition"
@click="handleClose"
>
关闭
</button>
</div>
</div>
</template>

View File

@@ -0,0 +1,90 @@
<script setup>
// 分析页目前为静态占位,实现基础对话 UI后续接入真实 AI 逻辑
</script>
<template>
<div class="h-full flex flex-col animate-fade-in pb-6">
<div class="flex items-center gap-3 mb-4">
<div
class="w-10 h-10 rounded-full bg-gradient-warm flex items-center justify-center text-white shadow-lg shadow-orange-200"
>
<i class="ph-fill ph-sparkle" />
</div>
<div>
<h2 class="text-xl font-extrabold text-stone-800">AI 财务顾问</h2>
<p class="text-xs text-stone-400">Powered by Gemini</p>
</div>
</div>
<!-- Chat Area -->
<div class="flex-1 overflow-y-auto space-y-5 pr-1 pb-2">
<!-- Bot Message -->
<div class="flex gap-3">
<div
class="w-8 h-8 rounded-full bg-stone-100 flex items-center justify-center text-stone-400 mt-1 shrink-0"
>
<i class="ph-fill ph-robot" />
</div>
<div
class="bg-white p-4 rounded-2xl rounded-tl-none shadow-sm border border-stone-100 text-sm text-stone-600 leading-relaxed max-w-[85%]"
>
<p>你好 Alex👋 我分析了你本周的饮食记录</p>
<div class="mt-3 bg-stone-50 rounded-xl p-3 border border-stone-100">
<div class="flex items-center gap-2 mb-2">
<i class="ph-fill ph-warning text-orange-400" />
<span class="font-bold text-stone-700 text-xs">高热量警告</span>
</div>
<p class="text-xs">
周二和周四的晚餐摄入热量超标 30%主要是因为炸鸡奶茶
</p>
</div>
<p class="mt-3">建议今晚尝试清淡饮食比如蔬菜沙拉或三文鱼</p>
</div>
</div>
<!-- User Message -->
<div class="flex gap-3 flex-row-reverse">
<div
class="bg-stone-700 text-white p-4 rounded-2xl rounded-tr-none shadow-lg text-sm max-w-[85%]"
>
如果是自己做饭有什么推荐的食谱吗要简单的
</div>
</div>
<!-- Bot Message 2 -->
<div class="flex gap-3">
<div
class="w-8 h-8 rounded-full bg-stone-100 flex items-center justify-center text-stone-400 mt-1 shrink-0"
>
<i class="ph-fill ph-robot" />
</div>
<div
class="bg-white p-4 rounded-2xl rounded-tl-none shadow-sm border border-stone-100 text-sm text-stone-600 leading-relaxed max-w-[85%]"
>
<p>基于你冰箱里的食材上次记录推荐</p>
<p class="font-bold text-stone-800 mt-2 mb-1">🥑 牛油果虾仁拌饭</p>
<ul class="list-disc list-inside text-xs space-y-1 marker:text-orange-400">
<li>热量 450 kcal</li>
<li>耗时10 分钟</li>
<li>成本 ¥18</li>
</ul>
</div>
</div>
</div>
<!-- Input Area -->
<div class="mt-2 relative shrink-0">
<input
type="text"
placeholder="输入消息..."
class="w-full pl-5 pr-12 py-3.5 rounded-full bg-white border border-stone-100 focus:outline-none focus:border-orange-300 focus:ring-4 focus:ring-orange-50 transition text-sm shadow-sm text-stone-700 font-medium placeholder-stone-300"
/>
<button
class="absolute right-2 top-2 w-9 h-9 bg-gradient-warm text-white rounded-full flex items-center justify-center hover:scale-105 transition shadow-md"
>
<i class="ph-bold ph-arrow-up" />
</button>
</div>
</div>
</template>

209
src/views/HomeView.vue Normal file
View File

@@ -0,0 +1,209 @@
<script setup>
import { ref } from 'vue'
const notifications = ref([
{ merchant: '支付宝 - 瑞幸咖啡', amount: '18.00', time: '14:30' }
])
const confirmNotif = (index) => {
notifications.value.splice(index, 1)
// In a real app, this would trigger a store action or API call
alert('已自动入账,并同步至 AI 饮食分析')
}
defineEmits(['changeTab'])
</script>
<template>
<div class="space-y-6 animate-fade-in pb-28">
<!-- Header -->
<div class="flex justify-between items-center">
<div>
<p class="text-xs text-stone-400 font-bold tracking-wider">HI, ALEX</p>
<h1 class="text-2xl font-extrabold text-stone-800">今日概览</h1>
</div>
<div class="w-10 h-10 rounded-full bg-orange-50 p-0.5 cursor-pointer border border-orange-100"
@click="$emit('changeTab', 'settings')">
<img src="https://api.dicebear.com/7.x/avataaars/svg?seed=Felix" class="rounded-full" alt="User">
</div>
</div>
<!-- Asset Card -->
<div
class="w-full h-48 rounded-3xl bg-gradient-warm text-white p-6 shadow-xl shadow-orange-200/50 relative overflow-hidden group transition-all hover:shadow-orange-300/50">
<div class="absolute -right-10 -top-10 w-40 h-40 bg-white opacity-10 rounded-full blur-2xl"></div>
<div class="absolute left-0 bottom-0 w-full h-1/2 bg-gradient-to-t from-black/10 to-transparent"></div>
<div class="relative z-10 flex flex-col h-full justify-between">
<div>
<div class="flex items-center justify-between">
<p class="text-white/80 text-xs font-bold tracking-widest uppercase">本月结余</p>
<button
class="w-8 h-8 rounded-full bg-white/20 flex items-center justify-center backdrop-blur-md hover:bg-white/30 transition">
<i class="ph-bold ph-eye"></i>
</button>
</div>
<h2 class="text-4xl font-extrabold mt-2">¥ 4,285<span
class="text-lg font-medium opacity-80">.00</span></h2>
</div>
<div class="flex gap-8">
<div>
<p class="text-white/70 text-xs mb-0.5 flex items-center gap-1"><i
class="ph-bold ph-arrow-down-left"></i> 收入</p>
<p class="font-bold text-lg">¥ 12,500</p>
</div>
<div>
<p class="text-white/70 text-xs mb-0.5 flex items-center gap-1"><i
class="ph-bold ph-arrow-up-right"></i> 支出</p>
<p class="font-bold text-lg">¥ 8,215</p>
</div>
</div>
</div>
</div>
<!-- Budget Bar -->
<div class="bg-white rounded-2xl p-4 shadow-sm border border-stone-100">
<div class="flex justify-between items-center mb-2">
<span class="text-xs font-bold text-stone-500">本月预算</span>
<span class="text-xs font-bold text-stone-800">65%</span>
</div>
<div class="w-full bg-stone-100 rounded-full h-2.5 overflow-hidden">
<div class="bg-gradient-warm h-2.5 rounded-full" style="width: 65%"></div>
</div>
<div class="flex justify-between mt-2 text-[10px] text-stone-400">
<span>已用 ¥8,215</span>
<span>剩余 ¥4,285</span>
</div>
</div>
<!-- Weekly Trend Chart -->
<div class="bg-white rounded-3xl p-5 shadow-sm border border-stone-100">
<div class="flex justify-between items-center mb-4">
<h3 class="font-bold text-stone-700">支出趋势</h3>
<div class="flex gap-2">
<span class="text-[10px] px-2 py-1 rounded-full bg-stone-100 text-stone-500 font-bold"></span>
<span class="text-[10px] px-2 py-1 rounded-full text-stone-400"></span>
</div>
</div>
<div class="flex items-end justify-between h-24 gap-2">
<!-- Mon -->
<div class="flex flex-col items-center gap-1 flex-1">
<div class="w-full bg-stone-100 rounded-t-md relative group h-full flex items-end overflow-hidden">
<div class="w-full bg-orange-200 group-hover:bg-orange-300 transition-all h-[40%] rounded-t-md">
</div>
</div>
<span class="text-[10px] text-stone-400 font-medium"></span>
</div>
<!-- Tue -->
<div class="flex flex-col items-center gap-1 flex-1">
<div class="w-full bg-stone-100 rounded-t-md relative group h-full flex items-end overflow-hidden">
<div class="w-full bg-orange-200 group-hover:bg-orange-300 transition-all h-[60%] rounded-t-md">
</div>
</div>
<span class="text-[10px] text-stone-400 font-medium"></span>
</div>
<!-- Wed -->
<div class="flex flex-col items-center gap-1 flex-1">
<div class="w-full bg-stone-100 rounded-t-md relative group h-full flex items-end overflow-hidden">
<div class="w-full bg-orange-200 group-hover:bg-orange-300 transition-all h-[30%] rounded-t-md">
</div>
</div>
<span class="text-[10px] text-stone-400 font-medium"></span>
</div>
<!-- Thu (High) -->
<div class="flex flex-col items-center gap-1 flex-1">
<div class="w-full bg-stone-100 rounded-t-md relative group h-full flex items-end overflow-hidden">
<div
class="w-full bg-gradient-warm transition-all h-[85%] rounded-t-md shadow-lg shadow-orange-200">
</div>
</div>
<span class="text-[10px] text-stone-800 font-bold"></span>
</div>
<!-- Fri -->
<div class="flex flex-col items-center gap-1 flex-1">
<div class="w-full bg-stone-100 rounded-t-md relative group h-full flex items-end overflow-hidden">
<div class="w-full bg-orange-200 group-hover:bg-orange-300 transition-all h-[50%] rounded-t-md">
</div>
</div>
<span class="text-[10px] text-stone-400 font-medium"></span>
</div>
<!-- Sat -->
<div class="flex flex-col items-center gap-1 flex-1">
<div class="w-full bg-stone-100 rounded-t-md relative group h-full flex items-end overflow-hidden">
<div class="w-full bg-orange-200 group-hover:bg-orange-300 transition-all h-[20%] rounded-t-md">
</div>
</div>
<span class="text-[10px] text-stone-400 font-medium"></span>
</div>
<!-- Sun -->
<div class="flex flex-col items-center gap-1 flex-1">
<div class="w-full bg-stone-100 rounded-t-md relative group h-full flex items-end overflow-hidden">
<div class="w-full bg-orange-200 group-hover:bg-orange-300 transition-all h-[35%] rounded-t-md">
</div>
</div>
<span class="text-[10px] text-stone-400 font-medium"></span>
</div>
</div>
</div>
<!-- Notifications -->
<div v-if="notifications.length > 0" class="space-y-3">
<div class="flex justify-between items-end">
<h3 class="font-bold text-lg text-stone-700">待确认</h3>
<span class="text-[10px] bg-orange-100 text-orange-600 px-2 py-1 rounded-full font-bold">自动捕获</span>
</div>
<div v-for="(notif, idx) in notifications" :key="idx"
class="glass-warm p-4 rounded-2xl flex items-center gap-4 shadow-sm">
<div
class="w-12 h-12 rounded-2xl bg-[#1677FF] text-white flex items-center justify-center shadow-md shadow-blue-200">
<i class="ph-fill ph-alipay-logo text-2xl"></i>
</div>
<div class="flex-1">
<h4 class="font-bold text-stone-800">{{ notif.merchant }}</h4>
<p class="text-xs text-stone-400">{{ notif.time }} · 自动识别</p>
</div>
<div class="text-right">
<p class="font-bold text-stone-800">- ¥{{ notif.amount }}</p>
<button @click="confirmNotif(idx)"
class="mt-1.5 text-xs bg-gradient-warm text-white px-4 py-1.5 rounded-full font-bold active:scale-95 transition shadow-md shadow-orange-200">
入账
</button>
</div>
</div>
</div>
<!-- Feature Entries -->
<div class="grid grid-cols-2 gap-4">
<div class="bg-white p-5 rounded-3xl shadow-sm border border-stone-100 flex flex-col justify-between h-32 relative overflow-hidden group"
@click="$emit('changeTab', 'analysis')">
<div
class="absolute right-[-10px] top-[-10px] w-20 h-20 bg-purple-50 rounded-full blur-xl group-hover:bg-purple-100 transition">
</div>
<div class="w-10 h-10 rounded-full bg-purple-100 text-purple-600 flex items-center justify-center z-10">
<i class="ph-fill ph-robot text-xl"></i>
</div>
<div class="z-10">
<h4 class="font-bold text-stone-700">AI 顾问</h4>
<p class="text-xs text-stone-400 mt-1">分析我的消费习惯</p>
</div>
</div>
<div
class="bg-white p-5 rounded-3xl shadow-sm border border-stone-100 flex flex-col justify-between h-32 relative overflow-hidden group">
<div
class="absolute right-[-10px] top-[-10px] w-20 h-20 bg-emerald-50 rounded-full blur-xl group-hover:bg-emerald-100 transition">
</div>
<div
class="w-10 h-10 rounded-full bg-emerald-100 text-emerald-600 flex items-center justify-center z-10">
<i class="ph-fill ph-carrot text-xl"></i>
</div>
<div class="z-10">
<h4 class="font-bold text-stone-700">热量管理</h4>
<p class="text-xs text-stone-400 mt-1">今日剩余 750 kcal</p>
</div>
</div>
</div>
</div>
</template>

156
src/views/ListView.vue Normal file
View File

@@ -0,0 +1,156 @@
<script setup>
import { ref } from 'vue'
// 按日期分组的交易列表(当前为纯前端 Mock 数据,后续会接 Pinia/SQLite
const groupedTransactions = ref([
{
date: '今天, 5月20日',
totalExpense: '42.50',
items: [
{
title: '全家便利店',
type: 'expense',
amount: '24.50',
time: '10:30',
icon: 'ph-coffee',
bg: 'bg-orange-100',
color: 'text-orange-600',
note: '早餐',
},
{
title: '滴滴出行',
type: 'expense',
amount: '18.00',
time: '09:15',
icon: 'ph-taxi',
bg: 'bg-blue-100',
color: 'text-blue-600',
note: '',
},
],
},
{
date: '昨天, 5月19日',
totalExpense: '380.00',
items: [
{
title: '工资收入',
type: 'income',
amount: '12,500.00',
time: '18:00',
icon: 'ph-wallet',
bg: 'bg-emerald-100',
color: 'text-emerald-600',
note: '包含奖金',
},
{
title: '乐刻健身',
type: 'expense',
amount: '380.00',
time: '12:30',
icon: 'ph-barbell',
bg: 'bg-purple-100',
color: 'text-purple-600',
note: '月卡续费',
},
],
},
{
date: '5月18日',
totalExpense: '120.00',
items: [
{
title: '山姆会员店',
type: 'expense',
amount: '120.00',
time: '15:40',
icon: 'ph-basket',
bg: 'bg-red-100',
color: 'text-red-600',
note: '零食采购',
},
],
},
])
</script>
<template>
<div class="space-y-4 pb-10 animate-fade-in">
<!-- 顶部月份与统计卡片 -->
<div class="sticky top-0 z-20 bg-warmOffwhite/95 backdrop-blur-sm py-2">
<div class="flex justify-between items-center mb-4">
<h2 class="text-2xl font-extrabold text-stone-800">账单明细</h2>
<div
class="flex items-center gap-2 bg-white border border-stone-100 px-3 py-1.5 rounded-full shadow-sm"
>
<span class="text-sm font-bold text-stone-600">2024 5</span>
<i class="ph-bold ph-caret-down text-xs text-stone-400" />
</div>
</div>
<!-- 汇总统计 -->
<div class="flex gap-4 overflow-x-auto hide-scrollbar pb-2">
<div
class="shrink-0 bg-stone-700 text-white px-5 py-3 rounded-2xl shadow-lg shadow-stone-200 flex flex-col justify-center min-w-[140px]"
>
<span class="text-xs text-white/60 mb-1">总支出</span>
<span class="font-bold text-xl">¥ 8,215.40</span>
</div>
<div
class="shrink-0 bg-white text-stone-800 border border-stone-100 px-5 py-3 rounded-2xl flex flex-col justify-center min-w-[140px]"
>
<span class="text-xs text-stone-400 mb-1">总收入</span>
<span class="font-bold text-xl text-emerald-500">+ ¥ 12,500</span>
</div>
</div>
</div>
<!-- 按日期分组列表 -->
<div class="space-y-6 pb-10">
<div v-for="(group, gIndex) in groupedTransactions" :key="gIndex">
<div class="flex justify-between items-center mb-3 px-1">
<h4 class="text-sm font-bold text-stone-400">{{ group.date }}</h4>
<span class="text-xs text-stone-300 font-bold">支出 {{ group.totalExpense }}</span>
</div>
<div class="bg-white rounded-3xl p-1 shadow-sm border border-stone-50">
<div
v-for="(item, iIndex) in group.items"
:key="iIndex"
class="flex items-center justify-between p-4 hover:bg-stone-50 rounded-2xl transition"
>
<div class="flex items-center gap-4">
<div
:class="[
'w-10 h-10 rounded-full flex items-center justify-center text-lg shrink-0',
item.bg,
item.color,
]"
>
<i :class="['ph-fill', item.icon]" />
</div>
<div>
<p class="font-bold text-stone-800 text-sm">
{{ item.title }}
</p>
<p class="text-xs text-stone-400 mt-0.5">
{{ item.time }}
<span v-if="item.note" class="text-stone-300">| {{ item.note }}</span>
</p>
</div>
</div>
<span
:class="[
'font-bold text-base',
item.type === 'expense' ? 'text-stone-800' : 'text-emerald-500',
]"
>
{{ item.type === 'expense' ? '-' : '+' }} {{ item.amount }}
</span>
</div>
</div>
</div>
</div>
</div>
</template>

101
src/views/SettingsView.vue Normal file
View File

@@ -0,0 +1,101 @@
<script setup>
// 设置页当前只展示静态 UI后续会接入真实设置状态和持久化逻辑
</script>
<template>
<div class="space-y-6 animate-fade-in pb-10">
<h2 class="text-2xl font-extrabold text-stone-800">设置</h2>
<!-- Profile Section -->
<div class="bg-white rounded-3xl p-5 flex items-center gap-4 shadow-sm border border-stone-100">
<img
src="https://api.dicebear.com/7.x/avataaars/svg?seed=Felix"
alt="Avatar"
class="w-16 h-16 rounded-full bg-stone-100"
/>
<div class="flex-1">
<h3 class="font-bold text-lg text-stone-800">Alex Chen</h3>
<p class="text-xs text-stone-400">Pro 会员 (2025.12 到期)</p>
</div>
<button
class="w-8 h-8 rounded-full bg-stone-50 flex items-center justify-center text-stone-400 active:bg-stone-100 transition"
>
<i class="ph-bold ph-pencil-simple" />
</button>
</div>
<!-- Settings Group 1: Automation & AI -->
<section>
<h3 class="text-xs font-bold text-stone-400 uppercase tracking-widest mb-3 ml-2">
自动化 &amp; AI
</h3>
<div class="bg-white rounded-3xl overflow-hidden shadow-sm border border-stone-100">
<div class="flex items-center justify-between p-4 border-b border-stone-50">
<div class="flex items-center gap-3">
<div
class="w-8 h-8 rounded-full bg-blue-50 text-blue-500 flex items-center justify-center"
>
<i class="ph-fill ph-bell-ringing" />
</div>
<span class="font-bold text-stone-700 text-sm">自动捕获支付通知</span>
</div>
<!-- 开关目前为静态 UI后续接入真实状态 -->
<div class="w-11 h-6 bg-orange-400 rounded-full relative cursor-pointer">
<div class="absolute right-1 top-1 w-4 h-4 bg-white rounded-full shadow-sm" />
</div>
</div>
<div class="flex items-center justify-between p-4">
<div class="flex items-center gap-3">
<div
class="w-8 h-8 rounded-full bg-purple-50 text-purple-500 flex items-center justify-center"
>
<i class="ph-fill ph-magic-wand" />
</div>
<span class="font-bold text-stone-700 text-sm">AI 自动分类</span>
</div>
<div class="w-11 h-6 bg-orange-400 rounded-full relative cursor-pointer">
<div class="absolute right-1 top-1 w-4 h-4 bg-white rounded-full shadow-sm" />
</div>
</div>
</div>
</section>
<!-- Settings Group 2: General -->
<section>
<h3 class="text-xs font-bold text-stone-400 uppercase tracking-widest mb-3 ml-2">
通用
</h3>
<div class="bg-white rounded-3xl overflow-hidden shadow-sm border border-stone-100">
<button
class="flex w-full items-center justify-between p-4 border-b border-stone-50 active:bg-stone-50 transition text-left"
>
<div class="flex items-center gap-3">
<div
class="w-8 h-8 rounded-full bg-orange-50 text-orange-500 flex items-center justify-center"
>
<i class="ph-fill ph-export" />
</div>
<span class="font-bold text-stone-700 text-sm">导出账单数据 (Excel)</span>
</div>
<i class="ph-bold ph-caret-right text-stone-300" />
</button>
<div class="flex items-center justify-between p-4 active:bg-stone-50 transition">
<div class="flex items-center gap-3">
<div
class="w-8 h-8 rounded-full bg-red-50 text-red-500 flex items-center justify-center"
>
<i class="ph-fill ph-trash" />
</div>
<span class="font-bold text-stone-700 text-sm">清除缓存</span>
</div>
<span class="text-xs text-stone-400">128 MB</span>
</div>
</div>
</section>
<div class="text-center pt-4">
<p class="text-xs text-stone-300">Version 1.0.2 Beta</p>
</div>
</div>
</template>