chore(admin-ui): dedupe platform orders create entry and keep prefill context
This commit is contained in:
@@ -51,6 +51,31 @@
|
||||
'lead_id' => null,
|
||||
'page' => null,
|
||||
], $safeBackForLinks);
|
||||
|
||||
// 新建平台订单:统一入口(页面顶部),并尽量预填当前筛选上下文,提高运营下单效率
|
||||
// - 默认携带 back 回到本页自身(剔除 back query,避免嵌套)
|
||||
// - 若当前列表已筛选站点/套餐/订阅ID/线索ID,则预填到创建页,维持闭环追溯
|
||||
$createQuery = ['back' => $selfWithoutBack];
|
||||
if (trim((string) ($filters['merchant_id'] ?? '')) !== '') {
|
||||
$createQuery['merchant_id'] = (int) ($filters['merchant_id'] ?? 0);
|
||||
}
|
||||
if (trim((string) ($filters['plan_id'] ?? '')) !== '') {
|
||||
$createQuery['plan_id'] = (int) ($filters['plan_id'] ?? 0);
|
||||
}
|
||||
if (trim((string) ($filters['site_subscription_id'] ?? '')) !== '') {
|
||||
$createQuery['site_subscription_id'] = (int) ($filters['site_subscription_id'] ?? 0);
|
||||
// 治理口径:当从订阅维度锁定进入时:
|
||||
// 1) 显式声明 require_subscription=1(统一来源口径/便于排查链路来源)
|
||||
// 2) 显式声明 order_type=renewal(语义更清晰;create 页仍会二次强制兜底)
|
||||
$createQuery['require_subscription'] = '1';
|
||||
$createQuery['order_type'] = 'renewal';
|
||||
}
|
||||
// 线索联动:若当前列表已按 lead_id 锁定,则新建订单也应带上 lead_id,维持闭环追溯
|
||||
if (trim((string) ($filters['lead_id'] ?? '')) !== '') {
|
||||
$createQuery['lead_id'] = (int) ($filters['lead_id'] ?? 0);
|
||||
}
|
||||
|
||||
$createOrderUrl = '/admin/platform-orders/create?' . \Illuminate\Support\Arr::query($createQuery);
|
||||
@endphp
|
||||
<div class="page-header mb-20" data-page="admin.platform_orders.index">
|
||||
<div class="page-header-main">
|
||||
@@ -64,9 +89,6 @@
|
||||
<a href="{!! $safeBackForLinks !!}" class="btn btn-secondary btn-sm">返回上一页(保留上下文)</a>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$createOrderUrl = \App\Support\BackUrl::withBack('/admin/platform-orders/create', $selfWithoutBack);
|
||||
@endphp
|
||||
<a class="btn btn-sm" href="{!! $createOrderUrl !!}">新建平台订单</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1075,31 +1097,7 @@
|
||||
<div>
|
||||
<h3 class="list-card-title">平台订单列表</h3>
|
||||
</div>
|
||||
@php
|
||||
// 新建平台订单:默认携带 back 回到本页自身(剔除 back query,避免嵌套)
|
||||
// 同时:若当前列表已筛选站点/套餐/订阅ID,则预填到创建页,提高运营下单效率
|
||||
$createQuery = ['back' => $selfWithoutBack];
|
||||
if (trim((string) ($filters['merchant_id'] ?? '')) !== '') {
|
||||
$createQuery['merchant_id'] = (int) ($filters['merchant_id'] ?? 0);
|
||||
}
|
||||
if (trim((string) ($filters['plan_id'] ?? '')) !== '') {
|
||||
$createQuery['plan_id'] = (int) ($filters['plan_id'] ?? 0);
|
||||
}
|
||||
if (trim((string) ($filters['site_subscription_id'] ?? '')) !== '') {
|
||||
$createQuery['site_subscription_id'] = (int) ($filters['site_subscription_id'] ?? 0);
|
||||
// 治理口径:当从订阅维度锁定进入时:
|
||||
// 1) 显式声明 require_subscription=1(统一来源口径/便于排查链路来源)
|
||||
// 2) 显式声明 order_type=renewal(语义更清晰;create 页仍会二次强制兜底)
|
||||
$createQuery['require_subscription'] = '1';
|
||||
$createQuery['order_type'] = 'renewal';
|
||||
}
|
||||
// 线索联动:若当前列表已按 lead_id 锁定,则新建订单也应带上 lead_id,维持闭环追溯
|
||||
if (trim((string) ($filters['lead_id'] ?? '')) !== '') {
|
||||
$createQuery['lead_id'] = (int) ($filters['lead_id'] ?? 0);
|
||||
}
|
||||
|
||||
$createOrderUrl = '/admin/platform-orders/create?' . \Illuminate\Support\Arr::query($createQuery);
|
||||
@endphp
|
||||
{{-- 新建平台订单链接已在页面顶部统一生成($createOrderUrl),避免口径漂移与重复入口 --}}
|
||||
@php
|
||||
$toggleViewUrl = $isFullView
|
||||
? $safeFullUrlWithQuery(['view' => null, 'page' => null])
|
||||
@@ -1108,7 +1106,6 @@
|
||||
@endphp
|
||||
<div class="actions gap-10">
|
||||
<a class="btn btn-secondary btn-sm" href="{!! $toggleViewUrl !!}">{{ $toggleViewLabel }}</a>
|
||||
<a href="{!! $createOrderUrl !!}" class="btn btn-sm">新建平台订单</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-card-body">
|
||||
|
||||
Reference in New Issue
Block a user