feat(admin): 开通线索 PlatformLead 总台列表页(只读)
This commit is contained in:
52
app/Http/Controllers/Admin/PlatformLeadController.php
Normal file
52
app/Http/Controllers/Admin/PlatformLeadController.php
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Concerns\ResolvesPlatformAdminContext;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\PlatformLead;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class PlatformLeadController extends Controller
|
||||||
|
{
|
||||||
|
use ResolvesPlatformAdminContext;
|
||||||
|
|
||||||
|
public function index(Request $request): View
|
||||||
|
{
|
||||||
|
$this->ensurePlatformAdmin($request);
|
||||||
|
|
||||||
|
$filters = [
|
||||||
|
'status' => trim((string) $request->query('status', '')),
|
||||||
|
'keyword' => trim((string) $request->query('keyword', '')),
|
||||||
|
];
|
||||||
|
|
||||||
|
$query = PlatformLead::query();
|
||||||
|
|
||||||
|
$query->when($filters['status'] !== '', fn (Builder $b) => $b->where('status', $filters['status']));
|
||||||
|
$query->when($filters['keyword'] !== '', function (Builder $b) use ($filters) {
|
||||||
|
$kw = $filters['keyword'];
|
||||||
|
$b->where(function (Builder $q) use ($kw) {
|
||||||
|
$q->where('name', 'like', '%' . $kw . '%')
|
||||||
|
->orWhere('mobile', 'like', '%' . $kw . '%')
|
||||||
|
->orWhere('email', 'like', '%' . $kw . '%')
|
||||||
|
->orWhere('company', 'like', '%' . $kw . '%');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$leads = $query->latest('id')->paginate(15)->withQueryString();
|
||||||
|
|
||||||
|
return view('admin.platform_leads.index', [
|
||||||
|
'leads' => $leads,
|
||||||
|
'filters' => $filters,
|
||||||
|
'statusLabels' => [
|
||||||
|
'new' => '新线索',
|
||||||
|
'contacted' => '已联系',
|
||||||
|
'qualified' => '已确认需求',
|
||||||
|
'converted' => '已转化',
|
||||||
|
'closed' => '已关闭',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
71
resources/views/admin/platform_leads/index.blade.php
Normal file
71
resources/views/admin/platform_leads/index.blade.php
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
@extends('admin.layouts.app')
|
||||||
|
|
||||||
|
@section('title', '开通线索')
|
||||||
|
@section('page_title', '开通线索')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="card mb-20">
|
||||||
|
<p class="muted muted-tight">对外平台(/platform)收集的开通意向线索,用于前期 A(站点开通型)人工运营承接。</p>
|
||||||
|
<p class="muted">后续会在此处逐步接入:一键生成站点/订阅/平台订单、跟进记录、转化漏斗与治理提示。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card mb-20">
|
||||||
|
<h3>筛选</h3>
|
||||||
|
<form method="get" action="/admin/platform-leads" class="grid-3">
|
||||||
|
<select name="status">
|
||||||
|
<option value="">全部状态</option>
|
||||||
|
@foreach(($statusLabels ?? []) as $v => $label)
|
||||||
|
<option value="{{ $v }}" @selected(($filters['status'] ?? '') === $v)>{{ $label }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
<input name="keyword" placeholder="关键词:姓名/手机号/邮箱/公司" value="{{ $filters['keyword'] ?? '' }}">
|
||||||
|
<div>
|
||||||
|
<button type="submit">应用筛选</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h3>线索列表</h3>
|
||||||
|
<div class="muted mb-10">当前阶段仅提供查询与筛选;后续补“状态流转/转化为站点/生成订单”等操作闭环。</div>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th>姓名</th>
|
||||||
|
<th>手机号</th>
|
||||||
|
<th>邮箱</th>
|
||||||
|
<th>公司</th>
|
||||||
|
<th>套餐ID</th>
|
||||||
|
<th>来源</th>
|
||||||
|
<th>创建时间</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@forelse($leads as $l)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $l->id }}</td>
|
||||||
|
<td>{{ $statusLabels[$l->status] ?? $l->status }}</td>
|
||||||
|
<td>{{ $l->name }}</td>
|
||||||
|
<td>{{ $l->mobile }}</td>
|
||||||
|
<td>{{ $l->email }}</td>
|
||||||
|
<td>{{ $l->company }}</td>
|
||||||
|
<td>{{ $l->plan_id ?: '-' }}</td>
|
||||||
|
<td>{{ $l->source }}</td>
|
||||||
|
<td>{{ optional($l->created_at)->format('Y-m-d H:i:s') }}</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="9" class="muted">暂无线索</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="mt-10">
|
||||||
|
{{ $leads->links() }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@@ -148,6 +148,8 @@ Route::prefix('admin')->group(function () {
|
|||||||
Route::get('/settings/channels', [PlatformSettingController::class, 'channels']);
|
Route::get('/settings/channels', [PlatformSettingController::class, 'channels']);
|
||||||
Route::post('/settings/channels/{id}', [PlatformSettingController::class, 'updateChannel']);
|
Route::post('/settings/channels/{id}', [PlatformSettingController::class, 'updateChannel']);
|
||||||
Route::post('/settings/payments/{id}', [PlatformSettingController::class, 'updatePayment']);
|
Route::post('/settings/payments/{id}', [PlatformSettingController::class, 'updatePayment']);
|
||||||
|
|
||||||
|
Route::get('/platform-leads', [\App\Http\Controllers\Admin\PlatformLeadController::class, 'index']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user