1. 修复价格获取的bug,应该获取诊所|药店价格而不是总仓库的

This commit is contained in:
李琦
2026-06-01 11:06:52 +08:00
parent 105f9eafa2
commit 550332d963
10 changed files with 179 additions and 63 deletions

30
common/utils/drug.js Normal file
View File

@@ -0,0 +1,30 @@
export function isWesternRxDrug(drug) {
return drug && drug.type == 2 && (drug.is_otc === 0 || drug.is_otc === '0');
}
export function isHealthFood(drug) {
return drug && (drug.type == 3 || drug.category_type === 'health_food');
}
export function canShowFunction(drug, prescriptionApproved) {
if (isHealthFood(drug)) return false;
if (isWesternRxDrug(drug)) return !!prescriptionApproved;
return true;
}
export function canShowUsage(drug, prescriptionApproved) {
if (isHealthFood(drug)) return false;
if (isWesternRxDrug(drug)) return !!prescriptionApproved;
return drug && drug.type != 3;
}
export function canShowInstruction(drug, prescriptionApproved) {
if (isWesternRxDrug(drug)) return !!prescriptionApproved;
return true;
}
export function isPrescriptionApprovedStatus(data) {
if (!data) return false;
const ps = data.prescription_status ?? data.status;
return data.status === true || ps === 1 || ps === '1' || ps === 3 || ps === '3' || ps === 4 || ps === '4';
}