feat(payment): 可再次申请售后按工单状态判定(rejected/cancelled 可再次申请)
This commit is contained in:
@@ -286,16 +286,25 @@ class UserOrders {
|
||||
&& \AKSRT\Settings\PaymentRuntime::after_sale_expired($paid_at);
|
||||
$has_application = $latest !== null;
|
||||
|
||||
// 可再次申请售后的状态判定(按工单状态推理,不再以「不能再申请」为常态):
|
||||
// - pending / processing / approved:工单仍在流转(待审核 / 处理中 / 已通过待退款),不允许重复申请;
|
||||
// - rejected:审核未通过,允许补充资料后再次申请;
|
||||
// - cancelled:用户自行取消,允许重新发起;
|
||||
// - completed:退款已完成,工单终结,不允许再次申请。
|
||||
$reapplyable_statuses = [AfterSaleService::STATUS_REJECTED, AfterSaleService::STATUS_CANCELLED];
|
||||
$latest_status = (string) ($latest['status'] ?? '');
|
||||
|
||||
return [
|
||||
'enabled' => $enabled,
|
||||
'expired' => (bool) $expired,
|
||||
'has_application' => $has_application,
|
||||
'open' => $open,
|
||||
'can_apply' => $enabled && !$expired && !$open,
|
||||
'can_reapply' => $enabled && !$expired && !$open && $has_application,
|
||||
'can_reapply' => $enabled && !$expired && $has_application && in_array($latest_status, $reapplyable_statuses, true),
|
||||
'latest' => $has_application ? [
|
||||
'status' => (string) ($latest['status'] ?? ''),
|
||||
'reason' => (string) ($latest['reason'] ?? ''),
|
||||
'apply_form' => is_array($latest['apply_form'] ?? null) ? $latest['apply_form'] : null,
|
||||
'images' => array_values((array) ($latest['images'] ?? [])),
|
||||
'refund_amount' => (string) ($latest['refund_amount'] ?? '0'),
|
||||
'created_at' => (string) ($latest['created_at'] ?? ''),
|
||||
|
||||
Reference in New Issue
Block a user