1. 修复价格获取的bug,应该获取诊所|药店价格而不是总仓库的
This commit is contained in:
30
common/utils/drug.js
Normal file
30
common/utils/drug.js
Normal 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';
|
||||
}
|
||||
Reference in New Issue
Block a user