功能(打手端): 移动端个人中心新增添加提现信息入口
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
<MobileTool
|
||||
label="添加提现信息"
|
||||
icon={<IdcardOutlined />}
|
||||
color="#0e7490"
|
||||
background="#ecfeff"
|
||||
disabled={!canUseFinanceActions}
|
||||
onClick={onAddWithdrawalAccount}
|
||||
/>
|
||||
{needsAlipayQrCode ? (
|
||||
<MobileTool
|
||||
label="补充支付宝收款码"
|
||||
@@ -291,7 +310,13 @@ export function WorkerProfileMobileView({
|
||||
{activeTab === 'ledger' ? ledgerRecords : null}
|
||||
{activeTab === 'requests' ? requestRecords : null}
|
||||
{activeTab === 'account' ? (
|
||||
<WorkerProfileMobileAccountDetails worker={worker} summary={summary} />
|
||||
<WorkerProfileMobileAccountDetails
|
||||
worker={worker}
|
||||
summary={summary}
|
||||
withdrawalAccounts={withdrawalAccounts}
|
||||
canUseFinanceActions={canUseFinanceActions}
|
||||
onAddWithdrawalAccount={onAddWithdrawalAccount}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
@@ -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({
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="worker-profile-mobile-withdraw-block">
|
||||
<div className="worker-profile-mobile-withdraw-head">
|
||||
<span className="worker-profile-mobile-withdraw-title">提现信息</span>
|
||||
{withdrawalAccounts.length > 0 ? (
|
||||
<span className="worker-profile-mobile-withdraw-hint">修改请联系客服</span>
|
||||
) : null}
|
||||
</div>
|
||||
{withdrawalAccounts.length > 0 ? (
|
||||
<div className="worker-profile-mobile-withdraw-list">
|
||||
{withdrawalAccounts.map((account) => (
|
||||
<div key={account.accountChannel} className="worker-profile-mobile-withdraw-item">
|
||||
<div className="worker-profile-mobile-withdraw-line">
|
||||
<Tag color="blue" className="worker-profile-mobile-withdraw-tag">
|
||||
{formatWithdrawChannel(account.accountChannel)}
|
||||
</Tag>
|
||||
<strong className="worker-profile-mobile-withdraw-name">
|
||||
{account.accountName}
|
||||
</strong>
|
||||
</div>
|
||||
<span className="worker-profile-mobile-withdraw-desc">
|
||||
{formatWithdrawalAccountDesc(account)}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="worker-profile-mobile-withdraw-empty">
|
||||
<span className="worker-profile-mobile-withdraw-desc">暂未添加提现信息</span>
|
||||
<button
|
||||
type="button"
|
||||
className="worker-profile-mobile-withdraw-add-btn"
|
||||
disabled={!canUseFinanceActions}
|
||||
onClick={onAddWithdrawalAccount}
|
||||
>
|
||||
添加提现信息
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function formatWithdrawalAccountDesc(account: WorkerWithdrawalAccount) {
|
||||
if (account.accountChannel === 'wechat') {
|
||||
return account.wechatQrCodeImage ? '已上传收款码' : '未上传收款码'
|
||||
}
|
||||
return `${account.accountNoMasked || '-'} · ${
|
||||
account.alipayQrCodeImage ? '已上传收款码' : '未上传收款码'
|
||||
}`
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
|
||||
@@ -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)
|
||||
========================================================================== */
|
||||
|
||||
Reference in New Issue
Block a user