dev
This commit is contained in:
parent
99e7985ab9
commit
51c11beda3
|
|
@ -0,0 +1,215 @@
|
|||
<template>
|
||||
<Mask :top="50" :height="650" :width="900" :is-show="show">
|
||||
<CloseBtn @click="show = false"></CloseBtn>
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="header">追溯码采集</div>
|
||||
</template>
|
||||
<div class="detail">
|
||||
<el-input placeholder="请输入追溯码" v-model="inputIdCode" clearable @keydown.enter="openAssociationIdCode()">
|
||||
<template #prefix>
|
||||
<el-icon>
|
||||
<Monitor/>
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<div class="list">
|
||||
<table class="simple-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>发药项目</th>
|
||||
<th>产品标识码</th>
|
||||
<th>发药数量</th>
|
||||
<th>已采/应采</th>
|
||||
<th>追溯码</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item,index) in list" :key="index">
|
||||
<td>{{ item.name }}</td>
|
||||
<td>
|
||||
<IdCodeListShow :idCodeList="item.idCode" v-if="item.idCode.length>0"/>
|
||||
<div v-else>未关联</div>
|
||||
</td>
|
||||
<td>{{ item.retailNumber }}{{ item.selectedUnit }}</td>
|
||||
<td>{{ item.gatherNumber }}/{{ item.retailNumber }}</td>
|
||||
<td>
|
||||
<TraceabilityCodeAdd :item="item"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="bottom-btn">
|
||||
<el-button @click="saveRetail()" type="primary">确定</el-button>
|
||||
<el-button @click="show = false">关闭</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-card>
|
||||
<AssociationIdCode ref="associationIdCodeRef" @addIdCode="cleanInputIdCode"></AssociationIdCode>
|
||||
</Mask>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import Mask from "@/components/Mask.vue";
|
||||
import CloseBtn from "@/components/CloseBtn.vue";
|
||||
import {nextTick, ref} from "vue";
|
||||
import IdCodeListShow from "@/components/retail/IdCodeListShow.vue";
|
||||
import AssociationIdCode from "@/components/retail/AssociationIdCode.vue";
|
||||
import TraceabilityCodeAdd from "@/components/retail/TraceabilityCodeAdd.vue";
|
||||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import {post} from "@/utils/request.ts";
|
||||
|
||||
|
||||
const show = ref(false)
|
||||
const list = ref()
|
||||
const orderInfo = ref()
|
||||
const init = (data: any) => {
|
||||
list.value = data
|
||||
console.log(list)
|
||||
show.value = true
|
||||
}
|
||||
const close = () => {
|
||||
show.value = false
|
||||
}
|
||||
defineExpose({init, close})
|
||||
const emit = defineEmits(['confirm'])
|
||||
const saveRetail = () => {
|
||||
if (!checkTraceCode()) {
|
||||
ElMessageBox.confirm(
|
||||
`追溯码采集未完成是否继续?`,
|
||||
'Warning',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
emit('confirm')
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
emit('confirm')
|
||||
}
|
||||
const checkTraceCode = () => {
|
||||
for (let i = 0; i < list.value.length; i++) {
|
||||
const item = list.value[i];
|
||||
if (item.gatherNumber !== item.retailNumber) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
const inputIdCode = ref()
|
||||
const associationIdCodeRef = ref()
|
||||
const openAssociationIdCode = () => {
|
||||
if (addTraceAbilityCode()) {
|
||||
return
|
||||
}
|
||||
nextTick(() => {
|
||||
associationIdCodeRef.value.init(inputIdCode.value, list.value)
|
||||
})
|
||||
}
|
||||
const addTraceAbilityCode = () => {
|
||||
for (let i = 0; i < list.value.length; i++) {
|
||||
let item = list.value[i];
|
||||
let idCode = inputIdCode.value.slice(0, 7);
|
||||
if (item.idCode.includes(idCode)) {
|
||||
addTraceabilityCodeDo(item);
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
const addTraceabilityCodeDo = (item: any) => {
|
||||
if (!item.traceAbilityCodeList) {
|
||||
item.traceAbilityCodeList = []
|
||||
}
|
||||
if (item.retailNumber == item.gatherNumber) {
|
||||
ElMessage({
|
||||
message: '采集数量已满',
|
||||
type: 'warning',
|
||||
})
|
||||
return
|
||||
}
|
||||
const index = item.traceAbilityCodeList.findIndex((codeObj: any) => codeObj.code === inputIdCode.value);
|
||||
if (index == -1 && item.selectedUnit == item.packagingUnit) {
|
||||
item.traceAbilityCodeList.push({
|
||||
code: inputIdCode.value,
|
||||
number: 1
|
||||
})
|
||||
cleanInputIdCode()
|
||||
getGatherNumber(item)
|
||||
return;
|
||||
}
|
||||
if (index == -1 && item.selectedUnit == item.minPackagingUnit) {
|
||||
|
||||
let needCodeCount = item.retailNumber - item.gatherNumber;
|
||||
let number = 1;
|
||||
if (needCodeCount >= item.minPackagingNumber) {
|
||||
number = item.minPackagingNumber;
|
||||
}
|
||||
if (needCodeCount < item.minPackagingNumber) {
|
||||
number = needCodeCount;
|
||||
}
|
||||
item.traceAbilityCodeList.push({
|
||||
code: inputIdCode.value,
|
||||
number: number
|
||||
})
|
||||
cleanInputIdCode()
|
||||
getGatherNumber(item)
|
||||
return;
|
||||
}
|
||||
if (item.selectedUnit == item.packagingUnit) {
|
||||
//没拆零 追溯码只能用一次
|
||||
ElMessage({
|
||||
message: '该追溯码已达到最大使用限制',
|
||||
type: 'warning',
|
||||
})
|
||||
return;
|
||||
} else {
|
||||
//拆零每一个追溯码最多使用minPackagingNumber次
|
||||
if (item.traceAbilityCodeList[index].number == item.minPackagingNumber) {
|
||||
ElMessage({
|
||||
message: '该追溯码已达到最大使用限制',
|
||||
type: 'warning',
|
||||
})
|
||||
return;
|
||||
}
|
||||
item.traceAbilityCodeList[index].number += 1;
|
||||
}
|
||||
cleanInputIdCode()
|
||||
getGatherNumber(item)
|
||||
console.log("item", item)
|
||||
}
|
||||
const getGatherNumber = (item: any) => {
|
||||
let gatherNumber = 0;
|
||||
for (let subItem of item.traceAbilityCodeList) {
|
||||
gatherNumber += subItem.number;
|
||||
}
|
||||
item.gatherNumber = gatherNumber;
|
||||
}
|
||||
|
||||
const cleanInputIdCode = () => {
|
||||
inputIdCode.value = ''
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.header {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.detail {
|
||||
.list {
|
||||
height: 400px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -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<any>()
|
||||
const editItem= () => {
|
||||
emit('edit');
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -20,8 +20,8 @@ const editItem= () => {
|
|||
<div class="footer">
|
||||
<div>总金额:<span class="text icon">¥</span><span class="text">{{ totalAmount || '0' }}</span></div>
|
||||
<div class="btn-group" v-if="status == 0">
|
||||
<el-button type="primary" disabled>追溯码</el-button>
|
||||
<el-button type="primary" @click="editItem">收费</el-button>
|
||||
<el-button type="primary" disabled @click="openCheckOut()">追溯码</el-button>
|
||||
<el-button type="primary" @click="save">收费</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</Panel>
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
@totalPriceChange="getOrderTotalPrice"></GoodsDetail>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<TotalPrice v-model="formData.totalPrice" @edit="saveAndCharge" :status="formData.status"></TotalPrice>
|
||||
<TotalPrice v-model="formData.totalPrice" @save="charge" :status="formData.status"></TotalPrice>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
|
|
@ -66,6 +66,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<CheckoutDetail ref="checkoutDetailRef"></CheckoutDetail>
|
||||
<Settlement
|
||||
ref="settlementRef"
|
||||
v-model="socialCard"
|
||||
|
|
@ -86,11 +87,11 @@ import DiagnosisSearchInput from "@/components/outpatient/DiagnosisSearchInput.v
|
|||
import Settlement from "@/components/charge/Settlement.vue";
|
||||
import TotalPrice from "@/components/charge/TotalPrice.vue";
|
||||
import psnCertTypes from "@/assets/config/directory/psnCertTypes.json"
|
||||
import {getKey} from "@/utils/discrotyUtil.ts";
|
||||
import antys from "@/assets/config/directory/antys.json"
|
||||
import RecordsLog from "@/components/charge/RecordsLog.vue";
|
||||
import PatientCard from "@/components/charge/PatientCard.vue";
|
||||
import {apiConfig} from "@/assets/config/apiConfig.ts";
|
||||
import CheckoutDetail from "@/components/charge/CheckoutDetail.vue";
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
const socialCard = ref<any>({payInfo: {}})
|
||||
const formData = ref<any>({
|
||||
|
|
@ -108,6 +109,56 @@ const delDraft = () => {
|
|||
})
|
||||
}
|
||||
const settlementRef = ref()
|
||||
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(() => {
|
||||
checkoutDetailRef.value.init(goodsList);
|
||||
})
|
||||
}
|
||||
|
||||
const saveAndCharge = () => {
|
||||
post('charge/save', {data: {...formData.value, doctorId: doctorId.value}}).then((res: any) => {
|
||||
formData.value.code = res
|
||||
|
|
@ -235,6 +286,7 @@ const list = () => {
|
|||
margin-right: 24px;
|
||||
|
||||
}
|
||||
|
||||
.doctor {
|
||||
width: 200px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue