This commit is contained in:
YI FANG
2025-11-26 09:50:49 +08:00
commit 8155c9f95d
43 changed files with 7687 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
import { BOOKING_DOCTORS } from '../../data/mockData';
import { Button, Input } from '../ui';
interface BookingModalProps {
doctor: (typeof BOOKING_DOCTORS)[number];
onClose: () => void;
}
export const BookingModal = ({ doctor, onClose }: BookingModalProps) => (
<div className='fixed inset-0 z-40 flex items-center justify-center bg-black/30'>
<div className='w-[520px] max-w-[95vw] bg-white rounded-3xl shadow-xl overflow-hidden text-sm'>
<div className='px-4 py-3 border-b flex items-center justify-between'>
<div className='font-semibold'> · {doctor.name}</div>
<button className='text-xs text-gray-500' onClick={onClose}>
</button>
</div>
<div className='px-4 py-4 bg-gray-50/60 space-y-3 text-xs text-gray-700'>
<div className='grid grid-cols-2 gap-3'>
<div>
<select className='mt-1 w-full rounded-2xl border px-3 py-1.5 bg-white outline-none text-xs'>
<option></option>
<option></option>
</select>
</div>
<div>
<Input placeholder='如:专家门诊咨询' className='mt-1' />
</div>
<div>
<select className='mt-1 w-full rounded-2xl border px-3 py-1.5 bg-white outline-none text-xs'>
<option></option>
<option></option>
</select>
</div>
<div>
<Input placeholder='例如2025-11-20 上午' className='mt-1' />
</div>
</div>
<div>
<textarea
className='w-full mt-1 rounded-2xl border px-3 py-2 text-xs outline-none focus:ring-2 focus:ring-gray-200 min-h-[72px]'
placeholder='可填写病情简要、既往史、特殊需求等信息'
/>
</div>
<div className='flex items-center justify-between text-[11px] text-gray-500'>
<span>
{doctor.name}{doctor.dept}
</span>
<Button></Button>
</div>
</div>
</div>
</div>
);

View File

@@ -0,0 +1,104 @@
import { BOOKING_DOCTORS } from '../../data/mockData';
import { Card, CardContent, CardHeader } from '../ui';
import { BookingModal } from './BookingModal';
import { cls } from '../../utils/cls';
interface BookingSectionProps {
selectedDay: number;
onSelectDay: (day: number) => void;
bookingDoctor: (typeof BOOKING_DOCTORS)[number] | null;
onSelectDoctor: (doctor: (typeof BOOKING_DOCTORS)[number]) => void;
onCloseModal: () => void;
}
export const BookingSection = ({
selectedDay,
onSelectDay,
bookingDoctor,
onSelectDoctor,
onCloseModal,
}: BookingSectionProps) => (
<div className='grid grid-cols-12 gap-6'>
<div className='col-span-4 space-y-4'>
<Card>
<CardHeader></CardHeader>
<CardContent>
<div className='grid grid-cols-6 gap-2 text-sm'>
{Array.from({ length: 30 }, (_, i) => i + 1).map((day) => (
<button
key={day}
onClick={() => onSelectDay(day)}
className={cls(
'h-9 rounded-2xl border flex items-center justify-center',
selectedDay === day ? 'bg-gray-900 text-white border-gray-900' : 'bg-white hover:bg-gray-50',
)}
>
{day}
</button>
))}
</div>
</CardContent>
</Card>
<Card>
<CardContent>
<div className='flex items-center justify-between text-sm'>
<span></span>
<span className='text-lg font-semibold'>{BOOKING_DOCTORS.length}</span>
</div>
</CardContent>
</Card>
</div>
<div className='col-span-8 space-y-4'>
<Card>
<CardHeader>
<span> · {selectedDay} </span>
<div className='flex items-center gap-2 text-xs'>
<span className='text-gray-500'></span>
<select className='border rounded-2xl px-3 py-1 bg-white outline-none text-xs'>
<option></option>
<option></option>
<option></option>
</select>
</div>
</CardHeader>
</Card>
<div className='grid grid-cols-2 gap-4'>
{BOOKING_DOCTORS.map((doctor) => {
const ratio = doctor.total ? (doctor.total - doctor.remain) / doctor.total : 0;
const percent = Math.round(Math.max(0, Math.min(1, ratio)) * 100);
return (
<button key={doctor.id} onClick={() => onSelectDoctor(doctor)} className='text-left w-full'>
<Card className='bg-gray-50/40'>
<CardContent>
<div className='flex items-start justify-between mb-3'>
<div>
<div className='font-semibold mb-1'>{doctor.name}</div>
<div className='text-xs text-gray-500'>{doctor.dept}</div>
</div>
<span className='px-3 py-1 rounded-2xl border text-xs text-gray-600 bg-white'>{doctor.period}</span>
</div>
<div className='text-xs text-gray-600 space-y-1 mb-2'>
<div>{doctor.total} </div>
<div>
<span className='font-semibold text-gray-900'>{doctor.remain}</span>
</div>
</div>
<div className='h-2 rounded-full bg-gray-200 overflow-hidden'>
<div className='h-full bg-gray-900' style={{ width: `${percent}%` }} />
</div>
</CardContent>
</Card>
</button>
);
})}
</div>
</div>
{bookingDoctor && <BookingModal doctor={bookingDoctor} onClose={onCloseModal} />}
</div>
);

