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

@@ -302,14 +302,14 @@ function handleRefund(row) {
// return new Decimal(accumulator).add(new Decimal(currentRow.totalPrice || 0));
// }, 0);
getReturnDetail({ id: row.paymentId }).then((res) => {
if (res.data.length > 0) {
if (res.data?.length > 0) {
totalAmount.value =
res.data.find((item) => item.payEnum === 220000).amount -
(res.data.find((item) => item.payEnum === 220500)?.amount || 0);
(res.data.find((item) => item.payEnum === 220000)?.amount ?? 0) -
(res.data.find((item) => item.payEnum === 220500)?.amount ?? 0);
}
details.value = res.data.filter((item) => {
details.value = res.data?.filter((item) => {
return item.amount > 0;
});
}) || [];
});
paymentId.value = row.paymentId;
patientInfo.value.patientId = row.patientId;