feat(order): complete 7.1 order full lifecycle state transitions, 15m/30m/48h auto-timeouts, expert reject/apply-complete, and partial refund arbitration
这个提交包含在:
@@ -242,9 +242,22 @@ export function formatOrderData(raw) {
|
||||
|
||||
let statusKey = raw.status || 'IN_SERVICE';
|
||||
if (statusKey === '待支付' || statusKey === '待付款') statusKey = 'PENDING_PAY';
|
||||
else if (statusKey === '已到场核销' || statusKey === '履约中' || statusKey === '服务中') statusKey = 'IN_SERVICE';
|
||||
else if (
|
||||
statusKey === '待接单' ||
|
||||
statusKey === '已接单' ||
|
||||
statusKey === '已到场核销' ||
|
||||
statusKey === '履约中' ||
|
||||
statusKey === '服务中' ||
|
||||
statusKey === '待确认'
|
||||
) statusKey = 'IN_SERVICE';
|
||||
else if (statusKey === '已完成') statusKey = 'COMPLETED';
|
||||
else if (statusKey === '争议仲裁中' || statusKey === '退款中' || statusKey === '已退款' || statusKey === '已全额退款') statusKey = 'REFUNDING';
|
||||
else if (
|
||||
statusKey === '争议仲裁中' ||
|
||||
statusKey === '退款中' ||
|
||||
statusKey === '已退款' ||
|
||||
statusKey === '已全额退款' ||
|
||||
statusKey === '已部分退款'
|
||||
) statusKey = 'REFUNDING';
|
||||
else if (statusKey === '已取消') statusKey = 'CANCELLED';
|
||||
|
||||
const companionAvatar = raw.expertAvatar || raw.expert_avatar || raw.avatar ||
|
||||
@@ -265,6 +278,7 @@ export function formatOrderData(raw) {
|
||||
serviceTitle: raw.serviceTitle || raw.service_title || `${game} · 专业陪伴服务`,
|
||||
quantity: Number(raw.durationHours || raw.duration_hours || raw.quantity || 2),
|
||||
totalAmount: Number(raw.amount || raw.totalAmount || 0),
|
||||
refundAmount: Number(raw.refundAmount || raw.refund_amount || 0),
|
||||
status: statusKey,
|
||||
rawStatus: raw.status || '履约中',
|
||||
meetVenue: raw.location || raw.meetVenue || '北京市公开商圈',
|
||||
@@ -332,7 +346,33 @@ export async function payOrder(orderId) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认验收订单
|
||||
* 大神拒单自动退款 (待接单 -> 已退款)
|
||||
*/
|
||||
export async function rejectOrder(orderId, payload = {}) {
|
||||
try {
|
||||
const res = await http.post(`/orders/${orderId}/reject`, payload);
|
||||
return formatOrderData(res);
|
||||
} catch (err) {
|
||||
console.warn('[API] 拒单接口网络异常:', err.message);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 大神点击申请完成服务 (服务中 -> 待确认)
|
||||
*/
|
||||
export async function applyCompleteOrder(orderId, payload = {}) {
|
||||
try {
|
||||
const res = await http.post(`/orders/${orderId}/apply-complete`, payload);
|
||||
return formatOrderData(res);
|
||||
} catch (err) {
|
||||
console.warn('[API] 申请完成服务网络异常:', err.message);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 买家确认验收订单 (待确认 -> 已完成)
|
||||
*/
|
||||
export async function completeOrder(orderId) {
|
||||
try {
|
||||
|
||||
在新工单中引用
屏蔽一个用户