View File

@@ -0,0 +1,375 @@
import { useState } from 'react';
import type { ExamClient, ExamModalTab } from '../../data/mockData';
import { Badge, Button } from '../ui';
interface ExamModalProps {
client: ExamClient;
tab: ExamModalTab;
onTabChange: (key: ExamModalTab) => void;
onClose: () => void;
}
export const ExamModal = ({ client, tab, onTabChange, onClose }: ExamModalProps) => {
const tabs: { key: ExamModalTab; label: string }[] = [
{ key: 'detail', label: '详情' },
{ key: 'sign', label: '签到' },
{ key: 'addon', label: '加项' },
{ key: 'print', label: '打印导检单' },
];
const signDone = client.signStatus === '已登记' || client.checkedItems.includes('签到');
const addonDone = (client.addonCount || 0) > 0;
const printDone = !!client.guidePrinted;
const tabDone: Record<ExamModalTab, boolean> = {
detail: false,
sign: signDone,
addon: addonDone,
print: printDone,
};
return (
<div className='fixed inset-0 z-40 flex items-center justify-center bg-black/30'>
<div className='w-[720px] max-w-[95vw] bg-white rounded-3xl shadow-xl overflow-hidden text-sm'>
<div className='px-4 py-3 border-b flex items-center justify-between'>
<div className='flex items-center gap-3'>
<span className='font-semibold'>{client.name}</span>
<span className='text-xs text-gray-500'>{client.id}</span>
<Badge>{client.level}</Badge>
</div>
<button className='text-xs text-gray-500' onClick={onClose}>
</button>
</div>
<div className='px-4 py-2 border-b flex items-center gap-2 text-xs'>
{tabs.map((t) => {
const isActive = tab === t.key;
const isDone = tabDone[t.key];
return (
<button
key={t.key}
onClick={() => onTabChange(t.key)}
className={`px-3 py-1 rounded-2xl border text-xs ${
isActive
? 'bg-gray-900 text-white border-gray-900'
: isDone
? 'bg-gray-100 text-gray-400 border-gray-200'
: 'bg-white text-gray-700'
}`}
>
{t.label}
{t.key === 'addon' && (client.addonCount || 0) > 0 && (
<span className='ml-1 text-[10px] opacity-80'>({client.addonCount})</span>
)}
{((t.key === 'sign' && signDone) || (t.key === 'print' && printDone)) && <span className='ml-1'></span>}
</button>
);
})}
</div>
<div className='px-4 py-4 bg-gray-50/60'>
{tab === 'detail' && <ExamDetailInfo client={client} />}
{tab === 'sign' && <ExamSignPanel />}
{tab === 'addon' && <ExamAddonPanel client={client} />}
{tab === 'print' && <ExamPrintPanel client={client} />}
</div>
</div>
</div>
);
};
const ExamSignPanel = () => (
<div className='grid grid-cols-2 gap-4 text-sm'>
<div className='p-4 rounded-2xl border bg-gray-50/60 flex flex-col gap-3'>
<div className='font-medium'></div>
<div className='text-xs text-gray-500'></div>
<div className='flex gap-2 text-xs'>
<Button className='py-1.5 px-3'></Button>
<Button className='py-1.5 px-3'></Button>
</div>
<div className='text-[11px] text-gray-400'></div>
</div>
<div className='p-4 rounded-2xl border bg-gray-50/60 flex flex-col gap-3'>
<div className='font-medium'></div>
<div className='text-xs text-gray-500'></div>
<div className='flex gap-2 text-xs text-gray-600'>
<Badge></Badge>
<Badge></Badge>
</div>
<Button className='py-1.5 px-3'></Button>
</div>
</div>
);
const ExamAddonPanel = ({ client }: { client: ExamClient }) => (
<div className='grid grid-cols-2 gap-6 text-sm'>
<div>
<div className='font-medium mb-2'></div>
<ul className='space-y-1 text-xs text-gray-600'>
{client.checkedItems.concat(client.pendingItems).map((item, idx) => (
<li key={idx} className='flex items-center justify-between'>
<span>{item}</span>
<span className='text-gray-400 text-[11px]'>{client.checkedItems.includes(item) ? '已检查' : '未检查'}</span>
</li>
))}
</ul>
</div>
<div>
<div className='font-medium mb-2'></div>
<div className='space-y-2 text-xs text-gray-600'>
{['肿瘤标志物筛查', '甲状腺彩超', '骨密度检测'].map((label) => (
<label key={label} className='flex items-center gap-2'>
<input type='checkbox' className='rounded' /> {label}
</label>
))}
</div>
<Button className='mt-3'></Button>
</div>
</div>
);
const ExamDetailInfo = ({ client }: { client: ExamClient }) => {
const [phone, setPhone] = useState((client['mobile' as keyof ExamClient] as string | undefined) || '137****9988');
const [marital, setMarital] = useState(
(client['maritalStatus' as keyof ExamClient] as string | undefined) || '未婚',
);
const [phoneEditing, setPhoneEditing] = useState(false);
const [maritalEditing, setMaritalEditing] = useState(false);
const customerChannel = client.customerType === '团客' ? '团体客户' : '散客客户';
const familyDoctor = (client['familyDoctor' as keyof ExamClient] as string | undefined) || '—';
const groupTag = client['groupTag' as keyof ExamClient] || (client.customerType === '团客' ? '团检' : '—');
const bookingTime = client['bookingTime' as keyof ExamClient] || '—';
const signTime = client['signTime' as keyof ExamClient] || '—';
const addonSummary = client['addonSummary' as keyof ExamClient] || '—';
return (
<div className='space-y-4 text-sm'>
<div className='flex items-center gap-4'>
<div className='w-14 h-14 rounded-full bg-gray-200 flex-shrink-0 overflow-hidden'>
<div className='w-full h-full rounded-full bg-gray-300 flex items-center justify-center text-[10px] text-gray-500'>
</div>
</div>
<div className='text-xs text-gray-500'></div>
</div>
<div className='space-y-2 text-xs text-gray-700'>
<div className='font-medium text-gray-900'></div>
<div className='grid grid-cols-2 gap-x-8 gap-y-1'>
<div>
<span className='text-gray-900'>{client.name}</span>
</div>
<div>
<span className='text-gray-900'>4401********1234</span>
</div>
<div className='flex items-center'>
<span></span>
{!phoneEditing ? (
<span className='text-gray-900 flex items-center'>
{phone}
<button className='ml-1 text-blue-500 text-[11px] hover:underline' onClick={() => setPhoneEditing(true)}>
</button>
</span>
) : (
<span className='flex items-center gap-1'>
<input
className='w-28 rounded-xl border px-2 py-0.5 text-[11px] outline-none'
value={phone}
onChange={(e) => setPhone(e.target.value)}
/>
<button className='px-2 py-0.5 rounded-xl border text-[11px]' onClick={() => setPhoneEditing(false)}>
</button>
</span>
)}
</div>
<div>
/
<span className='text-gray-900'>
{client.gender} / {client.age}
</span>
</div>
<div>
<span className='text-gray-900'>{client.level}</span>
</div>
<div>
<span className='text-gray-900'>{customerChannel}</span>
</div>
<div className='flex items-center'>
<span></span>
{!maritalEditing ? (
<span className='text-gray-900 flex items-center'>
{marital}
<button className='ml-1 text-blue-500 text-[11px] hover:underline' onClick={() => setMaritalEditing(true)}>
</button>
</span>
) : (
<span className='flex items-center gap-1'>
<input
className='w-20 rounded-xl border px-2 py-0.5 text-[11px] outline-none'
value={marital}
onChange={(e) => setMarital(e.target.value)}
/>
<button className='px-2 py-0.5 rounded-xl border text-[11px]' onClick={() => setMaritalEditing(false)}>
</button>
</span>
)}
</div>
<div>
<span className='text-gray-900'>{familyDoctor}</span>
</div>
<div>
<span className='text-gray-900'>{groupTag as string}</span>
</div>
</div>
</div>
<div className='space-y-2 text-xs text-gray-700'>
<div className='font-medium text-gray-900'></div>
<div className='grid grid-cols-2 gap-x-8 gap-y-1'>
<div>
<span className='text-gray-900'>{bookingTime as string}</span>
</div>
<div>
<span className='text-gray-900'>{signTime as string}</span>
</div>
<div>
<span className='text-gray-900'>{client.elapsed}</span>
</div>
<div className='col-span-2'>
<span className='text-gray-900'>{client.packageName}</span>
</div>
<div className='col-span-2'>
<span className='text-gray-900'>{addonSummary as string}</span>
</div>
</div>
</div>
<div className='grid grid-cols-2 gap-4 text-xs'>
<div className='p-3 rounded-2xl bg-green-50 border'>
<div className='font-medium mb-2'> {client.checkedItems.length} </div>
<div className='flex flex-wrap gap-2'>
{client.checkedItems.map((i) => (
<span key={i} className='px-2 py-0.5 rounded-full bg-white border text-[11px]'>
{i}
</span>
))}
</div>
</div>
<div className='p-3 rounded-2xl bg-red-50 border'>
<div className='font-medium mb-2'> 0 </div>
<div className='flex flex-wrap gap-2'>
<span className='text-gray-400 text-[11px]'></span>
</div>
</div>
<div className='p-3 rounded-2xl bg-yellow-50 border'>
<div className='font-medium mb-2'> {client.pendingItems.length} </div>
<div className='flex flex-wrap gap-2'>
{client.pendingItems.map((i) => (
<span key={i} className='px-2 py-0.5 rounded-full bg-white border text-[11px]'>
{i}
</span>
))}
</div>
</div>
<div className='p-3 rounded-2xl bg-blue-50 border'>
<div className='font-medium mb-2'> 0 </div>
<div className='flex flex-wrap gap-2'>
<span className='text-gray-400 text-[11px]'></span>
</div>
</div>
</div>
</div>
);
};
const ExamPrintPanel = ({ client }: { client: ExamClient }) => (
<div className='flex justify-center'>
<div className='w-[520px] max-w-[95%] bg-white rounded-2xl border shadow-sm px-6 py-4 text-xs text-gray-800'>
<div className='flex items-center justify-between border-b pb-3 mb-3'>
<div>
<div className='text-sm font-semibold'> · </div>
<div className='text-[11px] text-gray-500 mt-1'></div>
</div>
<div className='text-right text-[11px] text-gray-500'>
<div>{client.id}</div>
<div>2025-11-18</div>
</div>
</div>
<div className='grid grid-cols-2 gap-y-1 gap-x-6 mb-3'>
<div>
<span className='font-medium'>{client.name}</span>
</div>
<div>
/
<span className='font-medium'>
{client.gender} / {client.age}
</span>
</div>
<div>
<span className='font-medium'>{client.packageName}</span>
</div>
<div>
<span className='font-medium'>{client.customerType}</span>
</div>
</div>
<div className='mb-2 font-medium'></div>
<table className='w-full border text-[11px] mb-3'>
<thead>
<tr className='bg-gray-50'>
<th className='border px-2 py-1 text-left'></th>
<th className='border px-2 py-1 text-left'></th>
<th className='border px-2 py-1 text-left'></th>
<th className='border px-2 py-1 text-left'></th>
</tr>
</thead>
<tbody>
{client.checkedItems.map((item, idx) => (
<tr key={`c-${idx}`}>
<td className='border px-2 py-1'>{idx + 1}</td>
<td className='border px-2 py-1'>{item}</td>
<td className='border px-2 py-1'></td>
<td className='border px-2 py-1'></td>
</tr>
))}
{client.pendingItems.map((item, idx) => (
<tr key={`p-${idx}`}>
<td className='border px-2 py-1'>{client.checkedItems.length + idx + 1}</td>
<td className='border px-2 py-1'>{item}</td>
<td className='border px-2 py-1'></td>
<td className='border px-2 py-1'></td>
</tr>
))}
</tbody>
</table>
<div className='grid grid-cols-2 gap-4 text-[11px] text-gray-600'>
<div>
<div className='mb-1 font-medium text-gray-800'></div>
<ul className='list-disc ml-4 space-y-0.5'>
<li></li>
<li></li>
<li>尿</li>
</ul>
</div>
<div className='flex flex-col items-end justify-between'>
<div className='text-right'>
<div>________________</div>
<div className='mt-2'>2025-11-18 09:30</div>
</div>
<div className='mt-4 w-24 h-24 border border-dashed flex items-center justify-center text-[10px] text-gray-400'>
/
</div>
</div>
</div>
</div>
</div>
);

