功能:完善门店能力与用户安全配置
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
import api from './index'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
@@ -14,8 +18,39 @@ interface CreateOrderRequest {
|
||||
items: OrderItem[]
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
export const orderApi = {
|
||||
// 创建订单
|
||||
/**
|
||||
* `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`
|
||||
*/
|
||||
createOrder: (data: CreateOrderRequest) => {
|
||||
return api.post('/order/create', data)
|
||||
},
|
||||
@@ -26,21 +61,41 @@ export const orderApi = {
|
||||
},
|
||||
|
||||
// 获取订单详情
|
||||
/**
|
||||
* `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`
|
||||
*/
|
||||
getOrderDetail: (orderId: IdType) => {
|
||||
return api.get(`/order/detail/${orderId}`)
|
||||
},
|
||||
|
||||
// 取消订单
|
||||
/**
|
||||
* `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`
|
||||
*/
|
||||
cancelOrder: (orderId: IdType) => {
|
||||
return api.put(`/order/cancel/${orderId}`)
|
||||
},
|
||||
|
||||
// 后台获取所有订单
|
||||
/**
|
||||
* `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.
|
||||
*/
|
||||
getAllOrders: () => {
|
||||
return api.get('/order/admin/list')
|
||||
},
|
||||
|
||||
// 后台处理订单
|
||||
/**
|
||||
* `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`
|
||||
*/
|
||||
processOrder: (orderId: IdType, status: number) => {
|
||||
return api.put(`/order/admin/process/${orderId}`, {}, {
|
||||
params: { status }
|
||||
@@ -48,11 +103,33 @@ export const orderApi = {
|
||||
},
|
||||
|
||||
// 美甲师查看自己的订单
|
||||
/**
|
||||
* `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.
|
||||
*/
|
||||
getArtistOrders: () => {
|
||||
return api.get('/order/artist/list')
|
||||
},
|
||||
|
||||
// 预约日历: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`
|
||||
*/
|
||||
completeArtistOrder: (orderId: IdType) => {
|
||||
return api.put(`/order/artist/complete/${orderId}`)
|
||||
},
|
||||
|
||||
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[]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user