feat 完善注释

This commit is contained in:
Ironsp
2026-10-01 17:24:57 +08:00
parent 2b59f68fd7
commit 9f4a5c7cda
183 changed files with 485 additions and 3615 deletions

View File

@@ -2,7 +2,6 @@
import { computed, onMounted, watch } from 'vue'
import { storeToRefs } from 'pinia'
import { useRoute, useRouter } from 'vue-router'
// 页面容器:数据只经 store,不直接 import api
import { useFinanceStore } from '@/stores/modules/finance'
import type { Bill, BillStatus } from '@/types/business/finance'
import { formatMoney } from '@/utils/format'
@@ -15,11 +14,6 @@ const { currentBill } = storeToRefs(financeStore)
const billId = computed(() => String(route.params.id))
/**
* 设计 31 是三张并排状态卡(523/825/1127 各 270×476):
* 已支付(红金额)+ 待支付(橙金额)+ 未到期(灰金额)。
* 页面实际只展示当前账单状态那一张,其余两张是同一组件的另外两种状态。
*/
const STATUS_CARDS: BillStatus[] = ['已支付', '待支付', '未到期']
const AMOUNT_CLASS: Record<BillStatus, string> = {
@@ -29,7 +23,6 @@ const AMOUNT_CLASS: Record<BillStatus, string> = {
已取消: 'is-idle',
}
/** 演示用:三张卡各自的账单数据(当前账单代入对应状态卡) */
const cards = computed<Array<{ status: BillStatus; bill: Bill | null }>>(() =>
STATUS_CARDS.map((status) => ({
status,
@@ -38,12 +31,10 @@ const cards = computed<Array<{ status: BillStatus; bill: Bill | null }>>(() =>
)
async function load(): Promise<void> {
// 支付信息(渠道 / 时间 / 流水号)已由后端回写在账单本身上,无需再查支付结果
await financeStore.fetchDetail(billId.value)
}
function onPay(id: string): void {
// 进收银台(确认支付):选支付方式 → 微信出码 / 支付宝跳转
void router.push({ path: '/finance/checkout', query: { ids: id } })
}
@@ -59,7 +50,6 @@ onMounted(() => {
<template>
<div class="bill-detail">
<div class="container">
<!-- 面包屑 (70,117)「财务中心 / 账单明细 /」 + 「账单详情」 -->
<nav class="bill-detail__breadcrumb">
<RouterLink to="/finance" class="bill-detail__breadcrumb-link">
财务中心 /
@@ -70,14 +60,12 @@ onMounted(() => {
<span class="bill-detail__breadcrumb-current">账单详情</span>
</nav>
<!-- 三张状态卡 (523/825/1127,158) 各 270×476 -->
<div v-if="currentBill" class="bill-detail__cards">
<section
v-for="card in cards"
:key="card.status"
class="bill-detail__card"
>
<!-- 卡头:对勾圆 + 状态词 (539,278) 238×21 16/700 #1F2937 -->
<div class="bill-detail__head">
<span class="bill-detail__check" aria-hidden="true">✓</span>
<h3 class="bill-detail__status">
@@ -85,7 +73,6 @@ onMounted(() => {
</h3>
</div>
<!-- 付款金额:标签 (590.23,315) + 金额 (653.8,309) 18/700 -->
<div class="bill-detail__amount-row">
<span class="bill-detail__amount-label">付款金额:</span>
<span
@@ -94,7 +81,6 @@ onMounted(() => {
>¥ {{ formatMoney(card.bill?.amount ?? currentBill.amount, 0) }}</span>
</div>
<!-- 支付信息四行:标签 (547,y) 12/400 #6B7280 + 值 12/700 #1F2937 -->
<dl class="bill-detail__fields">
<div class="bill-detail__field">
<dt class="bill-detail__label">
@@ -122,7 +108,6 @@ onMounted(() => {
</div>
</dl>
<!-- 订单小卡 (555.5/857.5/1159.5,481..) 205 宽 -->
<div class="bill-detail__order">
<span class="bill-detail__order-title">
{{ card.status }}订单
@@ -137,7 +122,6 @@ onMounted(() => {
</div>
</div>
<!-- 返回 (727.4,594) 43.2×16 12/500 -->
<button
v-if="card.status === '待支付'"
class="bill-detail__cta"
@@ -163,13 +147,11 @@ onMounted(() => {
</template>
<style lang="less" scoped>
// 设计 31 账单详情(1920 画布 1:1)——内容区 x70→1850 = 1780
.bill-detail {
width: 100%;
padding-bottom: 325px; // 卡片底 634 → 页脚 1087
padding-bottom: 325px;
background: @contract-page-bg;
// 面包屑 (70,117):文字 ink y117,卡片顶 158 → 面包屑盒 86..131
&__breadcrumb {
.flex(row, flex-start, center);
height: 86px;
@@ -195,11 +177,10 @@ onMounted(() => {
font-weight: 500;
}
// 三张卡并排:x523 / 825 / 1127,间距 32
&__cards {
.flex(row, flex-start, flex-start);
gap: 32px;
padding-left: 453px; // 内容区起点 70 → 首卡 523
padding-left: 453px;
box-sizing: border-box;
}
@@ -212,11 +193,9 @@ onMounted(() => {
box-sizing: border-box;
}
// 卡头:对勾圆 (645.27,204) 34/400 白字 + 状态词 (539,278)
&__head {
.flex(row, flex-start, center);
gap: 0;
// 状态词盒 y278(卡内 120)、对勾圆 y204(卡内 46)→ 用 align-items:flex-start + 各自 margin
align-items: flex-start;
padding: 46px 0 0 16px;
height: 141px;
@@ -236,32 +215,30 @@ onMounted(() => {
line-height: 1;
order: 2;
flex-shrink: 0;
// 设计圆 x629.27(卡内 106.27);渲染值 714 → 左移 84.75
transform: translateX(-84.75px);
}
&__status {
order: 1;
width: 238px;
margin-top: 74px; // 卡内 46 → 120(状态词顶)
margin-top: 74px;
font-size: 16px;
font-weight: 700;
line-height: 21px;
color: @finance-ink;
}
// 付款金额行:标签卡内 (67.23,157),金额卡内 (130.8,151)
&__amount-row {
position: relative;
width: 238px;
height: 51px; // 行顶 = 卡内 130(金额盒顶 309−158=151 − 行内偏移 21)
height: 51px;
margin: 0 0 0 16px;
}
&__amount-label {
position: absolute;
top: 16px; // 设计 ink y315(卡内 157)
left: 51.23px; // 卡内 67.23 − 16
top: 16px;
left: 51.23px;
font-size: 12px;
font-weight: 400;
line-height: 16px;
@@ -270,8 +247,8 @@ onMounted(() => {
&__amount {
position: absolute;
top: 10px; // 设计盒顶 y309(卡内 151)
left: 114.8px; // 卡内 130.8 − 16
top: 10px;
left: 114.8px;
font-size: 18px;
font-weight: 700;
line-height: 24px;
@@ -282,7 +259,6 @@ onMounted(() => {
&.is-idle { color: @finance-idle; }
}
// 支付信息:标签卡内 (24,207) 起,行距 28
&__fields {
.flex(column, flex-start, stretch);
gap: 12px;
@@ -297,7 +273,7 @@ onMounted(() => {
}
&__label {
flex: 0 0 77.52px; // 值统一从卡内 101.52 起
flex: 0 0 77.52px;
font-size: 12px;
font-weight: 400;
line-height: 16px;
@@ -314,7 +290,6 @@ onMounted(() => {
word-break: break-all;
}
// 订单小卡:卡内 x32.5,标题顶卡内 323(设计 481−158)
&__order {
.flex(column, flex-start, flex-start);
gap: 0;
@@ -368,11 +343,10 @@ onMounted(() => {
color: @finance-ink;
}
// 底部按钮 (727.4,594) 43.2×16 文字;盒宽 90 居中于 270 卡
&__cta {
position: absolute;
left: 50%;
top: 428px; // 按钮文字 y594(卡内 436),盒高 32 → 盒顶 428
top: 428px;
width: 90px;
height: 32px;
border: none;
@@ -381,7 +355,6 @@ onMounted(() => {
color: @white;
font-size: 12px;
font-weight: 500;
/* 按钮基线:文字 ink y594 → 盒顶 428 + (32−16)/2 = 436 */
padding-bottom: 6px;
box-sizing: border-box;
transform: translateX(-50%);