From ea59a4bd44fcffc5d1ef2d363481dc06be91e5df Mon Sep 17 00:00:00 2001
From: zhaoxing <2558691827@qq.com>
Date: Thu, 19 Nov 2026 17:49:29 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD(=E6=89=93=E6=89=8B=E7=AB=AF)?=
=?UTF-8?q?:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF=E4=B8=AA=E4=BA=BA=E4=B8=AD?=
=?UTF-8?q?=E5=BF=83=E6=96=B0=E5=A2=9E=E6=B7=BB=E5=8A=A0=E6=8F=90=E7=8E=B0?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=85=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../pages/worker/WorkerProfileMobileView.tsx | 84 +++++++++++++++-
.../src/pages/worker/WorkerProfilePage.tsx | 4 +-
apps/frontend/src/styles/worker.css | 95 +++++++++++++++++++
...er-profile-mobile-withdrawal-entry.test.ts | 52 ++++++++++
4 files changed, 231 insertions(+), 4 deletions(-)
create mode 100644 apps/frontend/tests/worker-profile-mobile-withdrawal-entry.test.ts
diff --git a/apps/frontend/src/pages/worker/WorkerProfileMobileView.tsx b/apps/frontend/src/pages/worker/WorkerProfileMobileView.tsx
index 503e14b0..656fc86d 100644
--- a/apps/frontend/src/pages/worker/WorkerProfileMobileView.tsx
+++ b/apps/frontend/src/pages/worker/WorkerProfileMobileView.tsx
@@ -3,6 +3,7 @@ import {
CopyOutlined,
CustomerServiceOutlined,
GlobalOutlined,
+ IdcardOutlined,
LockOutlined,
LogoutOutlined,
ReloadOutlined,
@@ -12,11 +13,17 @@ import {
import { Alert, Avatar, Button, Progress, Tag } from 'antd'
import type { ReactNode } from 'react'
-import type { WorkerLevelProgress, WorkerProfileSummary, WorkerUser } from '@/types/worker-platform'
+import type {
+ WorkerLevelProgress,
+ WorkerProfileSummary,
+ WorkerUser,
+ WorkerWithdrawalAccount,
+} from '@/types/worker-platform'
import { formatDateTime } from '@/utils/date-time'
import {
formatMoney,
+ formatWithdrawChannel,
formatWorkerStatus,
resolveWorkerInitial,
resolveWorkerStatusColor,
@@ -28,6 +35,7 @@ type WorkerProfileMobileViewProps = {
levelProgress: WorkerLevelProgress | null | undefined
canUseFinanceActions: boolean
needsAlipayQrCode: boolean
+ withdrawalAccounts: WorkerWithdrawalAccount[]
activeTab: string
loading: boolean
ledgerRecords: ReactNode
@@ -42,6 +50,7 @@ type WorkerProfileMobileViewProps = {
renameDisabled: boolean
onManageDevices: () => void
onContact: () => void
+ onAddWithdrawalAccount: () => void
onAddAlipayQrCode: () => void
onLogout: () => void
}
@@ -52,6 +61,7 @@ export function WorkerProfileMobileView({
levelProgress,
canUseFinanceActions,
needsAlipayQrCode,
+ withdrawalAccounts,
activeTab,
loading,
ledgerRecords,
@@ -66,6 +76,7 @@ export function WorkerProfileMobileView({
renameDisabled,
onManageDevices,
onContact,
+ onAddWithdrawalAccount,
onAddAlipayQrCode,
onLogout,
}: WorkerProfileMobileViewProps) {
@@ -249,6 +260,14 @@ export function WorkerProfileMobileView({
disabled={!worker.inviteCode}
onClick={onCopyInviteCode}
/>
+ }
+ color="#0e7490"
+ background="#ecfeff"
+ disabled={!canUseFinanceActions}
+ onClick={onAddWithdrawalAccount}
+ />
{needsAlipayQrCode ? (
+
) : null}
@@ -361,9 +386,15 @@ function MobileTab({
function WorkerProfileMobileAccountDetails({
worker,
summary,
+ withdrawalAccounts,
+ canUseFinanceActions,
+ onAddWithdrawalAccount,
}: {
worker: WorkerUser
summary: WorkerProfileSummary | undefined
+ withdrawalAccounts: WorkerWithdrawalAccount[]
+ canUseFinanceActions: boolean
+ onAddWithdrawalAccount: () => void
}) {
const items: Array<[string, ReactNode]> = [
['账号', worker.username],
@@ -394,6 +425,55 @@ function WorkerProfileMobileAccountDetails({
))}
+
+
+
+ 提现信息
+ {withdrawalAccounts.length > 0 ? (
+ 修改请联系客服
+ ) : null}
+
+ {withdrawalAccounts.length > 0 ? (
+
+ {withdrawalAccounts.map((account) => (
+
+
+
+ {formatWithdrawChannel(account.accountChannel)}
+
+
+ {account.accountName}
+
+
+
+ {formatWithdrawalAccountDesc(account)}
+
+
+ ))}
+
+ ) : (
+
+ 暂未添加提现信息
+
+
+ )}
+
)
}
+
+function formatWithdrawalAccountDesc(account: WorkerWithdrawalAccount) {
+ if (account.accountChannel === 'wechat') {
+ return account.wechatQrCodeImage ? '已上传收款码' : '未上传收款码'
+ }
+ return `${account.accountNoMasked || '-'} · ${
+ account.alipayQrCodeImage ? '已上传收款码' : '未上传收款码'
+ }`
+}
diff --git a/apps/frontend/src/pages/worker/WorkerProfilePage.tsx b/apps/frontend/src/pages/worker/WorkerProfilePage.tsx
index 5c11a6ab..c86eecc7 100644
--- a/apps/frontend/src/pages/worker/WorkerProfilePage.tsx
+++ b/apps/frontend/src/pages/worker/WorkerProfilePage.tsx
@@ -329,8 +329,6 @@ export default function WorkerProfilePage() {
setWithdrawalAccountOpen(false)
withdrawalAccountForm.resetFields()
await refreshAll()
- withdrawForm.setFieldValue('accountChannel', String(values.accountChannel || ''))
- setWithdrawOpen(true)
} catch (error) {
message.error(error instanceof Error ? error.message : '添加提现信息失败')
} finally {
@@ -424,6 +422,7 @@ export default function WorkerProfilePage() {
needsAlipayQrCode={Boolean(
alipayWithdrawalAccount && !alipayWithdrawalAccount.alipayQrCodeImage,
)}
+ withdrawalAccounts={withdrawalAccounts}
activeTab={activeTab}
loading={profileQuery.isFetching || ledgersQuery.isFetching || requestsQuery.isFetching}
ledgerRecords={
@@ -487,6 +486,7 @@ export default function WorkerProfilePage() {
renameDisabled={!canRename}
onManageDevices={() => setDevicesOpen(true)}
onContact={() => setContactOpen(true)}
+ onAddWithdrawalAccount={openWithdrawalAccountModal}
onAddAlipayQrCode={openAlipayQrCodeModal}
onLogout={submitLogout}
/>
diff --git a/apps/frontend/src/styles/worker.css b/apps/frontend/src/styles/worker.css
index 1caefd57..e5774684 100644
--- a/apps/frontend/src/styles/worker.css
+++ b/apps/frontend/src/styles/worker.css
@@ -2330,6 +2330,101 @@ body {
font-weight: 500;
}
+/* 账号详情 - 提现信息 */
+.worker-profile-mobile-withdraw-block {
+ margin-top: 12px;
+ padding-top: 12px;
+ border-top: 1px solid #f1f5f9;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+
+.worker-profile-mobile-withdraw-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+}
+
+.worker-profile-mobile-withdraw-title {
+ font-size: 12px;
+ font-weight: 700;
+ color: #0f172a;
+}
+
+.worker-profile-mobile-withdraw-hint {
+ font-size: 11px;
+ color: #94a3b8;
+}
+
+.worker-profile-mobile-withdraw-list {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+
+.worker-profile-mobile-withdraw-item {
+ background: #f8fafc;
+ border: 1px solid #f1f5f9;
+ border-radius: 10px;
+ padding: 8px 10px;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+}
+
+.worker-profile-mobile-withdraw-line {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ flex-wrap: wrap;
+}
+
+.worker-profile-mobile-withdraw-tag {
+ margin-inline-end: 0;
+}
+
+.worker-profile-mobile-withdraw-name {
+ font-size: 12px;
+ color: #0f172a;
+}
+
+.worker-profile-mobile-withdraw-desc {
+ font-size: 11px;
+ color: #64748b;
+ word-break: break-all;
+}
+
+.worker-profile-mobile-withdraw-empty {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+ background: #f8fafc;
+ border: 1px dashed #e2e8f0;
+ border-radius: 10px;
+ padding: 8px 10px;
+}
+
+.worker-profile-mobile-withdraw-add-btn {
+ border: 1px solid #fdba74;
+ background: #ffffff;
+ color: #ea580c;
+ border-radius: 6px;
+ padding: 3px 10px;
+ font-size: 11px;
+ cursor: pointer;
+ white-space: nowrap;
+}
+
+.worker-profile-mobile-withdraw-add-btn:disabled {
+ border-color: #e2e8f0;
+ background: #f8fafc;
+ color: #94a3b8;
+ cursor: not-allowed;
+}
+
/* ==========================================================================
移动端 抢单大厅 (Worker Hall Mobile Page)
========================================================================== */
diff --git a/apps/frontend/tests/worker-profile-mobile-withdrawal-entry.test.ts b/apps/frontend/tests/worker-profile-mobile-withdrawal-entry.test.ts
new file mode 100644
index 00000000..cd007721
--- /dev/null
+++ b/apps/frontend/tests/worker-profile-mobile-withdrawal-entry.test.ts
@@ -0,0 +1,52 @@
+import assert from 'node:assert/strict'
+import { readFile } from 'node:fs/promises'
+import test from 'node:test'
+
+async function readSource(relativePath: string) {
+ return readFile(new URL(`../src/${relativePath}`, import.meta.url), 'utf8')
+}
+
+test('移动端个人中心提供添加提现信息入口', async () => {
+ const [mobileView, page] = await Promise.all([
+ readSource('pages/worker/WorkerProfileMobileView.tsx'),
+ readSource('pages/worker/WorkerProfilePage.tsx'),
+ ])
+
+ assert.ok(mobileView.includes('label="添加提现信息"'), '工具宫格必须有添加提现信息入口')
+ assert.ok(mobileView.includes('onAddWithdrawalAccount'), '移动端必须接线添加提现信息回调')
+ assert.ok(
+ page.includes('onAddWithdrawalAccount={openWithdrawalAccountModal}'),
+ '页面必须复用现有添加提现信息弹窗',
+ )
+ assert.ok(
+ page.includes('withdrawalAccounts={withdrawalAccounts}'),
+ '页面必须把提现账户传给移动端',
+ )
+})
+
+test('移动端账号详情展示提现信息与空状态入口', async () => {
+ const mobileView = await readSource('pages/worker/WorkerProfileMobileView.tsx')
+
+ assert.ok(mobileView.includes('worker-profile-mobile-withdraw-block'))
+ assert.ok(mobileView.includes('提现信息'))
+ assert.ok(mobileView.includes('暂未添加提现信息'))
+ assert.ok(mobileView.includes('formatWithdrawalAccountDesc'))
+})
+
+test('两个渠道都已添加时点击入口提示联系客服', async () => {
+ const page = await readSource('pages/worker/WorkerProfilePage.tsx')
+
+ assert.ok(page.includes('支付宝和微信提现信息均已添加,修改请联系客服处理'))
+})
+
+test('添加提现信息成功后只关闭弹窗,不自动打开提现申请', async () => {
+ const page = await readSource('pages/worker/WorkerProfilePage.tsx')
+ const submitBlock = page.slice(
+ page.indexOf('async function submitWithdrawalAccount'),
+ page.indexOf('async function submitAlipayQrCode'),
+ )
+
+ assert.ok(submitBlock.length > 0, '必须能找到添加提现信息的提交函数')
+ assert.ok(submitBlock.includes('setWithdrawalAccountOpen(false)'), '成功后必须关闭添加弹窗')
+ assert.ok(!submitBlock.includes('setWithdrawOpen(true)'), '成功后不得自动打开提现申请弹窗')
+})