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-05-23 18:44:57 +08:00
/**
* Purpose: OrderItem supports order.ts by holding or executing the order item page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 21:56:18 +08:00
export 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-05-23 18:44:57 +08:00
/**
* Purpose: CreateOrderRequest supports order.ts by holding or executing the create order request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 21:56:18 +08:00
export interface CreateOrderRequest {
2026-03-27 14:55:41 +08:00
couponId? : IdType
2026-03-20 12:24:56 +08:00
couponSourceType? : string
2026-06-04 16:39:06 +08:00
remark? : string
2026-06-10 00:19:49 +08:00
clientRequestId? : string
2026-03-19 14:10:59 +08:00
items : OrderItem []
2026-02-27 16:44:41 +08:00
}
2026-05-23 21:56:18 +08:00
export type CheckoutPreviewRequest = CreateOrderRequest
export interface CheckoutCouponPreview {
id : IdType
couponId? : IdType
userCouponId? : IdType
sourceType? : string
couponName : string
couponType : number
couponTypeName? : string
discountValue? : number
minAmount? : number
reduceAmount? : number
discountAmount? : number
available? : boolean
best? : boolean
vipAuto? : boolean
displayText? : string
savingText? : string
unavailableReason? : string
startTime? : string
endTime? : string
}
2026-06-04 16:39:06 +08:00
export interface CheckoutIssue {
code : string
message : string
itemId? : IdType
productId? : IdType
productTitle? : string
}
2026-05-23 21:56:18 +08:00
export interface CheckoutPreview {
subtotalAmount : number
savedAmount : number
payableAmount : number
bestCoupon? : CheckoutCouponPreview
availableCoupons : CheckoutCouponPreview []
unavailableCoupons : CheckoutCouponPreview []
2026-06-04 16:39:06 +08:00
bookingAvailable? : boolean
bookingIssues? : CheckoutIssue []
2026-05-23 21:56:18 +08:00
vipTip? : string
summaryText? : string
}
2026-05-24 18:09:11 +08:00
export interface PaymentOrderVO {
id : IdType
payNo? : string
orderId : IdType
orderNo? : string
userId? : IdType
shopId? : IdType
channel? : string
status? : string
payAmount? : number
paidAmount? : number
payTime? : string
expireTime? : string
remark? : string
}
2026-06-04 16:39:06 +08:00
export interface OrderQuoteItem {
orderItemId : IdType
quotedPrice? : number
}
export interface OrderQuoteSubmitRequest {
remark? : string
items : OrderQuoteItem []
}
export interface OrderQuoteReplyRequest {
remark? : string
}
export interface OrderQuoteMessage {
id : IdType
orderId : IdType
actorId? : IdType
actorType? : string
actorTypeText? : string
action? : string
actionText? : string
remark? : string
items? : any []
createTime? : string
}
2026-05-24 18:09:11 +08:00
export interface AfterSaleApplyRequest {
orderId : IdType
orderItemId? : IdType
type : string
reason : string
refundAmount? : number
}
export interface AfterSaleVO {
id : IdType
afterSaleNo? : string
orderId : IdType
orderItemId? : IdType
userId? : IdType
shopId? : IdType
type ?: string
reason? : string
refundAmount? : number
status? : string
auditReason? : string
auditTime? : string
createTime? : string
}
export interface PageResult < T > {
list : T []
total : number
page : number
size : number
}
export interface GrowthSummaryVO {
userId? : IdType
growthValue? : number
levelName? : string
appointmentCount? : number
reviewCount? : number
}
export const paymentApi = {
prepareOrderPayment : async ( orderId : IdType ) : Promise < PaymentOrderVO > => {
return await api . post < PaymentOrderVO >( `/payment/order/ ${ orderId } /prepare` ) as unknown as PaymentOrderVO
},
mockSuccess : async ( orderId : IdType ) : Promise < PaymentOrderVO > => {
return await api . post < PaymentOrderVO >( `/payment/order/ ${ orderId } /mock-success` ) as unknown as PaymentOrderVO
}
}
export const afterSaleApi = {
apply : async ( data : AfterSaleApplyRequest ) : Promise < AfterSaleVO > => {
return await api . post < AfterSaleVO >( '/after-sale/apply' , data ) as unknown as AfterSaleVO
},
listMy : async ( params : { page : number ; size : number }) : Promise < PageResult < AfterSaleVO >> => {
return await api . get < PageResult < AfterSaleVO >>( '/after-sale/my' , { params }) as unknown as PageResult < AfterSaleVO >
}
}
export const growthApi = {
getSummary : async () : Promise < GrowthSummaryVO > => {
return await api . get < GrowthSummaryVO >( '/growth/summary' ) as unknown as GrowthSummaryVO
}
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: OrderArtistReviewVO supports order.ts by holding or executing the order artist review vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
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
2026-05-23 21:56:18 +08:00
reviewTime? : string
2026-05-23 15:16:40 +08:00
createTime? : string
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: OrderArtistReviewSubmitRequest supports order.ts by holding or executing the order artist review submit request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
export interface OrderArtistReviewSubmitRequest {
rating : number
content? : string
imageFileIds : IdType []
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: OrderArtistChangeOptionsVO supports order.ts by holding or executing the order artist change options vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
export interface OrderArtistChangeOptionsVO {
orderId : IdType
orderItemId : IdType
currentArtistId? : IdType
currentArtistName? : string
artists : Array < {
artistId : IdType
artistName : string
artistAvatar? : string
userType? : number
participateProduction? : boolean
} >
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: OrderArtistChangeRequestVO supports order.ts by holding or executing the order artist change request vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
export interface OrderArtistChangeRequestVO {
id : IdType
orderId : IdType
orderItemId : IdType
productId? : IdType
productTitle? : string
shopId? : IdType
userId? : IdType
2026-05-23 21:56:18 +08:00
customerId? : IdType
2026-05-23 15:16:40 +08:00
originalArtistId? : IdType
originalArtistName? : string
requestedArtistId? : IdType
requestedArtistName? : string
2026-05-23 21:56:18 +08:00
fromArtistId? : IdType
fromArtistName? : string
toArtistId? : IdType
toArtistName? : string
requesterId? : IdType
requesterName? : string
2026-05-23 15:16:40 +08:00
status? : string
statusText? : string
reason? : string
rejectReason? : string
2026-05-23 21:56:18 +08:00
appointmentTime? : string
timeAffected? : boolean
timeImpactText? : string
originalPrice? : number | string
newPrice? : number | string
priceAffected? : boolean
priceImpactText? : string
2026-05-23 15:16:40 +08:00
reviewerId? : IdType
2026-05-23 21:56:18 +08:00
messageId? : IdType
2026-05-23 15:16:40 +08:00
reviewTime? : string
2026-05-23 21:56:18 +08:00
approvedTime? : string
rejectedTime? : string
expireTime? : string
2026-05-23 15:16:40 +08:00
createTime? : string
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: OrderArtistChangeRequestSubmitRequest supports order.ts by holding or executing the order artist change request submit request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
export interface OrderArtistChangeRequestSubmitRequest {
orderId : IdType
orderItemId : IdType
requestedArtistId : IdType
reason : string
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: OrderArtistChangeRejectRequest supports order.ts by holding or executing the order artist change reject request page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
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-05-23 21:56:18 +08:00
2026-06-04 16:39:06 +08:00
createInquiryAppointment : ( data : CreateOrderRequest ) => {
return api . post ( '/order/create' , data )
},
2026-05-23 21:56:18 +08:00
checkoutPreview : async ( data : CheckoutPreviewRequest ) : Promise < CheckoutPreview > => {
return await api . post < CheckoutPreview >( '/order/checkout-preview' , data ) as unknown as CheckoutPreview
},
2026-06-04 16:39:06 +08:00
replyQuote : async ( orderId : IdType , data? : OrderQuoteReplyRequest ) : Promise < any > => {
return await api . post ( `/order/ ${ orderId } /quote/reply` , data || {}) as unknown as any
},
confirmUserQuote : async ( orderId : IdType ) : Promise < any > => {
return await api . put ( `/order/ ${ orderId } /quote/confirm` ) as unknown as any
},
submitShopQuote : async ( orderId : IdType , data : OrderQuoteSubmitRequest ) : Promise < any > => {
return await api . post ( `/order/ ${ orderId } /quote/shop` , data ) as unknown as any
},
confirmShopQuote : async ( orderId : IdType ) : Promise < any > => {
return await api . put ( `/order/ ${ orderId } /quote/shop/confirm` ) as unknown as any
},
2026-02-27 16:44:41 +08:00
// 获取订单列表
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 []
},
2026-05-23 21:56:18 +08:00
getOrderArtistChangeRequests : async ( orderId : IdType ) : Promise < OrderArtistChangeRequestVO [] > => {
return await api . get < OrderArtistChangeRequestVO [] >( `/order/ ${ orderId } /artist-change/requests` ) as unknown as OrderArtistChangeRequestVO []
},
2026-05-23 15:16:40 +08:00
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 } ` )
},
}