View File

@@ -0,0 +1,131 @@
import type { ExamClient, ExamModalTab } from '../../data/mockData';
import { EXAM_STATS, EXAM_TAGS } from '../../data/mockData';
import { Badge, Card, CardContent, CardHeader, InfoCard } from '../ui';
import { cls } from '../../utils/cls';
interface ExamSectionProps {
filteredClients: ExamClient[];
selectedExamClient: ExamClient;
examFilterTag: (typeof EXAM_TAGS)[number];
onFilterChange: (tag: (typeof EXAM_TAGS)[number]) => void;
onOpenModal: (id: string, tab: ExamModalTab) => void;
}
export const ExamSection = ({
filteredClients,
selectedExamClient,
examFilterTag,
onFilterChange,
onOpenModal,
}: ExamSectionProps) => (
<div className='space-y-4'>
<Card>
<CardHeader></CardHeader>
<CardContent>
<div className='grid grid-cols-4 gap-3'>
{EXAM_STATS.map(([label, value]) => (
<InfoCard key={label} label={label} value={value} />
))}
</div>
</CardContent>
</Card>
<Card>
<CardHeader>
<span></span>
<div className='flex items-center gap-2 text-xs'>
{EXAM_TAGS.map((tag) => (
<button
key={tag}
onClick={() => onFilterChange(tag)}
className={cls(
'px-3 py-1 rounded-2xl border',
examFilterTag === tag ? 'bg-gray-900 text-white border-gray-900' : 'bg-white text-gray-700',
)}
>
{tag}
</button>
))}
</div>
</CardHeader>
<CardContent>
<div className='grid grid-cols-3 gap-3 text-sm'>
{filteredClients.map((client) => {
const signDone = client.signStatus === '已登记' || client.checkedItems.includes('签到');
const addonCount = client.addonCount || 0;
const printDone = !!client.guidePrinted;
const openModal = (tab: ExamModalTab) => onOpenModal(client.id, tab);
return (
<button
key={client.id}
onClick={() => openModal('detail')}
className={cls(
'text-left p-3 rounded-2xl border bg-white hover:bg-gray-50 flex flex-col gap-1',
selectedExamClient.id === client.id && 'border-gray-900 bg-gray-50',
)}
>
<div className='flex items-center justify-between mb-1'>
<span className='font-medium'>{client.name}</span>
<Badge>{client.level}</Badge>
</div>
<div className='text-xs text-gray-500 truncate'>{client.packageName}</div>
<div className='flex items-center justify-between text-xs text-gray-500 mt-1'>
<span>{client.status}</span>
<span>{client.elapsed}</span>
</div>
<div className='mt-2 flex flex-wrap gap-1 text-[11px]'>
<button
type='button'
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
onClick={(e) => {
e.stopPropagation();
openModal('detail');
}}
>
<span></span>
</button>
<button
type='button'
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
onClick={(e) => {
e.stopPropagation();
openModal('sign');
}}
>
<span></span>
{signDone && <span></span>}
</button>
<button
type='button'
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
onClick={(e) => {
e.stopPropagation();
openModal('addon');
}}
>
<span></span>
{addonCount > 0 && <span className='opacity-80'>({addonCount})</span>}
</button>
<button
type='button'
className='px-2 py-0.5 rounded-2xl border bg-white hover:bg-gray-100 flex items-center gap-1'
onClick={(e) => {
e.stopPropagation();
openModal('print');
}}
>
<span></span>
{printDone && <span></span>}
</button>
</div>
</button>
);
})}
</div>
</CardContent>
</Card>
</div>
);

