1. 特色方功能迭代(固定价格),固定价格目前统一使用药品id(-102),后期会考虑新增特色方的时候自动添加一个特色方药品
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
2. 退款的时候可以退回分成
This commit is contained in:
@@ -22,6 +22,11 @@ import {
|
||||
calcTotalMarginPercent,
|
||||
isSeeRateEnabled,
|
||||
} from '#/utils/chinesePrescriptionMargin';
|
||||
import { calculateProcessingFee, parsePriceValue } from '#/utils/formatPrice';
|
||||
import {
|
||||
applySingleChildProcessRuleAutoSelect,
|
||||
resolveProcessRuleLoadedLevel,
|
||||
} from '#/utils/processRuleCascade';
|
||||
import { getRegisterStoreInfo as getRegisterStoreInfoPharmacy } from '#/views/doctor/online-consultation/api';
|
||||
import { getRegisterStoreInfo as getRegisterStoreInfoClinic } from '#/views/doctor/online-consultation-clinic/api';
|
||||
import traditionalJson from '#/views/business/chat/config/traditional.json';
|
||||
@@ -121,31 +126,16 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
);
|
||||
});
|
||||
|
||||
const processRulePrice = ref(0);
|
||||
const calcMethod = ref(0);
|
||||
|
||||
const processingFee = computed(() => {
|
||||
if (ruleType.value === 1) return 0;
|
||||
if (currentDrugs.value.length === 0) return 0;
|
||||
|
||||
if (ruleType.value !== 2 || currentDrugs.value.length === 0) return 0;
|
||||
const processRule = childProcessRuleList.value.find(
|
||||
(item) => item.id === childProcessRuleId.value,
|
||||
);
|
||||
if (!processRule) return 0;
|
||||
|
||||
calcMethod.value = processRule.calc_method;
|
||||
processRulePrice.value = processRule.price;
|
||||
|
||||
if (calcMethod.value === 1) return processRulePrice.value;
|
||||
if (calcMethod.value === 2) return processRulePrice.value * dosage.value;
|
||||
if (calcMethod.value === 3) {
|
||||
const totalNumber = currentDrugs.value.reduce(
|
||||
(sum, drug) => sum + drug.number,
|
||||
0,
|
||||
);
|
||||
return processRulePrice.value * dosage.value * totalNumber;
|
||||
}
|
||||
return 0;
|
||||
const totalQty = currentDrugs.value.reduce(
|
||||
(sum, drug) => sum + parsePriceValue(drug.number ?? 1),
|
||||
0,
|
||||
);
|
||||
return calculateProcessingFee(processRule, dosage.value, totalQty);
|
||||
});
|
||||
|
||||
const totalCost = computed(() => {
|
||||
@@ -393,6 +383,38 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
} else {
|
||||
childProcessRuleList.value = res;
|
||||
}
|
||||
await applySingleChildProcessRuleAutoSelect(
|
||||
resolveProcessRuleLoadedLevel(pid, ruleId),
|
||||
{
|
||||
ruleType: ruleType.value,
|
||||
processRuleId: processRuleId.value,
|
||||
childProcessRuleId: childProcessRuleId.value,
|
||||
processRuleNoteId: processRuleNoteId.value,
|
||||
processRuleList: processRuleList.value,
|
||||
childProcessRuleList: childProcessRuleList.value,
|
||||
processRuleNoteList: processRuleNoteList.value,
|
||||
load: getProcessRuleListData,
|
||||
setProcessRuleId: (id) => {
|
||||
processRuleId.value = id;
|
||||
},
|
||||
setChildProcessRuleId: (id) => {
|
||||
childProcessRuleId.value = id;
|
||||
},
|
||||
setProcessRuleNoteId: (id) => {
|
||||
processRuleNoteId.value = id;
|
||||
},
|
||||
clearBelowProcessRule: () => {
|
||||
childProcessRuleId.value = undefined;
|
||||
processRuleNoteId.value = undefined;
|
||||
childProcessRuleList.value = [];
|
||||
processRuleNoteList.value = [];
|
||||
},
|
||||
clearBelowChild: () => {
|
||||
processRuleNoteId.value = undefined;
|
||||
processRuleNoteList.value = [];
|
||||
},
|
||||
},
|
||||
);
|
||||
console.log('获取加工规则成功');
|
||||
} catch (error) {
|
||||
console.error('获取加工规则失败:', error);
|
||||
@@ -796,6 +818,62 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
packageMethodId.value = id;
|
||||
};
|
||||
|
||||
/**
|
||||
* 中药配置变更(标签选择,对齐移动端级联逻辑)
|
||||
*/
|
||||
const handleChineseConfigChange = async (payload: {
|
||||
ruleType?: number;
|
||||
packageMethodId?: number | null;
|
||||
processRuleId?: number | null;
|
||||
childProcessRuleId?: number | null;
|
||||
processRuleNoteId?: number | null;
|
||||
dosage?: number;
|
||||
dayDosage?: number;
|
||||
}) => {
|
||||
const oldRuleType = ruleType.value;
|
||||
const oldProcessRuleId = processRuleId.value;
|
||||
const oldChildProcessRuleId = childProcessRuleId.value;
|
||||
|
||||
if (payload.ruleType === 2 && payload.ruleType !== oldRuleType) {
|
||||
if (processRuleList.value.length === 0) {
|
||||
await getProcessRuleListData();
|
||||
}
|
||||
}
|
||||
if (payload.ruleType === 1 && oldRuleType === 2) {
|
||||
processRuleId.value = undefined;
|
||||
childProcessRuleId.value = undefined;
|
||||
processRuleNoteId.value = undefined;
|
||||
processRuleList.value = [];
|
||||
childProcessRuleList.value = [];
|
||||
processRuleNoteList.value = [];
|
||||
}
|
||||
if (payload.processRuleId != null && payload.processRuleId !== oldProcessRuleId) {
|
||||
childProcessRuleId.value = undefined;
|
||||
processRuleNoteId.value = undefined;
|
||||
childProcessRuleList.value = [];
|
||||
processRuleNoteList.value = [];
|
||||
}
|
||||
if (payload.childProcessRuleId != null && payload.childProcessRuleId !== oldChildProcessRuleId) {
|
||||
processRuleNoteId.value = undefined;
|
||||
processRuleNoteList.value = [];
|
||||
}
|
||||
|
||||
if (payload.ruleType != null) ruleType.value = payload.ruleType;
|
||||
if (payload.packageMethodId !== undefined) packageMethodId.value = payload.packageMethodId ?? 2;
|
||||
if (payload.processRuleId !== undefined) processRuleId.value = payload.processRuleId ?? undefined;
|
||||
if (payload.childProcessRuleId !== undefined) childProcessRuleId.value = payload.childProcessRuleId ?? undefined;
|
||||
if (payload.processRuleNoteId !== undefined) processRuleNoteId.value = payload.processRuleNoteId ?? undefined;
|
||||
if (payload.dosage != null) dosage.value = payload.dosage;
|
||||
if (payload.dayDosage != null) dayDosage.value = payload.dayDosage;
|
||||
|
||||
if (payload.processRuleId != null && payload.processRuleId !== oldProcessRuleId) {
|
||||
await getProcessRuleListData(payload.processRuleId);
|
||||
}
|
||||
if (payload.childProcessRuleId != null && payload.childProcessRuleId !== oldChildProcessRuleId) {
|
||||
await getProcessRuleListData(0, payload.childProcessRuleId);
|
||||
}
|
||||
};
|
||||
|
||||
// 中药相冲检查
|
||||
const checkChineseMedicineConflict = async () => {
|
||||
if (activeCategory.value === 2) {
|
||||
@@ -897,7 +975,7 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
child_process_rule_id: childProcessRuleId.value,
|
||||
process_rule_type: ruleType.value,
|
||||
prescription_type: activeCategory.value,
|
||||
processing_fee: processRulePrice.value,
|
||||
processing_fee: processingFee.value,
|
||||
dosage: dosage.value,
|
||||
day_dosage: dayDosage.value,
|
||||
doctor_second_sign: doctorSecondSignValue,
|
||||
@@ -958,7 +1036,6 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
diagnosis.value = '';
|
||||
medicalAdvice.value = '';
|
||||
packageMethodId.value = 2;
|
||||
processRulePrice.value = 0;
|
||||
dosage.value = 7;
|
||||
dayDosage.value = 2;
|
||||
newDrugInfo.value = {};
|
||||
@@ -1084,6 +1161,7 @@ export const usePrescriptionStore = defineStore('prescription', () => {
|
||||
selectProcessRuleNot,
|
||||
selectProcessRuleNotCommit,
|
||||
selectPackageMethod,
|
||||
handleChineseConfigChange,
|
||||
checkChineseMedicineConflict,
|
||||
sendPrescription,
|
||||
resetForm,
|
||||
|
||||
@@ -2,6 +2,7 @@ import { computed, ref, nextTick } from "vue"
|
||||
import { message, notification } from "ant-design-vue"
|
||||
import { debounce } from "lodash-es"
|
||||
|
||||
import { calculateProcessingFee, parsePriceValue } from '#/utils/formatPrice'
|
||||
import {
|
||||
addWestPrescription,
|
||||
checkChineseMedicineConflictApi,
|
||||
@@ -75,26 +76,14 @@ export const usePrescriptionStore = () => {
|
||||
return currentDrugs.value.reduce((sum, drug) => sum + drug.price * (drug.select_number || 1), 0)
|
||||
})
|
||||
|
||||
const processRulePrice = ref(0)
|
||||
const calcMethod = ref(0)
|
||||
|
||||
const processingFee = computed(() => {
|
||||
if (ruleType.value === 1) return 0
|
||||
if (currentDrugs.value.length === 0) return 0
|
||||
|
||||
if (ruleType.value !== 2 || currentDrugs.value.length === 0) return 0
|
||||
const processRule = childProcessRuleList.value.find((item) => item.id === childProcessRuleId.value)
|
||||
if (!processRule) return 0
|
||||
|
||||
calcMethod.value = processRule.calc_method
|
||||
processRulePrice.value = processRule.price
|
||||
|
||||
if (calcMethod.value === 1) return processRulePrice.value
|
||||
if (calcMethod.value === 2) return processRulePrice.value * dosage.value
|
||||
if (calcMethod.value === 3) {
|
||||
const totalNumber = currentDrugs.value.reduce((sum, drug) => sum + drug.number, 0)
|
||||
return processRulePrice.value * dosage.value * totalNumber
|
||||
}
|
||||
return 0
|
||||
const totalQty = currentDrugs.value.reduce(
|
||||
(sum, drug) => sum + parsePriceValue(drug.number ?? 1),
|
||||
0,
|
||||
)
|
||||
return calculateProcessingFee(processRule, dosage.value, totalQty)
|
||||
})
|
||||
|
||||
const totalCost = computed(() => {
|
||||
@@ -548,7 +537,7 @@ export const usePrescriptionStore = () => {
|
||||
child_process_rule_id: childProcessRuleId.value,
|
||||
process_rule_type: ruleType.value,
|
||||
prescription_type: activeCategory.value,
|
||||
processing_fee: processRulePrice.value,
|
||||
processing_fee: processingFee.value,
|
||||
dosage: dosage.value,
|
||||
day_dosage: dayDosage.value,
|
||||
doctor_second_sign: doctorSecondSignValue,
|
||||
@@ -569,7 +558,6 @@ export const usePrescriptionStore = () => {
|
||||
diagnosis.value = ""
|
||||
medicalAdvice.value = ""
|
||||
packageMethodId.value = 2
|
||||
processRulePrice.value = 0
|
||||
dosage.value = 7
|
||||
dayDosage.value = 2
|
||||
newDrugInfo.value = {}
|
||||
|
||||
Reference in New Issue
Block a user