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