增加前端格式检查配置
This commit is contained in:
@@ -159,7 +159,9 @@ export async function fetchOrders() {
|
||||
}
|
||||
|
||||
export async function fetchAdminOrders(page = 1, pageSize = 20) {
|
||||
const { data } = await apiClient.get<ApiResponse<{ items: Order[]; total: number; page: number; page_size: number }>>('/admin/orders', {
|
||||
const { data } = await apiClient.get<
|
||||
ApiResponse<{ items: Order[]; total: number; page: number; page_size: number }>
|
||||
>('/admin/orders', {
|
||||
params: { page, page_size: pageSize },
|
||||
})
|
||||
return data.data
|
||||
@@ -181,27 +183,39 @@ export async function cancelOrder(id: number) {
|
||||
}
|
||||
|
||||
export async function submitHandoff(id: number, content: string) {
|
||||
const { data } = await apiClient.post<ApiResponse<HandoffRecord>>(`/orders/${id}/handoff`, { content })
|
||||
const { data } = await apiClient.post<ApiResponse<HandoffRecord>>(`/orders/${id}/handoff`, {
|
||||
content,
|
||||
})
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function fetchHandoffRecords(id: string | number) {
|
||||
const { data } = await apiClient.get<ApiResponse<{ items: HandoffRecord[] }>>(`/orders/${id}/handoff-records`)
|
||||
const { data } = await apiClient.get<ApiResponse<{ items: HandoffRecord[] }>>(
|
||||
`/orders/${id}/handoff-records`
|
||||
)
|
||||
return data.data.items
|
||||
}
|
||||
|
||||
export async function fetchAdminHandoffRecords(id: string | number) {
|
||||
const { data } = await apiClient.get<ApiResponse<{ items: HandoffRecord[] }>>(`/admin/orders/${id}/handoff-records`)
|
||||
const { data } = await apiClient.get<ApiResponse<{ items: HandoffRecord[] }>>(
|
||||
`/admin/orders/${id}/handoff-records`
|
||||
)
|
||||
return data.data.items
|
||||
}
|
||||
|
||||
export async function adminCloseOrder(id: number, reason: string) {
|
||||
const { data } = await apiClient.post<ApiResponse<{ closed: boolean }>>(`/admin/orders/${id}/close`, { reason })
|
||||
const { data } = await apiClient.post<ApiResponse<{ closed: boolean }>>(
|
||||
`/admin/orders/${id}/close`,
|
||||
{ reason }
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function adminMarkOrderAbnormal(id: number, reason: string) {
|
||||
const { data } = await apiClient.post<ApiResponse<{ abnormal: boolean }>>(`/admin/orders/${id}/mark-abnormal`, { reason })
|
||||
const { data } = await apiClient.post<ApiResponse<{ abnormal: boolean }>>(
|
||||
`/admin/orders/${id}/mark-abnormal`,
|
||||
{ reason }
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
@@ -220,7 +234,9 @@ export async function adminRefundOrder(id: number) {
|
||||
}
|
||||
|
||||
export async function adminRefundStatus(id: number) {
|
||||
const { data } = await apiClient.get<ApiResponse<RefundStatus>>(`/admin/orders/${id}/refund-status`)
|
||||
const { data } = await apiClient.get<ApiResponse<RefundStatus>>(
|
||||
`/admin/orders/${id}/refund-status`
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
@@ -230,46 +246,67 @@ export interface StartOrderPaymentRequest {
|
||||
}
|
||||
|
||||
export async function startOrderPayment(orderId: number, req?: StartOrderPaymentRequest) {
|
||||
const { data } = await apiClient.post<ApiResponse<PaymentOrder>>(`/orders/${orderId}/start-payment`, req || {})
|
||||
const { data } = await apiClient.post<ApiResponse<PaymentOrder>>(
|
||||
`/orders/${orderId}/start-payment`,
|
||||
req || {}
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function queryOrderPayment(orderId: number) {
|
||||
const { data } = await apiClient.get<ApiResponse<PaymentOrder>>(`/orders/${orderId}/query-payment`)
|
||||
const { data } = await apiClient.get<ApiResponse<PaymentOrder>>(
|
||||
`/orders/${orderId}/query-payment`
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function confirmReceive(id: number) {
|
||||
const { data } = await apiClient.post<ApiResponse<{ received: boolean }>>(`/orders/${id}/confirm-receive`)
|
||||
const { data } = await apiClient.post<ApiResponse<{ received: boolean }>>(
|
||||
`/orders/${id}/confirm-receive`
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function submitReturn(id: number, content: string) {
|
||||
const { data } = await apiClient.post<ApiResponse<HandoffRecord>>(`/orders/${id}/return`, { content })
|
||||
const { data } = await apiClient.post<ApiResponse<HandoffRecord>>(`/orders/${id}/return`, {
|
||||
content,
|
||||
})
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function confirmReturn(id: number) {
|
||||
const { data } = await apiClient.post<ApiResponse<{ completed: boolean }>>(`/orders/${id}/confirm-return`)
|
||||
const { data } = await apiClient.post<ApiResponse<{ completed: boolean }>>(
|
||||
`/orders/${id}/confirm-return`
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function submitCheckout(id: number, payload: SubmitCheckoutPayload) {
|
||||
const { data } = await apiClient.post<ApiResponse<HandoffRecord>>(`/orders/${id}/checkout`, payload)
|
||||
const { data } = await apiClient.post<ApiResponse<HandoffRecord>>(
|
||||
`/orders/${id}/checkout`,
|
||||
payload
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function confirmCheckout(id: number) {
|
||||
const { data } = await apiClient.post<ApiResponse<{ completed: boolean }>>(`/orders/${id}/checkout/confirm`)
|
||||
const { data } = await apiClient.post<ApiResponse<{ completed: boolean }>>(
|
||||
`/orders/${id}/checkout/confirm`
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function counterCheckout(id: number, payload: CounterCheckoutPayload) {
|
||||
const { data } = await apiClient.post<ApiResponse<Checkout>>(`/orders/${id}/checkout/counter`, payload)
|
||||
const { data } = await apiClient.post<ApiResponse<Checkout>>(
|
||||
`/orders/${id}/checkout/counter`,
|
||||
payload
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function acceptCheckout(id: number) {
|
||||
const { data } = await apiClient.post<ApiResponse<{ completed: boolean }>>(`/orders/${id}/checkout/accept`)
|
||||
const { data } = await apiClient.post<ApiResponse<{ completed: boolean }>>(
|
||||
`/orders/${id}/checkout/accept`
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user