diff --git a/apps/frontend/src/pages/worker/WorkerProfilePage.tsx b/apps/frontend/src/pages/worker/WorkerProfilePage.tsx index c7f30da5..7d0ac20b 100644 --- a/apps/frontend/src/pages/worker/WorkerProfilePage.tsx +++ b/apps/frontend/src/pages/worker/WorkerProfilePage.tsx @@ -176,19 +176,6 @@ export default function WorkerProfilePage() { } } - function jumpToLedgerSection(nextLedgerType = '') { - setLedgerType(nextLedgerType) - setLedgerPage(1) - setActiveTab('ledger') - } - - function jumpToRequestSection(nextRequestType = '', nextStatus = '') { - setRequestType(nextRequestType) - setRequestStatus(nextStatus) - setRequestPage(1) - setActiveTab('requests') - } - function openRechargeModal() { if (!canUseFinanceActions) { message.warning('当前账号尚未通过审核,暂时不能发起充值申请') @@ -226,7 +213,9 @@ export default function WorkerProfilePage() { setRechargeOpen(false) rechargeForm.resetFields() await refreshAll() - jumpToRequestSection('recharge') + setRequestType('recharge') + setRequestPage(1) + setActiveTab('requests') } catch (error) { message.error(error instanceof Error ? error.message : '提交充值申请失败') } finally { @@ -248,7 +237,9 @@ export default function WorkerProfilePage() { setWithdrawOpen(false) withdrawForm.resetFields() await refreshAll() - jumpToRequestSection('withdraw') + setRequestType('withdraw') + setRequestPage(1) + setActiveTab('requests') } catch (error) { message.error(error instanceof Error ? error.message : '提交提现申请失败') } finally { @@ -414,243 +405,230 @@ export default function WorkerProfilePage() { } return ( -
-
- 个人中心 - -
+ <> + {isMobile ? ( +
+ {!worker && !profileQuery.isLoading ? : null} - {!worker && !profileQuery.isLoading ? : null} + {worker ? ( + <> + {/* 沉浸式顶部个人卡片 */} +
+
+ + {resolveWorkerInitial(worker)} + +
+
+ + {worker.displayName || worker.username} + +
+
+ + {worker.level?.name || '未分级'} + + + {formatWorkerStatus(worker.status)} + + + {worker.workerType === 'internal' ? '内部打手' : '外部打手'} + +
+
+ 账号: {worker.username} {worker.phone ? `· ${worker.phone}` : ''} +
+
+
- {worker ? ( - - {!canUseFinanceActions ? ( - - ) : null} + {/* 邀请码与等级进度 */} +
+
+ 我的邀请码: + {worker.inviteCode || '-'} + {worker.inviteCode ? ( + + ) : null} +
- - - - {resolveWorkerInitial(worker)} - - - - {worker.displayName || worker.username} - - - 账号:{worker.username} - - - 手机号:{worker.phone || '-'} - - - - - {formatWorkerStatus(worker.status)} - - - {worker.workerType === 'internal' ? '内部打手' : '外部打手'} - - {worker.level?.name || '未分级'} - - - - - - 我的邀请码: - - {worker.inviteCode || '-'} -
+
+ + {!canUseFinanceActions ? ( + + ) : null} + + {/* 资产卡片 */} +
+
+
+ 可用余额 + + {formatMoney(worker.wallet.availableAmount)} + +
+
+ + +
+
+ +
+
+ 冻结押金 + + {formatMoney(worker.wallet.frozenDepositAmount)} + +
+
+ 待解冻押金 + + {formatMoney(worker.wallet.pendingUnfreezeAmount)} + +
+
+ 累计结算 + + {formatMoney(worker.wallet.totalSettledAmount)} + +
+
+
+ + {/* 快捷操作宫格 */} +
+ + + - - {levelProgress && levelProgress.nextThreshold !== null ? ( - - - 已累计完成 {summary?.acceptedOrderCount || 0} 单, - 距下一等级还需 {Math.max(0, levelProgress.nextThreshold - (summary?.acceptedOrderCount || 0))} 单 - - `${percent}%`} - /> - - ) : ( - - 已累计完成 {summary?.acceptedOrderCount || 0} 单,当前已是最高等级 - - )} - - +
+ +
+ 邀请好友 + + +
- -
-
- 可用余额 - - {formatMoney(worker.wallet.availableAmount)} - - 可用于抢单冻结或提现申请 -
-
- 冻结押金 - - {formatMoney(worker.wallet.frozenDepositAmount)} - - 抢单后冻结,验收后进入待解冻 -
-
- 待解冻押金 - - {formatMoney(worker.wallet.pendingUnfreezeAmount)} - - 验收后按配置天数解冻到账 -
-
- 累计结算 - - {formatMoney(worker.wallet.totalSettledAmount)} - - 已结算入账的报酬合计 -
-
-
+ {/* 记录与明细分段滑动页 */} +
+
+ + + +
- - - - - - - - - - - - - {worker.username} - - {worker.displayName || '-'} - - - {worker.phone || '-'} - - - - {formatWorkerStatus(worker.status)} - - - - {worker.level?.name || '-'} - - - - {worker.inviteCode || '-'} - {worker.inviteCode ? ( - + + } + > + + rowKey="ledgerId" + size="small" + loading={ledgersQuery.isLoading} + dataSource={ledgersQuery.data?.data.items || []} + columns={ledgerColumns} + locale={{ + emptyText: ledgersQuery.error + ? ledgersQuery.error instanceof Error + ? ledgersQuery.error.message + : '读取资金流水失败' + : '暂无钱包流水', + }} + pagination={{ + current: ledgersQuery.data?.data.pagination.page || ledgerPage, + pageSize: ledgersQuery.data?.data.pagination.pageSize || ledgerPageSize, + total: ledgersQuery.data?.data.pagination.total || 0, + showSizeChanger: true, + pageSizeOptions: [10, 20, 50], + showTotal: (total) => `共 ${total} 条`, + onChange: (nextPage, nextPageSize) => { + setLedgerPage(nextPage) + setLedgerPageSize(nextPageSize) + }, + }} + scroll={{ x: 980 }} + /> + + ), + }, + { + key: 'requests', + label: '申请记录', + children: ( + + { + setRequestStatus(nextStatus) + setRequestPage(1) + }} + /> + + + } + > + + rowKey="requestId" + size="small" + loading={requestsQuery.isLoading} + dataSource={requestsQuery.data?.data.items || []} + columns={requestColumns} + locale={{ + emptyText: requestsQuery.error + ? requestsQuery.error instanceof Error + ? requestsQuery.error.message + : '读取申请记录失败' + : '暂无申请记录', + }} + pagination={{ + current: requestsQuery.data?.data.pagination.page || requestPage, + pageSize: requestsQuery.data?.data.pagination.pageSize || requestPageSize, + total: requestsQuery.data?.data.pagination.total || 0, + showSizeChanger: true, + pageSizeOptions: [10, 20, 50], + showTotal: (total) => `共 ${total} 条`, + onChange: (nextPage, nextPageSize) => { + setRequestPage(nextPage) + setRequestPageSize(nextPageSize) + }, + }} + scroll={{ x: 980 }} + /> + + ), + }, + ]} + /> + + ) : null} +
+ )} - + ) } diff --git a/apps/frontend/src/styles/main.css b/apps/frontend/src/styles/main.css index 2bff8f91..2257a06b 100644 --- a/apps/frontend/src/styles/main.css +++ b/apps/frontend/src/styles/main.css @@ -3195,7 +3195,7 @@ body { .worker-profile-mobile-records { display: flex; flex-direction: column; - gap: 10px; + gap: 8px; width: 100%; } @@ -3203,10 +3203,10 @@ body { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px; - padding: 12px; + padding: 10px 12px; display: flex; flex-direction: column; - gap: 6px; + gap: 4px; font-size: 12px; } @@ -3243,4 +3243,386 @@ body { margin-top: 2px; } +/* ========================================================================== + 移动端 个人中心 (Worker Profile Mobile Page) + ========================================================================== */ + +.worker-profile-mobile-page { + display: flex; + flex-direction: column; + gap: 10px; + width: 100%; + box-sizing: border-box; +} + +/* 顶部沉浸式个人卡片(明亮温润风格) */ +.worker-profile-mobile-hero { + background: #ffffff; + border: 1px solid #e2e8f0; + border-radius: 14px; + padding: 14px; + color: #0f172a; + box-shadow: 0 1px 6px rgba(15, 23, 42, 0.04); + display: flex; + flex-direction: column; + gap: 10px; +} + +.worker-profile-mobile-user-row { + display: flex; + align-items: center; + gap: 12px; + position: relative; +} + +.worker-profile-mobile-avatar { + background: linear-gradient(135deg, #ff8c00, #ea580c); + color: #ffffff; + font-weight: 700; + font-size: 20px; + box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25); + flex-shrink: 0; +} + +.worker-profile-mobile-user-info { + display: flex; + flex-direction: column; + gap: 3px; + min-width: 0; + flex: 1; +} + +.worker-profile-mobile-name-row { + display: flex; + align-items: center; + gap: 6px; +} + +.worker-profile-mobile-name { + font-size: 17px; + font-weight: 700; + color: #0f172a; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.worker-profile-mobile-tags-row { + display: flex; + align-items: center; + gap: 4px; + flex-wrap: wrap; +} + +.worker-profile-mobile-vip-badge { + display: inline-flex; + align-items: center; + padding: 1px 6px; + background: linear-gradient(135deg, #fef08a, #facc15); + color: #854d0e; + border-radius: 4px; + font-size: 10px; + font-weight: 700; + line-height: 14px; +} + +.worker-profile-mobile-tag { + margin: 0; + font-size: 10px; + padding: 0 4px; + line-height: 16px; +} + +.worker-profile-mobile-account-text { + font-size: 11px; + color: #64748b; +} + +.worker-profile-mobile-refresh-btn { + color: #64748b; + background: #f1f5f9; + border: none; + width: 28px; + height: 28px; + display: grid; + place-items: center; + flex-shrink: 0; +} + +.worker-profile-mobile-refresh-btn:hover, +.worker-profile-mobile-refresh-btn:focus { + color: var(--theme-primary); + background: #e2e8f0; +} + +.worker-profile-mobile-hero-bottom { + border-top: 1px solid #f1f5f9; + padding-top: 8px; + display: flex; + flex-direction: column; + gap: 6px; +} + +.worker-profile-mobile-invite-bar { + display: flex; + align-items: center; + gap: 6px; + font-size: 12px; + background: #fff7ed; + border: 1px solid #ffedd5; + border-radius: 6px; + padding: 4px 8px; +} + +.worker-profile-mobile-invite-label { + color: #9a3412; + font-size: 11px; +} + +.worker-profile-mobile-invite-code { + color: #ea580c; + letter-spacing: 0.5px; + font-weight: 700; + font-size: 13px; +} + +.worker-profile-mobile-copy-btn { + border: 1px solid #fdba74; + background: #ffffff; + color: #ea580c; + border-radius: 4px; + padding: 1px 6px; + font-size: 11px; + cursor: pointer; + display: inline-flex; + align-items: center; + gap: 2px; + margin-left: auto; +} + +.worker-profile-mobile-level-box { + display: flex; + flex-direction: column; + gap: 2px; +} + +.worker-profile-mobile-level-text { + font-size: 11px; + color: #64748b; +} + +/* 资产钱包卡片 */ +.worker-profile-mobile-wallet-card { + background: #ffffff; + border: 1px solid #e2e8f0; + border-radius: 14px; + padding: 14px; + box-shadow: 0 1px 6px rgba(15, 23, 42, 0.04); + display: flex; + flex-direction: column; + gap: 12px; +} + +.worker-profile-mobile-wallet-top { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; +} + +.worker-profile-mobile-wallet-main { + display: flex; + flex-direction: column; + gap: 2px; +} + +.worker-profile-mobile-wallet-title { + font-size: 11px; + color: #64748b; +} + +.worker-profile-mobile-wallet-amount { + font-size: 24px; + font-weight: 800; + color: #ea580c; + line-height: 1; +} + +.worker-profile-mobile-wallet-actions { + display: flex; + align-items: center; + gap: 8px; +} + +.worker-profile-mobile-recharge-btn { + font-weight: 600; +} + +.worker-profile-mobile-withdraw-btn { + font-weight: 600; +} + +.worker-profile-mobile-wallet-grid { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + gap: 4px; + border-top: 1px solid #f1f5f9; + padding-top: 10px; + text-align: center; +} + +.worker-profile-mobile-wallet-col { + display: flex; + flex-direction: column; + gap: 2px; + padding: 0 4px; +} + +.worker-profile-mobile-wallet-col + .worker-profile-mobile-wallet-col { + border-left: 1px solid #f1f5f9; +} + +.worker-profile-mobile-sub-label { + font-size: 11px; + color: #64748b; +} + +.worker-profile-mobile-sub-val { + font-size: 14px; + font-weight: 700; + color: #1e293b; +} + +/* 快捷操作宫格 */ +.worker-profile-mobile-tools-card { + background: #ffffff; + border: 1px solid #e2e8f0; + border-radius: 14px; + padding: 12px 8px; + box-shadow: 0 1px 6px rgba(15, 23, 42, 0.04); + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 4px; +} + +.worker-profile-mobile-tool-item { + border: none; + background: transparent; + display: flex; + flex-direction: column; + align-items: center; + gap: 6px; + cursor: pointer; + padding: 6px 2px; + border-radius: 8px; + transition: background 0.15s ease; + -webkit-tap-highlight-color: transparent; +} + +.worker-profile-mobile-tool-item:active { + background: #f8fafc; + transform: scale(0.96); +} + +.worker-profile-mobile-tool-icon { + width: 38px; + height: 38px; + border-radius: 10px; + display: grid; + place-items: center; + font-size: 18px; +} + +.worker-profile-mobile-tool-item span { + font-size: 11px; + color: #334155; + font-weight: 500; + white-space: nowrap; +} + +/* 记录与明细分段滑动卡片 */ +.worker-profile-mobile-sections-card { + background: #ffffff; + border: 1px solid #e2e8f0; + border-radius: 14px; + box-shadow: 0 1px 6px rgba(15, 23, 42, 0.04); + overflow: hidden; + display: flex; + flex-direction: column; +} + +.worker-profile-mobile-tab-nav { + display: flex; + border-bottom: 1px solid #e2e8f0; + background: #f8fafc; +} + +.worker-profile-mobile-tab-btn { + flex: 1; + border: none; + background: transparent; + padding: 10px 0; + font-size: 13px; + font-weight: 500; + color: #64748b; + cursor: pointer; + position: relative; + transition: all 0.15s ease; +} + +.worker-profile-mobile-tab-btn.active { + color: var(--theme-primary); + font-weight: 700; + background: #ffffff; +} + +.worker-profile-mobile-tab-btn.active::after { + content: ''; + position: absolute; + bottom: 0; + left: 20%; + right: 20%; + height: 2px; + background: var(--theme-primary); + border-radius: 2px; +} + +.worker-profile-mobile-tab-body { + padding: 12px; +} + +.worker-profile-mobile-filter-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + margin-bottom: 10px; +} + +/* 账号详情列表 */ +.worker-profile-mobile-account-list { + display: flex; + flex-direction: column; + gap: 8px; +} + +.worker-profile-mobile-account-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 6px 0; + border-bottom: 1px solid #f1f5f9; + font-size: 12px; +} + +.worker-profile-mobile-acc-label { + color: #64748b; +} + +.worker-profile-mobile-acc-val { + color: #0f172a; + font-weight: 500; +} + +