feat(ui): 统一消息钱包与权益中心视觉

This commit is contained in:
yml
2026-11-16 16:59:31 +08:00
parent 1ce9f7aaf5
commit a9970c3ae1
5 changed files with 1646 additions and 654 deletions
+485 -272
View File
@@ -40,17 +40,10 @@ const walletMetrics = computed(() => {
return []
}
return [
{
label: '可用余额',
value: formatCentWithSymbol(account.value.available_balance_cent),
hint: '卖家结算收入累计到此账户',
icon: WalletIcon,
tone: 'available',
},
{
label: '冻结余额',
value: formatCentWithSymbol(account.value.frozen_balance_cent),
hint: '提现冻结及优质号主保证金',
hint: '提现冻结与号主保证金',
icon: Lock,
tone: 'frozen',
},
@@ -61,6 +54,13 @@ const walletMetrics = computed(() => {
icon: CircleCheck,
tone: account.value.status === 'active' ? 'status' : 'warning',
},
{
label: '流水记录',
value: `${total.value} 笔`,
hint: '当前账户全部资金变动',
icon: Tickets,
tone: 'ledger',
},
]
})
@@ -95,16 +95,6 @@ function handleWithdraw() {
router.push('/wallet/withdrawal')
}
function directionTone(direction: string) {
const map: Record<string, string> = {
in: 'success',
out: 'danger',
freeze: 'warning',
unfreeze: 'info',
}
return map[direction] || 'info'
}
function amountPrefix(direction: string) {
if (direction === 'in' || direction === 'unfreeze') return '+'
if (direction === 'out' || direction === 'freeze') return '-'
@@ -114,7 +104,7 @@ function amountPrefix(direction: string) {
<template>
<section class="page wallet-page" v-loading="loading">
<div class="wallet-hero">
<div class="wallet-header">
<div class="page-header">
<p class="eyebrow">
我的钱包
@@ -143,120 +133,140 @@ function amountPrefix(direction: string) {
}}
</p>
</div>
<div class="wallet-hero-action">
<span>当前可用</span>
<strong>{{
account ? formatCentWithSymbol(account.available_balance_cent) : '¥0.0'
}}</strong>
<el-button class="withdraw-button" :icon="Money" type="primary" @click="handleWithdraw">
申请提现
</el-button>
</div>
</div>
<div v-if="account" class="wallet-metric-grid">
<div
v-for="item in walletMetrics"
:key="item.label"
class="wallet-metric-card"
:class="`is-${item.tone}`"
>
<div class="metric-icon">
<el-icon><component :is="item.icon" /></el-icon>
<div v-if="account" class="wallet-overview">
<div class="wallet-balance-block">
<div class="balance-label">
<span class="balance-icon">
<el-icon><WalletIcon /></el-icon>
</span>
<span>当前可用余额</span>
</div>
<div>
<span>{{ item.label }}</span>
<strong>{{ formatCentWithSymbol(account.available_balance_cent) }}</strong>
<p>卖家结算收入会进入当前站点钱包,可直接申请提现。</p>
<button type="button" class="withdraw-button" @click="handleWithdraw">
<el-icon><Money /></el-icon>
申请提现
</button>
</div>
<div class="wallet-metric-grid">
<div
v-for="item in walletMetrics"
:key="item.label"
class="wallet-metric-item"
:class="`is-${item.tone}`"
>
<span class="metric-label">
<el-icon><component :is="item.icon" /></el-icon>
{{ item.label }}
</span>
<strong>{{ item.value }}</strong>
<small>{{ item.hint }}</small>
</div>
</div>
</div>
<div class="wallet-workspace">
<section class="ledger-summary-card">
<div class="panel-title">
<div class="panel-title-icon is-blue">
<section class="wallet-ledger-panel">
<div class="ledger-toolbar">
<div class="ledger-heading">
<span class="ledger-heading-icon">
<el-icon><Tickets /></el-icon>
</div>
</span>
<div>
<h2>资金流水</h2>
<p>共 {{ total }} 条记录,最近变动优先展示。</p>
<p>共 {{ total }} 条资金变动,最近记录优先展示。</p>
</div>
</div>
<el-button :icon="Refresh" :loading="loading" @click="loadWallet">刷新</el-button>
</section>
</div>
<section class="wallet-ledger-table" role="table" aria-label="资金流水">
<div class="ledger-grid ledger-header" role="row">
<span role="columnheader">流水号</span>
<span role="columnheader">业务</span>
<span role="columnheader">方向</span>
<span class="align-right" role="columnheader">金额</span>
<span role="columnheader">余额类型</span>
<span class="align-right" role="columnheader">变化后余额</span>
<span role="columnheader">备注</span>
<span role="columnheader">时间</span>
<button type="button" class="ledger-refresh" :disabled="loading" @click="loadWallet">
<el-icon :class="{ 'is-spinning': loading }"><Refresh /></el-icon>
刷新
</button>
</div>
<div v-if="ledger.length === 0" class="ledger-empty">暂无资金流水</div>
<div v-else class="ledger-body">
<div v-for="row in ledger" :key="row.id" class="ledger-grid ledger-row" role="row">
<span class="ledger-cell ledger-no" :title="row.ledger_no">{{ row.ledger_no }}</span>
<span class="ledger-cell">
<el-tag effect="plain" class="biz-tag">{{ walletBizTypeLabel(row.biz_type) }}</el-tag>
</span>
<span class="ledger-cell">
<el-tag :type="directionTone(row.direction)" effect="light" round>
{{ ledgerDirectionLabel(row.direction) }}
</el-tag>
</span>
<span class="ledger-cell align-right amount-cell" :class="`is-${row.direction}`">
{{ amountPrefix(row.direction) }}{{ formatCentWithSymbol(row.amount_cent) }}
</span>
<span class="ledger-cell muted-cell">{{ balanceTypeLabel(row.balance_type) }}</span>
<span class="ledger-cell align-right">{{
formatCentWithSymbol(row.balance_after_cent)
}}</span>
<span class="ledger-cell" :title="row.remark">{{ row.remark || '-' }}</span>
<span class="ledger-cell">{{ formatDateTime(row.created_at) }}</span>
<div class="wallet-ledger-table" role="table" aria-label="资金流水">
<div class="ledger-grid ledger-header" role="row">
<span role="columnheader">流水号</span>
<span role="columnheader">业务</span>
<span role="columnheader">方向</span>
<span class="align-right" role="columnheader">金额</span>
<span role="columnheader">余额类型</span>
<span class="align-right" role="columnheader">变化后余额</span>
<span role="columnheader">备注</span>
<span role="columnheader">时间</span>
</div>
<div v-if="ledger.length === 0" class="ledger-empty">暂无资金流水</div>
<div v-else class="ledger-body">
<div v-for="row in ledger" :key="row.id" class="ledger-grid ledger-row" role="row">
<span class="ledger-cell ledger-no" :title="row.ledger_no">{{ row.ledger_no }}</span>
<span class="ledger-cell">
<span class="biz-chip">{{ walletBizTypeLabel(row.biz_type) }}</span>
</span>
<span class="ledger-cell">
<span class="direction-chip" :class="`is-${row.direction}`">
{{ ledgerDirectionLabel(row.direction) }}
</span>
</span>
<span class="ledger-cell align-right amount-cell" :class="`is-${row.direction}`">
{{ amountPrefix(row.direction) }}{{ formatCentWithSymbol(row.amount_cent) }}
</span>
<span class="ledger-cell muted-cell">{{ balanceTypeLabel(row.balance_type) }}</span>
<span class="ledger-cell align-right">{{
formatCentWithSymbol(row.balance_after_cent)
}}</span>
<span class="ledger-cell" :title="row.remark">{{ row.remark || '-' }}</span>
<span class="ledger-cell">{{ formatDateTime(row.created_at) }}</span>
</div>
</div>
</div>
</section>
<div class="pagination-wrap" v-if="total > 0">
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="currentPageSize"
:total="total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next"
@current-change="loadLedgerPage"
@size-change="handleSizeChange"
/>
</div>
<div class="ledger-pagination" v-if="total > 0">
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="currentPageSize"
:total="total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next"
@current-change="loadLedgerPage"
@size-change="handleSizeChange"
/>
</div>
</section>
</section>
</template>
<style scoped>
.wallet-page {
display: grid;
gap: 18px;
gap: 20px;
--el-color-primary: #a95522;
--el-color-primary-dark-2: #8d461c;
--el-color-primary-light-3: #bd764c;
--el-color-primary-light-5: #d1a084;
--el-color-primary-light-7: #e4c9b8;
--el-color-primary-light-8: #eeded3;
--el-color-primary-light-9: #f7f0eb;
--wallet-accent: #a95522;
--wallet-ink: #252a31;
--wallet-muted: #737980;
--wallet-border: #e4e5e7;
--wallet-soft: #f6f5f3;
}
.wallet-hero {
.wallet-header {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 24px;
padding: 28px;
border: 1px solid #e6eaf2;
border-radius: 8px;
background: linear-gradient(135deg, rgba(255, 122, 0, 0.08), rgba(15, 118, 110, 0.06)), #ffffff;
box-shadow: 0 14px 36px rgba(17, 24, 39, 0.06);
gap: 20px;
}
.wallet-hero :deep(.page-header) {
max-width: 780px;
.wallet-header :deep(.page-header) {
max-width: 760px;
}
.page-header .eyebrow {
color: var(--wallet-accent);
}
.distribution-site-tag {
@@ -265,214 +275,271 @@ function amountPrefix(direction: string) {
font-weight: 500;
}
.wallet-hero-action {
min-width: 220px;
padding: 16px 18px;
border: 1px solid rgba(255, 122, 0, 0.18);
.wallet-overview {
display: grid;
grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.5fr);
overflow: hidden;
border: 1px solid var(--wallet-border);
border-radius: 8px;
background: rgba(255, 255, 255, 0.78);
text-align: right;
background: #ffffff;
box-shadow: 0 8px 24px rgba(25, 29, 34, 0.045);
}
.wallet-hero-action span {
display: block;
color: #6b7280;
.wallet-balance-block {
min-width: 0;
padding: 24px 26px;
border-right: 1px solid var(--wallet-border);
background: var(--wallet-soft);
color: var(--wallet-ink);
}
.balance-label {
display: flex;
align-items: center;
gap: 10px;
color: #686d73;
font-size: 13px;
font-weight: 600;
}
.wallet-hero-action strong {
.balance-icon {
display: grid;
width: 32px;
height: 32px;
place-items: center;
border: 1px solid #e0ddd9;
border-radius: 7px;
background: #ffffff;
color: var(--wallet-accent);
font-size: 17px;
}
.wallet-balance-block strong {
display: block;
margin-top: 6px;
color: #111a44;
font-size: 28px;
line-height: 1.15;
margin-top: 18px;
color: var(--wallet-ink);
font-size: 38px;
font-weight: 700;
line-height: 1.12;
overflow-wrap: anywhere;
}
.wallet-balance-block p {
max-width: 360px;
margin: 10px 0 0;
color: #77736f;
font-size: 12px;
line-height: 1.65;
}
.withdraw-button {
width: 100%;
margin-top: 14px;
display: inline-flex;
height: 34px;
align-items: center;
gap: 6px;
justify-content: center;
min-width: 126px;
margin-top: 20px;
padding: 0 13px;
border: 1px solid var(--wallet-accent);
border-radius: 6px;
background: var(--wallet-accent);
color: #ffffff;
font: inherit;
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition:
border-color 0.15s,
background 0.15s;
}
.withdraw-tag {
margin-left: 8px;
vertical-align: middle;
.withdraw-button:hover,
.withdraw-button:focus {
border-color: #8d461c;
background: #8d461c;
}
.withdraw-button:focus-visible {
outline: 2px solid rgba(169, 85, 34, 0.28);
outline-offset: 2px;
}
.wallet-metric-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 16px;
align-items: stretch;
background: #ffffff;
}
.wallet-metric-card {
.wallet-metric-item {
display: flex;
min-width: 0;
flex-direction: column;
justify-content: center;
padding: 24px 20px;
border-left: 1px solid #ececea;
}
.metric-label {
display: flex;
align-items: center;
gap: 16px;
min-height: 120px;
padding: 20px;
border: 1px solid #e6eaf2;
border-radius: 8px;
background: #ffffff;
box-shadow: 0 12px 30px rgba(17, 24, 39, 0.05);
}
.metric-icon {
display: grid;
flex: 0 0 46px;
width: 46px;
height: 46px;
place-items: center;
border-radius: 8px;
color: #ffffff;
font-size: 22px;
}
.wallet-metric-card.is-available .metric-icon {
background: #ff6b00;
}
.wallet-metric-card.is-frozen .metric-icon {
background: #3b82f6;
}
.wallet-metric-card.is-status .metric-icon {
background: #0f766e;
}
.wallet-metric-card.is-warning .metric-icon {
background: #d97706;
}
.wallet-metric-card span,
.wallet-metric-card small {
display: block;
color: #64748b;
}
.wallet-metric-card span {
gap: 7px;
color: #686e75;
font-size: 13px;
font-weight: 600;
}
.wallet-metric-card strong {
.metric-label .el-icon {
display: grid;
width: 24px;
height: 24px;
place-items: center;
border-radius: 6px;
background: #f3f2f0;
color: #746d67;
font-size: 15px;
}
.wallet-metric-item.is-frozen .metric-label .el-icon {
background: #f6f1e8;
color: #93652f;
}
.wallet-metric-item.is-status .metric-label .el-icon {
background: #eef4ef;
color: #557460;
}
.wallet-metric-item.is-warning .metric-label .el-icon {
background: #f8eeee;
color: #9d5656;
}
.wallet-metric-item.is-ledger .metric-label .el-icon {
background: #f3f1ef;
color: #6d625a;
}
.wallet-metric-item.is-warning .metric-label {
color: #8d6262;
}
.wallet-metric-item strong {
display: block;
margin-top: 8px;
color: #111a44;
font-size: 26px;
line-height: 1.1;
margin-top: 12px;
color: var(--wallet-ink);
font-size: 20px;
line-height: 1.25;
overflow-wrap: anywhere;
}
.wallet-metric-card small {
margin-top: 8px;
.wallet-metric-item small {
display: block;
margin-top: 7px;
color: #898e94;
font-size: 12px;
line-height: 1.5;
}
.wallet-workspace {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 16px;
}
.ledger-summary-card {
display: grid;
gap: 18px;
padding: 20px;
border: 1px solid #e6eaf2;
.wallet-ledger-panel {
min-width: 0;
overflow: hidden;
border: 1px solid var(--wallet-border);
border-radius: 8px;
background: #ffffff;
box-shadow: 0 12px 30px rgba(17, 24, 39, 0.05);
box-shadow: 0 6px 20px rgba(25, 29, 34, 0.04);
}
.ledger-summary-card {
align-content: space-between;
}
.ledger-summary-card :deep(.el-button) {
justify-self: start;
min-width: 118px;
}
.panel-title {
.ledger-toolbar {
display: flex;
min-height: 68px;
align-items: center;
justify-content: space-between;
gap: 20px;
padding: 14px 20px;
border-bottom: 1px solid var(--wallet-border);
}
.ledger-heading {
display: flex;
min-width: 0;
align-items: center;
gap: 12px;
}
.panel-title-icon {
.ledger-heading-icon {
display: grid;
flex: 0 0 40px;
width: 40px;
height: 40px;
flex: 0 0 38px;
width: 38px;
height: 38px;
place-items: center;
border-radius: 8px;
background: #fff4ec;
color: #ff6b00;
font-size: 20px;
border-radius: 7px;
background: #f5f2ef;
color: #8f6245;
font-size: 18px;
}
.panel-title-icon.is-blue {
background: #eff6ff;
color: #2563eb;
}
.panel-title h2 {
.ledger-heading h2 {
margin: 0;
color: #111827;
font-size: 17px;
color: var(--wallet-ink);
font-size: 16px;
font-weight: 700;
}
.panel-title p {
margin: 5px 0 0;
color: #64748b;
font-size: 13px;
.ledger-heading p {
margin: 4px 0 0;
color: #7c8188;
font-size: 12px;
}
.wallet-ledger-table {
overflow-x: auto;
border: 1px solid #e6eaf2;
border-radius: 8px;
background: #ffffff;
box-shadow: 0 12px 30px rgba(17, 24, 39, 0.05);
}
.ledger-grid {
display: grid;
grid-template-columns:
minmax(200px, 2fr)
minmax(100px, 0.8fr)
minmax(80px, 0.6fr)
minmax(100px, 0.8fr)
minmax(100px, 0.8fr)
minmax(120px, 0.9fr)
minmax(190px, 1.5fr)
minmax(100px, 0.75fr)
minmax(78px, 0.58fr)
minmax(108px, 0.8fr)
minmax(96px, 0.72fr)
minmax(118px, 0.85fr)
minmax(140px, 1.2fr)
minmax(170px, 1.1fr);
minmax(160px, 1.05fr);
align-items: center;
column-gap: clamp(10px, 1vw, 20px);
column-gap: clamp(10px, 1vw, 18px);
padding: 0 clamp(16px, 1.5vw, 24px);
}
.ledger-header {
min-height: 48px;
border-bottom: 1px solid #e6eaf2;
background: #f8fafc;
color: #64748b;
font-size: 13px;
font-weight: 700;
min-height: 44px;
border-bottom: 1px solid var(--wallet-border);
background: #fafafa;
color: #72777e;
font-size: 12px;
font-weight: 600;
}
.ledger-header span {
text-align: center;
}
.ledger-header span:first-child {
text-align: left;
}
.ledger-header span.align-right {
text-align: right;
}
.ledger-row {
min-height: 54px;
border-bottom: 1px solid #edf1f6;
color: #334155;
font-size: 14px;
min-height: 52px;
border-bottom: 1px solid #f0f0f1;
color: #394047;
font-size: 13px;
transition: background 0.15s ease;
}
@@ -481,7 +548,7 @@ function amountPrefix(direction: string) {
}
.ledger-row:hover {
background: #f8fafc;
background: #fafafa;
}
.ledger-cell {
@@ -497,11 +564,11 @@ function amountPrefix(direction: string) {
}
.ledger-no {
color: #475569;
color: #686d73;
font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
font-size: 12px;
letter-spacing: 0.02em;
text-align: center;
letter-spacing: 0;
text-align: left;
}
.align-right {
@@ -510,17 +577,58 @@ function amountPrefix(direction: string) {
.ledger-empty {
display: grid;
min-height: 80px;
min-height: 140px;
place-items: center;
border-top: 1px solid #edf1f6;
color: #94a3b8;
color: #8c9096;
font-size: 14px;
}
.biz-tag {
max-width: 96px;
height: 24px;
line-height: 22px;
.biz-chip {
display: inline-flex;
max-width: 100px;
height: 22px;
align-items: center;
overflow: hidden;
padding: 0 7px;
border: 1px solid #e7e4e1;
border-radius: 4px;
background: #f8f7f6;
color: #6f6258;
font-size: 11px;
font-weight: 600;
text-overflow: ellipsis;
white-space: nowrap;
}
.direction-chip {
display: inline-flex;
height: 22px;
align-items: center;
padding: 0 7px;
border: 1px solid #e0e5e1;
border-radius: 999px;
background: #f4f7f5;
color: #53715c;
font-size: 11px;
font-weight: 600;
}
.direction-chip.is-out {
border-color: #eadede;
background: #faf3f3;
color: #945858;
}
.direction-chip.is-freeze {
border-color: #e8e0d3;
background: #f8f4ed;
color: #85683e;
}
.direction-chip.is-unfreeze {
border-color: #e0e5e1;
background: #f4f7f5;
color: #53715c;
}
.amount-cell {
@@ -529,16 +637,84 @@ function amountPrefix(direction: string) {
.amount-cell.is-in,
.amount-cell.is-unfreeze {
color: #047857;
color: #4f7358;
}
.amount-cell.is-out,
.amount-cell.is-freeze {
color: #dc2626;
color: #9a5555;
}
.muted-cell {
color: #64748b;
color: #74797f;
}
.ledger-pagination {
display: flex;
justify-content: flex-end;
padding: 14px 20px;
border-top: 1px solid var(--wallet-border);
background: #ffffff;
}
.ledger-refresh {
display: inline-flex;
height: 30px;
align-items: center;
gap: 5px;
padding: 0 10px;
border: 1px solid #dedfe1;
border-radius: 6px;
background: #ffffff;
color: #62676d;
font: inherit;
font-size: 12px;
cursor: pointer;
transition:
border-color 0.15s,
background 0.15s,
color 0.15s;
}
.ledger-refresh:hover:not(:disabled) {
border-color: #cbb7a8;
background: #faf8f6;
color: #7f4b2d;
}
.ledger-refresh:focus-visible {
outline: 2px solid rgba(169, 85, 34, 0.25);
outline-offset: 1px;
}
.ledger-refresh:disabled {
cursor: not-allowed;
opacity: 0.55;
}
.is-spinning {
animation: wallet-spin 0.8s linear infinite;
}
@keyframes wallet-spin {
to {
transform: rotate(360deg);
}
}
.ledger-pagination :deep(.el-pager li.is-active) {
background: var(--wallet-accent);
color: #ffffff;
}
.ledger-pagination :deep(.el-pager li:hover),
.ledger-pagination :deep(.btn-prev:hover),
.ledger-pagination :deep(.btn-next:hover) {
color: var(--wallet-accent);
}
.ledger-pagination :deep(.el-select__wrapper.is-focused) {
box-shadow: 0 0 0 1px #d1a084 inset;
}
.pay-dialog-body {
@@ -620,24 +796,61 @@ function amountPrefix(direction: string) {
z-index: 4001;
}
@media (max-width: 720px) {
.wallet-hero {
display: grid;
padding: 20px;
}
.wallet-hero-action {
min-width: 0;
text-align: left;
}
.wallet-metric-grid,
.wallet-workspace {
@media (max-width: 1100px) {
.wallet-overview {
grid-template-columns: 1fr;
}
.wallet-metric-card {
min-height: auto;
.wallet-balance-block {
border-right: 0;
border-bottom: 1px solid var(--wallet-border);
}
.wallet-metric-grid {
border-top: 1px solid #edf1f6;
}
.wallet-metric-item:first-child {
border-left: 0;
}
}
@media (max-width: 720px) {
.wallet-header {
align-items: flex-start;
flex-direction: column;
}
.wallet-balance-block {
padding: 20px;
}
.wallet-balance-block strong {
font-size: 32px;
}
.wallet-metric-grid {
grid-template-columns: 1fr;
}
.wallet-metric-item {
padding: 16px 20px;
border-top: 1px solid #edf1f6;
border-left: 0;
}
.wallet-metric-item:first-child {
border-top: 0;
}
.ledger-toolbar {
align-items: flex-start;
flex-direction: column;
}
.ledger-pagination {
justify-content: flex-start;
overflow-x: auto;
}
.pay-qr-panel {
@@ -649,13 +862,13 @@ function amountPrefix(direction: string) {
.ledger-grid {
grid-template-columns:
minmax(160px, 1.5fr)
minmax(80px, 0.8fr)
minmax(64px, 0.6fr)
minmax(80px, 0.8fr)
minmax(80px, 0.8fr)
minmax(100px, 0.9fr)
minmax(120px, 1fr)
minmax(140px, 1fr);
minmax(84px, 0.75fr)
minmax(64px, 0.58fr)
minmax(90px, 0.8fr)
minmax(80px, 0.72fr)
minmax(100px, 0.85fr)
minmax(120px, 1.2fr)
minmax(140px, 1.05fr);
column-gap: 8px;
padding: 0 12px;
font-size: 13px;