完善个人中心资金功能

This commit is contained in:
yml2213
2026-07-28 10:41:46 +08:00
parent dca45afcc8
commit 2ab80c4df8
8 changed files with 1960 additions and 23 deletions
File diff suppressed because it is too large Load Diff
+50 -2
View File
@@ -3,9 +3,12 @@ import type {
CollectLookupResponse,
UploadedFile,
WorkOrder,
WorkerFinanceRequest,
WorkerListResponse,
WorkerLoginResponse,
WorkerProfileResponse,
WorkerUser,
WorkerWalletLedger,
} from '@/types/worker-platform'
export function registerWorker(payload: {
@@ -37,8 +40,53 @@ export function logoutWorker() {
}
export function fetchWorkerProfile() {
return apiGet<{ worker: WorkerUser; permissions: Record<string, unknown> }>(
'/api/v1/worker/profile',
return apiGet<WorkerProfileResponse>('/api/v1/worker/profile')
}
export function fetchWorkerWalletLedgers(params?: Record<string, unknown>) {
return apiGet<WorkerListResponse<WorkerWalletLedger>>(
'/api/v1/worker/profile/wallet-ledgers',
params,
)
}
export function fetchWorkerFinanceRequests(params?: Record<string, unknown>) {
return apiGet<WorkerListResponse<WorkerFinanceRequest>>(
'/api/v1/worker/profile/finance-requests',
params,
)
}
export function createWorkerRechargeRequest(payload: {
amount?: number
note?: string
}) {
return apiPost<{ request: WorkerFinanceRequest }>(
'/api/v1/worker/profile/recharge-requests',
payload,
)
}
export function createWorkerWithdrawRequest(payload: {
amount?: number
accountChannel?: string
accountName?: string
accountNo?: string
note?: string
}) {
return apiPost<{ request: WorkerFinanceRequest }>(
'/api/v1/worker/profile/withdraw-requests',
payload,
)
}
export function changeWorkerPassword(payload: {
currentPassword: string
newPassword: string
}) {
return apiPost<{ worker: WorkerUser; reloginRequired: boolean }>(
'/api/v1/worker/profile/change-password',
payload,
)
}
+223 -5
View File
@@ -1688,13 +1688,222 @@ select {
color: #f97316;
}
.worker-profile-card {
background: #c8b172;
.worker-profile-hero {
overflow: hidden;
border: 1px solid rgba(25, 94, 125, 0.14);
background:
radial-gradient(circle at top right, rgba(116, 227, 214, 0.18), transparent 30%),
linear-gradient(135deg, #14324a 0%, #1b5d73 55%, #237b77 100%);
}
.worker-profile-card .ant-statistic-title,
.worker-profile-card .ant-statistic-content {
color: #fff;
.worker-profile-hero .ant-card-body {
display: grid;
gap: 24px;
}
.worker-profile-hero-head {
display: flex;
justify-content: space-between;
gap: 24px;
align-items: flex-start;
}
.worker-profile-identity {
display: flex;
align-items: center;
gap: 16px;
min-width: 0;
}
.worker-profile-avatar {
width: 72px;
height: 72px;
border-radius: 22px;
display: grid;
place-items: center;
flex-shrink: 0;
background: rgba(255, 255, 255, 0.15);
border: 1px solid rgba(255, 255, 255, 0.24);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
color: #ffffff;
font-size: 28px;
font-weight: 700;
}
.worker-profile-identity-copy {
display: grid;
gap: 6px;
min-width: 0;
}
.worker-profile-identity-copy .ant-typography {
color: rgba(239, 248, 255, 0.88);
}
.worker-profile-identity-title {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
}
.worker-profile-identity-title .ant-typography {
margin: 0;
color: #ffffff;
}
.worker-profile-tag {
border-color: transparent;
background: rgba(255, 255, 255, 0.14);
color: #f8fafc;
}
.worker-profile-hero-side {
display: flex;
gap: 24px;
flex-wrap: wrap;
justify-content: flex-end;
}
.worker-profile-hero-side .ant-space {
padding: 10px 14px;
border-radius: 14px;
background: rgba(255, 255, 255, 0.1);
}
.worker-profile-hero-side .ant-typography {
color: rgba(239, 248, 255, 0.88);
}
.worker-profile-metrics {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 14px;
}
.worker-profile-metric {
display: grid;
gap: 6px;
padding: 16px 18px;
border-radius: 18px;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.worker-profile-metric-label,
.worker-profile-metric-note {
color: rgba(239, 248, 255, 0.75);
font-size: 12px;
}
.worker-profile-metric-value {
color: #ffffff;
font-size: 26px;
line-height: 1.2;
}
.worker-profile-actions {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 16px;
}
.worker-profile-action-card {
width: 100%;
padding: 18px;
border-radius: 18px;
border: 1px solid #e2e8f0;
background: #ffffff;
text-align: left;
display: grid;
gap: 10px;
cursor: pointer;
transition:
transform 0.18s ease,
box-shadow 0.18s ease,
border-color 0.18s ease;
box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}
.worker-profile-action-card:hover {
transform: translateY(-2px);
box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
}
.worker-profile-action-card:disabled {
cursor: not-allowed;
opacity: 0.58;
transform: none;
box-shadow: none;
}
.worker-profile-action-icon {
width: 48px;
height: 48px;
border-radius: 14px;
display: grid;
place-items: center;
font-size: 20px;
}
.worker-profile-action-title {
color: #0f172a;
font-size: 16px;
font-weight: 600;
}
.worker-profile-action-description {
color: #64748b;
font-size: 13px;
line-height: 1.6;
}
.worker-profile-action-card.is-blue .worker-profile-action-icon {
background: #dbeafe;
color: #2563eb;
}
.worker-profile-action-card.is-green .worker-profile-action-icon {
background: #dcfce7;
color: #16a34a;
}
.worker-profile-action-card.is-slate .worker-profile-action-icon {
background: #e2e8f0;
color: #334155;
}
.worker-profile-action-card.is-orange .worker-profile-action-icon {
background: #ffedd5;
color: #ea580c;
}
.worker-profile-action-card.is-violet .worker-profile-action-icon {
background: #ede9fe;
color: #7c3aed;
}
.worker-profile-action-card.is-amber .worker-profile-action-icon {
background: #fef3c7;
color: #d97706;
}
.worker-profile-action-card.is-rose .worker-profile-action-icon {
background: #ffe4e6;
color: #e11d48;
}
.worker-amount-positive {
color: #047857;
}
.worker-amount-negative {
color: #dc2626;
}
.worker-profile-help-text {
margin: 0;
color: #64748b;
}
.collect-order-input {
@@ -1752,4 +1961,13 @@ select {
.worker-order-grid {
grid-template-columns: 1fr;
}
.worker-profile-hero-head {
flex-direction: column;
}
.worker-profile-hero-side {
width: 100%;
justify-content: flex-start;
}
}
@@ -17,12 +17,56 @@ export type WorkerUser = {
wallet: {
availableAmount: number
frozenDepositAmount: number
totalCreditedAmount: number
totalSettledAmount: number
}
createdAt: string
updatedAt: string
reviewedAt: string | null
}
export type WorkerProfileSummary = {
acceptedOrderCount: number
pendingWithdrawAmount: number
approvedWithdrawAmount: number
pendingRechargeAmount: number
}
export type WorkerWalletLedger = {
ledgerId: number
ledgerType: string
amount: number
balanceAfter: number
frozenAfter: number
relatedWorkOrderId: number | null
auditStatus: string
note: string
payload: Record<string, unknown>
createdAt: string
}
export type WorkerFinanceRequest = {
requestId: number
requestType: string
status: string
amount: number
accountChannel: string
accountName: string
accountNo: string
note: string
reviewedNote: string
payload: Record<string, unknown>
createdAt: string
updatedAt: string
reviewedAt: string | null
}
export type WorkerProfileResponse = {
worker: WorkerUser
permissions: Record<string, unknown>
summary: WorkerProfileSummary
}
export type WorkerLevel = {
levelId: number
levelKey: string