feat(platform): 套餐页线索表单样式收敛(input 类)+ 线索提交测试

This commit is contained in:
萝卜
2026-03-14 02:33:44 +00:00
parent 249ffb3aba
commit e58b92a1f2
3 changed files with 100 additions and 3 deletions

View File

@@ -97,6 +97,14 @@ body{
color:#fff;
}
.input{
padding:8px 10px;
border:1px solid var(--border);
border-radius:8px;
width:100%;
box-sizing:border-box;
}
.badge{
display:inline-block;
font-size:12px;
@@ -106,6 +114,26 @@ body{
color:#374151;
}
.flash{
margin-top:16px;
padding:10px 12px;
border-radius:10px;
border:1px solid #bbf7d0;
background:#f0fdf4;
color:#14532d;
font-size:14px;
}
.error-box{
margin-top:16px;
padding:10px 12px;
border-radius:10px;
border:1px solid #fecaca;
background:#fef2f2;
color:#7f1d1d;
font-size:14px;
}
.price{
margin-top:10px;
font-size:22px;

View File

@@ -19,6 +19,21 @@
</div>
</div>
@if(session('success'))
<div class="flash">{{ session('success') }}</div>
@endif
@if($errors->any())
<div class="error-box">
<strong>提交失败:</strong>
<ul>
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="grid-3">
@forelse($plans as $p)
<div class="card">
@@ -39,13 +54,13 @@
<div class="muted">开通意向A站点开通型前期先由运营人工开通</div>
<div class="mt-8">
<input name="name" placeholder="你的姓名" required style="padding:8px 10px; border:1px solid #e5e7eb; border-radius:8px; width:100%; box-sizing:border-box;">
<input class="input" name="name" placeholder="你的姓名" value="{{ old('name') }}" required>
</div>
<div class="mt-8">
<input name="mobile" placeholder="手机号(可选)" style="padding:8px 10px; border:1px solid #e5e7eb; border-radius:8px; width:100%; box-sizing:border-box;">
<input class="input" name="mobile" placeholder="手机号(可选)" value="{{ old('mobile') }}">
</div>
<div class="mt-8">
<input name="company" placeholder="公司/团队(可选)" style="padding:8px 10px; border:1px solid #e5e7eb; border-radius:8px; width:100%; box-sizing:border-box;">
<input class="input" name="company" placeholder="公司/团队(可选)" value="{{ old('company') }}">
</div>
<div class="mt-8">
<button type="submit" class="btn btn-primary">提交开通意向</button>

View File

@@ -0,0 +1,54 @@
<?php
namespace Tests\Feature;
use App\Models\Plan;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class FrontPlatformLeadStoreTest extends TestCase
{
use RefreshDatabase;
public function test_can_submit_platform_lead_and_persist(): void
{
$plan = Plan::query()->create([
'code' => 'front_lead_plan_01',
'name' => '线索测试套餐',
'billing_cycle' => 'monthly',
'price' => 10,
'list_price' => 10,
'status' => 'active',
'sort' => 10,
'published_at' => now(),
]);
$res = $this->post('/platform/leads', [
'name' => '张三',
'mobile' => '13800000000',
'plan_id' => $plan->id,
'source' => 'platform_plans',
'note' => '想先试用一下',
]);
$res->assertRedirect('/platform/plans');
$this->assertDatabaseHas('platform_leads', [
'name' => '张三',
'mobile' => '13800000000',
'plan_id' => $plan->id,
'source' => 'platform_plans',
'status' => 'new',
]);
}
public function test_submit_platform_lead_should_validate_required_name(): void
{
$res = $this->post('/platform/leads', [
'name' => '',
]);
$res->assertStatus(302);
$res->assertSessionHasErrors(['name']);
}
}