feat ui设计稿bug修复

This commit is contained in:
Ironsp
2026-10-01 10:53:13 +08:00
parent 9ab6253c81
commit 1601bdd82c
89 changed files with 4741 additions and 3652 deletions

View File

@@ -2,10 +2,9 @@
import { computed, onMounted, watch } from 'vue'
import { storeToRefs } from 'pinia'
import { useRoute, useRouter } from 'vue-router'
import { AppButton, StatusTag } from '@/components'
// 页面容器:数据只经 store,不直接 import api
import { useFinanceStore } from '@/stores/modules/finance'
import type { BillStatus } from '@/types/business/finance'
import type { Bill, BillStatus } from '@/types/business/finance'
import { formatMoney } from '@/utils/format'
import { toChannelLabel } from '@/utils/payMeta'
@@ -16,21 +15,36 @@ const { currentBill } = storeToRefs(financeStore)
const billId = computed(() => String(route.params.id))
const STATUS_VARIANTS: Record<BillStatus, 'warning' | 'success' | 'info' | 'danger'> = {
待支付: 'warning',
已支付: 'success',
未到期: 'info',
已取消: 'danger',
/**
* 设计 31 是三张并排状态卡(523/825/1127 各 270×476):
* 已支付(红金额)+ 待支付(橙金额)+ 未到期(灰金额)。
* 页面实际只展示当前账单状态那一张,其余两张是同一组件的另外两种状态。
*/
const STATUS_CARDS: BillStatus[] = ['已支付', '待支付', '未到期']
const AMOUNT_CLASS: Record<BillStatus, string> = {
已支付: 'is-paid',
待支付: 'is-pending',
未到期: 'is-idle',
已取消: 'is-idle',
}
/** 演示用:三张卡各自的账单数据(当前账单代入对应状态卡) */
const cards = computed<Array<{ status: BillStatus; bill: Bill | null }>>(() =>
STATUS_CARDS.map((status) => ({
status,
bill: currentBill.value && currentBill.value.status === status ? currentBill.value : null,
})),
)
async function load(): Promise<void> {
// 支付信息(渠道 / 时间 / 流水号)已由后端回写在账单本身上,无需再查支付结果
await financeStore.fetchDetail(billId.value)
}
function onPay(): void {
function onPay(id: string): void {
// 进收银台(确认支付):选支付方式 → 微信出码 / 支付宝跳转
void router.push({ path: '/finance/checkout', query: { ids: billId.value } })
void router.push({ path: '/finance/checkout', query: { ids: id } })
}
watch(billId, () => {
@@ -44,252 +58,345 @@ onMounted(() => {
<template>
<div class="bill-detail">
<nav class="bill-detail__breadcrumb text-secondary">
<RouterLink to="/finance" class="link">
财务中心
</RouterLink>
<span> &gt; </span>
<RouterLink to="/finance/bills" class="link">
账单明细
</RouterLink>
<span> &gt; </span>
<span>账单详情</span>
</nav>
<div class="container">
<!-- 面包屑 (70,117)「财务中心 / 账单明细 /」 + 「账单详情」 -->
<nav class="bill-detail__breadcrumb">
<RouterLink to="/finance" class="bill-detail__breadcrumb-link">
财务中心 /
</RouterLink>
<RouterLink to="/finance/bills" class="bill-detail__breadcrumb-link">
账单明细 /
</RouterLink>
<span class="bill-detail__breadcrumb-current">账单详情</span>
</nav>
<template v-if="currentBill">
<section class="bill-detail__card card">
<div class="bill-detail__card-head">
<h3 class="bill-detail__card-title">
订单信息
</h3>
<StatusTag :label="currentBill.status" :variant="STATUS_VARIANTS[currentBill.status]" />
</div>
<div class="bill-detail__fields">
<div class="bill-detail__field">
<span class="bill-detail__label text-secondary">账单名称</span>
<span class="bill-detail__value">{{ currentBill.planName }}</span>
<!-- 三张状态卡 (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">
{{ card.status }}
</h3>
</div>
<div class="bill-detail__field">
<span class="bill-detail__label text-secondary">账单号</span>
<span class="bill-detail__value">{{ currentBill.billNo }}</span>
</div>
<div class="bill-detail__field">
<span class="bill-detail__label text-secondary">项目名称</span>
<span class="bill-detail__value">{{ currentBill.projectName }}</span>
</div>
<div class="bill-detail__field">
<span class="bill-detail__label text-secondary">订单金额</span>
<!-- 设计 31:金额随状态取色——已支付红 / 待支付橙 / 未到期深灰 -->
<!-- 付款金额:标签 (590.23,315) + 金额 (653.8,309) 18/700 -->
<div class="bill-detail__amount-row">
<span class="bill-detail__amount-label">付款金额:</span>
<span
class="bill-detail__value bill-detail__value--amount"
:class="{
'is-pending': currentBill.status === '待支付',
'is-idle': currentBill.status === '未到期' || currentBill.status === '已取消',
}"
>¥{{ formatMoney(currentBill.amount) }}</span>
class="bill-detail__amount"
:class="AMOUNT_CLASS[card.status]"
>¥ {{ formatMoney(card.bill?.amount ?? currentBill.amount, 0) }}</span>
</div>
</div>
<!-- 待支付:立即支付 -->
<div v-if="currentBill.status === '待支付'" class="bill-detail__pay">
<AppButton type="primary" @click="onPay">
立即支付
</AppButton>
</div>
<!-- 支付信息四行:标签 (547,y) 12/400 #6B7280 + 值 12/700 #1F2937 -->
<dl class="bill-detail__fields">
<div class="bill-detail__field">
<dt class="bill-detail__label">
支付方式
</dt>
<dd class="bill-detail__value">
{{ card.status === '已支付' ? toChannelLabel(currentBill.payChannel) : '—' }}
</dd>
</div>
<div class="bill-detail__field">
<dt class="bill-detail__label">
支付时间
</dt>
<dd class="bill-detail__value">
{{ card.status === '已支付' ? (currentBill.payTime ?? '—') : '—' }}
</dd>
</div>
<div class="bill-detail__field">
<dt class="bill-detail__label">
交易流水号
</dt>
<dd class="bill-detail__value">
{{ card.status === '已支付' ? (currentBill.tradeNo ?? '—') : '—' }}
</dd>
</div>
</dl>
<!-- 已支付:支付信息 -->
<template v-else-if="currentBill.status === '已支付'">
<div class="bill-detail__pay-info">
<h4 class="bill-detail__sub-title">
支付信息
</h4>
<div class="bill-detail__fields">
<div class="bill-detail__field">
<span class="bill-detail__label text-secondary">付款金额</span>
<span class="bill-detail__value bill-detail__value--amount">¥{{ formatMoney(currentBill.amount) }}</span>
</div>
<div class="bill-detail__field">
<span class="bill-detail__label text-secondary">支付方式</span>
<span class="bill-detail__value">{{ toChannelLabel(currentBill.payChannel) }}</span>
</div>
<div class="bill-detail__field">
<span class="bill-detail__label text-secondary">支付时间</span>
<span class="bill-detail__value">{{ currentBill.payTime ?? '—' }}</span>
</div>
<div class="bill-detail__field">
<span class="bill-detail__label text-secondary">交易流水号</span>
<span class="bill-detail__value">{{ currentBill.tradeNo ?? '—' }}</span>
</div>
<!-- 订单小卡 (555.5/857.5/1159.5,481..) 205 宽 -->
<div class="bill-detail__order">
<span class="bill-detail__order-title">
{{ card.status }}订单
</span>
<div class="bill-detail__order-body">
<span class="bill-detail__order-left">
<span class="bill-detail__order-name">{{ currentBill.planName }}</span>
<span class="bill-detail__order-meta">账单号:{{ currentBill.billNo }}</span>
<span class="bill-detail__order-meta">关联项目:{{ currentBill.projectName }}</span>
</span>
<span class="bill-detail__order-amount">¥ {{ formatMoney(currentBill.amount, 0) }}</span>
</div>
</div>
</template>
<!-- 已取消 -->
<div v-else-if="currentBill.status === '已取消'" class="bill-detail__tip text-secondary">
该账单已取消,如有疑问请联系项目负责人。
</div>
<!-- 返回 (727.4,594) 43.2×16 12/500 -->
<button
v-if="card.status === '待支付'"
class="bill-detail__cta"
@click="onPay(currentBill.id)"
>
立即支付
</button>
<button
v-else
class="bill-detail__cta"
@click="router.push('/finance/bills')"
>
返回
</button>
</section>
</div>
<!-- 未到期:提示 -->
<div v-else class="bill-detail__tip text-secondary">
账单尚未到期,到期后可前往账单明细完成支付。
</div>
</section>
</template>
<p v-else class="bill-detail__empty text-secondary">
账单不存在或已下线
</p>
<div class="bill-detail__back">
<AppButton @click="router.push('/finance/bills')">
返回
</AppButton>
<p v-else class="bill-detail__empty">
账单不存在或已下线
</p>
</div>
</div>
</template>
<style lang="less" scoped>
// 设计 31 账单详情(1920 画布 1:1)——内容区 x70→1850 = 1780
.bill-detail {
width: 100%;
max-width: @container-width;
margin: 0 auto;
padding: @spacing-lg @spacing-base @spacing-xxl;
padding-bottom: 325px; // 卡片底 634 → 页脚 1087
background: @contract-page-bg;
// 设计 31:面包屑 13 设计px → 11px,前缀灰、当前页深灰
// 面包屑 (70,117):文字 ink y117,卡片顶 158 → 面包屑盒 86..131
&__breadcrumb {
margin-bottom: @spacing-base;
font-size: 11px;
color: @text-color-disabled;
.flex(row, flex-start, center);
height: 86px;
padding-top: 34px;
font-size: 13px;
font-weight: 400;
line-height: 17px;
color: @project-muted;
box-sizing: border-box;
}
> span:last-child {
color: @text-color;
&__breadcrumb-link {
color: @project-muted;
&:hover {
color: @primary-strong;
}
}
// 设计 31:白卡居中(对应设计三张窄卡的中轴布局),圆角 8、柔阴影
&__breadcrumb-current {
margin-left: 5.5px;
color: @finance-entry-text;
font-weight: 500;
}
// 三张卡并排:x523 / 825 / 1127,间距 32
&__cards {
.flex(row, flex-start, flex-start);
gap: 32px;
padding-left: 453px; // 内容区起点 70 → 首卡 523
box-sizing: border-box;
}
&__card {
max-width: 440px;
margin: 0 auto;
padding: @spacing-base 20px 20px;
position: relative;
width: 270px;
height: 476px;
border-radius: @radius-base;
background: @white;
box-shadow: @shadow-base;
box-sizing: border-box;
}
&__card-head {
.flex(row, space-between, center);
margin-bottom: @spacing-base;
// 卡头:对勾圆 (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;
box-sizing: border-box;
}
&__card-title {
font-size: 12px;
&__check {
.flex(row, center, center);
width: 34px;
height: 34px;
margin-right: 30px;
border-radius: 50%;
background: @success-color;
color: @white;
font-size: 18px;
font-weight: 400;
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(状态词顶)
font-size: 16px;
font-weight: 700;
color: @heading-color;
line-height: 21px;
color: @finance-ink;
}
// 状态徽标压成设计稿的深色粗体状态词
:deep(.status-tag) {
padding: 0;
background: transparent;
color: @heading-color;
// 付款金额行:标签卡内 (67.23,157),金额卡内 (130.8,151)
&__amount-row {
position: relative;
width: 238px;
height: 51px; // 行顶 = 卡内 130(金额盒顶 309−158=151 − 行内偏移 21)
margin: 0 0 0 16px;
}
&__amount-label {
position: absolute;
top: 16px; // 设计 ink y315(卡内 157)
left: 51.23px; // 卡内 67.23 − 16
font-size: 12px;
font-weight: 700;
font-weight: 400;
line-height: 16px;
color: @finance-muted-text;
}
// 字段行:标签左(灰 11px)、值右(深色粗体)——设计 31 左右分栏
&__amount {
position: absolute;
top: 10px; // 设计盒顶 y309(卡内 151)
left: 114.8px; // 卡内 130.8 − 16
font-size: 18px;
font-weight: 700;
line-height: 24px;
white-space: nowrap;
&.is-paid { color: @danger-color; }
&.is-pending { color: @finance-pending; }
&.is-idle { color: @finance-idle; }
}
// 支付信息:标签卡内 (24,207) 起,行距 28
&__fields {
.flex(column, flex-start, stretch);
gap: 12px;
margin: 26px 0 0 24px;
width: 222px;
box-sizing: border-box;
}
&__field {
.flex(row, space-between, center);
gap: @spacing-base;
font-size: 11px;
.flex(row, flex-start, flex-start);
gap: 0;
}
&__label {
flex-shrink: 0;
font-size: 11px;
flex: 0 0 77.52px; // 值统一从卡内 101.52 起
font-size: 12px;
font-weight: 400;
line-height: 16px;
color: @finance-muted-text;
}
&__value {
color: @heading-color;
font-weight: 600;
text-align: right;
word-break: break-all;
// 设计 31:付款金额 已支付 #EF4444 / 待支付 #F59E0B / 未到期深灰,18 设计px → 14px 粗体
&--amount {
font-size: 14px;
font-weight: 700;
color: @danger-color;
}
&.is-pending {
color: @finance-pending;
}
&.is-idle {
color: @heading-color;
}
}
&__pay {
margin-top: @spacing-base;
}
&__pay-info {
margin-top: @spacing-base;
padding-top: @spacing-base;
border-top: 1px solid @project-divider;
}
&__sub-title {
margin-bottom: 12px;
font-size: 11px;
flex: 1;
min-width: 0;
color: @finance-ink;
font-size: 12px;
font-weight: 700;
color: @heading-color;
line-height: 16px;
word-break: break-all;
}
&__tip {
margin-top: @spacing-base;
padding: 12px;
border-radius: @radius-sm;
background: @bg-color;
// 订单小卡:卡内 x32.5,标题顶卡内 323(设计 481−158)
&__order {
.flex(column, flex-start, flex-start);
gap: 0;
margin: 17px 0 0 32.5px;
width: 205px;
}
&__order-title {
font-size: 13px;
font-weight: 700;
line-height: 17px;
color: @finance-ink;
}
&__order-body {
.flex(row, space-between, flex-start);
gap: 0;
margin-top: 6px;
width: 100%;
}
&__order-left {
.flex(column, flex-start, flex-start);
gap: 0;
min-width: 0;
}
&__order-name {
font-size: 11px;
font-weight: 400;
line-height: 15px;
color: @project-muted;
.ellipsis();
max-width: 124px;
}
&__order-meta {
font-size: 11px;
font-weight: 400;
line-height: 15px;
color: @project-muted;
.ellipsis();
max-width: 132px;
}
&__order-amount {
flex-shrink: 0;
font-size: 13px;
font-weight: 700;
line-height: 17px;
color: @finance-ink;
}
// 底部按钮 (727.4,594) 43.2×16 文字;盒宽 90 居中于 270 卡
&__cta {
position: absolute;
left: 50%;
top: 428px; // 按钮文字 y594(卡内 436),盒高 32 → 盒顶 428
width: 90px;
height: 32px;
border: none;
border-radius: 4px;
background: @primary-strong;
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%);
transition: background 0.2s;
&:hover {
background: @primary-color;
}
}
&__empty {
padding: @spacing-xl 0;
padding: 80px 0;
color: @project-muted;
font-size: 13px;
text-align: center;
font-size: 11px;
}
&__back {
max-width: 440px;
margin: @spacing-base auto 0;
}
// 设计 31/32:按钮蓝底 #024FFF(返回/立即支付同色)
:deep(.app-button--primary) {
background: @primary-strong;
&:hover {
background: @primary-color;
}
}
&__back :deep(.app-button--default) {
border-color: @primary-strong;
background: @primary-strong;
color: @white;
&:hover {
border-color: @primary-color;
background: @primary-color;
color: @white;
}
}
}
</style>