View File

@@ -0,0 +1,104 @@
import { B1_ROWS, B1_SUMMARY, HOME_STATS, NORTH3_ROWS, NORTH3_SUMMARY, REVENUE_STATS } from '../../data/mockData';
import { Card, CardContent, CardHeader, InfoCard } from '../ui';
export const HomeSection = () => (
<div className='space-y-6'>
<Card>
<CardHeader></CardHeader>
<CardContent>
<div className='grid grid-cols-5 gap-3'>
{HOME_STATS.map(([label, value]) => (
<InfoCard key={label} label={label} value={value} />
))}
</div>
</CardContent>
</Card>
<Card>
<CardHeader></CardHeader>
<CardContent>
<div className='grid grid-cols-3 gap-3'>
{REVENUE_STATS.map(([label, value]) => (
<InfoCard key={label} label={label} value={value} />
))}
</div>
</CardContent>
</Card>
<div className='grid grid-cols-2 gap-4'>
<Card>
<CardHeader>B1 </CardHeader>
<CardContent>
<div className='grid grid-cols-3 gap-3 mb-3'>
<InfoCard label='当前客户总数' value={B1_SUMMARY.totalClients} />
<InfoCard label='待检人数' value={B1_SUMMARY.waiting} />
<InfoCard label='在检人数' value={B1_SUMMARY.inExam} />
</div>
<table className='w-full text-xs'>
<thead>
<tr className='text-gray-500 border-b'>
<th className='py-2 text-left'></th>
<th className='py-2 text-left'></th>
<th className='py-2 text-right'></th>
<th className='py-2 text-right'></th>
<th className='py-2 text-right'></th>
<th className='py-2 text-right'></th>
<th className='py-2 text-right'></th>
<th className='py-2 text-right'></th>
</tr>
</thead>
<tbody>
{B1_ROWS.map(([dept, doctor, done, inExam, waiting, avg]) => {
const parts = done * 3;
const totalTime = done * avg;
return (
<tr key={dept} className='border-b last:border-b-0'>
<td className='py-2'>{dept}</td>
<td className='py-2'>{doctor}</td>
<td className='py-2 text-right'>{done}</td>
<td className='py-2 text-right'>{parts}</td>
<td className='py-2 text-right'>{totalTime}</td>
<td className='py-2 text-right'>{avg}</td>
<td className='py-2 text-right'>{inExam}</td>
<td className='py-2 text-right'>{waiting}</td>
</tr>
);
})}
</tbody>
</table>
</CardContent>
</Card>
<Card>
<CardHeader>3</CardHeader>
<CardContent>
<div className='grid grid-cols-3 gap-3 mb-3'>
<InfoCard label='今日家医数' value={NORTH3_SUMMARY.totalDoctor} />
<InfoCard label='分配客户数' value={NORTH3_SUMMARY.totalAssigned} />
<InfoCard label='面诊数' value={NORTH3_SUMMARY.consult} />
</div>
<table className='w-full text-xs'>
<thead>
<tr className='text-gray-500 border-b'>
<th className='py-2 text-left'></th>
<th className='py-2 text-right'></th>
<th className='py-2 text-right'></th>
</tr>
</thead>
<tbody>
{NORTH3_ROWS.map(([name, total, consult]) => (
<tr key={name} className='border-b last:border-b-0'>
<td className='py-2'>{name}</td>
<td className='py-2 text-right'>{total}</td>
<td className='py-2 text-right'>{consult}</td>
</tr>
))}
</tbody>
</table>
</CardContent>
</Card>
</div>
</div>
);

