feat 完善注释
This commit is contained in:
@@ -18,28 +18,16 @@ const emit = defineEmits<{
|
||||
download: [file: FileInfo]
|
||||
}>()
|
||||
|
||||
/**
|
||||
* 是否可跳收银台支付。
|
||||
*
|
||||
* <p>用「待支付 + id 是纯数字」判断,而不是过去的「来源是账单」——本栈的支付口径就是
|
||||
* **计划 id**(收银台 `?ids=` 与 `vm_finance_payment.bill_id` 同一口径),计划卡本就该能付;
|
||||
* 数字校验只是防止空 id 拼出 `?ids=`。</p>
|
||||
*/
|
||||
function canPay(bill: ProjectBill): boolean {
|
||||
return bill.status === '待支付' && /^\d+$/.test(bill.id)
|
||||
}
|
||||
|
||||
/**
|
||||
* 三态配色类(设计稿口径,挂到 `.project-finance__plan` 上,由后代选择器分发):
|
||||
* 已支付 = 绿、待支付 = 橙、未到期 = 灰,**徽标实底 + 金额文字同色**。
|
||||
*/
|
||||
const TONE_CLASS: Record<ProjectBill['status'], string> = {
|
||||
'已支付': 'is-paid',
|
||||
'待支付': 'is-pending',
|
||||
'未到期': 'is-idle',
|
||||
}
|
||||
|
||||
/** 文件行副标题(设计稿:「2.4MB · 上传于 2026-8-17 17:00」) */
|
||||
function fileMeta(file: FileInfo): string {
|
||||
const size = file.size ? formatFileSize(file.size) : ''
|
||||
const time = file.uploadTime ? `上传于 ${file.uploadTime}` : ''
|
||||
@@ -49,7 +37,6 @@ function fileMeta(file: FileInfo): string {
|
||||
|
||||
<template>
|
||||
<section class="project-finance">
|
||||
<!-- 付款计划(数据源 vm_bill_plan):卡内三态 = 已支付 / 待支付 / 未到期 -->
|
||||
<h2 class="project-finance__title">
|
||||
付款计划
|
||||
</h2>
|
||||
@@ -69,7 +56,6 @@ function fileMeta(file: FileInfo): string {
|
||||
|
||||
<div class="project-finance__plan-body">
|
||||
<div class="project-finance__fields">
|
||||
<!-- 交易流水号只在已支付时出现(设计稿:已支付那张卡多一行流水号) -->
|
||||
<p v-if="bill.status === '已支付' && bill.tradeNo" class="project-finance__field">
|
||||
交易流水号:{{ bill.tradeNo }}
|
||||
</p>
|
||||
@@ -85,7 +71,6 @@ function fileMeta(file: FileInfo): string {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 支付口径 = 计划 id(与收银台 ?ids= / vm_finance_payment.bill_id 一致) -->
|
||||
<button
|
||||
v-if="canPay(bill)"
|
||||
class="project-finance__pay"
|
||||
@@ -100,7 +85,6 @@ function fileMeta(file: FileInfo): string {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 发票记录 -->
|
||||
<h2 class="project-finance__title">
|
||||
发票记录
|
||||
</h2>
|
||||
@@ -134,7 +118,6 @@ function fileMeta(file: FileInfo): string {
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- 合同文件 -->
|
||||
<h2 class="project-finance__title">
|
||||
合同文件
|
||||
</h2>
|
||||
@@ -165,15 +148,10 @@ function fileMeta(file: FileInfo): string {
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
// 设计稿实测(1920,1:1):标题 (82,342) 15/700;计划卡 (70,380) 372×139 / (70,533) 372×144 /
|
||||
// (70,691) 372×116,描边 1px #F0F1F3、圆角 13;期次名 (89,398) 14/700;状态 (378,400) 11/500;
|
||||
// 字段行 (89,426) 11/400 #6B7280;金额 (341.33,453) 20/700;「立即支付」通栏 372×34 #F59E0B;
|
||||
// 发票记录标题 (82,841)、合同文件标题 (82,1033);文件行 1780×55 #F7F8FA。
|
||||
.project-finance {
|
||||
.flex(column, flex-start, stretch);
|
||||
padding: 0;
|
||||
|
||||
// 分割线 317 → 「付款计划」盒 339(ink 342,843103b2)
|
||||
&__title {
|
||||
.section-title();
|
||||
margin-top: 22px;
|
||||
@@ -188,32 +166,25 @@ function fileMeta(file: FileInfo): string {
|
||||
}
|
||||
}
|
||||
|
||||
// 首区块标题盒底 359 → 首张卡顶 380
|
||||
&__title:first-child + &__plans {
|
||||
margin-top: 21px;
|
||||
}
|
||||
|
||||
// 区块间距:付款计划卡底 807 → 「发票记录」盒 838(31);发票行底 999 → 「合同文件」盒 1030(31)
|
||||
&__plans + &__title,
|
||||
&__files + &__title {
|
||||
margin-top: 31px;
|
||||
}
|
||||
|
||||
// 区块标题盒底 → 首行顶:838+20 → 879(21);1030+20 → 1071(21)
|
||||
&__title + &__files,
|
||||
&__title + &__file {
|
||||
margin-top: 21px;
|
||||
}
|
||||
|
||||
// ---------- 付款计划 ----------
|
||||
|
||||
// 卡片竖排单列、定宽 372 左对齐;卡间距 14(380→533→691 实测 153/158,扣卡高)
|
||||
&__plans {
|
||||
.flex(column, flex-start, flex-start);
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
// 白底 + 1px #F0F1F3 描边、圆角 13,定宽 372;内容内缩 19/17
|
||||
&__plan {
|
||||
.flex(column, flex-start, stretch);
|
||||
position: relative;
|
||||
@@ -223,24 +194,20 @@ function fileMeta(file: FileInfo): string {
|
||||
border-radius: 13px;
|
||||
background: @white;
|
||||
box-sizing: border-box;
|
||||
gap: 0; // 段间距全部走显式 margin,避免 gap 与 margin 叠加
|
||||
gap: 0;
|
||||
|
||||
// 带「立即支付」时按钮贴卡片下缘:底部不留内边距
|
||||
&:has(.project-finance__pay) {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
// 两条字段、无支付按钮(卡3):底距 17(设计卡高 116 = 2+17+19+8+53+17)
|
||||
&:not(:has(.project-finance__field:nth-child(3))):not(:has(.project-finance__pay)) {
|
||||
padding-bottom: 17px;
|
||||
}
|
||||
|
||||
// 三条字段、无支付按钮(卡1):底距 15(设计卡高 139 = 2+17+19+8+78+15)
|
||||
&:has(.project-finance__field:nth-child(3)):not(:has(.project-finance__pay)) {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
// 三态配色(浅底徽标 + 同色系金额)
|
||||
&.is-paid {
|
||||
.project-finance__badge {
|
||||
color: @finance-paid;
|
||||
@@ -277,7 +244,6 @@ function fileMeta(file: FileInfo): string {
|
||||
gap: @spacing-sm;
|
||||
}
|
||||
|
||||
// 期次标题 14/700,行高 19(顶 398 = 卡内 380+18)
|
||||
&__plan-name {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
@@ -286,7 +252,6 @@ function fileMeta(file: FileInfo): string {
|
||||
.ellipsis();
|
||||
}
|
||||
|
||||
// 状态纯文字(设计 11/500)
|
||||
&__badge {
|
||||
.flex(row, center, center);
|
||||
flex-shrink: 0;
|
||||
@@ -296,24 +261,18 @@ function fileMeta(file: FileInfo): string {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
// 金额是**文本覆盖层**,不参与卡高:设计里它压在字段区右侧、与首字段行齐平
|
||||
// (ink 453 = 卡顶 380 + 73;字段盒顶 424 + 29)。必须 absolute,否则 26 高的
|
||||
// 行盒会把 __plan-body 撑高,三张卡分别虚高 8/8/0。
|
||||
&__plan-body {
|
||||
.flex(row, space-between, flex-start);
|
||||
position: relative;
|
||||
margin-top: 8px; // 期次行盒底 416 → 字段块顶 424
|
||||
margin-top: 8px;
|
||||
gap: @spacing-base;
|
||||
}
|
||||
|
||||
// 字段块按内容定高(3 行 78 / 2 行 53),行距由绝对偏移给,避免 margin 叠加。
|
||||
// 设计:卡1 424→502(3 行 0/23/61),卡2 564→617、卡3 729→782(2 行 0/23)。
|
||||
&__fields {
|
||||
position: relative;
|
||||
flex: 0 0 auto;
|
||||
min-width: 0;
|
||||
|
||||
// 3 行时块高 78,2 行时 53
|
||||
height: 53px;
|
||||
|
||||
&:has(> :nth-child(3)) {
|
||||
@@ -330,7 +289,6 @@ function fileMeta(file: FileInfo): string {
|
||||
color: @project-label;
|
||||
.ellipsis();
|
||||
|
||||
// 字段行距:426 → 449 → 487(相对块顶 0 / 23 / 61)
|
||||
&:nth-child(1) { top: 0; }
|
||||
|
||||
&:nth-child(2) { top: 23px; }
|
||||
@@ -338,7 +296,6 @@ function fileMeta(file: FileInfo): string {
|
||||
&:nth-child(3) { top: 61px; }
|
||||
}
|
||||
|
||||
// 金额 20/700:设计 ink 453(卡顶 380 + 73),相对首字段行盒顶(424)再下移 29
|
||||
&__amount {
|
||||
position: absolute;
|
||||
top: 29px;
|
||||
@@ -350,8 +307,6 @@ function fileMeta(file: FileInfo): string {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
// 「立即支付」:设计卡内通铺 370×34、贴卡片下缘。
|
||||
// 卡2:字段块底 617 → 按钮顶 642(间距 25),按钮底 676,卡底 677。
|
||||
&__pay {
|
||||
height: 34px;
|
||||
margin: 11px -19px 0;
|
||||
@@ -369,9 +324,6 @@ function fileMeta(file: FileInfo): string {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 发票 / 合同文件 ----------
|
||||
|
||||
// 发票行间距 10(879→944 / 1071→1136)
|
||||
&__files {
|
||||
.flex(column, flex-start, stretch);
|
||||
gap: 10px;
|
||||
@@ -380,18 +332,16 @@ function fileMeta(file: FileInfo): string {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
// 整行通铺 #F7F8FA、圆角 8,行高 55
|
||||
&__file {
|
||||
.flex(row, space-between, center);
|
||||
gap: @spacing-base;
|
||||
height: 55px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 5.7px 0 16px; // 徽标左缘 86 = 内容区 70 + 16;操作右缘 x1845
|
||||
padding: 0 5.7px 0 16px;
|
||||
border-radius: 8px;
|
||||
background: @finance-row-bg;
|
||||
}
|
||||
|
||||
// 文件类型方块(设计 ≈33×21)
|
||||
&__file-badge {
|
||||
.flex(row, center, center);
|
||||
flex-shrink: 0;
|
||||
|
||||
Reference in New Issue
Block a user