diff --git a/src/components/charge/CheckoutDetail.vue b/src/components/charge/CheckoutDetail.vue new file mode 100644 index 0000000..11c24c5 --- /dev/null +++ b/src/components/charge/CheckoutDetail.vue @@ -0,0 +1,215 @@ + + + + + + 追溯码采集 + + + + + + + + + + + + + + 发药项目 + 产品标识码 + 发药数量 + 已采/应采 + 追溯码 + + + + + {{ item.name }} + + + 未关联 + + {{ item.retailNumber }}{{ item.selectedUnit }} + {{ item.gatherNumber }}/{{ item.retailNumber }} + + + + + + + + + + + + + 确定 + 关闭 + + + + + + + + \ No newline at end of file diff --git a/src/components/charge/TotalPrice.vue b/src/components/charge/TotalPrice.vue index b6a5666..c05091e 100644 --- a/src/components/charge/TotalPrice.vue +++ b/src/components/charge/TotalPrice.vue @@ -2,17 +2,17 @@ import Panel from '../common/Panel.vue'; import {defineEmits, defineModel,defineProps} from 'vue' const {status}=defineProps(['status']) -const emit = defineEmits(['save','deleteItem','edit']); +const emit = defineEmits(['save','deleteItem','edit','openCheckOut']); const save = () => { emit('save'); }; +const openCheckOut= () => { + emit('openCheckOut'); +}; const deleteItem = () => { emit('deleteItem'); }; const totalAmount = defineModel() -const editItem= () => { - emit('edit'); -}; @@ -20,8 +20,8 @@ const editItem= () => { diff --git a/src/views/charge/index.vue b/src/views/charge/index.vue index 5e98816..34bd161 100644 --- a/src/views/charge/index.vue +++ b/src/views/charge/index.vue @@ -53,7 +53,7 @@ @totalPriceChange="getOrderTotalPrice"> - + @@ -66,6 +66,7 @@ + ({payInfo: {}}) const formData = ref({ @@ -108,101 +109,151 @@ const delDraft = () => { }) } const settlementRef = ref() -const saveAndCharge = () => { - post('charge/save', {data: {...formData.value, doctorId: doctorId.value}}).then((res: any) => { - formData.value.code = res +const charge = () => { + + if (checkTraceCode(formData.value.goodsDetail)) { + //保存订单 + saveAndCharge() + } else { + //打开追溯码详情页 + openCheckoutDetail(formData.value.goodsDetail) + } +} + + +const checkTraceCode = (goodsList: any[]) => { + + for (let i = 0; i < goodsList.length; i++) { + const item = goodsList[i]; + //应采数量 + let shouldNumber = 0; + if (item.selectedUnit == item.packagingUnit) { + shouldNumber = item.selectedNum + } else { + shouldNumber = Math.ceil(item.selectedNum / item.minPackagingNumber) + } + if (!item.traceAbilityCodeList || shouldNumber != item.traceAbilityCodeList.length) { + return false; + }else { + ElMessage({ + message: `${item.name}的追溯码采集未完成`, + type: 'warning', + }) + } + + } + return true; +} + const checkoutDetailRef = ref() + const openCheckoutDetail = (goodsList: any[]) => { + if (!goodsList || goodsList.length == 0) { + ElMessage({ + message: '没有商品信息,请先选择需要售卖的商品', + type: 'info', + plain: true, + }); + return + } nextTick(() => { - settlementRef.value?.init(res) + checkoutDetailRef.value.init(goodsList); }) - }) -} -const diagnosisSearchRef = ref() -const diagnosisSearchApi = "social/diagnose/search" -const diagnosisShowConfig = [ - { - label: "诊断名称", - prop: "name", - }, - { - label: "诊断编码", - prop: "code", } -] -const diagnosisSelect = (list: any) => { - const diagnosisNames = list.map((item: any) => item.name).join(',') - formData.value.diagnosisMedicalRecord.diagnosisDetail = JSON.stringify(list) - formData.value.diagnosisMedicalRecord.diagnosisSummary = diagnosisNames -} -const recordsConsumptionRef = ref("") -const patientCardRef = ref() -const clickItem = async (item: any, status: any) => { - statusDisabled.value = status - formData.value = await post('medical/record/getByDiagnosisCode', {diagnosisCode: item.code}) - getOrderTotalPrice() - nextTick(() => { - let list = JSON.parse(formData.value.diagnosisMedicalRecord.diagnosisDetail) - let nList = formData.value.diagnosisMedicalRecord.diagnosisSummary.split(',') - diagnosisSearchRef.value?.init(list, nList); - recordsConsumptionRef.value?.init(formData.value.patientInfo.id); - patientCardRef.value?.init(formData.value.registrationId); - }) -} -const dockerList = ref([]) -const getDockerList = () => { - let query = { - role: 1 + + const saveAndCharge = () => { + post('charge/save', {data: {...formData.value, doctorId: doctorId.value}}).then((res: any) => { + formData.value.code = res + nextTick(() => { + settlementRef.value?.init(res) + }) + }) } - post('organization/member/search', {query: query}).then((res: any) => { - dockerList.value = res + const diagnosisSearchRef = ref() + const diagnosisSearchApi = "social/diagnose/search" + const diagnosisShowConfig = [ + { + label: "诊断名称", + prop: "name", + }, + { + label: "诊断编码", + prop: "code", + } + ] + const diagnosisSelect = (list: any) => { + const diagnosisNames = list.map((item: any) => item.name).join(',') + formData.value.diagnosisMedicalRecord.diagnosisDetail = JSON.stringify(list) + formData.value.diagnosisMedicalRecord.diagnosisSummary = diagnosisNames + } + const recordsConsumptionRef = ref("") + const patientCardRef = ref() + const clickItem = async (item: any, status: any) => { + statusDisabled.value = status + formData.value = await post('medical/record/getByDiagnosisCode', {diagnosisCode: item.code}) + getOrderTotalPrice() + nextTick(() => { + let list = JSON.parse(formData.value.diagnosisMedicalRecord.diagnosisDetail) + let nList = formData.value.diagnosisMedicalRecord.diagnosisSummary.split(',') + diagnosisSearchRef.value?.init(list, nList); + recordsConsumptionRef.value?.init(formData.value.patientInfo.id); + patientCardRef.value?.init(formData.value.registrationId); + }) + } + const dockerList = ref([]) + const getDockerList = () => { + let query = { + role: 1 + } + post('organization/member/search', {query: query}).then((res: any) => { + dockerList.value = res + }) + } + const orderCompleted = () => { + nextTick(() => { + chargeQueueRef.value?.getOrderList() + }) + } + const orderCanceled = () => { + nextTick(() => { + chargeQueueRef.value?.getOrderList() + }) + + } + + + onMounted(() => { + getDockerList() + list() }) -} -const orderCompleted = () => { - nextTick(() => { - chargeQueueRef.value?.getOrderList() - }) -} -const orderCanceled = () => { - nextTick(() => { - chargeQueueRef.value?.getOrderList() - }) - -} + const getOrderTotalPrice = () => { + let totalPrice = 0 + formData.value.itemDetail?.forEach((item: any) => { + totalPrice += item.selectedPrice * item.selectedNum + }) + formData.value.goodsDetail.forEach((item: any) => { + totalPrice += item.selectedPrice * item.selectedNum + }) + formData.value.preTotalPrice = totalPrice + formData.value.totalPrice = totalPrice + } -onMounted(() => { - getDockerList() - list() -}) -const getOrderTotalPrice = () => { - let totalPrice = 0 - formData.value.itemDetail?.forEach((item: any) => { - totalPrice += item.selectedPrice * item.selectedNum - }) - formData.value.goodsDetail.forEach((item: any) => { - totalPrice += item.selectedPrice * item.selectedNum - }) - formData.value.preTotalPrice = totalPrice - formData.value.totalPrice = totalPrice -} + const props = { + expandTrigger: 'hover' as const, + } + const doctorId = ref('') + const handleChange = (value: any) => { + doctorId.value = value[value.length - 1] + } -const props = { - expandTrigger: 'hover' as const, -} - -const doctorId = ref('') -const handleChange = (value: any) => { - doctorId.value = value[value.length - 1] -} - -const cardTypeList = ref(Object.entries(psnCertTypes).map(([id, name]) => ({id, name}))) -const doctorList = ref([]) -const sectionDoctorOption = ref('') -const list = () => { - post(apiConfig.OrganizationMemberSearch, {query: {role: 1}}).then((res: any) => { - doctorList.value = res - }) -} + const cardTypeList = ref(Object.entries(psnCertTypes).map(([id, name]) => ({id, name}))) + const doctorList = ref([]) + const sectionDoctorOption = ref('') + const list = () => { + post(apiConfig.OrganizationMemberSearch, {query: {role: 1}}).then((res: any) => { + doctorList.value = res + }) + }