View File

@@ -0,0 +1,73 @@
import type { QuickActionType } from '../../data/mockData';
import { Button } from '../ui';
import { cls } from '../../utils/cls';
export type SectionKey = 'home' | 'exam' | 'booking' | 'support';
interface SidebarProps {
active: SectionKey;
onNavigate: (key: SectionKey) => void;
onQuickAction: (action: Exclude<QuickActionType, 'none'>) => void;
}
const IconHome = () => <span className='text-xs'>🏠</span>;
const IconHospital = () => <span className='text-xs'>🏥</span>;
const IconCalendar = () => <span className='text-xs'>📅</span>;
const IconSupport = () => <span className='text-xs'>💬</span>;
const NAV_ITEMS = [
{ key: 'home', icon: IconHome, label: '首页' },
{ key: 'exam', icon: IconHospital, label: '体检中心' },
{ key: 'booking', icon: IconCalendar, label: '预约中心' },
{ key: 'support', icon: IconSupport, label: '客服咨询' },
] as const;
export const Sidebar = ({ active, onNavigate, onQuickAction }: SidebarProps) => (
<aside className='bg-white border-r p-4 flex flex-col gap-4'>
<div>
<div className='text-base font-semibold'> · </div>
<div className='text-xs text-gray-500 mt-1'>iPad </div>
</div>
<nav className='space-y-1'>
{NAV_ITEMS.map((item) => (
<Button
key={item.key}
onClick={() => onNavigate(item.key as SectionKey)}
className={cls('w-full justify-start', active === item.key && 'bg-gray-100 border-gray-900 text-gray-900')}
>
<item.icon />
<span>{item.label}</span>
</Button>
))}
</nav>
<section className='mt-2 p-3 rounded-2xl border bg-gray-50/50'>
<div className='text-sm text-gray-700 mb-2'></div>
<div className='grid grid-cols-2 gap-2 text-xs'>
<Button className='justify-center py-1.5' onClick={() => onQuickAction('meal')}>
</Button>
<Button className='justify-center py-1.5' onClick={() => onQuickAction('vip')}>
VIP认证
</Button>
<Button className='justify-center py-1.5' onClick={() => onQuickAction('delivery')}>
</Button>
<Button className='justify-center py-1.5' onClick={() => onQuickAction('note')}>
</Button>
</div>
</section>
<section className='mt-auto p-3 rounded-2xl border bg-gray-50/70 text-xs flex flex-col gap-2'>
<div className='text-sm font-medium flex items-center gap-2'>
<span>💻</span>
<span> / IT </span>
</div>
<div className='text-gray-600'> IT / </div>
</section>
</aside>
);

