Files
cz-web/src/views/finance/pay-result.vue
2026-10-01 10:53:13 +08:00

357 lines
9.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { computed, onMounted } from 'vue'
import { storeToRefs } from 'pinia'
import { useRoute, useRouter } from 'vue-router'
// 页面容器:数据只经 store,不直接 import api
import { useFinanceStore } from '@/stores/modules/finance'
import { formatMoney } from '@/utils/format'
const route = useRoute()
const router = useRouter()
const financeStore = useFinanceStore()
const { result } = storeToRefs(financeStore)
const billId = computed(() => String(route.params.id))
/** 需求 id(收银台带过来):有它就走「需求 + 期次」的财务口径查支付结果 */
const requirementId = computed(() => {
const raw = route.query.requirementId
return String(Array.isArray(raw) ? raw[0] : (raw ?? '')).trim()
})
const methodLabel = computed(() => {
if (!result.value) return '—'
return result.value.method === 'wechat' ? '微信支付' : '支付宝支付'
})
onMounted(() => {
void financeStore.fetchResult(billId.value, requirementId.value)
})
</script>
<template>
<div class="pay-result">
<div class="container">
<!-- 面包屑 (67,95)「财务中心 / 账单明细 /」+「支付成功」13/500 #4B5563 -->
<nav class="pay-result__breadcrumb">
<RouterLink to="/finance" class="pay-result__crumb-link">
财务中心 /
</RouterLink>
<RouterLink to="/finance/bills" class="pay-result__crumb-link">
账单明细 /
</RouterLink>
<span class="pay-result__crumb-current">支付成功</span>
</nav>
<template v-if="result">
<!-- 主列 316 居中(设计 x799→1115) -->
<section class="pay-result__col">
<!-- 绿圆勾 (897,187) 120×120 #7ED321,✓ 56/400 白字居中 -->
<div class="pay-result__check" aria-hidden="true">
✓
</div>
<!-- 标题 (900.3,331) 22/700 #1F2937,字距 6 -->
<h2 class="pay-result__title">
支付成功
</h2>
<!-- 金额行 (852.9,379):13/400 灰 + ¥ 18/700 #EF4444,基线对齐 -->
<p class="pay-result__amount-row">
<span class="pay-result__amount-label">共{{ result.bills.length }}个订单 支付金额:</span>
<span class="pay-result__amount">¥ {{ formatMoney(result.amount, 0) }}</span>
</p>
<!-- 分割线 (799,428) 316×1 #F0F1F3 -->
<div class="pay-result__divider" />
<!-- 支付信息 (799,449) 13/700 -->
<h4 class="pay-result__sub-title">
支付信息
</h4>
<dl class="pay-result__fields">
<div class="pay-result__field">
<dt class="pay-result__label">
支付方式
</dt>
<dd class="pay-result__value">
{{ methodLabel }}
</dd>
</div>
<div class="pay-result__field">
<dt class="pay-result__label">
支付时间
</dt>
<dd class="pay-result__value">
{{ result.payTime }}
</dd>
</div>
<div class="pay-result__field">
<dt class="pay-result__label">
交易流水号
</dt>
<dd class="pay-result__value">
{{ result.tradeNo || '—' }}
</dd>
</div>
</dl>
<!-- 已支付订单 (799,574) 13/700 -->
<h4 class="pay-result__sub-title pay-result__sub-title--bills">
已支付订单
</h4>
<ul class="pay-result__bill-list">
<li
v-for="bill in result.bills"
:key="bill.id"
class="pay-result__bill"
>
<div class="pay-result__bill-head">
<span class="pay-result__bill-name">{{ bill.planName }}</span>
<span class="pay-result__bill-amount">¥ {{ formatMoney(bill.amount, 0) }}</span>
</div>
<p class="pay-result__bill-meta">
账单号:{{ bill.billNo }}
</p>
<p class="pay-result__bill-meta">
关联项目:{{ bill.projectName }}
</p>
</li>
</ul>
<!-- 返回 (1031,711) 84×32 #024FFF 12/500 白字,右对齐 -->
<div class="pay-result__footer">
<button
class="pay-result__back"
type="button"
@click="router.push('/finance/bills')"
>
返回
</button>
</div>
</section>
</template>
<p v-else class="pay-result__empty">
暂无支付结果
</p>
</div>
</div>
</template>
<style lang="less" scoped>
// 设计「支付成功」c56193d1(1920 画布 1:1)——316 居中窄列坐在页面底色上
.pay-result {
width: 100%;
padding-bottom: 344px; // 列底 743 → 页脚 1087
background: @contract-page-bg;
// 面包屑 (67,95):头部底 73 → 文字盒顶 95 = 22
&__breadcrumb {
.flex(row, flex-start, center);
padding-top: 22px;
font-size: 13px;
font-weight: 400;
line-height: 17px;
color: @project-muted;
}
&__crumb-link {
color: @project-muted;
&:hover {
color: @primary-strong;
}
}
&__crumb-current {
margin-left: 3px;
color: @finance-entry-text; // 设计 #4B5563
font-weight: 500;
}
// 主列 316,居中(面包屑底 112 → 圆顶 187 = 75)
&__col {
width: 316px;
margin: 75px auto 0;
}
// 绿圆勾 120×120 #7ED321
&__check {
.flex(row, center, center);
width: 120px;
height: 120px;
margin: 0 auto;
border-radius: 50%;
background: @finance-result-circle;
color: @white;
font-size: 56px;
font-weight: 400;
line-height: 1;
}
// 标题:圆底 307 → 331 = 24;盒 113.3 ≈ 4×22 + 4×6 字距
&__title {
margin: 24px -6px 0 0;
text-align: center;
font-size: 22px;
font-weight: 700;
line-height: 29px;
letter-spacing: 6px;
color: @finance-ink;
}
// 金额行:标题底 360 → 374 = 14;13/400 灰 + 18/700 #EF4444 基线对齐
&__amount-row {
.flex(row, center, baseline);
margin-top: 14px;
}
&__amount-label {
font-size: 13px;
font-weight: 400;
line-height: 17px;
color: @finance-muted-text;
}
&__amount {
font-size: 18px;
font-weight: 700;
line-height: 24px;
color: @danger-color; // 设计 #EF4444
white-space: nowrap;
}
// 分割线:金额行底 398 → 428 = 30
&__divider {
height: 1px;
margin-top: 30px;
background: @project-divider;
}
&__sub-title {
margin-top: 20px; // 线底 429 → 449 = 20
font-size: 13px;
font-weight: 700;
line-height: 17px;
color: @finance-ink;
&--bills {
margin-top: 22px; // 末行底 552 → 574 = 22
}
}
// 支付信息三行:标题底 466 → 首行 480 = 14;行高 16 步进 28 → gap 12
&__fields {
.flex(column, flex-start, stretch);
gap: 12px;
margin-top: 14px;
}
&__field {
.flex(row, space-between, flex-start);
}
&__label {
font-size: 12px;
font-weight: 400;
line-height: 16px;
color: @finance-muted-text;
}
&__value {
font-size: 12px;
font-weight: 700;
line-height: 16px;
color: @finance-ink;
text-align: right;
word-break: break-all;
}
// 白卡:标题底 591 → 601 = 10;316×84 白底描边 #F0F1F3
&__bill-list {
.flex(column, flex-start, stretch);
margin-top: 10px;
list-style: none;
padding: 0;
margin-bottom: 0;
}
&__bill {
box-sizing: border-box;
height: 84px;
padding: 15px 17px;
border: 1px solid @project-divider;
border-radius: @radius-base;
background: @white;
overflow: hidden;
}
&__bill-head {
.flex(row, space-between, baseline);
}
&__bill-name {
font-size: 12px;
font-weight: 700;
line-height: 16px;
color: @finance-ink;
.ellipsis();
min-width: 0;
}
&__bill-amount {
flex-shrink: 0;
margin-left: 12px;
font-size: 14px;
font-weight: 700;
line-height: 16px;
color: @finance-ink;
}
&__bill-meta {
margin-top: 6px;
font-size: 12px;
font-weight: 400;
line-height: 16px;
color: @project-muted; // 设计 #9CA3AF
.ellipsis();
+ .pay-result__bill-meta {
margin-top: 0; // 账单号 638 → 关联项目 654 连排
}
}
// 返回按钮:卡底 685 → 711 = 26,右对齐 84×32 #024FFF
&__footer {
.flex(row, flex-end, flex-start);
margin-top: 26px;
}
&__back {
width: 84px;
height: 32px;
border: none;
border-radius: 6px;
background: @primary-strong;
color: @white;
font-size: 12px;
font-weight: 500;
line-height: 16px;
cursor: pointer;
transition: background 0.2s;
&:hover {
background: @primary-color;
}
}
&__empty {
padding: 80px 0;
text-align: center;
font-size: 13px;
color: @project-muted;
}
}
</style>