feat(platform): 套餐页线索表单样式收敛(input 类)+ 线索提交测试
This commit is contained in:
@@ -97,6 +97,14 @@ body{
|
|||||||
color:#fff;
|
color:#fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input{
|
||||||
|
padding:8px 10px;
|
||||||
|
border:1px solid var(--border);
|
||||||
|
border-radius:8px;
|
||||||
|
width:100%;
|
||||||
|
box-sizing:border-box;
|
||||||
|
}
|
||||||
|
|
||||||
.badge{
|
.badge{
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
@@ -106,6 +114,26 @@ body{
|
|||||||
color:#374151;
|
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{
|
.price{
|
||||||
margin-top:10px;
|
margin-top:10px;
|
||||||
font-size:22px;
|
font-size:22px;
|
||||||
|
|||||||
@@ -19,6 +19,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="grid-3">
|
||||||
@forelse($plans as $p)
|
@forelse($plans as $p)
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@@ -39,13 +54,13 @@
|
|||||||
|
|
||||||
<div class="muted">开通意向(A:站点开通型,前期先由运营人工开通)</div>
|
<div class="muted">开通意向(A:站点开通型,前期先由运营人工开通)</div>
|
||||||
<div class="mt-8">
|
<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>
|
||||||
<div class="mt-8">
|
<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>
|
||||||
<div class="mt-8">
|
<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>
|
||||||
<div class="mt-8">
|
<div class="mt-8">
|
||||||
<button type="submit" class="btn btn-primary">提交开通意向</button>
|
<button type="submit" class="btn btn-primary">提交开通意向</button>
|
||||||
|
|||||||
54
tests/Feature/FrontPlatformLeadStoreTest.php
Normal file
54
tests/Feature/FrontPlatformLeadStoreTest.php
Normal 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']);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user