2026-05-18 09:46:11 +08:00
|
|
|
/**
|
|
|
|
|
* Front-end API wrapper for this module.
|
|
|
|
|
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
|
|
|
|
|
*/
|
2026-02-27 16:44:41 +08:00
|
|
|
import api from './index'
|
2026-03-27 14:55:41 +08:00
|
|
|
import type { IdType } from '@/utils/id'
|
2026-02-27 16:44:41 +08:00
|
|
|
|
2026-03-19 14:10:59 +08:00
|
|
|
interface OrderItem {
|
2026-03-27 14:55:41 +08:00
|
|
|
productId: IdType
|
2026-03-19 14:10:59 +08:00
|
|
|
quantity: number
|
2026-03-27 14:55:41 +08:00
|
|
|
artistId?: IdType
|
2026-03-19 20:19:41 +08:00
|
|
|
appointmentTime?: string
|
2026-03-19 14:10:59 +08:00
|
|
|
}
|
|
|
|
|
|
2026-02-27 16:44:41 +08:00
|
|
|
interface CreateOrderRequest {
|
2026-03-27 14:55:41 +08:00
|
|
|
couponId?: IdType
|
2026-03-20 12:24:56 +08:00
|
|
|
couponSourceType?: string
|
2026-03-19 14:10:59 +08:00
|
|
|
items: OrderItem[]
|
2026-02-27 16:44:41 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
export interface ArtistCalendarAppointment {
|
|
|
|
|
orderId: IdType
|
|
|
|
|
orderNo: string
|
|
|
|
|
totalAmount?: number
|
|
|
|
|
actualAmount?: number
|
|
|
|
|
orderStatus: number
|
|
|
|
|
orderStatusText: string
|
|
|
|
|
orderItemId: IdType
|
|
|
|
|
productId: IdType
|
|
|
|
|
productTitle: string
|
|
|
|
|
artistId: IdType
|
|
|
|
|
artistName?: string
|
|
|
|
|
customerNickname?: string
|
|
|
|
|
customerPhoneMasked?: string
|
|
|
|
|
shopId?: IdType
|
|
|
|
|
shopName?: string
|
|
|
|
|
appointmentStartTime: string
|
|
|
|
|
appointmentEndTime: string
|
|
|
|
|
quantity: number
|
|
|
|
|
durationMinutes: number
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-23 15:16:40 +08:00
|
|
|
export interface OrderArtistReviewVO {
|
|
|
|
|
id: IdType
|
|
|
|
|
orderId: IdType
|
|
|
|
|
orderItemId: IdType
|
|
|
|
|
productId?: IdType
|
|
|
|
|
productTitle?: string
|
|
|
|
|
artistId?: IdType
|
|
|
|
|
artistName?: string
|
|
|
|
|
artistAvatar?: string
|
|
|
|
|
userId?: IdType
|
|
|
|
|
rating?: number
|
|
|
|
|
content?: string
|
|
|
|
|
imageFileIds?: IdType[]
|
|
|
|
|
status?: number
|
|
|
|
|
statusText?: string
|
|
|
|
|
submitTime?: string
|
|
|
|
|
createTime?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface OrderArtistReviewSubmitRequest {
|
|
|
|
|
rating: number
|
|
|
|
|
content?: string
|
|
|
|
|
imageFileIds: IdType[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface OrderArtistChangeOptionsVO {
|
|
|
|
|
orderId: IdType
|
|
|
|
|
orderItemId: IdType
|
|
|
|
|
currentArtistId?: IdType
|
|
|
|
|
currentArtistName?: string
|
|
|
|
|
artists: Array<{
|
|
|
|
|
artistId: IdType
|
|
|
|
|
artistName: string
|
|
|
|
|
artistAvatar?: string
|
|
|
|
|
userType?: number
|
|
|
|
|
participateProduction?: boolean
|
|
|
|
|
}>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface OrderArtistChangeRequestVO {
|
|
|
|
|
id: IdType
|
|
|
|
|
orderId: IdType
|
|
|
|
|
orderItemId: IdType
|
|
|
|
|
productId?: IdType
|
|
|
|
|
productTitle?: string
|
|
|
|
|
shopId?: IdType
|
|
|
|
|
userId?: IdType
|
|
|
|
|
originalArtistId?: IdType
|
|
|
|
|
originalArtistName?: string
|
|
|
|
|
requestedArtistId?: IdType
|
|
|
|
|
requestedArtistName?: string
|
|
|
|
|
status?: string
|
|
|
|
|
statusText?: string
|
|
|
|
|
reason?: string
|
|
|
|
|
rejectReason?: string
|
|
|
|
|
reviewerId?: IdType
|
|
|
|
|
reviewTime?: string
|
|
|
|
|
createTime?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface OrderArtistChangeRequestSubmitRequest {
|
|
|
|
|
orderId: IdType
|
|
|
|
|
orderItemId: IdType
|
|
|
|
|
requestedArtistId: IdType
|
|
|
|
|
reason: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface OrderArtistChangeRejectRequest {
|
|
|
|
|
rejectReason?: string
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
/**
|
|
|
|
|
* orderApi groups all API calls for this page domain.
|
|
|
|
|
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
|
|
|
|
|
*/
|
2026-02-27 16:44:41 +08:00
|
|
|
export const orderApi = {
|
|
|
|
|
// 创建订单
|
2026-05-18 09:46:11 +08:00
|
|
|
/**
|
|
|
|
|
* `createOrder` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
|
|
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
|
|
|
|
* @param data: CreateOrderRequest caller-supplied value for `data: CreateOrderRequest`
|
|
|
|
|
*/
|
2026-02-27 16:44:41 +08:00
|
|
|
createOrder: (data: CreateOrderRequest) => {
|
|
|
|
|
return api.post('/order/create', data)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 获取订单列表
|
2026-03-26 10:28:28 +08:00
|
|
|
getOrderList: async (): Promise<any[]> => {
|
|
|
|
|
return await api.get<any[]>('/order/list') as unknown as any[]
|
2026-02-27 16:44:41 +08:00
|
|
|
},
|
2026-05-23 15:16:40 +08:00
|
|
|
|
|
|
|
|
getMyPendingReviews: async (): Promise<OrderArtistReviewVO[]> => {
|
|
|
|
|
return await api.get<OrderArtistReviewVO[]>('/order/review/my-pending') as unknown as OrderArtistReviewVO[]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getOrderReviews: async (orderId: IdType): Promise<OrderArtistReviewVO[]> => {
|
|
|
|
|
return await api.get<OrderArtistReviewVO[]>(`/order/${orderId}/reviews`) as unknown as OrderArtistReviewVO[]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
submitArtistReview: async (reviewId: IdType, data: OrderArtistReviewSubmitRequest): Promise<OrderArtistReviewVO> => {
|
|
|
|
|
return await api.post<OrderArtistReviewVO>(`/order/review/${reviewId}/submit`, data) as unknown as OrderArtistReviewVO
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getArtistChangeOptions: async (orderId: IdType, orderItemId: IdType): Promise<OrderArtistChangeOptionsVO> => {
|
|
|
|
|
return await api.get<OrderArtistChangeOptionsVO>(`/order/${orderId}/artist-change/options`, {
|
|
|
|
|
params: { orderItemId }
|
|
|
|
|
}) as unknown as OrderArtistChangeOptionsVO
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
requestArtistChange: async (data: OrderArtistChangeRequestSubmitRequest): Promise<OrderArtistChangeRequestVO> => {
|
|
|
|
|
return await api.post<OrderArtistChangeRequestVO>('/order/artist-change/request', data) as unknown as OrderArtistChangeRequestVO
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getMyPendingArtistChangeRequests: async (): Promise<OrderArtistChangeRequestVO[]> => {
|
|
|
|
|
return await api.get<OrderArtistChangeRequestVO[]>('/order/artist-change/my-pending') as unknown as OrderArtistChangeRequestVO[]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
approveArtistChange: async (requestId: IdType): Promise<OrderArtistChangeRequestVO> => {
|
|
|
|
|
return await api.put<OrderArtistChangeRequestVO>(`/order/artist-change/${requestId}/approve`) as unknown as OrderArtistChangeRequestVO
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
rejectArtistChange: async (requestId: IdType, data?: OrderArtistChangeRejectRequest): Promise<OrderArtistChangeRequestVO> => {
|
|
|
|
|
return await api.put<OrderArtistChangeRequestVO>(`/order/artist-change/${requestId}/reject`, data || {}) as unknown as OrderArtistChangeRequestVO
|
|
|
|
|
},
|
2026-02-27 16:44:41 +08:00
|
|
|
|
|
|
|
|
// 获取订单详情
|
2026-05-18 09:46:11 +08:00
|
|
|
/**
|
|
|
|
|
* `getOrderDetail` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
|
|
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
|
|
|
|
* @param orderId: IdType caller-supplied value for `orderId: IdType`
|
|
|
|
|
*/
|
2026-03-27 14:55:41 +08:00
|
|
|
getOrderDetail: (orderId: IdType) => {
|
2026-02-27 16:44:41 +08:00
|
|
|
return api.get(`/order/detail/${orderId}`)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 取消订单
|
2026-05-18 09:46:11 +08:00
|
|
|
/**
|
|
|
|
|
* `cancelOrder` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
|
|
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
|
|
|
|
* @param orderId: IdType caller-supplied value for `orderId: IdType`
|
|
|
|
|
*/
|
2026-03-27 14:55:41 +08:00
|
|
|
cancelOrder: (orderId: IdType) => {
|
2026-02-27 16:44:41 +08:00
|
|
|
return api.put(`/order/cancel/${orderId}`)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 后台获取所有订单
|
2026-05-18 09:46:11 +08:00
|
|
|
/**
|
|
|
|
|
* `getAllOrders` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
|
|
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
|
|
|
|
*/
|
2026-02-27 16:44:41 +08:00
|
|
|
getAllOrders: () => {
|
|
|
|
|
return api.get('/order/admin/list')
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 后台处理订单
|
2026-05-18 09:46:11 +08:00
|
|
|
/**
|
|
|
|
|
* `processOrder` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
|
|
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
|
|
|
|
* @param orderId: IdType caller-supplied value for `orderId: IdType`
|
|
|
|
|
* @param status: number caller-supplied value for `status: number`
|
|
|
|
|
*/
|
2026-03-27 14:55:41 +08:00
|
|
|
processOrder: (orderId: IdType, status: number) => {
|
2026-02-27 16:44:41 +08:00
|
|
|
return api.put(`/order/admin/process/${orderId}`, {}, {
|
|
|
|
|
params: { status }
|
|
|
|
|
})
|
2026-03-19 14:10:59 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 美甲师查看自己的订单
|
2026-05-18 09:46:11 +08:00
|
|
|
/**
|
|
|
|
|
* `getArtistOrders` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
|
|
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
|
|
|
|
*/
|
2026-03-19 14:10:59 +08:00
|
|
|
getArtistOrders: () => {
|
|
|
|
|
return api.get('/order/artist/list')
|
2026-03-19 20:19:41 +08:00
|
|
|
},
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
// 预约日历:recent 取未来 7 天概览,day 传 yyyy-MM-dd 查某天明细。
|
|
|
|
|
/**
|
|
|
|
|
* `completeArtistOrder` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
|
|
|
|
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
|
|
|
|
* @param orderId: IdType caller-supplied value for `orderId: IdType`
|
|
|
|
|
*/
|
2026-03-27 14:55:41 +08:00
|
|
|
completeArtistOrder: (orderId: IdType) => {
|
2026-03-19 20:19:41 +08:00
|
|
|
return api.put(`/order/artist/complete/${orderId}`)
|
2026-05-18 09:46:11 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getArtistCalendarRecent: async (days = 7): Promise<ArtistCalendarAppointment[]> => {
|
|
|
|
|
return await api.get<ArtistCalendarAppointment[]>('/order/artist/calendar/recent', {
|
|
|
|
|
params: { days }
|
|
|
|
|
}) as unknown as ArtistCalendarAppointment[]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getArtistCalendarDay: async (date: string): Promise<ArtistCalendarAppointment[]> => {
|
|
|
|
|
return await api.get<ArtistCalendarAppointment[]>('/order/artist/calendar/day', {
|
|
|
|
|
params: { date }
|
|
|
|
|
}) as unknown as ArtistCalendarAppointment[]
|
2026-02-27 16:44:41 +08:00
|
|
|
}
|
|
|
|
|
}
|