完善接单平台上传与物品规则
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { apiGet, apiPost } from '@/lib/http'
|
||||
import type {
|
||||
CollectField,
|
||||
UploadedFile,
|
||||
WorkOrder,
|
||||
WorkerListResponse,
|
||||
WorkerLoginResponse,
|
||||
@@ -13,7 +14,10 @@ export function registerWorker(payload: {
|
||||
displayName?: string
|
||||
phone?: string
|
||||
}) {
|
||||
return apiPost<{ worker: WorkerUser; reviewRequired: boolean }>('/api/v1/worker/auth/register', payload)
|
||||
return apiPost<{ worker: WorkerUser; reviewRequired: boolean }>(
|
||||
'/api/v1/worker/auth/register',
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
export function loginWorker(payload: { username: string; password: string }) {
|
||||
@@ -21,7 +25,11 @@ export function loginWorker(payload: { username: string; password: string }) {
|
||||
}
|
||||
|
||||
export function fetchWorkerSession() {
|
||||
return apiGet<{ authenticated: boolean; expiresAt: string; worker: WorkerUser }>('/api/v1/worker/auth/session')
|
||||
return apiGet<{
|
||||
authenticated: boolean
|
||||
expiresAt: string
|
||||
worker: WorkerUser
|
||||
}>('/api/v1/worker/auth/session')
|
||||
}
|
||||
|
||||
export function logoutWorker() {
|
||||
@@ -29,15 +37,22 @@ export function logoutWorker() {
|
||||
}
|
||||
|
||||
export function fetchWorkerProfile() {
|
||||
return apiGet<{ worker: WorkerUser; permissions: Record<string, unknown> }>('/api/v1/worker/profile')
|
||||
return apiGet<{ worker: WorkerUser; permissions: Record<string, unknown> }>(
|
||||
'/api/v1/worker/profile',
|
||||
)
|
||||
}
|
||||
|
||||
export function fetchWorkerHallOrders(params?: Record<string, unknown>) {
|
||||
return apiGet<WorkerListResponse<WorkOrder>>('/api/v1/worker/hall/orders', params)
|
||||
return apiGet<WorkerListResponse<WorkOrder>>(
|
||||
'/api/v1/worker/hall/orders',
|
||||
params,
|
||||
)
|
||||
}
|
||||
|
||||
export function grabWorkerOrder(workOrderId: number) {
|
||||
return apiPost<{ order: WorkOrder }>(`/api/v1/worker/hall/orders/${workOrderId}/grab`)
|
||||
return apiPost<{ order: WorkOrder }>(
|
||||
`/api/v1/worker/hall/orders/${workOrderId}/grab`,
|
||||
)
|
||||
}
|
||||
|
||||
export function fetchWorkerMyOrders(params?: Record<string, unknown>) {
|
||||
@@ -46,14 +61,20 @@ export function fetchWorkerMyOrders(params?: Record<string, unknown>) {
|
||||
|
||||
export function submitWorkerAcceptance(
|
||||
workOrderId: number,
|
||||
payload: { note?: string; imageUrls?: string[] },
|
||||
payload: { note?: string; imageUrls?: string[]; files?: UploadedFile[] },
|
||||
) {
|
||||
return apiPost<{ order: WorkOrder }>(`/api/v1/worker/orders/${workOrderId}/submit-acceptance`, payload)
|
||||
return apiPost<{ order: WorkOrder }>(
|
||||
`/api/v1/worker/orders/${workOrderId}/submit-acceptance`,
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
export function lookupCollectOrder(orderNo: string) {
|
||||
return apiPost<{
|
||||
order: Pick<WorkOrder, 'workOrderNo' | 'platformOrderId' | 'productName' | 'status'>
|
||||
order: Pick<
|
||||
WorkOrder,
|
||||
'workOrderNo' | 'platformOrderId' | 'productName' | 'status'
|
||||
>
|
||||
fields: CollectField[]
|
||||
}>('/api/v1/collect/lookup', { orderNo })
|
||||
}
|
||||
@@ -62,5 +83,8 @@ export function submitCollectOrder(payload: {
|
||||
orderNo: string
|
||||
fields: Record<string, string>
|
||||
}) {
|
||||
return apiPost<{ complete: boolean; order: Record<string, unknown> }>('/api/v1/collect/submit', payload)
|
||||
return apiPost<{ complete: boolean; order: Record<string, unknown> }>(
|
||||
'/api/v1/collect/submit',
|
||||
payload,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user