feat(platform-orders): surface renew create CTA in header when subscription locked

This commit is contained in:
萝卜
2026-03-16 11:48:14 +08:00
parent d9e6ecec4a
commit 02bf14a8f4

View File

@@ -76,6 +76,27 @@
}
$createOrderUrl = '/admin/platform-orders/create?' . \Illuminate\Support\Arr::query($createQuery);
// 订阅锁定场景:提供更贴近 SOP 的“一键续费下单”(放在页面右上角主动作区,避免用户在页面中部寻找)
$currentSubscription = $currentSubscription ?? null;
$renewCreateUrl = '';
if ($currentSubscription && (int) ($currentSubscription->id ?? 0) > 0) {
$renewRemarkPrefix = (string) config('saasshop.platform_orders.renewal_order_remark_prefix', '来自订阅:');
$renewCreateQuery = [
'order_type' => 'renewal',
'site_subscription_id' => $currentSubscription->id,
'merchant_id' => $currentSubscription->merchant_id,
'plan_id' => $currentSubscription->plan_id,
'require_subscription' => '1',
'quantity' => 1,
'remark' => $renewRemarkPrefix . $currentSubscription->subscription_no,
'back' => $selfWithoutBack,
];
if (! (int) ($currentSubscription->plan_id ?? 0)) {
unset($renewCreateQuery['plan_id']);
}
$renewCreateUrl = '/admin/platform-orders/create?' . \Illuminate\Support\Arr::query($renewCreateQuery);
}
@endphp
<div class="page-header mb-20" data-page="admin.platform_orders.index">
<div class="page-header-main">
@@ -90,6 +111,9 @@
@endif
<a class="btn btn-sm" href="{!! $createOrderUrl !!}">新建平台订单</a>
@if($currentSubscription && $currentSubscription->id)
<a class="btn btn-secondary btn-sm" href="{!! $renewCreateUrl ?? '' !!}">为该订阅创建续费订单</a>
@endif
</div>
</div>
</div>