feat(mobile): 接入商品详情下单确认与协议
This commit is contained in:
@@ -5,6 +5,8 @@ import type { ApiResponse } from '@/shared/api/types'
|
||||
import type {
|
||||
CounterCheckoutPayload,
|
||||
CreateDisputePayload,
|
||||
OrderAgreements,
|
||||
PostRentalNotice,
|
||||
SubmitCheckoutPayload,
|
||||
UserHandoffRecord,
|
||||
UserOrderDetail,
|
||||
@@ -54,6 +56,40 @@ export async function cancelMyOrder(id: number | string) {
|
||||
await apiClient.post(`/orders/${id}/cancel`)
|
||||
}
|
||||
|
||||
export async function createOrder(listingId: number | string) {
|
||||
return unwrapData<{ id: number }>(
|
||||
apiClient.post<ApiResponse<{ id: number }>>('/orders', { listing_id: Number(listingId) })
|
||||
)
|
||||
}
|
||||
|
||||
export function fetchOrderAgreements() {
|
||||
return unwrapData<OrderAgreements>(
|
||||
apiClient.get<ApiResponse<OrderAgreements>>('/order-agreements')
|
||||
)
|
||||
}
|
||||
|
||||
export function fetchPostRentalNotice() {
|
||||
return unwrapData<PostRentalNotice>(
|
||||
apiClient.get<ApiResponse<PostRentalNotice>>('/post-rental-notice')
|
||||
)
|
||||
}
|
||||
|
||||
export function useOrderAgreements() {
|
||||
return useQuery({
|
||||
queryKey: ['order-agreements'],
|
||||
queryFn: fetchOrderAgreements,
|
||||
staleTime: 5 * 60 * 1000,
|
||||
})
|
||||
}
|
||||
|
||||
export function usePostRentalNotice() {
|
||||
return useQuery({
|
||||
queryKey: ['post-rental-notice'],
|
||||
queryFn: fetchPostRentalNotice,
|
||||
staleTime: 5 * 60 * 1000,
|
||||
})
|
||||
}
|
||||
|
||||
export async function startOrderPayment(id: number | string, payWay: 'WXZF' | 'ZFBZF') {
|
||||
return unwrapData<UserPayment>(
|
||||
apiClient.post<ApiResponse<UserPayment>>(`/orders/${id}/start-payment`, {
|
||||
|
||||
Reference in New Issue
Block a user