fix(charge): 修复收费模块中的数值计算和空指针异常问题

- 修复金额计算精度问题,使用Number转换和toFixed(2)确保数值准确性
- 添加安全访问操作符(?.)避免空指针异常导致页面崩溃
- 修复数组过滤和查找操作的空值处理逻辑
- 优化错误消息显示,提供更友好的用户提示
- 修复模板文件路径引用问题,确保打印功能正常工作
- 统一金额计算逻辑,避免因数据类型不一致导致的计算错误
This commit is contained in:
2026-01-13 17:30:17 +08:00
parent 0f013715b8
commit f5f4e3c48e
10 changed files with 719 additions and 43 deletions

View File

@@ -498,21 +498,21 @@ function confirmCharge() {
encounterId: patientInfo.value.encounterId,
chargeItemIds: chargeItemIdList.value,
}).then((res) => {
if (res.code == 200) {
const item = res.data.paymentRecDetailDtoList.find((i) => {
if (res.code == 200 && res.data) {
const item = res.data.paymentRecDetailDtoList?.find((i) => {
return i.payEnum == 220000;
});
totalAmount.value = item?.amount;
totalAmount.value = item?.amount ?? 0;
paymentId.value = res.data.id;
newId.value = res.data.newId;
oldId.value = res.data.oldId;
chrgBchnoList.value = res.data.chrgBchnoList;
details.value = res.data.paymentRecDetailDtoList?.filter((item) => {
return item.amount > 0;
});
}) || [];
openDialog.value = true;
} else {
proxy.$modal.msgError(res.msg);
proxy.$modal.msgError(res?.msg || '预结算失败');
}
});
// console.log(patientInfo)
@@ -656,12 +656,12 @@ async function handleReadCard(value) {
ybMdtrtCertType: userCardInfo.psnCertType,
busiCardInfo: userCardInfo.busiCardInfo,
}).then((res) => {
if (res.code == 200) {
if (res.code == 200 && res.data) {
paymentId.value = res.data.id;
totalAmount.value = res.data.paymentRecDetailDtoList.find(
totalAmount.value = res.data.paymentRecDetailDtoList?.find(
(item) => item.payEnum == 220000
).amount;
details.value = res.data.paymentRecDetailDtoList;
)?.amount ?? 0;
details.value = res.data.paymentRecDetailDtoList || [];
// chrgBchnoList.value = res.data.chrgBchnoList;
chargeItemIdList.value = selectRows.map((item) => {
return item.id;
@@ -680,7 +680,7 @@ async function handleReadCard(value) {
openDialog.value = true;
} else {
proxy.$modal.msgError(res.msg);
proxy.$modal.msgError(res?.msg || '预结算失败');
}
});
}