From 32af1cc335bf753ce3885961489e722d5d5a0c71 Mon Sep 17 00:00:00 2001 From: xianyi Date: Thu, 18 Dec 2025 11:39:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8A=A5=E5=91=8A=E5=AF=84?= =?UTF-8?q?=E9=80=81=E5=9C=B0=E5=9D=80=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/exam/ExamDeliveryPanel.tsx | 133 +++++++++++++++++----- 1 file changed, 102 insertions(+), 31 deletions(-) diff --git a/src/components/exam/ExamDeliveryPanel.tsx b/src/components/exam/ExamDeliveryPanel.tsx index 133e4e7..b6dff45 100644 --- a/src/components/exam/ExamDeliveryPanel.tsx +++ b/src/components/exam/ExamDeliveryPanel.tsx @@ -1,39 +1,110 @@ +import { useEffect, useState } from 'react'; import type { ExamClient } from '../../data/mockData'; +import { getReportSendQRcode } from '../../api'; import { Button, Input } from '../ui'; -export const ExamDeliveryPanel = ({ client }: { client: ExamClient }) => ( -
-
-
报告寄送
-
-
- 收件人姓名 - +export const ExamDeliveryPanel = ({ client }: { client: ExamClient }) => { + const [viewMode, setViewMode] = useState<'form' | 'image'>('form'); + const [qrcodeUrl, setQrcodeUrl] = useState(null); + const [qrcodeLoading, setQrcodeLoading] = useState(false); + + useEffect(() => { + if (viewMode === 'image' && !qrcodeUrl && !qrcodeLoading) { + setQrcodeLoading(true); + // 使用 client.id 作为 appointment_id,如果接口需要其他格式,可以调整 + getReportSendQRcode({ appointment_id: client.id }) + .then((res) => { + if (res.Status === 200 && res.Data?.qrcode_url) { + setQrcodeUrl(res.Data.qrcode_url); + } + }) + .catch((err) => { + console.error('获取报告寄送二维码失败', err); + }) + .finally(() => { + setQrcodeLoading(false); + }); + } + }, [viewMode, client.id, qrcodeUrl, qrcodeLoading]); + + return ( +
+
+
+
报告寄送
+
+ + +
-
- 联系电话 - -
-
- 寄送地址 - -
-
-
-
备注说明
-