InputAddItemCombinationInfo
This commit is contained in:
@@ -722,11 +722,11 @@ export type PhysicalExamQrcodeCreateResponse = CommonActionResult<string>;
|
||||
*/
|
||||
export interface InputAddItemCombinationInfo {
|
||||
/** 体检组合项目代码 */
|
||||
combination_item_code: string;
|
||||
combination_item_code?: string | null;
|
||||
/** 体检组合项目价格 */
|
||||
combination_item_price: number;
|
||||
combination_item_price?: number | null;
|
||||
/** 折扣比例 */
|
||||
discount_rate: number;
|
||||
discount_rate?: number | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1400,6 +1400,15 @@ export interface InputCustomSettlementApplyApprove {
|
||||
add_item_id?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 体检加项自定义结算申请-加项组合项
|
||||
*/
|
||||
export interface OutputCustomSettlementApplyApproveItem {
|
||||
combination_item_code?: string | null;
|
||||
combination_item_price?: number | null;
|
||||
discount_rate?: number | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 体检加项自定义结算申请状态编辑出参
|
||||
*/
|
||||
@@ -1416,6 +1425,8 @@ export interface OutputCustomSettlementApplyApprove {
|
||||
apply_reason?: string;
|
||||
/** 折扣 */
|
||||
discount_ratio?: number | null;
|
||||
/** 加项组合列表 */
|
||||
listAddItemCombination?: OutputCustomSettlementApplyApproveItem[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useState, useRef, useCallback } from 'react';
|
||||
|
||||
import type { ExamClient } from '../../data/mockData';
|
||||
import { searchPhysicalExamAddItem, getAddItemCustomerInfo, getChannelCompanyList, createNativePaymentQrcode, checkNativePaymentStatus, getAddItemBillPdf, getCustomSettlementApproveStatus, customSettlementApply, customSettlementApplyCancel } from '../../api';
|
||||
import type { InputAddItemCombinationInfo, OutputCustomSettlementApplyApproveItem } from '../../api/types';
|
||||
import { Button, Input } from '../ui';
|
||||
import { cls } from '../../utils/cls';
|
||||
import nozImage from '../../assets/image/noz.png';
|
||||
@@ -97,6 +98,7 @@ export const ExamAddonPanel = ({ client, onGoToSign }: ExamAddonPanelProps) => {
|
||||
settlement_type?: number | null;
|
||||
discount_ratio?: number | null;
|
||||
add_item_id?: string | null;
|
||||
listAddItemCombination?: OutputCustomSettlementApplyApproveItem[] | null;
|
||||
} | null>(null);
|
||||
const [customSettlementLoading, setCustomSettlementLoading] = useState(false);
|
||||
const [customSettlementType, setCustomSettlementType] = useState<1 | 2>(1); // 1-按比例折扣 2-自定义结算价
|
||||
@@ -504,6 +506,7 @@ export const ExamAddonPanel = ({ client, onGoToSign }: ExamAddonPanelProps) => {
|
||||
settlement_type: (res.Data as any).settlement_type,
|
||||
discount_ratio: (res.Data as any).discount_ratio,
|
||||
add_item_id: currentAddItemId,
|
||||
listAddItemCombination: res.Data.listAddItemCombination,
|
||||
};
|
||||
|
||||
// 获取旧状态用于判断是否刚进入审核中
|
||||
@@ -794,11 +797,7 @@ export const ExamAddonPanel = ({ client, onGoToSign }: ExamAddonPanelProps) => {
|
||||
const startPaymentPolling = (
|
||||
physical_exam_id: number,
|
||||
patient_id: number,
|
||||
listAddItemCombination: Array<{
|
||||
combination_item_code: string;
|
||||
combination_item_price: number;
|
||||
discount_rate: number;
|
||||
}>,
|
||||
listAddItemCombination: InputAddItemCombinationInfo[],
|
||||
pay_type: number,
|
||||
company_id: number,
|
||||
combinationItemCodes: string,
|
||||
@@ -889,26 +888,32 @@ export const ExamAddonPanel = ({ client, onGoToSign }: ExamAddonPanelProps) => {
|
||||
const selectedItems = allAddons.filter((item) => selectedIds.has(item.id || item.name));
|
||||
|
||||
// 构建加项组合项目信息列表
|
||||
const listAddItemCombination = selectedItems
|
||||
.map((item) => {
|
||||
const combinationItemCode = item.combinationItemCode;
|
||||
if (combinationItemCode === null || combinationItemCode === undefined) {
|
||||
return null;
|
||||
}
|
||||
let combinationItemPrice = parseFloat(item.currentPrice || item.originalPrice || '0');
|
||||
let listAddItemCombination: InputAddItemCombinationInfo[] = [];
|
||||
|
||||
// 如果自定义结算审核通过,传申请后的均价(按项平摊)
|
||||
if (customSettlementStatus?.apply_status === 3 && typeof customSettlementStatus.final_settlement_price === 'number') {
|
||||
combinationItemPrice = customSettlementStatus.final_settlement_price / selectedItems.length;
|
||||
}
|
||||
// 如果自定义结算审核通过,直接使用接口返回的项目列表
|
||||
if (customSettlementStatus?.apply_status === 3 && customSettlementStatus.listAddItemCombination) {
|
||||
listAddItemCombination = customSettlementStatus.listAddItemCombination.map((item: OutputCustomSettlementApplyApproveItem) => ({
|
||||
combination_item_code: item.combination_item_code,
|
||||
combination_item_price: item.combination_item_price,
|
||||
discount_rate: item.discount_rate
|
||||
}));
|
||||
} else {
|
||||
listAddItemCombination = selectedItems
|
||||
.map((item) => {
|
||||
const combinationItemCode = item.combinationItemCode;
|
||||
if (combinationItemCode === null || combinationItemCode === undefined) {
|
||||
return null;
|
||||
}
|
||||
const combinationItemPrice = parseFloat(item.currentPrice || item.originalPrice || '0');
|
||||
|
||||
return {
|
||||
combination_item_code: String(combinationItemCode),
|
||||
combination_item_price: combinationItemPrice,
|
||||
discount_rate: discountRatio,
|
||||
};
|
||||
})
|
||||
.filter((item): item is { combination_item_code: string; combination_item_price: number; discount_rate: number } => item !== null);
|
||||
return {
|
||||
combination_item_code: String(combinationItemCode),
|
||||
combination_item_price: combinationItemPrice,
|
||||
discount_rate: discountRatio,
|
||||
} as InputAddItemCombinationInfo;
|
||||
})
|
||||
.filter((item): item is InputAddItemCombinationInfo => item !== null);
|
||||
}
|
||||
|
||||
if (listAddItemCombination.length === 0) {
|
||||
setPaymentMessage('缺少加项信息,请稍后重试');
|
||||
@@ -919,6 +924,7 @@ export const ExamAddonPanel = ({ client, onGoToSign }: ExamAddonPanelProps) => {
|
||||
// 获取组合项目代码(用于生成二维码接口 & 生成加项单,多个加项逗号分隔)
|
||||
const combinationItemCodes = listAddItemCombination
|
||||
.map((item) => item.combination_item_code)
|
||||
.filter(Boolean)
|
||||
.join(',');
|
||||
|
||||
// 获取 patient_id(必须从接口返回的客户信息中获取)
|
||||
|
||||
Reference in New Issue
Block a user