89 lines
2.1 KiB
Vue
89 lines
2.1 KiB
Vue
<script setup lang="ts">
|
||
import type { FinanceStats } from '@/types/business/finance'
|
||
import { formatMoney } from '@/utils/format'
|
||
|
||
interface Props {
|
||
stats: FinanceStats | null
|
||
}
|
||
|
||
defineProps<Props>()
|
||
|
||
const emit = defineEmits<{
|
||
periodChange: [period: string]
|
||
export: []
|
||
}>()
|
||
</script>
|
||
|
||
<template>
|
||
<div class="finance-overview">
|
||
<!-- 卡内文字块:相对卡顶 26(设计 221 − 195) -->
|
||
<div class="finance-overview__main">
|
||
<p class="finance-overview__label">
|
||
累计消费总额
|
||
</p>
|
||
<p class="finance-overview__amount">
|
||
¥ {{ formatMoney(stats?.totalExpense ?? 0) }}
|
||
</p>
|
||
</div>
|
||
|
||
<!-- 右上角「2026年账单 ›」 -->
|
||
<button class="finance-overview__period-link" @click="emit('periodChange', 'year')">
|
||
{{ stats?.month || '2026年账单' }}
|
||
<span aria-hidden="true">›</span>
|
||
</button>
|
||
</div>
|
||
</template>
|
||
|
||
<style lang="less" scoped>
|
||
// 设计 6cd4aa76:渐变卡 (70,195) 1093.84×135;标签 (100,221) 13/400 #FFFFFF;
|
||
// 金额 (100,254) 38/700;右上角「2026年账单 ›」(1066.98,220) 11/500
|
||
.finance-overview {
|
||
position: relative;
|
||
flex: 1 1 auto;
|
||
min-width: 0;
|
||
height: 135px;
|
||
border-radius: @radius-base;
|
||
background: @finance-hero-gradient;
|
||
box-sizing: border-box;
|
||
|
||
&__main {
|
||
.flex(column, flex-start, flex-start);
|
||
padding: 26px 0 0 30px; // 标签 ink (100,221) → 卡内 (30,26)
|
||
gap: 16px; // 标签盒底 238 → 金额盒顶 254
|
||
}
|
||
|
||
&__label {
|
||
font-size: 13px;
|
||
font-weight: 400;
|
||
line-height: 17px;
|
||
color: @white;
|
||
}
|
||
|
||
&__amount {
|
||
font-size: 38px;
|
||
font-weight: 700;
|
||
line-height: 50px;
|
||
color: @white;
|
||
}
|
||
|
||
// 右上角链接:设计 x1066.98 y220 → 卡内右缘 27、顶 25
|
||
&__period-link {
|
||
position: absolute;
|
||
top: 25px;
|
||
right: 27px;
|
||
border: none;
|
||
background: transparent;
|
||
font-size: 11px;
|
||
font-weight: 500;
|
||
line-height: 15px;
|
||
color: @white;
|
||
cursor: pointer;
|
||
transition: opacity 0.2s;
|
||
|
||
&:hover {
|
||
opacity: 0.8;
|
||
}
|
||
}
|
||
}
|
||
</style>
|