更新加项接口入参接口

This commit is contained in:
xianyi
2025-12-25 16:07:03 +08:00
parent 6b9c55c50e
commit b552ff4963
3 changed files with 59 additions and 11 deletions

View File

@@ -399,14 +399,34 @@ export type CustomerDetailEditResponse = CommonActionResult<OutputCustomerDetail
* 体检加项列表信息入参 * 体检加项列表信息入参
*/ */
export interface InputPhysicalExamAddItem { export interface InputPhysicalExamAddItem {
/** 项目名称(必填,空字符串表示获取全部) */ /** 体检ID */
item_name: string; physical_exam_id: number;
/** 项目名称(默认空值,传入项目名称过滤数据) */
item_name?: string | null;
} }
/** /**
* 体检加项列表信息出参 * 加项界面客户基本信息
*/ */
export interface OutputPhysicalExamAddItem { export interface PoAddItemCustomerInfo {
/** 客户姓名 */
customer_name?: string | null;
/** 体检编号 */
exam_no?: string | null;
/** 体检ID */
physical_exam_id?: number | null;
/** 渠道名称 */
scrm_account_name?: string | null;
/** 是否VIP1是0否 */
is_vip?: number | null;
/** 是否VIP名称1是0否 */
is_vip_name?: string | null;
}
/**
* 体检加项列表项
*/
export interface PoPhysicalExamAddItem {
/** 项目ID */ /** 项目ID */
item_id?: number | null; item_id?: number | null;
/** 项目名称 */ /** 项目名称 */
@@ -417,14 +437,28 @@ export interface OutputPhysicalExamAddItem {
original_price?: number | null; original_price?: number | null;
/** 折扣率含折扣单位如8.0折) */ /** 折扣率含折扣单位如8.0折) */
discount_rate?: string | null; discount_rate?: string | null;
/** 折扣比例 */
discount_ratio?: number | null;
/** 次数 */ /** 次数 */
times?: number | null; times?: number | null;
/** 组合项目代码 */
combination_item_code?: number | null;
}
/**
* 体检加项列表信息出参
*/
export interface OutputPhysicalExamAddItem {
/** 客户基本信息 */
customerInfo?: PoAddItemCustomerInfo | null;
/** 体检加项列表 */
addItemList?: PoPhysicalExamAddItem[] | null;
} }
/** /**
* 体检加项列表信息响应 * 体检加项列表信息响应
*/ */
export type PhysicalExamAddItemListResponse = CommonActionResult<OutputPhysicalExamAddItem[]>; export type PhysicalExamAddItemListResponse = CommonActionResult<OutputPhysicalExamAddItem>;
/** /**
* 体检加项支付记录入参(生成扫码支付二维码) * 体检加项支付记录入参(生成扫码支付二维码)

View File

@@ -1,5 +1,6 @@
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import type { ExamClient } from '../../data/mockData';
import { searchPhysicalExamAddItem } from '../../api'; import { searchPhysicalExamAddItem } from '../../api';
import { Button, Input } from '../ui'; import { Button, Input } from '../ui';
@@ -17,7 +18,11 @@ interface AddonItem {
currentPrice?: string; currentPrice?: string;
} }
export const ExamAddonPanel = () => { interface ExamAddonPanelProps {
client: ExamClient;
}
export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
const [addonList, setAddonList] = useState<AddonItem[]>([]); const [addonList, setAddonList] = useState<AddonItem[]>([]);
const [addonSearch, setAddonSearch] = useState(''); const [addonSearch, setAddonSearch] = useState('');
const [addonLoading, setAddonLoading] = useState(false); const [addonLoading, setAddonLoading] = useState(false);
@@ -25,13 +30,22 @@ export const ExamAddonPanel = () => {
// 拉取加项列表 // 拉取加项列表
useEffect(() => { useEffect(() => {
const physical_exam_id = Number(client.id);
if (!physical_exam_id) {
setAddonError('缺少体检ID');
return;
}
const fetchList = async () => { const fetchList = async () => {
setAddonLoading(true); setAddonLoading(true);
setAddonError(null); setAddonError(null);
try { try {
const res = await searchPhysicalExamAddItem({ item_name: addonSearch.trim() }); const res = await searchPhysicalExamAddItem({
if (res.Status === 200 && Array.isArray(res.Data)) { physical_exam_id,
const list: AddonItem[] = res.Data.map((item) => ({ item_name: addonSearch.trim() || null,
});
if (res.Status === 200 && res.Data?.addItemList) {
const list: AddonItem[] = res.Data.addItemList.map((item) => ({
id: item.item_id ? String(item.item_id) : `addon_${item.item_name}`, id: item.item_id ? String(item.item_id) : `addon_${item.item_name}`,
name: item.item_name || '', name: item.item_name || '',
originalPrice: item.original_price !== undefined ? Number(item.original_price).toFixed(2) : '0.00', originalPrice: item.original_price !== undefined ? Number(item.original_price).toFixed(2) : '0.00',
@@ -55,7 +69,7 @@ export const ExamAddonPanel = () => {
} }
}; };
fetchList(); fetchList();
}, [addonSearch]); }, [addonSearch, client.id]);
const allAddons = useMemo(() => addonList, [addonList]); const allAddons = useMemo(() => addonList, [addonList]);

View File

@@ -161,7 +161,7 @@ export const ExamModal = ({ client, tab, onTabChange, onClose }: ExamModalProps)
/> />
)} )}
{tab === 'sign' && <ExamSignPanel examId={Number(client.id)} onBusyChange={setSignBusy} />} {tab === 'sign' && <ExamSignPanel examId={Number(client.id)} onBusyChange={setSignBusy} />}
{tab === 'addon' && <ExamAddonPanel />} {tab === 'addon' && <ExamAddonPanel client={client} />}
{tab === 'print' && <ExamPrintPanel client={client} />} {tab === 'print' && <ExamPrintPanel client={client} />}
{tab === 'delivery' && <ExamDeliveryPanel client={client} />} {tab === 'delivery' && <ExamDeliveryPanel client={client} />}
</div> </div>