统一前后端代码格式化配置
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
import { ClockCircleOutlined, PushpinOutlined, ReloadOutlined, SearchOutlined, TrophyOutlined } from '@ant-design/icons'
|
||||
import {
|
||||
ClockCircleOutlined,
|
||||
PushpinOutlined,
|
||||
ReloadOutlined,
|
||||
SearchOutlined,
|
||||
TrophyOutlined,
|
||||
} from '@ant-design/icons'
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import {
|
||||
Alert,
|
||||
@@ -96,8 +102,7 @@ export default function WorkerHallPage() {
|
||||
}),
|
||||
])
|
||||
|
||||
const pendingAcceptanceCount =
|
||||
pendingAcceptanceResponse.data.pagination.total
|
||||
const pendingAcceptanceCount = pendingAcceptanceResponse.data.pagination.total
|
||||
const problemCount = problemResponse.data.pagination.total
|
||||
|
||||
return {
|
||||
@@ -124,10 +129,8 @@ export default function WorkerHallPage() {
|
||||
const pendingAcceptanceCount = hallSummaryQuery.data?.pendingAcceptanceCount || 0
|
||||
const problemCount = hallSummaryQuery.data?.problemCount || 0
|
||||
const maxActiveOrders = Number(worker?.level?.permissions.maxActiveOrders || 0)
|
||||
const remainingSlots =
|
||||
maxActiveOrders > 0 ? Math.max(0, maxActiveOrders - activeCount) : null
|
||||
const shouldWarn =
|
||||
(remainingSlots !== null && remainingSlots <= 0) || problemCount > 0
|
||||
const remainingSlots = maxActiveOrders > 0 ? Math.max(0, maxActiveOrders - activeCount) : null
|
||||
const shouldWarn = (remainingSlots !== null && remainingSlots <= 0) || problemCount > 0
|
||||
|
||||
async function refreshAll() {
|
||||
await Promise.all([
|
||||
@@ -199,14 +202,13 @@ export default function WorkerHallPage() {
|
||||
{
|
||||
label: '当前余额',
|
||||
value: worker ? formatMoney(worker.wallet.availableAmount) : '-',
|
||||
note: worker ? `冻结押金 ${formatMoney(worker.wallet.frozenDepositAmount)}` : '可用于抢单冻结',
|
||||
note: worker
|
||||
? `冻结押金 ${formatMoney(worker.wallet.frozenDepositAmount)}`
|
||||
: '可用于抢单冻结',
|
||||
},
|
||||
{
|
||||
label: '接单上限',
|
||||
value:
|
||||
remainingSlots === null
|
||||
? '未配置'
|
||||
: `${activeCount}/${maxActiveOrders} 单`,
|
||||
value: remainingSlots === null ? '未配置' : `${activeCount}/${maxActiveOrders} 单`,
|
||||
note:
|
||||
remainingSlots === null
|
||||
? '当前等级待配置'
|
||||
@@ -222,11 +224,17 @@ export default function WorkerHallPage() {
|
||||
<div className="worker-hall-mobile-top-bar">
|
||||
<div className="worker-hall-mobile-stat-pill">
|
||||
<span className="worker-hall-mobile-stat-item">
|
||||
余额 <strong className="worker-hall-mobile-stat-highlight">{worker ? formatMoney(worker.wallet.availableAmount) : '-'}</strong>
|
||||
余额{' '}
|
||||
<strong className="worker-hall-mobile-stat-highlight">
|
||||
{worker ? formatMoney(worker.wallet.availableAmount) : '-'}
|
||||
</strong>
|
||||
</span>
|
||||
<span className="worker-hall-mobile-stat-divider">|</span>
|
||||
<span className="worker-hall-mobile-stat-item">
|
||||
上限 <strong>{remainingSlots === null ? '-' : `${activeCount}/${maxActiveOrders}`}</strong>
|
||||
上限{' '}
|
||||
<strong>
|
||||
{remainingSlots === null ? '-' : `${activeCount}/${maxActiveOrders}`}
|
||||
</strong>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -242,20 +250,14 @@ export default function WorkerHallPage() {
|
||||
</Tooltip>
|
||||
<div className="worker-hall-mobile-autorefresh-switch">
|
||||
<span className="worker-hall-mobile-autorefresh-text">自动刷新</span>
|
||||
<Switch
|
||||
size="small"
|
||||
checked={autoRefresh}
|
||||
onChange={toggleAutoRefresh}
|
||||
/>
|
||||
<Switch size="small" checked={autoRefresh} onChange={toggleAutoRefresh} />
|
||||
</div>
|
||||
<Button
|
||||
size="small"
|
||||
shape="circle"
|
||||
icon={<ReloadOutlined />}
|
||||
loading={
|
||||
ordersQuery.isFetching ||
|
||||
profileQuery.isFetching ||
|
||||
hallSummaryQuery.isFetching
|
||||
ordersQuery.isFetching || profileQuery.isFetching || hallSummaryQuery.isFetching
|
||||
}
|
||||
onClick={() => refreshAll()}
|
||||
/>
|
||||
@@ -356,11 +358,7 @@ export default function WorkerHallPage() {
|
||||
/>
|
||||
) : (
|
||||
orders.map((order) => {
|
||||
const disabledReason = resolveGrabDisabledReason(
|
||||
order,
|
||||
worker,
|
||||
remainingSlots,
|
||||
)
|
||||
const disabledReason = resolveGrabDisabledReason(order, worker, remainingSlots)
|
||||
|
||||
return (
|
||||
<article key={order.workOrderId} className="worker-hall-mobile-card">
|
||||
@@ -368,7 +366,11 @@ export default function WorkerHallPage() {
|
||||
<div className="worker-hall-mobile-card-top">
|
||||
<div className="worker-hall-mobile-card-tags">
|
||||
{order.pinnedAt ? (
|
||||
<Tag color="gold" icon={<PushpinOutlined />} className="worker-hall-mobile-tag">
|
||||
<Tag
|
||||
color="gold"
|
||||
icon={<PushpinOutlined />}
|
||||
className="worker-hall-mobile-tag"
|
||||
>
|
||||
置顶
|
||||
</Tag>
|
||||
) : null}
|
||||
@@ -383,7 +385,11 @@ export default function WorkerHallPage() {
|
||||
</Tag>
|
||||
) : null}
|
||||
{Number(order.timeoutMinutes || 0) > 0 ? (
|
||||
<Tag color="orange" icon={<ClockCircleOutlined />} className="worker-hall-mobile-tag">
|
||||
<Tag
|
||||
color="orange"
|
||||
icon={<ClockCircleOutlined />}
|
||||
className="worker-hall-mobile-tag"
|
||||
>
|
||||
限时{order.timeoutMinutes}分
|
||||
</Tag>
|
||||
) : null}
|
||||
@@ -395,7 +401,10 @@ export default function WorkerHallPage() {
|
||||
|
||||
{/* 商品标题与保证金说明 */}
|
||||
<div className="worker-hall-mobile-card-main">
|
||||
<strong className="worker-hall-mobile-card-title" title={order.productName || '未命名商品'}>
|
||||
<strong
|
||||
className="worker-hall-mobile-card-title"
|
||||
title={order.productName || '未命名商品'}
|
||||
>
|
||||
{order.productName || '未命名商品'}
|
||||
</strong>
|
||||
<div className="worker-hall-mobile-card-meta">
|
||||
@@ -478,11 +487,7 @@ export default function WorkerHallPage() {
|
||||
>
|
||||
<div className="worker-hall-autorefresh-box">
|
||||
<span className="worker-hall-autorefresh-label">自动刷新</span>
|
||||
<Switch
|
||||
size="small"
|
||||
checked={autoRefresh}
|
||||
onChange={toggleAutoRefresh}
|
||||
/>
|
||||
<Switch size="small" checked={autoRefresh} onChange={toggleAutoRefresh} />
|
||||
</div>
|
||||
</Tooltip>
|
||||
<Button
|
||||
@@ -606,17 +611,17 @@ export default function WorkerHallPage() {
|
||||
<>
|
||||
<div className="worker-hall-card-grid">
|
||||
{orders.map((order) => {
|
||||
const disabledReason = resolveGrabDisabledReason(
|
||||
order,
|
||||
worker,
|
||||
remainingSlots,
|
||||
)
|
||||
const disabledReason = resolveGrabDisabledReason(order, worker, remainingSlots)
|
||||
|
||||
return (
|
||||
<article key={order.workOrderId} className="worker-hall-card">
|
||||
<div className="worker-hall-card-title">
|
||||
{order.pinnedAt ? (
|
||||
<Tag color="gold" icon={<PushpinOutlined />} className="worker-hall-pinned-tag">
|
||||
<Tag
|
||||
color="gold"
|
||||
icon={<PushpinOutlined />}
|
||||
className="worker-hall-pinned-tag"
|
||||
>
|
||||
置顶
|
||||
</Tag>
|
||||
) : null}
|
||||
@@ -640,8 +645,7 @@ export default function WorkerHallPage() {
|
||||
<Typography.Text type="secondary">
|
||||
单价 {formatMoney(order.sharing.unitReward)} · 进度{' '}
|
||||
{order.sharingProgress?.joinedQuantity || 0}/
|
||||
{order.sharing.totalQuantity} · 剩{' '}
|
||||
{resolveSharingRemaining(order)} 份
|
||||
{order.sharing.totalQuantity} · 剩 {resolveSharingRemaining(order)} 份
|
||||
</Typography.Text>
|
||||
</div>
|
||||
) : null}
|
||||
@@ -658,19 +662,13 @@ export default function WorkerHallPage() {
|
||||
<div className="worker-hall-card-amount">
|
||||
{formatMoney(order.rewardAmount)}
|
||||
</div>
|
||||
<Typography.Text
|
||||
type="secondary"
|
||||
className="worker-hall-card-deposit"
|
||||
>
|
||||
<Typography.Text type="secondary" className="worker-hall-card-deposit">
|
||||
所需保证金:{formatMoney(order.freezeDepositAmount)}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
|
||||
{disabledReason ? (
|
||||
<Typography.Text
|
||||
type="danger"
|
||||
className="worker-hall-card-hint"
|
||||
>
|
||||
<Typography.Text type="danger" className="worker-hall-card-hint">
|
||||
{disabledReason}
|
||||
</Typography.Text>
|
||||
) : null}
|
||||
|
||||
@@ -141,7 +141,9 @@ export default function WorkerLoginPage() {
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="auth-brand-footer">© {new Date().getFullYear()} 王大锤 · 保留所有权利</div>
|
||||
<div className="auth-brand-footer">
|
||||
© {new Date().getFullYear()} 王大锤 · 保留所有权利
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
{/* 登录注册表单区 */}
|
||||
|
||||
@@ -80,7 +80,9 @@ const PRESET_NOTE_TAGS: Array<{ label: string; theme: NoteTheme }> = [
|
||||
]
|
||||
|
||||
function resolveNoteTheme(note?: string): NoteTheme {
|
||||
const text = String(note || '').trim().toLowerCase()
|
||||
const text = String(note || '')
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
if (!text) return 'default'
|
||||
|
||||
// 1. 危险 / 异常 / 问题类 (Red)
|
||||
@@ -352,7 +354,11 @@ export default function WorkerOrdersPage() {
|
||||
{row.categoryName ? <Tag color="blue">{row.categoryName}</Tag> : null}
|
||||
{row.myShare ? <Tag color="purple">拼单</Tag> : null}
|
||||
</Space>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }} ellipsis={{ tooltip: getDisplayOrderNo(row) }}>
|
||||
<Typography.Text
|
||||
type="secondary"
|
||||
style={{ fontSize: 12 }}
|
||||
ellipsis={{ tooltip: getDisplayOrderNo(row) }}
|
||||
>
|
||||
{getDisplayOrderNo(row)}
|
||||
</Typography.Text>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
@@ -373,7 +379,11 @@ export default function WorkerOrdersPage() {
|
||||
) : null}
|
||||
</Space>
|
||||
{row.status === 'problem' && String(row.problemNote || '').trim() ? (
|
||||
<Typography.Text type="danger" ellipsis={{ tooltip: row.problemNote }} style={{ fontSize: 12 }}>
|
||||
<Typography.Text
|
||||
type="danger"
|
||||
ellipsis={{ tooltip: row.problemNote }}
|
||||
style={{ fontSize: 12 }}
|
||||
>
|
||||
{row.problemNote}
|
||||
</Typography.Text>
|
||||
) : null}
|
||||
@@ -410,7 +420,11 @@ export default function WorkerOrdersPage() {
|
||||
const draftCount = draftFiles.length
|
||||
|
||||
if (!hasAcceptance && !submittedAt && draftCount === 0) {
|
||||
return <Typography.Text type="secondary" style={{ fontSize: 12 }}>未提交</Typography.Text>
|
||||
return (
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
未提交
|
||||
</Typography.Text>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div className="cell-stack">
|
||||
@@ -431,7 +445,11 @@ export default function WorkerOrdersPage() {
|
||||
</div>
|
||||
) : null}
|
||||
{getWorkerAcceptance(row)?.note ? (
|
||||
<Typography.Text type="secondary" ellipsis={{ tooltip: getWorkerAcceptance(row)?.note }} style={{ fontSize: 12 }}>
|
||||
<Typography.Text
|
||||
type="secondary"
|
||||
ellipsis={{ tooltip: getWorkerAcceptance(row)?.note }}
|
||||
style={{ fontSize: 12 }}
|
||||
>
|
||||
{getWorkerAcceptance(row)?.note}
|
||||
</Typography.Text>
|
||||
) : null}
|
||||
@@ -443,16 +461,18 @@ export default function WorkerOrdersPage() {
|
||||
title: '快捷复制',
|
||||
width: 250,
|
||||
render: (_, row) => {
|
||||
const items = getMaterialDetailItems(row).filter((item) =>
|
||||
String(item.value || '').trim(),
|
||||
)
|
||||
const items = getMaterialDetailItems(row).filter((item) => String(item.value || '').trim())
|
||||
const canCopyInfo = getCopyOrderInfoItems(row).length > 0
|
||||
const screenshots = getMaterialScreenshots(row)
|
||||
return (
|
||||
<div className="cell-stack">
|
||||
{items.length > 0 ? (
|
||||
items.map((item) => (
|
||||
<Typography.Text key={item.key} style={{ fontSize: 12 }} ellipsis={{ tooltip: `${item.label}: ${item.value}` }}>
|
||||
<Typography.Text
|
||||
key={item.key}
|
||||
style={{ fontSize: 12 }}
|
||||
ellipsis={{ tooltip: `${item.label}: ${item.value}` }}
|
||||
>
|
||||
{item.label}: {item.value}
|
||||
</Typography.Text>
|
||||
))
|
||||
@@ -461,9 +481,7 @@ export default function WorkerOrdersPage() {
|
||||
暂无资料信息
|
||||
</Typography.Text>
|
||||
)}
|
||||
{screenshots.length > 0 ? (
|
||||
<ImagePreviewList files={screenshots} size={34} />
|
||||
) : null}
|
||||
{screenshots.length > 0 ? <ImagePreviewList files={screenshots} size={34} /> : null}
|
||||
<Space wrap size={4}>
|
||||
<Button
|
||||
size="small"
|
||||
@@ -625,11 +643,7 @@ export default function WorkerOrdersPage() {
|
||||
/>
|
||||
) : orders.length === 0 ? (
|
||||
<Empty
|
||||
description={
|
||||
keyword
|
||||
? `没有找到与 “${keyword}” 相关的订单`
|
||||
: '当前筛选下暂无订单'
|
||||
}
|
||||
description={keyword ? `没有找到与 “${keyword}” 相关的订单` : '当前筛选下暂无订单'}
|
||||
/>
|
||||
) : (
|
||||
orders.map((order) => {
|
||||
@@ -695,7 +709,8 @@ export default function WorkerOrdersPage() {
|
||||
</span>
|
||||
{order.myShare ? (
|
||||
<span className="worker-order-mobile-sub-item">
|
||||
已拼 {order.myShare.quantity} 份 ({formatMoney(order.myShare.shareReward)})
|
||||
已拼 {order.myShare.quantity} 份 ({formatMoney(order.myShare.shareReward)}
|
||||
)
|
||||
</span>
|
||||
) : null}
|
||||
<span className="worker-order-mobile-sub-time">
|
||||
@@ -718,8 +733,12 @@ export default function WorkerOrdersPage() {
|
||||
<div className="worker-order-mobile-credentials-grid">
|
||||
{items.map((item) => (
|
||||
<div key={item.key} className="worker-order-mobile-credential-line">
|
||||
<span className="worker-order-mobile-credential-label">{item.label}:</span>
|
||||
<span className="worker-order-mobile-credential-val">{item.value}</span>
|
||||
<span className="worker-order-mobile-credential-label">
|
||||
{item.label}:
|
||||
</span>
|
||||
<span className="worker-order-mobile-credential-val">
|
||||
{item.value}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -755,7 +774,9 @@ export default function WorkerOrdersPage() {
|
||||
)}
|
||||
|
||||
{/* 验收凭据与暂存状态 */}
|
||||
{(hasAcceptance || (draftCount > 0 && !hasSubmittedAcceptance(order)) || noteText) && (
|
||||
{(hasAcceptance ||
|
||||
(draftCount > 0 && !hasSubmittedAcceptance(order)) ||
|
||||
noteText) && (
|
||||
<div className="worker-order-mobile-acceptance-strip">
|
||||
{hasAcceptance ? (
|
||||
<div className="worker-order-mobile-acceptance-files">
|
||||
@@ -872,9 +893,7 @@ export default function WorkerOrdersPage() {
|
||||
label: (
|
||||
<span>
|
||||
{item.label}
|
||||
{count > 0 ? (
|
||||
<span className="worker-order-tab-count">{count}</span>
|
||||
) : null}
|
||||
{count > 0 ? <span className="worker-order-tab-count">{count}</span> : null}
|
||||
</span>
|
||||
),
|
||||
}
|
||||
@@ -929,9 +948,7 @@ export default function WorkerOrdersPage() {
|
||||
) : (
|
||||
<Empty
|
||||
description={
|
||||
keyword
|
||||
? `没有找到与 “${keyword}” 相关的订单`
|
||||
: '当前筛选下暂无订单'
|
||||
keyword ? `没有找到与 “${keyword}” 相关的订单` : '当前筛选下暂无订单'
|
||||
}
|
||||
/>
|
||||
),
|
||||
@@ -988,9 +1005,7 @@ export default function WorkerOrdersPage() {
|
||||
<div className="worker-order-detail-stack">
|
||||
<Card title="基础信息" size="small">
|
||||
<Descriptions column={{ xs: 1, md: 2 }} bordered size="small">
|
||||
<Descriptions.Item label="商品">
|
||||
{detailOrder.productName || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="商品">{detailOrder.productName || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label="分类">
|
||||
{detailOrder.categoryName || '-'}
|
||||
</Descriptions.Item>
|
||||
@@ -1027,10 +1042,7 @@ export default function WorkerOrdersPage() {
|
||||
</Card>
|
||||
|
||||
<Card title="资料信息" size="small">
|
||||
{renderDetailFieldValues(
|
||||
getMaterialDetailItems(detailOrder),
|
||||
'当前还没有资料内容',
|
||||
)}
|
||||
{renderDetailFieldValues(getMaterialDetailItems(detailOrder), '当前还没有资料内容')}
|
||||
{getMaterialScreenshots(detailOrder).length > 0 ? (
|
||||
<div style={{ marginTop: 12 }}>
|
||||
<Typography.Text type="secondary">买家主页截图</Typography.Text>
|
||||
@@ -1174,10 +1186,7 @@ export default function WorkerOrdersPage() {
|
||||
>
|
||||
<Form form={form} layout="vertical" onFinish={submitAcceptance}>
|
||||
<Form.Item label="完成说明" name="note">
|
||||
<Input.TextArea
|
||||
rows={3}
|
||||
placeholder="可补充代练结果、注意事项或截图说明。"
|
||||
/>
|
||||
<Input.TextArea rows={3} placeholder="可补充代练结果、注意事项或截图说明。" />
|
||||
</Form.Item>
|
||||
<Form.Item label="验收图片" required>
|
||||
<ImageUpload
|
||||
@@ -1224,9 +1233,7 @@ function getDisplayOrderNo(order: Pick<WorkOrder, 'platformOrderId'> | null | un
|
||||
|
||||
function getRequirementFields(order: WorkOrder | null): CollectField[] {
|
||||
if (!order) return []
|
||||
const rawFields = Array.isArray(order.requirement?.fields)
|
||||
? order.requirement.fields
|
||||
: []
|
||||
const rawFields = Array.isArray(order.requirement?.fields) ? order.requirement.fields : []
|
||||
return rawFields
|
||||
.map((item) => {
|
||||
const source = asRecord(item)
|
||||
@@ -1261,9 +1268,7 @@ async function toPngBlob(source: Blob): Promise<Blob> {
|
||||
const context = canvas.getContext('2d')
|
||||
if (!context) return source
|
||||
context.drawImage(image, 0, 0)
|
||||
const png = await new Promise<Blob | null>((resolve) =>
|
||||
canvas.toBlob(resolve, 'image/png'),
|
||||
)
|
||||
const png = await new Promise<Blob | null>((resolve) => canvas.toBlob(resolve, 'image/png'))
|
||||
return png || source
|
||||
} finally {
|
||||
URL.revokeObjectURL(url)
|
||||
@@ -1332,10 +1337,7 @@ function getCopyOrderInfoItems(order: WorkOrder): Array<Pick<DetailFieldItem, 'l
|
||||
String(item.value || '').trim(),
|
||||
)
|
||||
|
||||
return [
|
||||
...(productName ? [{ label: '物品', value: productName }] : []),
|
||||
...materialItems,
|
||||
]
|
||||
return [...(productName ? [{ label: '物品', value: productName }] : []), ...materialItems]
|
||||
}
|
||||
|
||||
function renderDetailFieldValues(items: DetailFieldItem[], emptyText: string) {
|
||||
@@ -1432,9 +1434,7 @@ function getDraftImageUrls(row: WorkOrder): string[] {
|
||||
function getAcceptanceSubmittedAt(order: WorkOrder): string | null {
|
||||
if (order.myShare) return order.myShare.submittedAt
|
||||
const acceptanceSubmittedAt =
|
||||
typeof order.acceptance?.submittedAt === 'string'
|
||||
? order.acceptance.submittedAt
|
||||
: null
|
||||
typeof order.acceptance?.submittedAt === 'string' ? order.acceptance.submittedAt : null
|
||||
return order.submittedAt || acceptanceSubmittedAt || null
|
||||
}
|
||||
|
||||
|
||||
@@ -138,13 +138,7 @@ export default function WorkerProfilePage() {
|
||||
})
|
||||
|
||||
const requestsQuery = useQuery({
|
||||
queryKey: [
|
||||
'worker-finance-requests',
|
||||
requestType,
|
||||
requestStatus,
|
||||
requestPage,
|
||||
requestPageSize,
|
||||
],
|
||||
queryKey: ['worker-finance-requests', requestType, requestStatus, requestPage, requestPageSize],
|
||||
queryFn: () =>
|
||||
fetchWorkerFinanceRequests({
|
||||
page: requestPage,
|
||||
@@ -275,9 +269,7 @@ export default function WorkerProfilePage() {
|
||||
title: '类型',
|
||||
width: 150,
|
||||
render: (_, row) => (
|
||||
<Tag color={resolveLedgerTagColor(row.ledgerType)}>
|
||||
{formatLedgerType(row.ledgerType)}
|
||||
</Tag>
|
||||
<Tag color={resolveLedgerTagColor(row.ledgerType)}>{formatLedgerType(row.ledgerType)}</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -310,9 +302,7 @@ export default function WorkerProfilePage() {
|
||||
<div className="cell-stack">
|
||||
<Typography.Text>{row.note || '-'}</Typography.Text>
|
||||
{row.relatedWorkOrderId ? (
|
||||
<Typography.Text type="secondary">
|
||||
关联工单 #{row.relatedWorkOrderId}
|
||||
</Typography.Text>
|
||||
<Typography.Text type="secondary">关联工单 #{row.relatedWorkOrderId}</Typography.Text>
|
||||
) : null}
|
||||
</div>
|
||||
),
|
||||
@@ -349,9 +339,7 @@ export default function WorkerProfilePage() {
|
||||
<Typography.Text>
|
||||
{formatWithdrawChannel(row.accountChannel)} / {row.accountName || '-'}
|
||||
</Typography.Text>
|
||||
<Typography.Text type="secondary">
|
||||
{maskAccountNo(row.accountNo)}
|
||||
</Typography.Text>
|
||||
<Typography.Text type="secondary">{maskAccountNo(row.accountNo)}</Typography.Text>
|
||||
</div>
|
||||
) : (
|
||||
renderRechargeRequestSummary(row)
|
||||
@@ -361,9 +349,7 @@ export default function WorkerProfilePage() {
|
||||
title: '状态',
|
||||
width: 130,
|
||||
render: (_, row) => (
|
||||
<Tag color={resolveRequestStatusColor(row.status)}>
|
||||
{formatRequestStatus(row.status)}
|
||||
</Tag>
|
||||
<Tag color={resolveRequestStatusColor(row.status)}>{formatRequestStatus(row.status)}</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -373,9 +359,7 @@ export default function WorkerProfilePage() {
|
||||
<div className="cell-stack">
|
||||
<Typography.Text>{row.note || '-'}</Typography.Text>
|
||||
{row.reviewedNote ? (
|
||||
<Typography.Text type="secondary">
|
||||
审核备注:{row.reviewedNote}
|
||||
</Typography.Text>
|
||||
<Typography.Text type="secondary">审核备注:{row.reviewedNote}</Typography.Text>
|
||||
) : null}
|
||||
</div>
|
||||
),
|
||||
@@ -415,10 +399,7 @@ export default function WorkerProfilePage() {
|
||||
{/* 沉浸式顶部个人卡片 */}
|
||||
<div className="worker-profile-mobile-hero">
|
||||
<div className="worker-profile-mobile-user-row">
|
||||
<Avatar
|
||||
size={52}
|
||||
className="worker-profile-mobile-avatar"
|
||||
>
|
||||
<Avatar size={52} className="worker-profile-mobile-avatar">
|
||||
{resolveWorkerInitial(worker)}
|
||||
</Avatar>
|
||||
<div className="worker-profile-mobile-user-info">
|
||||
@@ -431,7 +412,10 @@ export default function WorkerProfilePage() {
|
||||
<span className="worker-profile-mobile-vip-badge">
|
||||
{worker.level?.name || '未分级'}
|
||||
</span>
|
||||
<Tag color={resolveWorkerStatusColor(worker.status)} className="worker-profile-mobile-tag">
|
||||
<Tag
|
||||
color={resolveWorkerStatusColor(worker.status)}
|
||||
className="worker-profile-mobile-tag"
|
||||
>
|
||||
{formatWorkerStatus(worker.status)}
|
||||
</Tag>
|
||||
<Tag className="worker-profile-mobile-tag">
|
||||
@@ -447,7 +431,9 @@ export default function WorkerProfilePage() {
|
||||
shape="circle"
|
||||
icon={<ReloadOutlined />}
|
||||
className="worker-profile-mobile-refresh-btn"
|
||||
loading={profileQuery.isFetching || ledgersQuery.isFetching || requestsQuery.isFetching}
|
||||
loading={
|
||||
profileQuery.isFetching || ledgersQuery.isFetching || requestsQuery.isFetching
|
||||
}
|
||||
onClick={() => refreshAll()}
|
||||
/>
|
||||
</div>
|
||||
@@ -456,7 +442,9 @@ export default function WorkerProfilePage() {
|
||||
<div className="worker-profile-mobile-hero-bottom">
|
||||
<div className="worker-profile-mobile-invite-bar">
|
||||
<span className="worker-profile-mobile-invite-label">我的邀请码:</span>
|
||||
<strong className="worker-profile-mobile-invite-code">{worker.inviteCode || '-'}</strong>
|
||||
<strong className="worker-profile-mobile-invite-code">
|
||||
{worker.inviteCode || '-'}
|
||||
</strong>
|
||||
{worker.inviteCode ? (
|
||||
<button
|
||||
type="button"
|
||||
@@ -471,7 +459,12 @@ export default function WorkerProfilePage() {
|
||||
{levelProgress && levelProgress.nextThreshold !== null ? (
|
||||
<div className="worker-profile-mobile-level-box">
|
||||
<div className="worker-profile-mobile-level-text">
|
||||
已完成 {summary?.acceptedOrderCount || 0} 单 · 距下一级还需 {Math.max(0, levelProgress.nextThreshold - (summary?.acceptedOrderCount || 0))} 单
|
||||
已完成 {summary?.acceptedOrderCount || 0} 单 · 距下一级还需{' '}
|
||||
{Math.max(
|
||||
0,
|
||||
levelProgress.nextThreshold - (summary?.acceptedOrderCount || 0),
|
||||
)}{' '}
|
||||
单
|
||||
</div>
|
||||
<Progress
|
||||
percent={levelProgress.progressPercent}
|
||||
@@ -557,7 +550,10 @@ export default function WorkerProfilePage() {
|
||||
className="worker-profile-mobile-tool-item"
|
||||
onClick={() => setPasswordOpen(true)}
|
||||
>
|
||||
<div className="worker-profile-mobile-tool-icon" style={{ background: '#eff6ff', color: '#3b82f6' }}>
|
||||
<div
|
||||
className="worker-profile-mobile-tool-icon"
|
||||
style={{ background: '#eff6ff', color: '#3b82f6' }}
|
||||
>
|
||||
<LockOutlined />
|
||||
</div>
|
||||
<span>修改密码</span>
|
||||
@@ -567,7 +563,10 @@ export default function WorkerProfilePage() {
|
||||
className="worker-profile-mobile-tool-item"
|
||||
onClick={() => setContactOpen(true)}
|
||||
>
|
||||
<div className="worker-profile-mobile-tool-icon" style={{ background: '#f0fdf4', color: '#16a34a' }}>
|
||||
<div
|
||||
className="worker-profile-mobile-tool-icon"
|
||||
style={{ background: '#f0fdf4', color: '#16a34a' }}
|
||||
>
|
||||
<CustomerServiceOutlined />
|
||||
</div>
|
||||
<span>联系客服</span>
|
||||
@@ -578,7 +577,10 @@ export default function WorkerProfilePage() {
|
||||
disabled={!worker.inviteCode}
|
||||
onClick={copyInviteCode}
|
||||
>
|
||||
<div className="worker-profile-mobile-tool-icon" style={{ background: '#fef3c7', color: '#d97706' }}>
|
||||
<div
|
||||
className="worker-profile-mobile-tool-icon"
|
||||
style={{ background: '#fef3c7', color: '#d97706' }}
|
||||
>
|
||||
<CopyOutlined />
|
||||
</div>
|
||||
<span>邀请好友</span>
|
||||
@@ -588,7 +590,10 @@ export default function WorkerProfilePage() {
|
||||
className="worker-profile-mobile-tool-item"
|
||||
onClick={submitLogout}
|
||||
>
|
||||
<div className="worker-profile-mobile-tool-icon" style={{ background: '#fef2f2', color: '#ef4444' }}>
|
||||
<div
|
||||
className="worker-profile-mobile-tool-icon"
|
||||
style={{ background: '#fef2f2', color: '#ef4444' }}
|
||||
>
|
||||
<LogoutOutlined />
|
||||
</div>
|
||||
<span>退出登录</span>
|
||||
@@ -657,7 +662,9 @@ export default function WorkerProfilePage() {
|
||||
|
||||
<div className="worker-profile-mobile-records">
|
||||
{ledgersQuery.isLoading ? (
|
||||
<div className="worker-hall-loading"><Spin size="large" /></div>
|
||||
<div className="worker-hall-loading">
|
||||
<Spin size="large" />
|
||||
</div>
|
||||
) : (ledgersQuery.data?.data.items || []).length === 0 ? (
|
||||
<Empty description="暂无钱包流水" />
|
||||
) : (
|
||||
@@ -702,7 +709,9 @@ export default function WorkerProfilePage() {
|
||||
<div className="worker-orders-mobile-pagination">
|
||||
<Pagination
|
||||
current={ledgersQuery.data?.data.pagination.page || ledgerPage}
|
||||
pageSize={ledgersQuery.data?.data.pagination.pageSize || ledgerPageSize}
|
||||
pageSize={
|
||||
ledgersQuery.data?.data.pagination.pageSize || ledgerPageSize
|
||||
}
|
||||
total={ledgersQuery.data?.data.pagination.total || 0}
|
||||
simple
|
||||
onChange={(nextPage: number, nextPageSize: number) => {
|
||||
@@ -760,7 +769,9 @@ export default function WorkerProfilePage() {
|
||||
|
||||
<div className="worker-profile-mobile-records">
|
||||
{requestsQuery.isLoading ? (
|
||||
<div className="worker-hall-loading"><Spin size="large" /></div>
|
||||
<div className="worker-hall-loading">
|
||||
<Spin size="large" />
|
||||
</div>
|
||||
) : (requestsQuery.data?.data.items || []).length === 0 ? (
|
||||
<Empty description="暂无申请记录" />
|
||||
) : (
|
||||
@@ -779,7 +790,8 @@ export default function WorkerProfilePage() {
|
||||
</div>
|
||||
{row.requestType === 'withdraw' ? (
|
||||
<div className="worker-profile-record-row-meta">
|
||||
收款: {formatWithdrawChannel(row.accountChannel)} / {row.accountName || '-'} ({maskAccountNo(row.accountNo)})
|
||||
收款: {formatWithdrawChannel(row.accountChannel)} /{' '}
|
||||
{row.accountName || '-'} ({maskAccountNo(row.accountNo)})
|
||||
</div>
|
||||
) : (
|
||||
<div className="worker-profile-record-row-meta">
|
||||
@@ -790,7 +802,10 @@ export default function WorkerProfilePage() {
|
||||
<div className="worker-profile-record-note">备注: {row.note}</div>
|
||||
) : null}
|
||||
{row.reviewedNote ? (
|
||||
<div className="worker-profile-record-note" style={{ color: '#d97706' }}>
|
||||
<div
|
||||
className="worker-profile-record-note"
|
||||
style={{ color: '#d97706' }}
|
||||
>
|
||||
审核备注: {row.reviewedNote}
|
||||
</div>
|
||||
) : null}
|
||||
@@ -805,7 +820,9 @@ export default function WorkerProfilePage() {
|
||||
<div className="worker-orders-mobile-pagination">
|
||||
<Pagination
|
||||
current={requestsQuery.data?.data.pagination.page || requestPage}
|
||||
pageSize={requestsQuery.data?.data.pagination.pageSize || requestPageSize}
|
||||
pageSize={
|
||||
requestsQuery.data?.data.pagination.pageSize || requestPageSize
|
||||
}
|
||||
total={requestsQuery.data?.data.pagination.total || 0}
|
||||
simple
|
||||
onChange={(nextPage: number, nextPageSize: number) => {
|
||||
@@ -828,11 +845,15 @@ export default function WorkerProfilePage() {
|
||||
</div>
|
||||
<div className="worker-profile-mobile-account-item">
|
||||
<span className="worker-profile-mobile-acc-label">昵称</span>
|
||||
<span className="worker-profile-mobile-acc-val">{worker.displayName || '-'}</span>
|
||||
<span className="worker-profile-mobile-acc-val">
|
||||
{worker.displayName || '-'}
|
||||
</span>
|
||||
</div>
|
||||
<div className="worker-profile-mobile-account-item">
|
||||
<span className="worker-profile-mobile-acc-label">手机号</span>
|
||||
<span className="worker-profile-mobile-acc-val">{worker.phone || '-'}</span>
|
||||
<span className="worker-profile-mobile-acc-val">
|
||||
{worker.phone || '-'}
|
||||
</span>
|
||||
</div>
|
||||
<div className="worker-profile-mobile-account-item">
|
||||
<span className="worker-profile-mobile-acc-label">审核状态</span>
|
||||
@@ -844,7 +865,9 @@ export default function WorkerProfilePage() {
|
||||
</div>
|
||||
<div className="worker-profile-mobile-account-item">
|
||||
<span className="worker-profile-mobile-acc-label">当前等级</span>
|
||||
<span className="worker-profile-mobile-acc-val">{worker.level?.name || '-'}</span>
|
||||
<span className="worker-profile-mobile-acc-val">
|
||||
{worker.level?.name || '-'}
|
||||
</span>
|
||||
</div>
|
||||
<div className="worker-profile-mobile-account-item">
|
||||
<span className="worker-profile-mobile-acc-label">免押额度</span>
|
||||
@@ -861,12 +884,16 @@ export default function WorkerProfilePage() {
|
||||
<div className="worker-profile-mobile-account-item">
|
||||
<span className="worker-profile-mobile-acc-label">邀请人</span>
|
||||
<span className="worker-profile-mobile-acc-val">
|
||||
{worker.inviter ? worker.inviter.displayName || worker.inviter.username : '-'}
|
||||
{worker.inviter
|
||||
? worker.inviter.displayName || worker.inviter.username
|
||||
: '-'}
|
||||
</span>
|
||||
</div>
|
||||
<div className="worker-profile-mobile-account-item">
|
||||
<span className="worker-profile-mobile-acc-label">已完成订单</span>
|
||||
<span className="worker-profile-mobile-acc-val">{summary?.acceptedOrderCount || 0} 单</span>
|
||||
<span className="worker-profile-mobile-acc-val">
|
||||
{summary?.acceptedOrderCount || 0} 单
|
||||
</span>
|
||||
</div>
|
||||
<div className="worker-profile-mobile-account-item">
|
||||
<span className="worker-profile-mobile-acc-label">累计充值</span>
|
||||
@@ -876,7 +903,9 @@ export default function WorkerProfilePage() {
|
||||
</div>
|
||||
<div className="worker-profile-mobile-account-item">
|
||||
<span className="worker-profile-mobile-acc-label">注册时间</span>
|
||||
<span className="worker-profile-mobile-acc-val">{formatDateTime(worker.createdAt)}</span>
|
||||
<span className="worker-profile-mobile-acc-val">
|
||||
{formatDateTime(worker.createdAt)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -915,16 +944,12 @@ export default function WorkerProfilePage() {
|
||||
|
||||
<Card size="small">
|
||||
<Space size={16} wrap align="start">
|
||||
<Avatar size={64}>
|
||||
{resolveWorkerInitial(worker)}
|
||||
</Avatar>
|
||||
<Avatar size={64}>{resolveWorkerInitial(worker)}</Avatar>
|
||||
<Space direction="vertical" size={2}>
|
||||
<Typography.Title level={4} style={{ margin: 0 }}>
|
||||
{worker.displayName || worker.username}
|
||||
</Typography.Title>
|
||||
<Typography.Text type="secondary">
|
||||
账号:{worker.username}
|
||||
</Typography.Text>
|
||||
<Typography.Text type="secondary">账号:{worker.username}</Typography.Text>
|
||||
<Typography.Text type="secondary">
|
||||
手机号:{worker.phone || '-'}
|
||||
</Typography.Text>
|
||||
@@ -941,9 +966,7 @@ export default function WorkerProfilePage() {
|
||||
</Space>
|
||||
<Space direction="vertical" size={4} style={{ marginTop: 12, width: '100%' }}>
|
||||
<Space wrap size={[8, 8]}>
|
||||
<Typography.Text type="secondary">
|
||||
我的邀请码:
|
||||
</Typography.Text>
|
||||
<Typography.Text type="secondary">我的邀请码:</Typography.Text>
|
||||
<Typography.Text strong>{worker.inviteCode || '-'}</Typography.Text>
|
||||
<Button
|
||||
size="small"
|
||||
@@ -958,8 +981,12 @@ export default function WorkerProfilePage() {
|
||||
{levelProgress && levelProgress.nextThreshold !== null ? (
|
||||
<Space direction="vertical" size={0} style={{ width: '100%' }}>
|
||||
<Typography.Text type="secondary">
|
||||
已累计完成 {summary?.acceptedOrderCount || 0} 单,
|
||||
距下一等级还需 {Math.max(0, levelProgress.nextThreshold - (summary?.acceptedOrderCount || 0))} 单
|
||||
已累计完成 {summary?.acceptedOrderCount || 0} 单, 距下一等级还需{' '}
|
||||
{Math.max(
|
||||
0,
|
||||
levelProgress.nextThreshold - (summary?.acceptedOrderCount || 0),
|
||||
)}{' '}
|
||||
单
|
||||
</Typography.Text>
|
||||
<Progress
|
||||
percent={levelProgress.progressPercent}
|
||||
@@ -989,7 +1016,9 @@ export default function WorkerProfilePage() {
|
||||
<strong className="worker-profile-wallet-value">
|
||||
{formatMoney(worker.wallet.frozenDepositAmount)}
|
||||
</strong>
|
||||
<small className="worker-profile-wallet-note">抢单后冻结,验收后进入待解冻</small>
|
||||
<small className="worker-profile-wallet-note">
|
||||
抢单后冻结,验收后进入待解冻
|
||||
</small>
|
||||
</div>
|
||||
<div className="worker-profile-wallet-item">
|
||||
<span className="worker-profile-wallet-label">待解冻押金</span>
|
||||
@@ -1029,10 +1058,7 @@ export default function WorkerProfilePage() {
|
||||
<Button icon={<LockOutlined />} onClick={() => setPasswordOpen(true)}>
|
||||
修改密码
|
||||
</Button>
|
||||
<Button
|
||||
icon={<CustomerServiceOutlined />}
|
||||
onClick={() => setContactOpen(true)}
|
||||
>
|
||||
<Button icon={<CustomerServiceOutlined />} onClick={() => setContactOpen(true)}>
|
||||
联系管理员
|
||||
</Button>
|
||||
<Button danger icon={<LogoutOutlined />} onClick={submitLogout}>
|
||||
@@ -1080,7 +1106,9 @@ export default function WorkerProfilePage() {
|
||||
</Space>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="邀请人">
|
||||
{worker.inviter ? worker.inviter.displayName || worker.inviter.username : '-'}
|
||||
{worker.inviter
|
||||
? worker.inviter.displayName || worker.inviter.username
|
||||
: '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="已累计完成">
|
||||
{summary?.acceptedOrderCount || 0} 单
|
||||
@@ -1240,7 +1268,8 @@ export default function WorkerProfilePage() {
|
||||
}}
|
||||
pagination={{
|
||||
current: requestsQuery.data?.data.pagination.page || requestPage,
|
||||
pageSize: requestsQuery.data?.data.pagination.pageSize || requestPageSize,
|
||||
pageSize:
|
||||
requestsQuery.data?.data.pagination.pageSize || requestPageSize,
|
||||
total: requestsQuery.data?.data.pagination.total || 0,
|
||||
showSizeChanger: true,
|
||||
pageSizeOptions: [10, 20, 50],
|
||||
@@ -1313,9 +1342,7 @@ export default function WorkerProfilePage() {
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="收款账号">
|
||||
{financeConfig?.recharge.accountNo ? (
|
||||
<Typography.Text copyable>
|
||||
{financeConfig.recharge.accountNo}
|
||||
</Typography.Text>
|
||||
<Typography.Text copyable>{financeConfig.recharge.accountNo}</Typography.Text>
|
||||
) : (
|
||||
'-'
|
||||
)}
|
||||
@@ -1434,10 +1461,7 @@ export default function WorkerProfilePage() {
|
||||
<Input placeholder="请输入支付宝账号、微信号或银行卡号" />
|
||||
</Form.Item>
|
||||
<Form.Item label="备注说明" name="note">
|
||||
<Input.TextArea
|
||||
rows={4}
|
||||
placeholder="可补充到账要求、手机号、开户行等说明。"
|
||||
/>
|
||||
<Input.TextArea rows={4} placeholder="可补充到账要求、手机号、开户行等说明。" />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
@@ -1531,9 +1555,7 @@ export default function WorkerProfilePage() {
|
||||
<Descriptions.Item label="账号">
|
||||
<Typography.Text copyable>{worker?.username || '-'}</Typography.Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="昵称">
|
||||
{worker?.displayName || '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="昵称">{worker?.displayName || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label="手机号">
|
||||
<Typography.Text copyable>{worker?.phone || '-'}</Typography.Text>
|
||||
</Descriptions.Item>
|
||||
@@ -1559,8 +1581,7 @@ function resolveAvailableForWithdraw(
|
||||
) {
|
||||
return Math.max(
|
||||
0,
|
||||
Number(worker?.wallet.availableAmount || 0) -
|
||||
Number(summary?.pendingWithdrawAmount || 0),
|
||||
Number(worker?.wallet.availableAmount || 0) - Number(summary?.pendingWithdrawAmount || 0),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1634,14 +1655,16 @@ function formatRequestStatus(status: string) {
|
||||
}
|
||||
|
||||
function hasRechargeConfig(
|
||||
financeConfig: {
|
||||
recharge?: { accountName?: string; accountNo?: string; qrCodeImage?: unknown }
|
||||
} | undefined,
|
||||
financeConfig:
|
||||
| {
|
||||
recharge?: { accountName?: string; accountNo?: string; qrCodeImage?: unknown }
|
||||
}
|
||||
| undefined,
|
||||
) {
|
||||
return Boolean(
|
||||
financeConfig?.recharge?.accountName ||
|
||||
financeConfig?.recharge?.accountNo ||
|
||||
financeConfig?.recharge?.qrCodeImage,
|
||||
financeConfig?.recharge?.accountNo ||
|
||||
financeConfig?.recharge?.qrCodeImage,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user