View File

@@ -0,0 +1,37 @@
import { Input } from '../ui';
interface TopBarProps {
search: string;
onSearch: (value: string) => void;
enableSearch?: boolean;
operatorName?: string;
onLoginClick?: () => void;
}
export const TopBar = ({ search, onSearch, enableSearch = true, operatorName, onLoginClick }: TopBarProps) => (
<header className='flex items-center gap-3 p-4 border-b bg-white'>
<div className='flex-1 flex items-center gap-3'>
{enableSearch ? (
<div className='w-[420px] max-w-[60vw]'>
<Input
placeholder='搜索姓名 / 体检号 / 套餐'
value={search}
onChange={(e) => onSearch(e.target.value)}
/>
</div>
) : (
<div className='text-sm text-gray-500'> · </div>
)}
</div>
<div className='flex items-center gap-3 text-xs'>
<button
onClick={onLoginClick}
className='px-3 py-1 rounded-2xl border bg-gray-50 hover:bg-gray-100 transition-colors cursor-pointer'
>
· {operatorName || '未登录'}
</button>
</div>
</header>
);

View File

@@ -0,0 +1,169 @@
import { useState, useEffect } from 'react';
import { Button, Input } from '../ui';
interface LoginModalProps {
onClose: () => void;
onLoginSuccess?: (phone: string) => void;
}
export const LoginModal = ({ onClose, onLoginSuccess }: LoginModalProps) => {
const [phone, setPhone] = useState('');
const [code, setCode] = useState('');
const [countdown, setCountdown] = useState(0);
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
// 验证码倒计时
useEffect(() => {
if (countdown > 0) {
const timer = setTimeout(() => setCountdown(countdown - 1), 1000);
return () => clearTimeout(timer);
}
}, [countdown]);
// 验证手机号格式
const validatePhone = (phoneNumber: string): boolean => {
return /^1[3-9]\d{9}$/.test(phoneNumber);
};
// 发送验证码
const handleSendCode = async () => {
if (!phone) {
setError('请输入手机号');
return;
}
if (!validatePhone(phone)) {
setError('请输入正确的手机号');
return;
}
setError('');
setLoading(true);
// 模拟发送验证码 API 调用
await new Promise((resolve) => setTimeout(resolve, 1000));
setLoading(false);
setCountdown(60); // 60秒倒计时
// 实际项目中,这里应该调用后端 API 发送验证码
// 开发环境可以显示验证码例如123456
// eslint-disable-next-line no-console
console.log('验证码已发送开发环境123456');
};
// 登录
const handleLogin = async () => {
if (!phone) {
setError('请输入手机号');
return;
}
if (!validatePhone(phone)) {
setError('请输入正确的手机号');
return;
}
if (!code) {
setError('请输入验证码');
return;
}
if (code.length !== 6) {
setError('验证码应为6位数字');
return;
}
setError('');
setLoading(true);
// 模拟登录 API 调用
await new Promise((resolve) => setTimeout(resolve, 1500));
// 开发环境:验证码为 123456 时通过
if (code === '123456') {
setLoading(false);
onLoginSuccess?.(phone);
onClose();
} else {
setLoading(false);
setError('验证码错误,请重新输入');
}
};
const canSendCode = countdown === 0 && !loading && phone.length === 11;
const canLogin = phone && code && !loading;
return (
<div className='fixed inset-0 z-50 flex items-center justify-center bg-black/30' onClick={onClose}>
<div
className='w-[480px] max-w-[95vw] bg-white rounded-3xl shadow-xl overflow-hidden text-sm'
onClick={(e) => e.stopPropagation()}
>
<div className='px-4 py-3 border-b flex items-center justify-between'>
<div className='font-semibold'></div>
<button className='text-xs text-gray-500 hover:text-gray-700' onClick={onClose}>
</button>
</div>
<div className='px-4 py-6 bg-gray-50/60 space-y-4'>
<div className='space-y-2'>
<label className='text-xs text-gray-700 font-medium'></label>
<Input
type='tel'
placeholder='请输入手机号'
value={phone}
onChange={(e) => {
const value = e.target.value.replace(/\D/g, '').slice(0, 11);
setPhone(value);
setError('');
}}
maxLength={11}
className='text-base'
/>
</div>
<div className='space-y-2'>
<label className='text-xs text-gray-700 font-medium'></label>
<div className='flex gap-2'>
<Input
type='text'
placeholder='请输入6位验证码'
value={code}
onChange={(e) => {
const value = e.target.value.replace(/\D/g, '').slice(0, 6);
setCode(value);
setError('');
}}
maxLength={6}
className='text-base flex-1'
/>
<Button
onClick={handleSendCode}
disabled={!canSendCode}
className={!canSendCode ? 'opacity-50 cursor-not-allowed' : ''}
>
{countdown > 0 ? `${countdown}` : loading ? '发送中...' : '发送验证码'}
</Button>
</div>
<div className='text-[11px] text-gray-500'>
<span className='font-mono font-semibold'>123456</span>
</div>
</div>
{error && (
<div className='px-3 py-2 rounded-xl bg-red-50 border border-red-200 text-xs text-red-600'>{error}</div>
)}
<div className='pt-2'>
<Button
onClick={handleLogin}
disabled={!canLogin}
className={`w-full justify-center ${!canLogin ? 'opacity-50 cursor-not-allowed' : 'bg-gray-900 hover:bg-gray-800'}`}
>
{loading ? '· · ·' : '登录'}
</Button>
</div>
</div>
</div>
</div>
);
};

