完善打印

This commit is contained in:
xianyi
2026-01-06 16:42:56 +08:00
parent f17f9774ac
commit 973f5338af
3 changed files with 224 additions and 171 deletions

View File

@@ -356,17 +356,22 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
};
}, []);
// 获取加项PDF
const fetchAddItemBillPdf = async (examId: number) => {
// 获取加项PDF(按本次支付的组合代码生成对应的加项单)
const fetchAddItemBillPdf = async (examId: number, combinationItemCodes: string) => {
try {
// 调用接口获取加项PDF
const res = await getAddItemBillPdf({
exam_id: examId,
CombinationCode: combinationItemCodes,
});
if (res.Status === 200 && res.Data?.pdf_url) {
if (res.Status === 200 && res.Data?.pdf_url && res.Data?.pdf_sort !== undefined && res.Data?.pdf_sort !== null) {
// 保存加项PDF信息到localStorage未签名状态
setAddItemBillPdf(examId, {
pdf_sort: res.Data.pdf_sort,
combinationCode: combinationItemCodes,
payment_status: res.Data.payment_status ?? null,
payment_status_name: res.Data.payment_status_name ?? null,
pdf_name: res.Data.pdf_name || '加项单',
pdf_url: res.Data.pdf_url,
is_signed: false,
@@ -392,7 +397,8 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
discount_rate: number;
}>,
pay_type: number,
company_id: number
company_id: number,
combinationItemCodes: string
) => {
if (pollingTimerRef.current) {
clearInterval(pollingTimerRef.current);
@@ -424,8 +430,8 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
setQrcodeUrl(null);
// 清空已选项目
setSelectedIds(new Set());
// 获取加项PDF
fetchAddItemBillPdf(physical_exam_id).then((success) => {
// 获取本次支付对应的加项PDF
fetchAddItemBillPdf(physical_exam_id, combinationItemCodes).then((success) => {
if (success) {
setPaymentMessage('支付成功,加项单已生成');
} else {
@@ -497,7 +503,7 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
return;
}
// 获取组合项目代码(用于生成二维码接口,多个加项逗号分隔)
// 获取组合项目代码(用于生成二维码接口 & 生成加项单,多个加项逗号分隔)
const combinationItemCodes = listAddItemCombination
.map((item) => item.combination_item_code)
.join(',');
@@ -534,7 +540,8 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
patient_id,
listAddItemCombination,
12, // 微信支付
0 // 自费模式company_id 传 0
0, // 自费模式company_id 传 0
combinationItemCodes
);
} else {
setPaymentMessage(res.Message || '生成支付二维码失败');
@@ -564,8 +571,8 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
if (result === 'success' || result === '1' || result === 'SUCCESS') {
setPaymentMessage('挂账成功,正在生成加项单...');
setSelectedIds(new Set());
// 获取加项PDF
fetchAddItemBillPdf(physical_exam_id).then((success) => {
// 获取本次挂账对应的加项PDF
fetchAddItemBillPdf(physical_exam_id, combinationItemCodes).then((success) => {
if (success) {
setPaymentMessage('挂账成功,加项单已生成');
} else {