Files

187 lines
5.7 KiB
JavaScript

/**
* Mini program API wrapper for this module.
* Call guide: require this module in a page, then invoke the matching method from page event handlers or lifecycle hooks.
*/
const request = require('../utils/request')
module.exports = {
/**
* Purpose: createOrder supports order.js by holding or executing the create order page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
createOrder(data) {
return request({
url: '/order/create',
method: 'POST',
data
})
},
checkoutPreview(data) {
return request({
url: '/order/checkout-preview',
method: 'POST',
data
})
},
/**
* Purpose: getOrderList supports order.js by holding or executing the get order list page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
getOrderList() {
return request({
url: '/order/list'
})
},
getOrderDetail(orderId) {
return request({
url: `/order/detail/${orderId}`
})
},
/**
* Purpose: listMyPendingReviews supports order.js by holding or executing the list my pending reviews page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
listMyPendingReviews() {
return request({
url: '/order/review/my-pending'
})
},
/**
* Purpose: listOrderReviews supports order.js by holding or executing the list order reviews page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
listOrderReviews(orderId) {
return request({
url: `/order/${orderId}/reviews`
})
},
/**
* Purpose: listOrderArtistChangeRequests loads every change request attached to one order for timeline display.
* Usage: call it from the order page after loading the order list; callers may fall back to an empty list.
*/
listOrderArtistChangeRequests(orderId) {
return request({
url: `/order/${orderId}/artist-change/requests`
})
},
/**
* Purpose: submitArtistReview supports order.js by holding or executing the submit artist review page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
submitArtistReview(reviewId, data) {
return request({
url: `/order/review/${reviewId}/submit`,
method: 'POST',
data
})
},
/**
* Purpose: getArtistChangeOptions supports order.js by holding or executing the get artist change options page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
getArtistChangeOptions(orderId, orderItemId) {
return request({
url: `/order/${orderId}/artist-change/options`,
params: {
orderItemId
}
})
},
/**
* Purpose: requestArtistChange supports order.js by holding or executing the request artist change page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
requestArtistChange(data) {
return request({
url: '/order/artist-change/request',
method: 'POST',
data
})
},
/**
* Purpose: listMyPendingArtistChangeRequests supports order.js by holding or executing the list my pending artist change requests page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
listMyPendingArtistChangeRequests() {
return request({
url: '/order/artist-change/my-pending'
})
},
/**
* Purpose: approveArtistChange supports order.js by holding or executing the approve artist change page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
approveArtistChange(requestId) {
return request({
url: `/order/artist-change/${requestId}/approve`,
method: 'PUT',
data: {}
})
},
/**
* Purpose: rejectArtistChange supports order.js by holding or executing the reject artist change page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
rejectArtistChange(requestId, data) {
return request({
url: `/order/artist-change/${requestId}/reject`,
method: 'PUT',
data: data || {}
})
},
/**
* Purpose: cancelOrder supports order.js by holding or executing the cancel order page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
cancelOrder(orderId) {
return request({
url: `/order/cancel/${orderId}`,
method: 'PUT'
})
},
getArtistOrders() {
return request({
url: '/order/artist/list'
})
},
completeArtistOrder(orderId) {
return request({
url: `/order/artist/complete/${orderId}`,
method: 'PUT'
})
},
getArtistCalendarRecent(days) {
return request({
url: '/order/artist/calendar/recent',
params: {
days: days || 7
}
})
},
getArtistCalendarDay(date) {
return request({
url: '/order/artist/calendar/day',
params: {
date
}
})
}
}