feat(ux): after-sale multi-step, ban appeal, message types, coupon wallet
Orders center gains after-sale tickets (return ship/cancel/timeline), coupon wallet list, ban-appeal page, and expanded message center tabs.
This commit is contained in:
1 parent
3a883bc3d0
commit
1337664ed3
15 files changed
+999
-37
No files matched your search
@@ -49,6 +49,55 @@ trait Part1 {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* List after-sale tickets for current user.
|
||||
*/
|
||||
public function get_user_after_sales(int $user_id): array {
|
||||
if ($user_id <= 0 || !class_exists('\AKSRT\Payment\AfterSale')) {
|
||||
return ['items' => []];
|
||||
}
|
||||
$items = \AKSRT\Payment\AfterSale::get_instance()->get_user_tickets($user_id, 50);
|
||||
return ['items' => $items];
|
||||
}
|
||||
|
||||
/**
|
||||
* User submits return shipping info.
|
||||
*/
|
||||
public function submit_after_sale_return(int $user_id, int $ticket_id, array $payload): array {
|
||||
if ($user_id <= 0 || $ticket_id <= 0 || !class_exists('\AKSRT\Payment\AfterSale')) {
|
||||
return ['success' => false, 'message' => __('售后系统不可用。', 'aksrt')];
|
||||
}
|
||||
$carrier = sanitize_text_field((string) ($payload['carrier'] ?? ''));
|
||||
$tracking = sanitize_text_field((string) ($payload['tracking_no'] ?? ''));
|
||||
if ($carrier === '' || $tracking === '') {
|
||||
return ['success' => false, 'message' => __('请填写快递公司与运单号。', 'aksrt')];
|
||||
}
|
||||
$ok = \AKSRT\Payment\AfterSale::get_instance()->user_submit_return_shipping($ticket_id, $user_id, $carrier, $tracking);
|
||||
if (!$ok) {
|
||||
return ['success' => false, 'message' => __('提交退货物流失败,请确认工单状态。', 'aksrt')];
|
||||
}
|
||||
$ticket = \AKSRT\Payment\AfterSale::get_instance()->get($ticket_id);
|
||||
return [
|
||||
'success' => true,
|
||||
'message' => __('退货物流已提交', 'aksrt'),
|
||||
'data' => $ticket ? \AKSRT\Payment\AfterSale::get_instance()->decorate_user_ticket($ticket) : ['id' => $ticket_id],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* User cancels after-sale ticket.
|
||||
*/
|
||||
public function cancel_after_sale(int $user_id, int $ticket_id, string $reason = ''): array {
|
||||
if ($user_id <= 0 || $ticket_id <= 0 || !class_exists('\AKSRT\Payment\AfterSale')) {
|
||||
return ['success' => false, 'message' => __('售后系统不可用。', 'aksrt')];
|
||||
}
|
||||
$ok = \AKSRT\Payment\AfterSale::get_instance()->user_cancel($ticket_id, $user_id, $reason);
|
||||
if (!$ok) {
|
||||
return ['success' => false, 'message' => __('无法取消该售后工单。', 'aksrt')];
|
||||
}
|
||||
return ['success' => true, 'message' => __('已取消售后申请', 'aksrt')];
|
||||
}
|
||||
|
||||
public function get_product_archive_view(array $args = []): array {
|
||||
$taxonomy = sanitize_key((string) ($args['taxonomy'] ?? ''));
|
||||
$term_id = (int) ($args['term_id'] ?? 0);
|
||||
|
||||
Reference in new issue
Block a user