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
@@ -346,7 +346,7 @@ function formatBps(value: number | undefined, fallback: number) {
max-width: none; max-width: none;
min-height: 100vh; min-height: 100vh;
padding: 28px max(20px, calc((100% - 1180px) / 2)) 56px; padding: 28px max(20px, calc((100% - 1180px) / 2)) 56px;
background: #f5f7fb; background: transparent;
color: #20242a; color: #20242a;
} }
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue' import { computed } from 'vue'
import { Bell, BellFilled } from '@element-plus/icons-vue' import { Bell, BellFilled, Microphone, Mute } from '@element-plus/icons-vue'
import { useDesktopNotification } from '../composables/useDesktopNotification' import { useDesktopNotification } from '../composables/useDesktopNotification'
const props = defineProps<{ const props = defineProps<{
@@ -16,15 +16,9 @@ const statusText = computed(() => {
return '未开启' return '未开启'
}) })
const statusType = computed(() => {
if (notification.permission.value === 'granted') return 'success'
if (notification.permission.value === 'denied') return 'danger'
return 'info'
})
const voiceStatusText = computed(() => { const voiceStatusText = computed(() => {
if (!notification.isSpeechSupported) return '语音不支持' if (!notification.isSpeechSupported) return '语音不支持'
return notification.voiceEnabled.value ? '语音已开' : '语音关闭' return notification.voiceEnabled.value ? '已开启' : '已关闭'
}) })
async function toggleNotification() { async function toggleNotification() {
@@ -46,37 +40,48 @@ function toggleVoice() {
<template> <template>
<div class="notification-settings"> <div class="notification-settings">
<div class="setting-group"> <el-tooltip content="接收新消息的桌面通知" placement="bottom">
<el-tooltip content="接收新消息的桌面通知" placement="bottom"> <button
<el-button type="button"
:icon="notification.permission.value === 'granted' ? BellFilled : Bell" class="setting-toggle"
:type="notification.permission.value === 'granted' ? 'primary' : 'default'" :class="{ 'is-active': notification.permission.value === 'granted' }"
:disabled="!notification.isSupported || notification.permission.value === 'denied'" :disabled="!notification.isSupported"
circle :aria-pressed="notification.permission.value === 'granted'"
@click="toggleNotification" @click="toggleNotification"
> >
<template #default> <span class="setting-icon">
<el-badge <el-icon>
v-if="notification.permission.value !== 'granted' && notification.isSupported" <BellFilled v-if="notification.permission.value === 'granted'" />
is-dot <Bell v-else />
:type="statusType" </el-icon>
/> </span>
</template> <span class="setting-copy">
</el-button> <strong>通知</strong>
</el-tooltip> <small>{{ statusText }}</small>
<span class="status-text">{{ statusText }}</span> </span>
</div> </button>
</el-tooltip>
<el-tooltip content="开启后,新消息会自动语音播报" placement="bottom"> <el-tooltip content="开启后,新消息会自动语音播报" placement="bottom">
<el-button <button
size="small" type="button"
:type="notification.voiceEnabled.value ? 'success' : 'default'" class="setting-toggle"
:class="{ 'is-active': notification.voiceEnabled.value }"
:disabled="!notification.isSpeechSupported" :disabled="!notification.isSpeechSupported"
plain :aria-pressed="notification.voiceEnabled.value"
@click="toggleVoice" @click="toggleVoice"
> >
{{ voiceStatusText }} <span class="setting-icon">
</el-button> <el-icon>
<Microphone v-if="notification.voiceEnabled.value" />
<Mute v-else />
</el-icon>
</span>
<span class="setting-copy">
<strong>声音</strong>
<small>{{ voiceStatusText }}</small>
</span>
</button>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>
@@ -86,17 +91,78 @@ function toggleVoice() {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
gap: 10px; gap: 6px;
} }
.setting-group { .setting-toggle {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
min-height: 34px;
padding: 4px 9px 4px 7px;
border: 1px solid #f0e4da;
border-radius: 7px;
background: #ffffff;
color: #725f52;
font: inherit;
text-align: left;
cursor: pointer;
transition:
border-color 0.15s,
background 0.15s,
color 0.15s;
} }
.status-text { .setting-toggle:hover:not(:disabled) {
color: #8a94a6; border-color: #ffc899;
background: #fff8f3;
color: #c2410c;
}
.setting-toggle.is-active {
border-color: #ffd1a8;
background: var(--el-color-primary-light-9, #fff2e8);
color: var(--el-color-primary, #ff7a00);
}
.setting-toggle:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.setting-icon {
display: grid;
width: 24px;
height: 24px;
place-items: center;
border-radius: 6px;
background: #f8f2ed;
color: #8b7565;
font-size: 15px;
}
.setting-toggle.is-active .setting-icon {
background: #ffffff;
color: var(--el-color-primary, #ff7a00);
}
.setting-copy {
display: grid;
gap: 1px;
line-height: 1.15;
}
.setting-copy strong {
font-size: 12px; font-size: 12px;
font-weight: 600;
}
.setting-copy small {
color: #9a887b;
font-size: 10px;
}
.setting-toggle.is-active .setting-copy small {
color: var(--el-color-primary-dark-2, #d65f00);
} }
</style> </style>
File diff suppressed because it is too large Load Diff
@@ -9,6 +9,7 @@ import { useDistributionSiteStore } from '@/stores/distributionSite'
const router = useRouter() const router = useRouter()
const distributionStore = useDistributionSiteStore() const distributionStore = useDistributionSiteStore()
const currentUserId = Number(localStorage.getItem('user_id') || 0)
const loading = ref(false) const loading = ref(false)
const refreshing = ref(false) const refreshing = ref(false)
const finished = ref(false) const finished = ref(false)
@@ -73,6 +74,29 @@ function roleLabel(role: string) {
return map[role] || '成员' return map[role] || '成员'
} }
function conversationTypeLabel(item: ChatConversation) {
if (item.type === 'listing_group') return '账号群'
if (item.type === 'order_group' || item.order_id) return '订单'
return '平台客服'
}
function conversationAvatar(item: ChatConversation) {
const candidates =
item.participants?.filter(
participant => participant.participant_type === 'user' && participant.avatar_url
) || []
const otherUser = candidates.find(participant => participant.participant_id !== currentUserId)
return resolveAvatarURL((otherUser || candidates[0])?.avatar_url)
}
function resolveAvatarURL(url: string | undefined | null) {
if (!url) return ''
if (url.includes('/api/files/object?key=avatar/')) {
return url.replace('/api/files/object', '/api/public/files/object')
}
return url
}
function previewText(item: ChatConversation) { function previewText(item: ChatConversation) {
return ( return (
item.last_message_preview || item.last_message_preview ||
@@ -94,9 +118,23 @@ const unreadTotal = computed(() =>
<h1> <h1>
{{ distributionStore.isDistribution ? `${distributionStore.siteName} · 消息` : '消息' }} {{ distributionStore.isDistribution ? `${distributionStore.siteName} · 消息` : '消息' }}
</h1> </h1>
<span class="header-count">{{ unreadTotal > 0 ? `${unreadTotal} 未读` : '' }}</span> <span class="header-count" :class="{ 'is-clear': unreadTotal === 0 }">
{{ unreadTotal > 0 ? `${unreadTotal} 未读` : '全部已读' }}
</span>
</header> </header>
<section class="inbox-summary">
<span class="summary-icon">
<van-icon name="chat-o" :size="19" />
</span>
<div class="summary-copy">
<strong>会话消息</strong>
<span>共 {{ total }} 个会话</span>
</div>
<span v-if="unreadTotal > 0" class="summary-unread">{{ unreadTotal }} 条未读</span>
<span v-else class="summary-read">已读</span>
</section>
<van-pull-refresh v-model="refreshing" class="scroll-container" @refresh="onRefresh"> <van-pull-refresh v-model="refreshing" class="scroll-container" @refresh="onRefresh">
<van-list <van-list
v-model:loading="loading" v-model:loading="loading"
@@ -116,13 +154,14 @@ const unreadTotal = computed(() =>
v-for="item in conversations" v-for="item in conversations"
:key="item.id" :key="item.id"
class="conversation-item" class="conversation-item"
:class="{ 'is-unread': item.unread_count > 0 }"
type="button" type="button"
@click="openConversation(item)" @click="openConversation(item)"
> >
<div class="avatar-stack"> <span class="conversation-avatar">
<span class="avatar main">{{ roleLabel(item.role).slice(0, 1) }}</span> <img v-if="conversationAvatar(item)" :src="conversationAvatar(item)" alt="" />
<span class="avatar support">客</span> <van-icon v-else name="chat-o" :size="20" />
</div> </span>
<div class="conversation-main"> <div class="conversation-main">
<div class="conversation-title-row"> <div class="conversation-title-row">
<h2>{{ item.title }}</h2> <h2>{{ item.title }}</h2>
@@ -132,9 +171,10 @@ const unreadTotal = computed(() =>
</div> </div>
<div class="conversation-meta"> <div class="conversation-meta">
<span class="role-chip">{{ roleLabel(item.role) }}</span> <span class="role-chip">{{ roleLabel(item.role) }}</span>
<span>{{ item.order_id ? `订单 #${item.order_id}` : '平台客服' }}</span> <span class="conversation-type">{{ conversationTypeLabel(item) }}</span>
<span v-if="item.needs_reply" class="reply-chip">待回复</span>
</div> </div>
<p>{{ previewText(item) }}</p> <p class="conversation-preview">{{ previewText(item) }}</p>
</div> </div>
<span v-if="item.unread_count > 0" class="unread-badge"> <span v-if="item.unread_count > 0" class="unread-badge">
{{ item.unread_count > 99 ? '99+' : item.unread_count }} {{ item.unread_count > 99 ? '99+' : item.unread_count }}
@@ -151,8 +191,9 @@ const unreadTotal = computed(() =>
<style scoped> <style scoped>
.mobile-messages { .mobile-messages {
min-height: 100dvh; min-height: 100dvh;
background: #f5f7fb; padding-bottom: calc(52px + env(safe-area-inset-bottom));
padding-bottom: calc(62px + env(safe-area-inset-bottom)); background: #f4f4f2;
color: #252a31;
} }
.page-header { .page-header {
@@ -160,103 +201,188 @@ const unreadTotal = computed(() =>
top: 0; top: 0;
z-index: 100; z-index: 100;
display: grid; display: grid;
grid-template-columns: 44px 1fr 72px; grid-template-columns: 44px minmax(0, 1fr) auto;
align-items: center; align-items: center;
height: 48px; height: 52px;
padding: 0 8px; padding: 0 10px;
background: rgba(255, 255, 255, 0.96); background: rgba(255, 255, 255, 0.96);
border-bottom: 1px solid #edf0f5; border-bottom: 1px solid #ececea;
backdrop-filter: blur(10px); box-shadow: 0 1px 8px rgba(26, 28, 31, 0.03);
backdrop-filter: blur(12px);
} }
.page-header h1 { .page-header h1 {
margin: 0; margin: 0;
color: #111827; overflow: hidden;
color: #24282d;
font-size: 17px; font-size: 17px;
font-weight: 800; font-weight: 700;
text-align: center; text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
} }
.back-btn { .back-btn {
display: grid; display: grid;
width: 40px; width: 34px;
height: 40px; height: 34px;
place-items: center; place-items: center;
border: 0; border: 1px solid #ececea;
background: transparent; border-radius: 8px;
color: #374151; background: #f7f7f5;
color: #4f555b;
cursor: pointer;
} }
.header-count { .header-count {
color: #ef4444; min-width: 52px;
font-size: 12px; padding: 4px 8px;
border: 1px solid #ead8cb;
border-radius: 999px;
background: #f8f1eb;
color: #9c542b;
font-size: 10px;
font-weight: 700; font-weight: 700;
text-align: right; text-align: center;
white-space: nowrap;
}
.header-count.is-clear {
border-color: #e8e8e6;
background: #f6f6f4;
color: #8a8e93;
}
.inbox-summary {
display: flex;
align-items: center;
gap: 10px;
margin: 12px 12px 0;
padding: 11px 12px;
border: 1px solid #e7e6e3;
border-radius: 8px;
background: #ffffff;
box-shadow: 0 4px 14px rgba(28, 31, 35, 0.035);
}
.summary-icon {
display: grid;
flex: 0 0 34px;
width: 34px;
height: 34px;
place-items: center;
border-radius: 8px;
background: #f7f1eb;
color: #a65b31;
}
.summary-copy {
display: grid;
min-width: 0;
gap: 2px;
}
.summary-copy strong {
color: #2a2f35;
font-size: 13px;
font-weight: 700;
}
.summary-copy span {
color: #858a90;
font-size: 10px;
}
.summary-unread,
.summary-read {
margin-left: auto;
padding: 3px 7px;
border-radius: 999px;
font-size: 10px;
font-weight: 700;
white-space: nowrap;
}
.summary-unread {
background: #f8eee6;
color: #9c542b;
}
.summary-read {
background: #f4f4f2;
color: #858a90;
} }
.scroll-container { .scroll-container {
min-height: calc(100dvh - 48px - 62px - env(safe-area-inset-bottom)); min-height: calc(100dvh - 52px - 52px - env(safe-area-inset-bottom));
} }
.empty-state { .empty-state {
padding-top: 90px; padding-top: 72px;
} }
.conversation-list { .conversation-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 8px;
padding: 12px; padding: 10px 12px 20px;
} }
.conversation-item { .conversation-item {
position: relative; position: relative;
display: grid; display: grid;
grid-template-columns: 52px minmax(0, 1fr); grid-template-columns: 44px minmax(0, 1fr) auto;
gap: 10px; align-items: center;
gap: 12px;
width: 100%; width: 100%;
padding: 12px; padding: 12px;
border: 1px solid #e8edf3; border: 1px solid #e7e6e3;
border-radius: 8px; border-radius: 8px;
background: #fff; background: #ffffff;
text-align: left; text-align: left;
box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04); box-shadow: 0 4px 14px rgba(28, 31, 35, 0.035);
cursor: pointer;
transition:
background 0.15s,
border-color 0.15s;
}
.conversation-item.is-unread {
border-color: #e5d5c9;
}
.conversation-item.is-unread::before {
position: absolute;
top: 12px;
bottom: 12px;
left: 0;
width: 3px;
border-radius: 0 3px 3px 0;
background: #b96538;
content: '';
} }
.conversation-item:active { .conversation-item:active {
transform: scale(0.99); background: #faf8f6;
} }
.avatar-stack { .conversation-avatar {
position: relative;
width: 48px;
height: 48px;
}
.avatar {
display: grid; display: grid;
place-items: center;
border-radius: 50%;
color: #fff;
font-weight: 800;
}
.avatar.main {
width: 44px; width: 44px;
height: 44px; height: 44px;
background: #1477ff; place-items: center;
font-size: 16px; overflow: hidden;
border: 1px solid #eadfd7;
border-radius: 8px;
background: #f8f2ed;
color: #a65b31;
} }
.avatar.support { .conversation-avatar img {
position: absolute; display: block;
right: 0; width: 100%;
bottom: 0; height: 100%;
width: 22px; object-fit: cover;
height: 22px;
border: 2px solid #fff;
background: #10b981;
font-size: 11px;
} }
.conversation-main { .conversation-main {
@@ -274,59 +400,79 @@ const unreadTotal = computed(() =>
min-width: 0; min-width: 0;
margin: 0; margin: 0;
overflow: hidden; overflow: hidden;
color: #111827; color: #252a31;
font-size: 15px; font-size: 14px;
font-weight: 800; font-weight: 700;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.conversation-time { .conversation-time {
flex: none; flex: none;
color: #9ca3af; color: #95999e;
font-size: 11px; font-size: 10px;
} }
.conversation-meta { .conversation-meta {
display: flex; display: flex;
flex-wrap: wrap;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
margin-top: 5px; margin-top: 5px;
color: #6b7280; color: #74797f;
font-size: 11px; font-size: 10px;
} }
.role-chip { .role-chip {
padding: 1px 6px; padding: 2px 6px;
border-radius: 999px; border-radius: 4px;
background: #eef6ff; background: #f3f3f1;
color: #1477ff; color: #656b71;
font-weight: 600;
}
.conversation-type {
padding: 2px 6px;
border-radius: 4px;
background: #f8f1eb;
color: #985c38;
font-weight: 600;
}
.reply-chip {
padding: 2px 6px;
border-radius: 4px;
background: #f8ece3;
color: #a45227;
font-weight: 700; font-weight: 700;
} }
.conversation-main p { .conversation-preview {
margin: 7px 0 0; margin: 7px 0 0;
overflow: hidden; overflow: hidden;
color: #4b5563; color: #666c72;
font-size: 13px; font-size: 12px;
line-height: 1.4; line-height: 1.45;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.unread-badge { .unread-badge {
position: absolute; min-width: 20px;
right: 10px; height: 20px;
bottom: 10px; padding: 0 6px;
min-width: 18px; border-radius: 999px;
height: 18px; background: #b96538;
padding: 0 5px;
border-radius: 9px;
background: #ef4444;
color: #fff; color: #fff;
font-size: 10px; font-size: 10px;
font-weight: 800; font-weight: 700;
line-height: 18px; line-height: 20px;
text-align: center; text-align: center;
} }
.scroll-container :deep(.van-list__finished-text) {
padding: 18px 0 4px;
color: #9a9ea3;
font-size: 11px;
}
</style> </style>
+485 -272
View File
@@ -40,17 +40,10 @@ const walletMetrics = computed(() => {
return [] return []
} }
return [ return [
{
label: '可用余额',
value: formatCentWithSymbol(account.value.available_balance_cent),
hint: '卖家结算收入累计到此账户',
icon: WalletIcon,
tone: 'available',
},
{ {
label: '冻结余额', label: '冻结余额',
value: formatCentWithSymbol(account.value.frozen_balance_cent), value: formatCentWithSymbol(account.value.frozen_balance_cent),
hint: '提现冻结及优质号主保证金', hint: '提现冻结与号主保证金',
icon: Lock, icon: Lock,
tone: 'frozen', tone: 'frozen',
}, },
@@ -61,6 +54,13 @@ const walletMetrics = computed(() => {
icon: CircleCheck, icon: CircleCheck,
tone: account.value.status === 'active' ? 'status' : 'warning', 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') 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) { function amountPrefix(direction: string) {
if (direction === 'in' || direction === 'unfreeze') return '+' if (direction === 'in' || direction === 'unfreeze') return '+'
if (direction === 'out' || direction === 'freeze') return '-' if (direction === 'out' || direction === 'freeze') return '-'
@@ -114,7 +104,7 @@ function amountPrefix(direction: string) {
<template> <template>
<section class="page wallet-page" v-loading="loading"> <section class="page wallet-page" v-loading="loading">
<div class="wallet-hero"> <div class="wallet-header">
<div class="page-header"> <div class="page-header">
<p class="eyebrow"> <p class="eyebrow">
我的钱包 我的钱包
@@ -143,120 +133,140 @@ function amountPrefix(direction: string) {
}} }}
</p> </p>
</div> </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>
<div v-if="account" class="wallet-metric-grid"> <div v-if="account" class="wallet-overview">
<div <div class="wallet-balance-block">
v-for="item in walletMetrics" <div class="balance-label">
:key="item.label" <span class="balance-icon">
class="wallet-metric-card" <el-icon><WalletIcon /></el-icon>
:class="`is-${item.tone}`" </span>
> <span>当前可用余额</span>
<div class="metric-icon">
<el-icon><component :is="item.icon" /></el-icon>
</div> </div>
<div> <strong>{{ formatCentWithSymbol(account.available_balance_cent) }}</strong>
<span>{{ item.label }}</span> <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> <strong>{{ item.value }}</strong>
<small>{{ item.hint }}</small> <small>{{ item.hint }}</small>
</div> </div>
</div> </div>
</div> </div>
<div class="wallet-workspace"> <section class="wallet-ledger-panel">
<section class="ledger-summary-card"> <div class="ledger-toolbar">
<div class="panel-title"> <div class="ledger-heading">
<div class="panel-title-icon is-blue"> <span class="ledger-heading-icon">
<el-icon><Tickets /></el-icon> <el-icon><Tickets /></el-icon>
</div> </span>
<div> <div>
<h2>资金流水</h2> <h2>资金流水</h2>
<p>共 {{ total }} 条记录,最近变动优先展示。</p> <p>共 {{ total }} 条资金变动,最近记录优先展示。</p>
</div> </div>
</div> </div>
<el-button :icon="Refresh" :loading="loading" @click="loadWallet">刷新</el-button> <button type="button" class="ledger-refresh" :disabled="loading" @click="loadWallet">
</section> <el-icon :class="{ 'is-spinning': loading }"><Refresh /></el-icon>
</div> 刷新
</button>
<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>
</div> </div>
<div v-if="ledger.length === 0" class="ledger-empty">暂无资金流水</div>
<div v-else class="ledger-body"> <div class="wallet-ledger-table" role="table" aria-label="资金流水">
<div v-for="row in ledger" :key="row.id" class="ledger-grid ledger-row" role="row"> <div class="ledger-grid ledger-header" role="row">
<span class="ledger-cell ledger-no" :title="row.ledger_no">{{ row.ledger_no }}</span> <span role="columnheader">流水号</span>
<span class="ledger-cell"> <span role="columnheader">业务</span>
<el-tag effect="plain" class="biz-tag">{{ walletBizTypeLabel(row.biz_type) }}</el-tag> <span role="columnheader">方向</span>
</span> <span class="align-right" role="columnheader">金额</span>
<span class="ledger-cell"> <span role="columnheader">余额类型</span>
<el-tag :type="directionTone(row.direction)" effect="light" round> <span class="align-right" role="columnheader">变化后余额</span>
{{ ledgerDirectionLabel(row.direction) }} <span role="columnheader">备注</span>
</el-tag> <span role="columnheader">时间</span>
</span> </div>
<span class="ledger-cell align-right amount-cell" :class="`is-${row.direction}`"> <div v-if="ledger.length === 0" class="ledger-empty">暂无资金流水</div>
{{ amountPrefix(row.direction) }}{{ formatCentWithSymbol(row.amount_cent) }} <div v-else class="ledger-body">
</span> <div v-for="row in ledger" :key="row.id" class="ledger-grid ledger-row" role="row">
<span class="ledger-cell muted-cell">{{ balanceTypeLabel(row.balance_type) }}</span> <span class="ledger-cell ledger-no" :title="row.ledger_no">{{ row.ledger_no }}</span>
<span class="ledger-cell align-right">{{ <span class="ledger-cell">
formatCentWithSymbol(row.balance_after_cent) <span class="biz-chip">{{ walletBizTypeLabel(row.biz_type) }}</span>
}}</span> </span>
<span class="ledger-cell" :title="row.remark">{{ row.remark || '-' }}</span> <span class="ledger-cell">
<span class="ledger-cell">{{ formatDateTime(row.created_at) }}</span> <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>
</div> </div>
</section>
<div class="pagination-wrap" v-if="total > 0"> <div class="ledger-pagination" v-if="total > 0">
<el-pagination <el-pagination
v-model:current-page="currentPage" v-model:current-page="currentPage"
v-model:page-size="currentPageSize" v-model:page-size="currentPageSize"
:total="total" :total="total"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next" layout="total, sizes, prev, pager, next"
@current-change="loadLedgerPage" @current-change="loadLedgerPage"
@size-change="handleSizeChange" @size-change="handleSizeChange"
/> />
</div> </div>
</section>
</section> </section>
</template> </template>
<style scoped> <style scoped>
.wallet-page { .wallet-page {
display: grid; 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; display: flex;
align-items: flex-end; align-items: flex-end;
justify-content: space-between; justify-content: space-between;
gap: 24px; gap: 20px;
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);
} }
.wallet-hero :deep(.page-header) { .wallet-header :deep(.page-header) {
max-width: 780px; max-width: 760px;
}
.page-header .eyebrow {
color: var(--wallet-accent);
} }
.distribution-site-tag { .distribution-site-tag {
@@ -265,214 +275,271 @@ function amountPrefix(direction: string) {
font-weight: 500; font-weight: 500;
} }
.wallet-hero-action { .wallet-overview {
min-width: 220px; display: grid;
padding: 16px 18px; grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.5fr);
border: 1px solid rgba(255, 122, 0, 0.18); overflow: hidden;
border: 1px solid var(--wallet-border);
border-radius: 8px; border-radius: 8px;
background: rgba(255, 255, 255, 0.78); background: #ffffff;
text-align: right; box-shadow: 0 8px 24px rgba(25, 29, 34, 0.045);
} }
.wallet-hero-action span { .wallet-balance-block {
display: block; min-width: 0;
color: #6b7280; 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-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; display: block;
margin-top: 6px; margin-top: 18px;
color: #111a44; color: var(--wallet-ink);
font-size: 28px; font-size: 38px;
line-height: 1.15; 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 { .withdraw-button {
width: 100%; display: inline-flex;
margin-top: 14px; 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 { .withdraw-button:hover,
margin-left: 8px; .withdraw-button:focus {
vertical-align: middle; border-color: #8d461c;
background: #8d461c;
}
.withdraw-button:focus-visible {
outline: 2px solid rgba(169, 85, 34, 0.28);
outline-offset: 2px;
} }
.wallet-metric-grid { .wallet-metric-grid {
display: grid; display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr)); 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; display: flex;
align-items: center; align-items: center;
gap: 16px; gap: 7px;
min-height: 120px; color: #686e75;
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 {
font-size: 13px; font-size: 13px;
font-weight: 600; 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; display: block;
margin-top: 8px; margin-top: 12px;
color: #111a44; color: var(--wallet-ink);
font-size: 26px; font-size: 20px;
line-height: 1.1; line-height: 1.25;
overflow-wrap: anywhere;
} }
.wallet-metric-card small { .wallet-metric-item small {
margin-top: 8px; display: block;
margin-top: 7px;
color: #898e94;
font-size: 12px; font-size: 12px;
line-height: 1.5;
} }
.wallet-workspace { .wallet-ledger-panel {
display: grid; min-width: 0;
grid-template-columns: minmax(0, 1fr); overflow: hidden;
gap: 16px; border: 1px solid var(--wallet-border);
}
.ledger-summary-card {
display: grid;
gap: 18px;
padding: 20px;
border: 1px solid #e6eaf2;
border-radius: 8px; border-radius: 8px;
background: #ffffff; 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 { .ledger-toolbar {
align-content: space-between;
}
.ledger-summary-card :deep(.el-button) {
justify-self: start;
min-width: 118px;
}
.panel-title {
display: flex; 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; align-items: center;
gap: 12px; gap: 12px;
} }
.panel-title-icon { .ledger-heading-icon {
display: grid; display: grid;
flex: 0 0 40px; flex: 0 0 38px;
width: 40px; width: 38px;
height: 40px; height: 38px;
place-items: center; place-items: center;
border-radius: 8px; border-radius: 7px;
background: #fff4ec; background: #f5f2ef;
color: #ff6b00; color: #8f6245;
font-size: 20px; font-size: 18px;
} }
.panel-title-icon.is-blue { .ledger-heading h2 {
background: #eff6ff;
color: #2563eb;
}
.panel-title h2 {
margin: 0; margin: 0;
color: #111827; color: var(--wallet-ink);
font-size: 17px; font-size: 16px;
font-weight: 700;
} }
.panel-title p { .ledger-heading p {
margin: 5px 0 0; margin: 4px 0 0;
color: #64748b; color: #7c8188;
font-size: 13px; font-size: 12px;
} }
.wallet-ledger-table { .wallet-ledger-table {
overflow-x: auto; overflow-x: auto;
border: 1px solid #e6eaf2;
border-radius: 8px;
background: #ffffff; background: #ffffff;
box-shadow: 0 12px 30px rgba(17, 24, 39, 0.05);
} }
.ledger-grid { .ledger-grid {
display: grid; display: grid;
grid-template-columns: grid-template-columns:
minmax(200px, 2fr) minmax(190px, 1.5fr)
minmax(100px, 0.8fr) minmax(100px, 0.75fr)
minmax(80px, 0.6fr) minmax(78px, 0.58fr)
minmax(100px, 0.8fr) minmax(108px, 0.8fr)
minmax(100px, 0.8fr) minmax(96px, 0.72fr)
minmax(120px, 0.9fr) minmax(118px, 0.85fr)
minmax(140px, 1.2fr) minmax(140px, 1.2fr)
minmax(170px, 1.1fr); minmax(160px, 1.05fr);
align-items: center; align-items: center;
column-gap: clamp(10px, 1vw, 20px); column-gap: clamp(10px, 1vw, 18px);
padding: 0 clamp(16px, 1.5vw, 24px); padding: 0 clamp(16px, 1.5vw, 24px);
} }
.ledger-header { .ledger-header {
min-height: 48px; min-height: 44px;
border-bottom: 1px solid #e6eaf2; border-bottom: 1px solid var(--wallet-border);
background: #f8fafc; background: #fafafa;
color: #64748b; color: #72777e;
font-size: 13px; font-size: 12px;
font-weight: 700; font-weight: 600;
} }
.ledger-header span { .ledger-header span {
text-align: center; text-align: center;
} }
.ledger-header span:first-child {
text-align: left;
}
.ledger-header span.align-right { .ledger-header span.align-right {
text-align: right; text-align: right;
} }
.ledger-row { .ledger-row {
min-height: 54px; min-height: 52px;
border-bottom: 1px solid #edf1f6; border-bottom: 1px solid #f0f0f1;
color: #334155; color: #394047;
font-size: 14px; font-size: 13px;
transition: background 0.15s ease; transition: background 0.15s ease;
} }
@@ -481,7 +548,7 @@ function amountPrefix(direction: string) {
} }
.ledger-row:hover { .ledger-row:hover {
background: #f8fafc; background: #fafafa;
} }
.ledger-cell { .ledger-cell {
@@ -497,11 +564,11 @@ function amountPrefix(direction: string) {
} }
.ledger-no { .ledger-no {
color: #475569; color: #686d73;
font-family: 'SF Mono', 'Menlo', 'Consolas', monospace; font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
font-size: 12px; font-size: 12px;
letter-spacing: 0.02em; letter-spacing: 0;
text-align: center; text-align: left;
} }
.align-right { .align-right {
@@ -510,17 +577,58 @@ function amountPrefix(direction: string) {
.ledger-empty { .ledger-empty {
display: grid; display: grid;
min-height: 80px; min-height: 140px;
place-items: center; place-items: center;
border-top: 1px solid #edf1f6; color: #8c9096;
color: #94a3b8;
font-size: 14px; font-size: 14px;
} }
.biz-tag { .biz-chip {
max-width: 96px; display: inline-flex;
height: 24px; max-width: 100px;
line-height: 22px; 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 { .amount-cell {
@@ -529,16 +637,84 @@ function amountPrefix(direction: string) {
.amount-cell.is-in, .amount-cell.is-in,
.amount-cell.is-unfreeze { .amount-cell.is-unfreeze {
color: #047857; color: #4f7358;
} }
.amount-cell.is-out, .amount-cell.is-out,
.amount-cell.is-freeze { .amount-cell.is-freeze {
color: #dc2626; color: #9a5555;
} }
.muted-cell { .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 { .pay-dialog-body {
@@ -620,24 +796,61 @@ function amountPrefix(direction: string) {
z-index: 4001; z-index: 4001;
} }
@media (max-width: 720px) { @media (max-width: 1100px) {
.wallet-hero { .wallet-overview {
display: grid;
padding: 20px;
}
.wallet-hero-action {
min-width: 0;
text-align: left;
}
.wallet-metric-grid,
.wallet-workspace {
grid-template-columns: 1fr; grid-template-columns: 1fr;
} }
.wallet-metric-card { .wallet-balance-block {
min-height: auto; 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 { .pay-qr-panel {
@@ -649,13 +862,13 @@ function amountPrefix(direction: string) {
.ledger-grid { .ledger-grid {
grid-template-columns: grid-template-columns:
minmax(160px, 1.5fr) minmax(160px, 1.5fr)
minmax(80px, 0.8fr) minmax(84px, 0.75fr)
minmax(64px, 0.6fr) minmax(64px, 0.58fr)
minmax(80px, 0.8fr) minmax(90px, 0.8fr)
minmax(80px, 0.8fr) minmax(80px, 0.72fr)
minmax(100px, 0.9fr) minmax(100px, 0.85fr)
minmax(120px, 1fr) minmax(120px, 1.2fr)
minmax(140px, 1fr); minmax(140px, 1.05fr);
column-gap: 8px; column-gap: 8px;
padding: 0 12px; padding: 0 12px;
font-size: 13px; font-size: 13px;