import { useState } from 'react' import PageContainer from '../../components/PageContainer' import PageHeader from '../../components/PageHeader' import './ProjectQuotes.css' const ALL_INSURERS = [ { id: 'pacific', name: '太平洋' }, { id: 'taiping', name: '太平' }, { id: 'dadi', name: '大地' }, { id: 'pingan', name: '平安' }, { id: 'huatai', name: '华泰财' }, { id: 'yatai', name: '亚太' }, ] type QuoteItem = { insurer: string premium?: string coverage?: string note?: string status: 'pending' | 'received' } type FormData = { projectCode: string projectTitle: string sponsor: string projectPhase: string } const initialForm: FormData = { projectCode: '', projectTitle: '', sponsor: '', projectPhase: '', } function ProjectQuotes() { const [fillMode, setFillMode] = useState<'manual' | 'upload'>('manual') const [formData, setFormData] = useState(initialForm) const [uploading, setUploading] = useState(false) const [aiQuote, setAiQuote] = useState(null) const [generatingQuote, setGeneratingQuote] = useState(false) const [preciseSent, setPreciseSent] = useState(false) const [sendingPrecise, setSendingPrecise] = useState(false) const [quotes, setQuotes] = useState([]) const [preciseReceived, setPreciseReceived] = useState(false) const canGenerateQuote = formData.projectCode.trim() && formData.projectTitle.trim() && formData.sponsor.trim() && formData.projectPhase.trim() const handleUploadChange = async (e: React.ChangeEvent) => { const file = e.target.files?.[0] if (!file) return setUploading(true) await new Promise((r) => setTimeout(r, 1200)) setFormData({ projectCode: 'CT-2025-' + Math.floor(1000 + Math.random() * 9000), projectTitle: file.name.replace(/\.[^.]+$/, '') || '临床试验方案', sponsor: '示例申办者', projectPhase: 'I期', }) setUploading(false) } const handleGenerateQuote = async () => { if (!canGenerateQuote) return setGeneratingQuote(true) await new Promise((r) => setTimeout(r, 1500)) setAiQuote( `基于当前项目信息(${formData.projectTitle},${formData.projectPhase})的预估报价:\n` + '· 建议每人保额:80–120 万\n· 每次事故限额:400–600 万\n· 预估年保费区间:约 1.1 万–1.4 万元\n(实际以各保司精准报价为准)' ) setGeneratingQuote(false) } const handleGetPreciseQuote = async () => { if (!aiQuote) return setSendingPrecise(true) setPreciseSent(true) setQuotes(ALL_INSURERS.map(({ name }) => ({ insurer: name, status: 'pending' as const }))) setSendingPrecise(false) // Mock: 保司回复后展示 const mockQuotes: QuoteItem[] = [ { insurer: '太平洋', premium: '¥12,800/年', coverage: '每人保额 100 万,每次事故 500 万', note: '3 个工作日内出单', status: 'received' }, { insurer: '太平', premium: '¥11,500/年', coverage: '每人保额 80 万,每次事故 400 万', note: '支持医疗直付', status: 'received' }, { insurer: '大地', premium: '¥13,200/年', coverage: '每人保额 100 万,每次事故 600 万', note: '含 SUSAR/SAE 专项', status: 'received' }, { insurer: '平安', premium: '¥14,000/年', coverage: '每人保额 120 万,每次事故 800 万', note: '全国网点理赔', status: 'received' }, { insurer: '华泰财', premium: '¥12,000/年', coverage: '每人保额 100 万,每次事故 500 万', note: '与经纪服务联动', status: 'received' }, { insurer: '亚太', premium: '¥11,800/年', coverage: '每人保额 80 万,每次事故 400 万', note: '5 个工作日报价', status: 'received' }, ] setTimeout(() => { setQuotes(mockQuotes) setPreciseReceived(true) }, 2000) } const startNewInquiry = () => { setFormData(initialForm) setAiQuote(null) setPreciseSent(false) setQuotes([]) setPreciseReceived(false) } return (

1. 报价需提交的资料

{fillMode === 'upload' && (
{uploading &&

AI 识别中…

}
)}
setFormData((d) => ({ ...d, projectCode: e.target.value }))} placeHolder="如:CT-2025-001" />
setFormData((d) => ({ ...d, projectTitle: e.target.value }))} placeHolder="试验方案标题" />
setFormData((d) => ({ ...d, sponsor: e.target.value }))} placeHolder="申办者名称" />
setFormData((d) => ({ ...d, projectPhase: e.target.value }))} placeHolder="如:I期、II期、III期" />

2. 生成报价

由 AI 基于上述资料自动生成预估报价。

{aiQuote && (
{aiQuote}
)}

3. 获取精准报价

系统将报价资料整合后以 Email 发送至各保司,保司回复至 rmo@vdano.com,经临研安审核后在此展示。

{(preciseSent || preciseReceived) && ( )}
{preciseSent && (

已向各保司发送询价邮件,保司将回复至 rmo@vdano.com,审核通过后展示如下。

)} {quotes.length > 0 && (
{quotes.map((q) => (

{q.insurer}

{q.status === 'pending' ? (

等待保司报价回复…

) : ( <> {q.premium &&

{q.premium}

} {q.coverage &&

{q.coverage}

} {q.note &&

{q.note}

} )}
))}
)}
) } export default ProjectQuotes