fix(doctorstation): 修复耗材价格获取逻辑

- 优先从priceList获取药品/诊疗价格
- 添加耗材类型直接从retailPrice或price字段获取价格
- 支持耗材价格字段为空时返回默认值
- 修复价格显示格式化问题
This commit is contained in:
2026-03-23 18:38:16 +08:00
parent c15c091718
commit bedad38ca3

View File

@@ -327,11 +327,24 @@ function fetchFromApi(searchKey) {
} }
// 从priceList列表中获取价格 - 与V1.3一致 // 从priceList列表中获取价格 - 与V1.3一致
// 🔧 Bug #220 修复:增强价格获取逻辑,支持耗材直接价格字段
function getPriceFromInventory(row) { function getPriceFromInventory(row) {
// 优先从priceList获取药品/诊疗)
if (row.priceList && row.priceList.length > 0) { if (row.priceList && row.priceList.length > 0) {
const price = row.priceList[0].price || 0; const price = row.priceList[0].price || 0;
return Number(price).toFixed(2) + ' 元'; return Number(price).toFixed(2) + ' 元';
} }
// 耗材类型直接从retailPrice或price字段获取
if (row.adviceType === 4) {
const price = row.retailPrice !== undefined && row.retailPrice !== null
? row.retailPrice
: (row.price !== undefined && row.price !== null ? row.price : null);
if (price !== null && price !== '') {
return Number(price).toFixed(2) + ' 元';
}
}
return '-'; return '-';
} }