文件
shanghaipeiwan/pwuniapp/pages/user/withdraw-records.vue

1010 行
25 KiB
Vue

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<template>
<view class="withdraw-records-page" :class="['theme-' + currentThemeKey]" :style="navStyle">
<!-- 顶部沉浸式自定义导航栏 -->
<view class="custom-nav-bar">
<view class="nav-content">
<view class="btn-nav-back btn-active" @click="handleBack">
<image class="nav-back-icon" :src="ICONS.chevronLeft" mode="aspectFit" />
</view>
<view class="nav-title-wrap">
<text class="nav-title">提现审批明细</text>
</view>
<view class="nav-capsule-placeholder"></view>
</view>
</view>
<!-- 主滚动区域 -->
<scroll-view
scroll-y
class="records-scroll-view"
refresher-enabled
:refresher-triggered="isRefreshing"
@refresherrefresh="onRefresh"
>
<!-- 1. 资产与提现统计流光总览卡片 -->
<view class="summary-stat-card">
<view class="card-bg-glow"></view>
<view class="summary-inner">
<view class="summary-title-row">
<view class="title-left">
<image class="wallet-icon-svg" :src="ICONS.wallet" mode="aspectFit" />
<text class="summary-card-title">提现资产总览</text>
</view>
<view class="btn-new-withdraw btn-active" @click="goToWithdraw">
<text class="btn-txt">去提现</text>
<image class="btn-arrow" :src="ICONS.chevronRight" mode="aspectFit" />
</view>
</view>
<view class="summary-numbers-grid">
<view class="stat-col">
<text class="stat-num-val">¥{{ stats.totalSuccessAmount }}</text>
<text class="stat-num-label">累计成功到账</text>
</view>
<view class="col-divider"></view>
<view class="stat-col">
<text class="stat-num-val gold">¥{{ stats.pendingAmount }}</text>
<text class="stat-num-label">审核处理中</text>
</view>
<view class="col-divider"></view>
<view class="stat-col">
<text class="stat-num-val purple">{{ allRecords.length }} 笔</text>
<text class="stat-num-label">申请总记录</text>
</view>
</view>
</view>
</view>
<!-- 2. 状态分类筛选选项卡 (Tabs) -->
<view class="filter-tabs-row">
<view
v-for="tab in tabList"
:key="tab.key"
class="tab-item btn-active"
:class="{ active: currentTab === tab.key }"
@click="selectTab(tab.key)"
>
<text class="tab-label">{{ tab.label }}</text>
<text class="tab-badge" v-if="tab.count > 0">{{ tab.count }}</text>
<view class="tab-indicator" v-if="currentTab === tab.key"></view>
</view>
</view>
<!-- 3. 加载骨架屏 -->
<view class="skeleton-wrap" v-if="isLoading">
<view class="skeleton-card" v-for="n in 3" :key="n"></view>
</view>
<!-- 4. 提现记录列表卡片 -->
<view class="records-list-wrap" v-else-if="filteredRecords.length > 0">
<view
v-for="item in filteredRecords"
:key="item.id || item.withdrawNo"
class="record-card card-active"
>
<!-- 卡片头部: 流水单号与状态胶囊 -->
<view class="card-head-row">
<view class="order-no-wrap" @click="handleCopyOrderNo(item.withdrawNo)">
<text class="order-no-label">单号:</text>
<text class="order-no-val">{{ item.withdrawNo }}</text>
<text class="copy-tag">复制</text>
</view>
<view
class="status-pill"
:class="{
pending: item.status === '待审核',
processing: item.status === '处理中',
success: item.status === '已打款',
rejected: item.status === '已驳回'
}"
>
<view class="status-dot"></view>
<text class="status-text">{{ item.status }}</text>
</view>
</view>
<!-- 卡片核心: 金额与到账渠道 -->
<view class="card-main-row">
<view class="amount-col">
<text class="amount-symbol">¥</text>
<text class="amount-number">{{ item.amount }}</text>
</view>
<view class="channel-pill">
<image class="channel-icon" :src="ICONS.wechat" mode="aspectFit" />
<text class="channel-name">{{ item.channel || '微信零钱钱包' }}</text>
</view>
</view>
<!-- 卡片时间流与审核信息 -->
<view class="card-timeline-box">
<view class="timeline-row">
<text class="timeline-label">申请时间:</text>
<text class="timeline-val">{{ item.applyTime || '刚刚' }}</text>
</view>
<view class="timeline-row" v-if="item.status === '已打款'">
<text class="timeline-label">到账时间:</text>
<text class="timeline-val success">企业付款打款成功</text>
</view>
<view class="timeline-row" v-else-if="item.status === '待审核' || item.status === '处理中'">
<text class="timeline-label">预计到账:</text>
<text class="timeline-val notice">预计 1 至 24 小时内到账</text>
</view>
</view>
<!-- 驳回理由与重新发起入口 -->
<view class="card-rejected-box" v-if="item.status === '已驳回'">
<view class="reject-title-row">
<text class="reject-title">审核未通过说明:</text>
</view>
<text class="reject-reason">{{ item.reason || '收款信息不完整或账户异常,请联系在线客服核验。' }}</text>
<button class="btn-re-withdraw btn-active" @click="goToWithdraw">重新发起申请</button>
</view>
</view>
<!-- 列表触底提示 -->
<view class="list-end-tip">
<text class="tip-line"></text>
<text class="tip-txt">已展示全部审批明细</text>
<text class="tip-line"></text>
</view>
</view>
<!-- 5. 暂无数据空状态 -->
<view class="empty-state-card" v-else>
<image class="empty-icon-svg" :src="ICONS.orderList" mode="aspectFit" />
<text class="empty-title">暂无相关的提现申请记录</text>
<text class="empty-sub">接单赚取的佣金收益满额后即可随时发起零钱提现</text>
<button class="btn-empty-withdraw btn-active" @click="goToWithdraw">立即去提现</button>
</view>
<!-- 底部安全垫高 -->
<view class="bottom-spacer"></view>
</scroll-view>
</view>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
import { getNavBarInfo } from '@/common/nav.js';
import { getUserWithdrawals } from '@/common/api.js';
const currentThemeKey = ref(getCurrentThemeKey());
const navInfo = ref(getNavBarInfo());
const isLoading = ref(true);
const isRefreshing = ref(false);
const allRecords = ref([]);
const currentTab = ref('ALL');
const stats = ref({
totalSuccessAmount: '0.00',
pendingAmount: '0.00'
});
const navStyle = computed(() => {
const info = navInfo.value;
return {
paddingTop: `${info.statusBarHeight}px`,
'--nav-bar-height': `${info.navBarHeight}px`,
'--status-bar-height': `${info.statusBarHeight}px`,
'--header-height': `${info.headerHeight}px`
};
});
// 计算状态分类筛选选项及计数
const tabList = computed(() => {
const records = allRecords.value;
const pendingCount = records.filter(r => r.status === '待审核' || r.status === '处理中').length;
const successCount = records.filter(r => r.status === '已打款').length;
const rejectedCount = records.filter(r => r.status === '已驳回').length;
return [
{ key: 'ALL', label: '全部', count: records.length },
{ key: 'PENDING', label: '审核中', count: pendingCount },
{ key: 'SUCCESS', label: '已打款', count: successCount },
{ key: 'REJECTED', label: '已驳回', count: rejectedCount }
];
});
// 根据当前选中的 Tab 过滤列表
const filteredRecords = computed(() => {
const tab = currentTab.value;
if (tab === 'PENDING') {
return allRecords.value.filter(r => r.status === '待审核' || r.status === '处理中');
}
if (tab === 'SUCCESS') {
return allRecords.value.filter(r => r.status === '已打款');
}
if (tab === 'REJECTED') {
return allRecords.value.filter(r => r.status === '已驳回');
}
return allRecords.value;
});
const selectTab = (tabKey) => {
currentTab.value = tabKey;
};
const handleBack = () => {
const pages = getCurrentPages();
if (pages && pages.length > 1) {
uni.navigateBack();
} else {
uni.redirectTo({
url: '/pages/user/withdraw'
});
}
};
const goToWithdraw = () => {
const pages = getCurrentPages();
const prevPage = pages && pages.length > 1 ? pages[pages.length - 2] : null;
if (prevPage && prevPage.route && prevPage.route.includes('withdraw')) {
uni.navigateBack();
} else {
uni.navigateTo({
url: '/pages/user/withdraw'
});
}
};
const handleCopyOrderNo = (orderNo) => {
if (!orderNo) return;
uni.setClipboardData({
data: String(orderNo),
success: () => {
uni.showToast({ title: '单号已复制', icon: 'none' });
}
});
};
const loadWithdrawals = async () => {
try {
const list = await getUserWithdrawals(1001);
if (Array.isArray(list)) {
allRecords.value = list;
let successSum = 0;
let pendingSum = 0;
list.forEach(r => {
const amt = Number(r.amount || 0);
if (r.status === '已打款') successSum += amt;
if (r.status === '待审核' || r.status === '处理中') pendingSum += amt;
});
stats.value.totalSuccessAmount = successSum.toFixed(2);
stats.value.pendingAmount = pendingSum.toFixed(2);
} else {
allRecords.value = [];
}
} catch (_) {
allRecords.value = [];
} finally {
isLoading.value = false;
isRefreshing.value = false;
}
};
const onRefresh = async () => {
isRefreshing.value = true;
await loadWithdrawals();
};
onMounted(() => {
applyThemeToNativeUI();
loadWithdrawals();
});
onShow(() => {
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI();
loadWithdrawals();
});
</script>
<style lang="scss" scoped>
.withdraw-records-page {
min-height: 100vh;
background-color: #0A0F1D;
color: #F8FAFC;
box-sizing: border-box;
display: flex;
flex-direction: column;
/* 顶部沉浸式自定义导航栏 */
.custom-nav-bar {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
background: rgba(10, 15, 29, 0.95);
backdrop-filter: blur(12px);
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
.nav-content {
height: var(--nav-bar-height);
margin-top: var(--status-bar-height);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24rpx;
.btn-nav-back {
width: 64rpx;
height: 64rpx;
border-radius: 50%;
background: rgba(255, 255, 255, 0.08);
display: flex;
align-items: center;
justify-content: center;
.nav-back-icon {
width: 36rpx;
height: 36rpx;
}
}
.nav-title-wrap {
.nav-title {
font-size: 32rpx;
font-weight: 700;
color: #F8FAFC;
letter-spacing: 1rpx;
}
}
.nav-capsule-placeholder {
width: 64rpx;
}
}
}
/* 滚动主视图 */
.records-scroll-view {
flex: 1;
margin-top: var(--header-height);
box-sizing: border-box;
padding: 24rpx;
}
/* 1. 总览统计流光卡片 */
.summary-stat-card {
position: relative;
border-radius: 28rpx;
padding: 32rpx 28rpx;
margin-bottom: 24rpx;
background: linear-gradient(135deg, #1E1B4B 0%, #0F172A 100%);
border: 1px solid rgba(99, 102, 241, 0.25);
box-shadow: 0 12rpx 36rpx rgba(15, 23, 42, 0.45);
overflow: hidden;
.card-bg-glow {
position: absolute;
top: -60rpx;
right: -60rpx;
width: 200rpx;
height: 200rpx;
border-radius: 50%;
background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
pointer-events: none;
}
.summary-inner {
position: relative;
z-index: 1;
}
.summary-title-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
.title-left {
display: flex;
align-items: center;
gap: 12rpx;
.wallet-icon-svg {
width: 36rpx;
height: 36rpx;
}
.summary-card-title {
font-size: 26rpx;
color: #CBD5E1;
font-weight: 600;
}
}
.btn-new-withdraw {
display: flex;
align-items: center;
gap: 6rpx;
background: rgba(99, 102, 241, 0.2);
border: 1px solid rgba(99, 102, 241, 0.4);
padding: 6rpx 18rpx;
border-radius: 24rpx;
.btn-txt {
font-size: 22rpx;
color: #A5B4FC;
font-weight: 600;
}
.btn-arrow {
width: 20rpx;
height: 20rpx;
}
}
}
.summary-numbers-grid {
display: flex;
align-items: center;
justify-content: space-around;
background: rgba(15, 23, 42, 0.6);
border-radius: 20rpx;
padding: 20rpx 12rpx;
border: 1px solid rgba(255, 255, 255, 0.05);
.stat-col {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 6rpx;
.stat-num-val {
font-size: 32rpx;
font-weight: 800;
color: #F8FAFC;
&.gold { color: #FBBF24; }
&.purple { color: #818CF8; }
}
.stat-num-label {
font-size: 20rpx;
color: #94A3B8;
}
}
.col-divider {
width: 1px;
height: 48rpx;
background: rgba(255, 255, 255, 0.1);
}
}
}
/* 2. 状态切换选项卡 */
.filter-tabs-row {
display: flex;
align-items: center;
justify-content: space-between;
background: #151D30;
border-radius: 20rpx;
padding: 8rpx;
margin-bottom: 24rpx;
border: 1px solid rgba(255, 255, 255, 0.06);
.tab-item {
flex: 1;
position: relative;
text-align: center;
padding: 16rpx 0;
display: flex;
align-items: center;
justify-content: center;
gap: 8rpx;
border-radius: 14rpx;
transition: all 0.2s ease;
.tab-label {
font-size: 24rpx;
color: #94A3B8;
font-weight: 500;
}
.tab-badge {
font-size: 18rpx;
color: #CBD5E1;
background: rgba(255, 255, 255, 0.1);
padding: 2rpx 10rpx;
border-radius: 12rpx;
}
&.active {
background: rgba(99, 102, 241, 0.2);
.tab-label {
color: #818CF8;
font-weight: 700;
}
.tab-badge {
background: #6366F1;
color: #FFFFFF;
}
.tab-indicator {
position: absolute;
bottom: 2rpx;
left: 50%;
transform: translateX(-50%);
width: 32rpx;
height: 4rpx;
background: #6366F1;
border-radius: 2rpx;
}
}
}
}
/* 3. 骨架屏 */
.skeleton-wrap {
display: flex;
flex-direction: column;
gap: 20rpx;
.skeleton-card {
height: 220rpx;
background: #151D30;
border-radius: 24rpx;
animation: pulse 1.5s infinite;
}
}
@keyframes pulse {
0% { opacity: 0.6; }
50% { opacity: 0.3; }
100% { opacity: 0.6; }
}
/* 4. 记录列表卡片 */
.records-list-wrap {
display: flex;
flex-direction: column;
gap: 20rpx;
.record-card {
background: #151D30;
border-radius: 24rpx;
padding: 24rpx;
border: 1px solid rgba(255, 255, 255, 0.06);
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.2);
.card-head-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
padding-bottom: 14rpx;
border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
.order-no-wrap {
display: flex;
align-items: center;
gap: 6rpx;
.order-no-label {
font-size: 22rpx;
color: #64748B;
}
.order-no-val {
font-size: 22rpx;
font-family: monospace;
color: #CBD5E1;
}
.copy-tag {
font-size: 18rpx;
color: #6366F1;
background: rgba(99, 102, 241, 0.12);
padding: 2rpx 8rpx;
border-radius: 6rpx;
margin-left: 6rpx;
}
}
.status-pill {
display: flex;
align-items: center;
gap: 8rpx;
padding: 6rpx 16rpx;
border-radius: 20rpx;
font-size: 20rpx;
font-weight: 600;
.status-dot {
width: 10rpx;
height: 10rpx;
border-radius: 50%;
}
&.pending, &.processing {
color: #FBBF24;
background: rgba(251, 191, 36, 0.12);
.status-dot { background: #FBBF24; }
}
&.success {
color: #34D399;
background: rgba(52, 211, 153, 0.12);
.status-dot { background: #34D399; }
}
&.rejected {
color: #F87171;
background: rgba(248, 113, 113, 0.12);
.status-dot { background: #F87171; }
}
}
}
.card-main-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
.amount-col {
display: flex;
align-items: baseline;
gap: 4rpx;
.amount-symbol {
font-size: 28rpx;
font-weight: 700;
color: #F8FAFC;
}
.amount-number {
font-size: 44rpx;
font-weight: 800;
color: #F8FAFC;
letter-spacing: 0.5rpx;
}
}
.channel-pill {
display: flex;
align-items: center;
gap: 8rpx;
background: rgba(16, 185, 129, 0.1);
border: 1px solid rgba(16, 185, 129, 0.25);
padding: 6rpx 16rpx;
border-radius: 18rpx;
.channel-icon {
width: 26rpx;
height: 26rpx;
}
.channel-name {
font-size: 22rpx;
color: #34D399;
font-weight: 600;
}
}
}
.card-timeline-box {
background: rgba(0, 0, 0, 0.2);
border-radius: 14rpx;
padding: 12rpx 16rpx;
display: flex;
flex-direction: column;
gap: 8rpx;
.timeline-row {
display: flex;
align-items: center;
font-size: 20rpx;
.timeline-label {
color: #64748B;
width: 140rpx;
}
.timeline-val {
color: #94A3B8;
&.success { color: #34D399; font-weight: 600; }
&.notice { color: #FBBF24; font-weight: 500; }
}
}
}
.card-rejected-box {
margin-top: 16rpx;
background: rgba(239, 68, 68, 0.08);
border: 1px solid rgba(239, 68, 68, 0.25);
border-radius: 14rpx;
padding: 14rpx 16rpx;
.reject-title-row {
margin-bottom: 6rpx;
.reject-title {
font-size: 20rpx;
font-weight: 700;
color: #EF4444;
}
}
.reject-reason {
font-size: 20rpx;
color: #F87171;
line-height: 1.5;
display: block;
margin-bottom: 12rpx;
}
.btn-re-withdraw {
height: 48rpx;
line-height: 46rpx;
font-size: 20rpx;
font-weight: 600;
color: #EF4444;
background: rgba(239, 68, 68, 0.12);
border: 1px solid rgba(239, 68, 68, 0.4);
border-radius: 24rpx;
padding: 0 20rpx;
display: inline-block;
margin: 0;
}
}
}
.list-end-tip {
display: flex;
align-items: center;
justify-content: center;
gap: 16rpx;
padding: 30rpx 0;
.tip-line {
width: 60rpx;
height: 1px;
background: rgba(255, 255, 255, 0.1);
}
.tip-txt {
font-size: 20rpx;
color: #475569;
}
}
}
/* 5. 空状态区 */
.empty-state-card {
padding: 100rpx 40rpx;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
.empty-icon-svg {
width: 100rpx;
height: 100rpx;
margin-bottom: 24rpx;
opacity: 0.35;
}
.empty-title {
font-size: 28rpx;
font-weight: 700;
color: #94A3B8;
margin-bottom: 12rpx;
}
.empty-sub {
font-size: 22rpx;
color: #64748B;
line-height: 1.5;
margin-bottom: 36rpx;
}
.btn-empty-withdraw {
height: 72rpx;
line-height: 70rpx;
font-size: 26rpx;
font-weight: 700;
color: #FFFFFF;
background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
box-shadow: 0 8rpx 24rpx rgba(99, 102, 241, 0.35);
border-radius: 36rpx;
padding: 0 48rpx;
margin: 0;
}
}
.bottom-spacer {
height: 60rpx;
}
}
/* ==========================================================================
浅色暖阳晨曦模式专属高对比度适配 (theme-warm)
========================================================================== */
.theme-warm {
background-color: #F7F5F0;
color: #1C1917;
.custom-nav-bar {
background: rgba(247, 245, 240, 0.95);
border-bottom-color: #E7E2D8;
.nav-content {
.btn-nav-back {
background: #FFFFFF;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.nav-title-wrap .nav-title {
color: #1C1917;
}
}
}
.summary-stat-card {
background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
border: 1px solid #FED7AA;
box-shadow: 0 8rpx 28rpx rgba(234, 88, 12, 0.08);
.summary-title-row {
.title-left .summary-card-title {
color: #9A3412;
}
.btn-new-withdraw {
background: rgba(234, 88, 12, 0.12);
border-color: rgba(234, 88, 12, 0.35);
.btn-txt {
color: #EA580C;
}
}
}
.summary-numbers-grid {
background: #FFFFFF;
border-color: #FED7AA;
.stat-col {
.stat-num-val {
color: #1C1917;
&.gold { color: #D97706; }
&.purple { color: #EA580C; }
}
.stat-num-label {
color: #78716C;
}
}
.col-divider {
background: #F5EBE1;
}
}
}
.filter-tabs-row {
background: #FFFFFF;
border-color: #EAE5DC;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.03);
.tab-item {
.tab-label {
color: #78716C;
}
.tab-badge {
color: #78716C;
background: #F5F5F4;
}
&.active {
background: #FFF7ED;
.tab-label {
color: #EA580C;
}
.tab-badge {
background: #EA580C;
color: #FFFFFF;
}
.tab-indicator {
background: #EA580C;
}
}
}
}
.records-list-wrap {
.record-card {
background: #FFFFFF;
border-color: #EAE5DC;
box-shadow: 0 4rpx 20rpx rgba(28, 25, 23, 0.04);
.card-head-row {
border-bottom-color: #F5F0E8;
.order-no-wrap {
.order-no-label { color: #78716C; }
.order-no-val { color: #1C1917; }
.copy-tag {
color: #EA580C;
background: #FFF7ED;
}
}
}
.card-main-row {
.amount-col {
.amount-symbol, .amount-number {
color: #1C1917;
}
}
.channel-pill {
background: #ECFDF5;
border-color: #A7F3D0;
.channel-name {
color: #059669;
}
}
}
.card-timeline-box {
background: #FAFAF9;
border: 1px solid #F5F5F4;
.timeline-row {
.timeline-label { color: #78716C; }
.timeline-val {
color: #44403C;
&.success { color: #059669; }
&.notice { color: #D97706; }
}
}
}
.card-rejected-box {
background: #FEF2F2;
border-color: #FECACA;
.reject-title-row .reject-title { color: #DC2626; }
.reject-reason { color: #B91C1C; }
.btn-re-withdraw {
background: #FEE2E2;
border-color: #FCA5A5;
color: #DC2626;
}
}
}
.list-end-tip {
.tip-line { background: #E7E2D8; }
.tip-txt { color: #A8A29E; }
}
}
.empty-state-card {
.empty-title { color: #44403C; }
.empty-sub { color: #78716C; }
.btn-empty-withdraw {
background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
box-shadow: 0 8rpx 24rpx rgba(234, 88, 12, 0.35);
}
}
}
</style>