View File

@@ -0,0 +1,144 @@
import type { ExamClient, QuickActionType } from '../../data/mockData';
import { EXAM_CLIENTS } from '../../data/mockData';
import { Button, InfoCard, Input } from '../ui';
interface QuickActionModalProps {
action: QuickActionType;
noteText: string;
onNoteChange: (v: string) => void;
onClose: () => void;
totalExamCount: number;
mealCount: number;
notMealCount: number;
mealDoneIds: string[];
onMealDone: (id: string) => void;
}
export const QuickActionModal = ({
action,
noteText,
onNoteChange,
onClose,
totalExamCount,
mealCount,
notMealCount,
mealDoneIds,
onMealDone,
}: QuickActionModalProps) => {
const titleMap: Record<Exclude<QuickActionType, 'none'>, string> = {
meal: '用餐登记',
vip: '太平 VIP 认证说明',
delivery: '报告寄送登记',
note: '备注窗',
};
if (action === 'none') {
return null;
}
return (
<div className='fixed inset-0 z-40 flex items-center justify-center bg-black/30'>
<div className='w-[560px] max-w-[95vw] bg-white rounded-3xl shadow-xl overflow-hidden text-sm'>
<div className='px-4 py-3 border-b flex items-center justify-between'>
<div className='font-semibold'>{titleMap[action]}</div>
<button className='text-xs text-gray-500' onClick={onClose}>
</button>
</div>
<div className='px-4 py-4 bg-gray-50/60'>
{action === 'meal' && (
<div className='space-y-3'>
<div className='grid grid-cols-3 gap-3 text-xs'>
<InfoCard label='今日体检人数' value={totalExamCount} />
<InfoCard label='已用餐人数' value={mealCount} />
<InfoCard label='未用餐人数' value={notMealCount} />
</div>
<div className='text-xs text-gray-600 mt-2 mb-1'></div>
<div className='max-h-60 overflow-auto border rounded-2xl bg-white p-2 text-xs'>
{EXAM_CLIENTS.map((c: ExamClient) => {
const checked = mealDoneIds.includes(c.id);
return (
<label
key={c.id}
className='flex items-center justify-between px-3 py-1.5 rounded-2xl hover:bg-gray-50 cursor-pointer'
>
<span>
{c.name} <span className='text-gray-400 text-[11px]'>({c.id})</span>
</span>
<span className='flex items-center gap-2'>
<span className='text-gray-400'>{c.status}</span>
<input type='checkbox' checked={checked} onChange={() => onMealDone(c.id)} />
</span>
</label>
);
})}
</div>
</div>
)}
{action === 'vip' && (
<div className='flex gap-4 items-center'>
<div className='flex-1 text-xs text-gray-700 space-y-2'>
<p> VIP </p>
<ul className='list-disc ml-5 space-y-1'>
<li> APP </li>
<li> VIP </li>
<li></li>
</ul>
</div>
<div className='w-40 h-40 rounded-3xl bg-white border flex items-center justify-center text-xs text-gray-500'>
</div>
</div>
)}
{action === 'delivery' && (
<div className='space-y-3 text-xs text-gray-700'>
<div className='grid grid-cols-2 gap-3'>
<div>
<Input placeholder='请输入收件人姓名' className='mt-1' />
</div>
<div>
<Input placeholder='用于快递联系' className='mt-1' />
</div>
<div className='col-span-2'>
<Input placeholder='请输入详细寄送地址' className='mt-1' />
</div>
</div>
<div>
<textarea
className='w-full mt-1 rounded-2xl border px-3 py-2 text-xs outline-none focus:ring-2 focus:ring-gray-200 min-h-[72px]'
placeholder='如需多份报告、加急寄送等,请在此备注'
/>
</div>
<div className='text-right'>
<Button></Button>
</div>
</div>
)}
{action === 'note' && (
<div className='space-y-3 text-xs text-gray-700'>
<div></div>
<textarea
className='w-full rounded-2xl border px-3 py-2 text-xs outline-none focus:ring-2 focus:ring-gray-200 min-h-[96px]'
placeholder='例如:客户有既往疾病史、沟通偏好、特殊关怀需求等,可在此记录。'
value={noteText}
onChange={(e) => onNoteChange(e.target.value)}
/>
<div className='text-right text-[11px] text-gray-500'>
</div>
</div>
)}
</div>
</div>
</div>
);
};

