feat(admin): 线索列表增加创建平台订单入口 + 护栏

This commit is contained in:
萝卜
2026-03-14 03:30:51 +00:00
parent e9fba11785
commit 23ff6d7d5d
2 changed files with 132 additions and 2 deletions

View File

@@ -4,6 +4,39 @@
@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);
}
// 从线索直达“创建平台订单”入口:预填 plan_id/remark并带 back 回到当前线索列表(保留筛选)
$buildCreatePlatformOrderUrl = function (\App\Models\PlatformLead $l) use ($selfWithoutBack) {
$remarkParts = array_filter([
'线索#' . $l->id,
$l->name,
$l->mobile,
$l->company,
$l->email,
], fn ($v) => (string) $v !== '');
$q = [
'order_type' => 'new_purchase',
'back' => $selfWithoutBack,
'remark' => mb_substr(implode(' / ', $remarkParts), 0, 180),
];
if ((int) $l->plan_id > 0) {
$q['plan_id'] = (int) $l->plan_id;
}
return '/admin/platform-orders/create?' . \Illuminate\Support\Arr::query($q);
};
@endphp
<div class="card mb-20">
<p class="muted muted-tight">对外平台(/platform收集的开通意向线索用于前期 A站点开通型人工运营承接。</p>
<p class="muted">后续会在此处逐步接入:一键生成站点/订阅/平台订单、跟进记录、转化漏斗与治理提示。</p>
@@ -27,7 +60,7 @@
<div class="card">
<h3>线索列表</h3>
<div class="muted mb-10">当前阶段仅提供查询与筛选;后续补“状态流转/转化为站点/生成订单”等操作闭环</div>
<div class="muted mb-10">当前阶段仅提供查询与筛选;已补“从线索创建订单”入口,先把收费闭环跑起来</div>
<table class="table">
<thead>
@@ -41,6 +74,7 @@
<th>套餐ID</th>
<th>来源</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@@ -55,10 +89,13 @@
<td>{{ $l->plan_id ?: '-' }}</td>
<td>{{ $l->source }}</td>
<td>{{ optional($l->created_at)->format('Y-m-d H:i:s') }}</td>
<td>
<a class="muted" href="{!! $buildCreatePlatformOrderUrl($l) !!}">创建订单</a>
</td>
</tr>
@empty
<tr>
<td colspan="9" class="muted">暂无线索</td>
<td colspan="10" class="muted">暂无线索</td>
</tr>
@endforelse
</tbody>