Enhance: plans links to subscriptions/orders include back
This commit is contained in:
@@ -4,6 +4,28 @@
|
||||
@section('page_title', '套餐管理')
|
||||
|
||||
@section('content')
|
||||
@php
|
||||
// back 参数用于“返回上一页(保留上下文)”,但 back 本身不应再包含 back(避免无限嵌套导致 URL 膨胀)
|
||||
$currentQuery = request()->query();
|
||||
unset($currentQuery['back']);
|
||||
$selfWithoutBack = '/' . ltrim(request()->path(), '/');
|
||||
if (count($currentQuery) > 0) {
|
||||
$selfWithoutBack .= '?' . \Illuminate\Support\Arr::query($currentQuery);
|
||||
}
|
||||
|
||||
// 用于构建“从套餐页跳转到订阅/订单页后可返回套餐页”的链接
|
||||
$makeSubscriptionUrl = function (array $query) use ($selfWithoutBack) {
|
||||
$query = $query + ['back' => $selfWithoutBack];
|
||||
|
||||
return '/admin/site-subscriptions?' . \Illuminate\Support\Arr::query($query);
|
||||
};
|
||||
|
||||
$makePlatformOrderUrl = function (array $query) use ($selfWithoutBack) {
|
||||
$query = $query + ['back' => $selfWithoutBack];
|
||||
|
||||
return '/admin/platform-orders?' . \Illuminate\Support\Arr::query($query);
|
||||
};
|
||||
@endphp
|
||||
<div class="card mb-20">
|
||||
<p class="muted muted-tight">这里是总台视角的套餐目录页,用于沉淀平台可售卖的标准能力包。</p>
|
||||
<p class="muted">当前阶段先完成套餐主数据可见、可筛与口径收拢,后续再接授权项、售价规则与上下架动作。</p>
|
||||
@@ -125,7 +147,7 @@
|
||||
<td>
|
||||
@php $subCount = (int) ($plan->subscriptions_count ?? 0); @endphp
|
||||
@if($subCount > 0)
|
||||
<a class="link" href="/admin/site-subscriptions?plan_id={{ $plan->id }}">{{ $subCount }} 个</a>
|
||||
<a class="link" href="{!! $makeSubscriptionUrl(['plan_id' => $plan->id]) !!}">{{ $subCount }} 个</a>
|
||||
@else
|
||||
<span class="muted">0</span>
|
||||
@endif
|
||||
@@ -133,7 +155,7 @@
|
||||
<td>
|
||||
@php $orderCount = (int) ($plan->platform_orders_count ?? 0); @endphp
|
||||
@if($orderCount > 0)
|
||||
<a class="link" href="/admin/platform-orders?plan_id={{ $plan->id }}">{{ $orderCount }} 单</a>
|
||||
<a class="link" href="{!! $makePlatformOrderUrl(['plan_id' => $plan->id]) !!}">{{ $orderCount }} 单</a>
|
||||
@else
|
||||
<span class="muted">0</span>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user