View File

@@ -0,0 +1,42 @@
import { Card, CardContent, CardHeader } from '../ui';
export const SupportSection = () => (
<Card>
<CardHeader> · </CardHeader>
<CardContent>
<div className='grid grid-cols-[1.2fr_1fr] gap-6 items-center'>
<div className='space-y-3 text-sm text-gray-700'>
<p></p>
<ul className='list-disc ml-5 space-y-1 text-xs text-gray-600'>
<li></li>
<li>线</li>
<li></li>
</ul>
<div className='text-xs text-gray-500'></div>
</div>
<div className='h-64 rounded-3xl overflow-hidden shadow-inner flex items-center justify-center bg-gradient-to-b from-[#152749] to-[#c73545]'>
<div className='flex flex-col items-center gap-3 text-white'>
<div className='text-[11px] tracking-[0.2em] opacity-80'>CIRCLE HARMONY · </div>
<div className='text-sm font-medium'> · </div>
<div className='w-28 h-28 rounded-full bg-white flex items-center justify-center'>
<div className='w-20 h-20 rounded-md bg-gray-200 flex items-center justify-center text-[10px] text-gray-500'>
</div>
</div>
<div className='text-sm font-semibold'></div>
<div className='px-4 py-1.5 rounded-full border border-white/70 text-[11px] flex gap-2'>
<span></span>
<span>/</span>
<span></span>
<span>/</span>
<span></span>
</div>
</div>
</div>
</div>
</CardContent>
</Card>
);

View File

@@ -0,0 +1,7 @@
import type { PropsWithChildren } from 'react';
export const Badge = ({ children }: PropsWithChildren) => (
<span className='px-2 py-0.5 rounded-full border text-xs bg-gray-50'>{children}</span>
);

View File

@@ -0,0 +1,21 @@
import type { ButtonHTMLAttributes, PropsWithChildren } from 'react';
import { cls } from '../../utils/cls';
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, PropsWithChildren {
className?: string;
}
export const Button = ({ className = '', children, ...rest }: ButtonProps) => (
<button
className={cls(
'inline-flex items-center gap-2 px-4 py-2 rounded-2xl border text-sm bg-white hover:bg-gray-50 transition-colors',
className,
)}
{...rest}
>
{children}
</button>
);

View File

@@ -0,0 +1,21 @@
import type { PropsWithChildren } from 'react';
import { cls } from '../../utils/cls';
interface CardProps extends PropsWithChildren {
className?: string;
}
export const Card = ({ className = '', children }: CardProps) => (
<div className={cls('rounded-2xl border bg-white shadow-sm', className)}>{children}</div>
);
export const CardHeader = ({ children }: PropsWithChildren) => (
<div className='px-5 pt-4 pb-2 font-medium flex items-center justify-between'>{children}</div>
);
export const CardContent = ({ children }: PropsWithChildren) => (
<div className='px-5 pb-5'>{children}</div>
);

View File

@@ -0,0 +1,13 @@
interface InfoCardProps {
label: React.ReactNode;
value: React.ReactNode;
}
export const InfoCard = ({ label, value }: InfoCardProps) => (
<div className='p-3 rounded-xl border flex items-center justify-between text-sm'>
<span>{label}</span>
<span className='text-lg font-semibold'>{value}</span>
</div>
);

View File

@@ -0,0 +1,19 @@
import type { InputHTMLAttributes } from 'react';
import { cls } from '../../utils/cls';
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
className?: string;
}
export const Input = ({ className = '', ...rest }: InputProps) => (
<input
className={cls(
'w-full rounded-2xl border px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-gray-200',
className,
)}
{...rest}
/>
);

View File

@@ -0,0 +1,7 @@
export * from './Badge';
export * from './Button';
export * from './Card';
export * from './InfoCard';
export * from './Input';