-
- 付费方式
-
-
-
- 产品名称
-
-
-
- 是否定制
-
-
-
- 期望预约时间
-
-
+export const BookingModal = ({ doctor, onClose }: BookingModalProps) => {
+ const [paymentMethod, setPaymentMethod] = useState('自费');
+ const [isCustomized, setIsCustomized] = useState('否');
+
+ return (
+
+
+
+
预约申请 · {doctor.name}
+
-
- 备注
-
-
-
-
- 医生:{doctor.name}({doctor.dept})
-
-
+
+
+
+ 付费方式
+
+
+
+ 产品名称
+
+
+
+ 是否定制
+
+
+
+ 期望预约时间
+
+
+
+
+ 备注
+
+
+
+
+ 医生:{doctor.name}({doctor.dept})
+
+
+
-
-);
+ );
+};
diff --git a/src/components/ui/Select.tsx b/src/components/ui/Select.tsx
new file mode 100644
index 0000000..66b9e92
--- /dev/null
+++ b/src/components/ui/Select.tsx
@@ -0,0 +1,85 @@
+import { useEffect, useRef, useState } from 'react';
+import { cls } from '../../utils/cls';
+
+interface SelectProps {
+ options: string[];
+ value?: string;
+ onChange?: (value: string) => void;
+ className?: string;
+ placeholder?: string;
+}
+
+export const Select = ({ options, value, onChange, className = '', placeholder }: SelectProps) => {
+ const [isOpen, setIsOpen] = useState(false);
+ const [selectedValue, setSelectedValue] = useState(value || options[0] || '');
+ const selectRef = useRef
(null);
+
+ useEffect(() => {
+ if (value !== undefined) {
+ setSelectedValue(value);
+ }
+ }, [value]);
+
+ useEffect(() => {
+ const handleClickOutside = (event: MouseEvent) => {
+ if (selectRef.current && !selectRef.current.contains(event.target as Node)) {
+ setIsOpen(false);
+ }
+ };
+
+ if (isOpen) {
+ document.addEventListener('mousedown', handleClickOutside);
+ }
+
+ return () => {
+ document.removeEventListener('mousedown', handleClickOutside);
+ };
+ }, [isOpen]);
+
+ const handleSelect = (option: string) => {
+ setSelectedValue(option);
+ onChange?.(option);
+ setIsOpen(false);
+ };
+
+ return (
+
+
+ {isOpen && (
+
+ {options.map((option) => (
+
+ ))}
+
+ )}
+
+ );
+};
+
diff --git a/src/components/ui/index.ts b/src/components/ui/index.ts
index 07d97dc..3838e3a 100644
--- a/src/components/ui/index.ts
+++ b/src/components/ui/index.ts
@@ -3,5 +3,6 @@ export * from './Button';
export * from './Card';
export * from './InfoCard';
export * from './Input';
+export * from './Select';