Merge branch 'main' of ssh://git.jizhiweb.cn:2222/clinic-v2/web
# Conflicts: # src/views/charge/index.vue
This commit is contained in:
commit
4638683b01
|
|
@ -0,0 +1,218 @@
|
||||||
|
<template>
|
||||||
|
<Mask :height="600" :width="700" :is-show="show">
|
||||||
|
<CloseBtn @click="show = false"></CloseBtn>
|
||||||
|
<el-card>
|
||||||
|
<div class="panel">
|
||||||
|
<div class="header">
|
||||||
|
请勾选该追溯码关联的发药项目商品
|
||||||
|
</div>
|
||||||
|
<div class="code">
|
||||||
|
<div class="before-code">
|
||||||
|
{{ traceabilityCode.slice(0, 7) }}
|
||||||
|
</div>
|
||||||
|
<div class="after-code">
|
||||||
|
{{ traceabilityCode.slice(7, traceabilityCode.length) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="table">
|
||||||
|
<table class="simple-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>选择</th>
|
||||||
|
<th>发药项目</th>
|
||||||
|
<th>产品标识码</th>
|
||||||
|
<th>系统处理</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="(item,index) in tableData">
|
||||||
|
<td><input class="blue-radio" type="radio" :value="item.id" v-model="selected"/></td>
|
||||||
|
<td>{{ item.name }}</td>
|
||||||
|
<td>
|
||||||
|
<IdCodeListShow :idCodeList="item.idCode" v-if="item.idCode && item.idCode.length > 0"/>
|
||||||
|
<div v-else>未关联</div>
|
||||||
|
</td>
|
||||||
|
<td style="width: 300px;">
|
||||||
|
<template v-if="selected === item.id">
|
||||||
|
关联产品标识码,采集追溯码自动识别商品
|
||||||
|
</template>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="addIdCode" type="primary">确定</el-button>
|
||||||
|
<el-button @click="show = false" type="primary">关闭</el-button>
|
||||||
|
</template>
|
||||||
|
</el-card>
|
||||||
|
</Mask>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
import Mask from "@/components/Mask.vue";
|
||||||
|
import {ref} from "vue"
|
||||||
|
import IdCodeListShow from "@/components/retail/IdCodeListShow.vue";
|
||||||
|
import CloseBtn from "@/components/CloseBtn.vue";
|
||||||
|
import {post} from "@/utils/request.ts";
|
||||||
|
import {ElMessage} from "element-plus";
|
||||||
|
|
||||||
|
interface TableItem {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
idCode?: string[] | undefined; // 可选属性,默认为 undefined
|
||||||
|
gatherNumber?: number;
|
||||||
|
retailNumber?: number;
|
||||||
|
packagingUnit?: string;
|
||||||
|
minPackagingUnit?: string;
|
||||||
|
selectedUnit?: string;
|
||||||
|
minPackagingNumber?: number;
|
||||||
|
traceAbilityCodeList?: { code: string; number: number }[];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const show = ref(false);
|
||||||
|
const traceabilityCode = ref("");
|
||||||
|
const tableData = ref<TableItem[]>([]);
|
||||||
|
const init = (newIdCode: any, newTableDate: any) => {
|
||||||
|
traceabilityCode.value = newIdCode;
|
||||||
|
tableData.value = newTableDate;
|
||||||
|
console.log(tableData)
|
||||||
|
show.value = true;
|
||||||
|
}
|
||||||
|
const selected = ref()
|
||||||
|
defineExpose({init})
|
||||||
|
const addIdCode = ()=>{
|
||||||
|
if (traceabilityCode.value ==""){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let idCode = traceabilityCode.value.slice(0, 7);
|
||||||
|
post("goods/goods/addIdCode",{goodsId:selected.value,idCode:idCode}).then((res:any)=>{
|
||||||
|
show.value = false;
|
||||||
|
for (let subItem of tableData.value){
|
||||||
|
if (subItem.id === selected.value){
|
||||||
|
subItem.idCode?.push(idCode);
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const selectedItem = tableData.value.find((item: any) => item.id === selected.value);
|
||||||
|
if(!selectedItem){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
addTraceabilityCode(selectedItem)
|
||||||
|
|
||||||
|
}
|
||||||
|
const getGatherNumber=(item:any)=>{
|
||||||
|
let gatherNumber = 0;
|
||||||
|
for (let subItem of item.traceAbilityCodeList){
|
||||||
|
gatherNumber+=subItem.number;
|
||||||
|
}
|
||||||
|
item.gatherNumber = gatherNumber;
|
||||||
|
}
|
||||||
|
const emit = defineEmits(["addIdCode"])
|
||||||
|
const addTraceabilityCode = (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 === traceabilityCode.value);
|
||||||
|
if (index == -1 && item.selectedUnit == item.packagingUnit){
|
||||||
|
item.traceAbilityCodeList.push({
|
||||||
|
code: traceabilityCode.value,
|
||||||
|
number: 1
|
||||||
|
})
|
||||||
|
traceabilityCode.value = "";
|
||||||
|
getGatherNumber(item)
|
||||||
|
emit("addIdCode")
|
||||||
|
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: traceabilityCode.value,
|
||||||
|
number: number
|
||||||
|
})
|
||||||
|
traceabilityCode.value = "";
|
||||||
|
getGatherNumber(item)
|
||||||
|
emit("addIdCode")
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
traceabilityCode.value = "";
|
||||||
|
getGatherNumber(item)
|
||||||
|
emit("addIdCode")
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.panel {
|
||||||
|
height: 400px;
|
||||||
|
.header {
|
||||||
|
margin-top: 20px;
|
||||||
|
font-size: 24px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code {
|
||||||
|
height: 50px;
|
||||||
|
display: flex;
|
||||||
|
font-size: 24px;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.before-code {
|
||||||
|
color: #7a8794;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.after-code {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.table {
|
||||||
|
.simple-table {
|
||||||
|
.blue-radio {
|
||||||
|
accent-color: #28addd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,177 @@
|
||||||
|
<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&&item.idCode.length>0"/>
|
||||||
|
<div v-else>未关联</div>
|
||||||
|
</td>
|
||||||
|
<td>{{ item.selectedNum }}{{ item.selectedUnit }}</td>
|
||||||
|
<td>{{ item.traceAbilityCodeList ? item.traceAbilityCodeList.length : 0 }}/{{ item.shouldNumber }}</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/charge/IdCodeListShow.vue";
|
||||||
|
import AssociationIdCode from "@/components/charge/AssociationIdCode.vue";
|
||||||
|
import TraceabilityCodeAdd from "@/components/charge/TraceabilityCodeAdd.vue";
|
||||||
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
|
import {Monitor} from '@element-plus/icons-vue'
|
||||||
|
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.traceAbilityCodeList || item.shouldNumber !== item.traceAbilityCodeList.length) {
|
||||||
|
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) break
|
||||||
|
if (item.idCode.includes(idCode)) {
|
||||||
|
addTraceabilityCodeDo(item);
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const addTraceabilityCodeDo = (item: any) => {
|
||||||
|
if (!item.traceAbilityCodeList) {
|
||||||
|
item.traceAbilityCodeList = []
|
||||||
|
}
|
||||||
|
let traceAbilityCodeListList = item.traceAbilityCodeList.length
|
||||||
|
|
||||||
|
if (traceAbilityCodeListList == item.shouldNumber) {
|
||||||
|
ElMessage({
|
||||||
|
message: '采集数量已满',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const index = item.traceAbilityCodeList.findIndex((codeObj: any) => codeObj.code === inputIdCode.value);
|
||||||
|
if (index != -1) {
|
||||||
|
ElMessage({
|
||||||
|
message: '该追溯码已采集',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
item.traceAbilityCodeList.push(inputIdCode.value)
|
||||||
|
cleanInputIdCode()
|
||||||
|
getGatherNumber(item)
|
||||||
|
}
|
||||||
|
const getGatherNumber = (item: any) => {
|
||||||
|
item.shouldNumber = item.traceAbilityCodeList?item.traceAbilityCodeList.length:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cleanInputIdCode = () => {
|
||||||
|
inputIdCode.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.header {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail {
|
||||||
|
.list {
|
||||||
|
height: 400px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const props = defineProps({
|
||||||
|
idCodeList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-popover
|
||||||
|
title="已关联的追溯码产品标识码:"
|
||||||
|
placement="bottom-start"
|
||||||
|
trigger="hover"
|
||||||
|
width="250px"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<div class="id-code-panel">
|
||||||
|
<div class="code" v-if="props.idCodeList.length >0">{{props.idCodeList[0]}}</div>
|
||||||
|
<div class="number" v-if="props.idCodeList.length >1">
|
||||||
|
+{{props.idCodeList.length-1}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
<div class="id-code-detail">
|
||||||
|
<div class="item" v-for="(item,index) in props.idCodeList" :key="index">
|
||||||
|
{{index+1}}.{{item}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-popover>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.id-code-panel{
|
||||||
|
display: flex;
|
||||||
|
.number{
|
||||||
|
margin-left: 10px;
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -2,26 +2,27 @@
|
||||||
import Panel from '../common/Panel.vue';
|
import Panel from '../common/Panel.vue';
|
||||||
import {defineEmits, defineModel,defineProps} from 'vue'
|
import {defineEmits, defineModel,defineProps} from 'vue'
|
||||||
const {status}=defineProps(['status'])
|
const {status}=defineProps(['status'])
|
||||||
const emit = defineEmits(['save','deleteItem','edit']);
|
const emit = defineEmits(['save','deleteItem','edit','openCheckOut']);
|
||||||
const save = () => {
|
const save = () => {
|
||||||
emit('save');
|
emit('save');
|
||||||
};
|
};
|
||||||
|
const openCheckOut= () => {
|
||||||
|
emit('openCheckOut');
|
||||||
|
};
|
||||||
const deleteItem = () => {
|
const deleteItem = () => {
|
||||||
emit('deleteItem');
|
emit('deleteItem');
|
||||||
};
|
};
|
||||||
const totalAmount = defineModel<any>()
|
const totalAmount = defineModel<any>()
|
||||||
const editItem= () => {
|
|
||||||
emit('edit');
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Panel :showTools="false" :showHeader="false">
|
<Panel :showTools="false" :showHeader="false">
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div>总金额:<span class="text icon">¥</span><span class="text">{{ totalAmount || '0' }}</span></div>
|
<div>总金额:<span class="text icon">¥</span><span class="text">{{ totalAmount || '0' }}</span></div>
|
||||||
<div class="btn-group" v-if="status">
|
<div class="btn-group" v-if="status == 0">
|
||||||
<el-button type="primary" disabled>追溯码</el-button>
|
<el-button type="primary" @click="openCheckOut()">追溯码</el-button>
|
||||||
<el-button type="primary" @click="editItem">收费</el-button>
|
<el-button type="primary" @click="save">收费</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,174 @@
|
||||||
|
<template>
|
||||||
|
<el-popover
|
||||||
|
title="追溯码:"
|
||||||
|
placement="bottom-start"
|
||||||
|
trigger="click"
|
||||||
|
width="300px"
|
||||||
|
>
|
||||||
|
<template #reference>
|
||||||
|
<el-input
|
||||||
|
placeholder="追溯码"
|
||||||
|
clearable
|
||||||
|
v-model="inputTraceabilityCode"
|
||||||
|
style="width: 300px;"
|
||||||
|
@keydown.enter="addTraceabilityCodeDo(props.item)"
|
||||||
|
></el-input>
|
||||||
|
</template>
|
||||||
|
<template #default>
|
||||||
|
<div v-for="(subItem,index) in item.traceAbilityCodeList" class="list">
|
||||||
|
<div class="code"> {{ subItem.code }}</div>
|
||||||
|
<div class="remove" @click="removeTraceAbility(item)">
|
||||||
|
<el-icon>
|
||||||
|
<CloseBold/>
|
||||||
|
</el-icon>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-popover>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {ref,watch} from "vue";
|
||||||
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
|
import {CloseBold} from "@element-plus/icons-vue";
|
||||||
|
import {post} from "@/utils/request.ts";
|
||||||
|
interface TraceAbilityCode {
|
||||||
|
code: string;
|
||||||
|
number: number;
|
||||||
|
showNumberInput?: boolean;
|
||||||
|
}
|
||||||
|
const props = defineProps({
|
||||||
|
item: {
|
||||||
|
type: Object as () => {
|
||||||
|
id?: number|undefined;
|
||||||
|
traceAbilityCodeList: TraceAbilityCode[];
|
||||||
|
retailNumber: number;
|
||||||
|
gatherNumber: number;
|
||||||
|
selectedUnit: string;
|
||||||
|
idCode: string[];
|
||||||
|
packagingUnit: string;
|
||||||
|
minPackagingUnit: string;
|
||||||
|
minPackagingNumber: number;
|
||||||
|
},
|
||||||
|
default: () => ({
|
||||||
|
traceAbilityCodeList: [],
|
||||||
|
retailNumber: 0,
|
||||||
|
gatherNumber: 0,
|
||||||
|
selectedUnit: "",
|
||||||
|
idCode:[],
|
||||||
|
packagingUnit: "",
|
||||||
|
minPackagingUnit: "",
|
||||||
|
minPackagingNumber: 0,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const getGatherNumber = (item: any) => {
|
||||||
|
item.shouldNumber = item.traceAbilityCodeList?item.traceAbilityCodeList.length:0;
|
||||||
|
}
|
||||||
|
const inputTraceabilityCode = ref("");
|
||||||
|
const addTraceabilityCodeDo = (item: any) => {
|
||||||
|
if (!item.traceAbilityCodeList) {
|
||||||
|
item.traceAbilityCodeList = []
|
||||||
|
}
|
||||||
|
let traceAbilityCodeListList = item.traceAbilityCodeList.length
|
||||||
|
|
||||||
|
if (traceAbilityCodeListList == item.shouldNumber) {
|
||||||
|
ElMessage({
|
||||||
|
message: '采集数量已满',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const index = item.traceAbilityCodeList.findIndex((codeObj: any) => codeObj.code === inputTraceabilityCode.value);
|
||||||
|
if (index != -1) {
|
||||||
|
ElMessage({
|
||||||
|
message: '该追溯码已采集',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
item.traceAbilityCodeList.push(inputTraceabilityCode.value)
|
||||||
|
inputTraceabilityCode.value = "";
|
||||||
|
getGatherNumber(item)
|
||||||
|
}
|
||||||
|
const removeTraceAbility = (item: any) => {
|
||||||
|
item.traceAbilityCodeList.splice(item.traceAbilityCodeList.findIndex((codeObj: any) => codeObj.code === inputTraceabilityCode.value), 1)
|
||||||
|
getGatherNumber(item)
|
||||||
|
}
|
||||||
|
const changeNumber=ref(0);
|
||||||
|
const openNumberInput = (subItem: any) => {
|
||||||
|
subItem.showNumberInput = true;
|
||||||
|
changeNumber.value = subItem.number;
|
||||||
|
}
|
||||||
|
const handleNumberChange = (subItem:any)=>{
|
||||||
|
let limit = 1;
|
||||||
|
if (props.item.selectedUnit == props.item.minPackagingUnit){
|
||||||
|
limit = props.item.minPackagingNumber;
|
||||||
|
}
|
||||||
|
if (changeNumber.value>limit) {
|
||||||
|
ElMessage({
|
||||||
|
message: '单个追溯码采集数量超过限制',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
subItem.showNumberInput = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 可以在这里添加具体的处理逻辑
|
||||||
|
let totalNumber = 0;
|
||||||
|
for (let subItem of props.item.traceAbilityCodeList) {
|
||||||
|
totalNumber += subItem.number;
|
||||||
|
}
|
||||||
|
totalNumber = totalNumber - subItem.number + changeNumber.value;
|
||||||
|
if (totalNumber > props.item.retailNumber) {
|
||||||
|
ElMessage({
|
||||||
|
message: '采集数量超过上限',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
subItem.showNumberInput = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
subItem.number = changeNumber.value;
|
||||||
|
}
|
||||||
|
const addIdCode = (idCode:any)=>{
|
||||||
|
if (idCode==null || idCode.value ==""){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (props.item.idCode.includes(idCode)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
`当前标识码未绑定是否确认绑定标识码?`,
|
||||||
|
'Warning',
|
||||||
|
{
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
}).then(() => {
|
||||||
|
post("goods/goods/addIdCode",{goodsId:props.item.id,idCode:idCode}).then((res:any)=>{
|
||||||
|
props.item.idCode.push(idCode);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.list {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.code {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.number {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove {
|
||||||
|
font-size: 16px;
|
||||||
|
width: 50px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
<el-table-column prop="number" label="数量">
|
<el-table-column prop="number" label="数量">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div v-if="props.status">
|
<div v-if="props.status">
|
||||||
<el-input-number v-model="scope.row.selectedNum" :min="0" @change="handleNumChange"
|
<el-input-number v-model="scope.row.selectedNum" :min="0" @change="handleNumChange(scope.row)"
|
||||||
size="small"></el-input-number>
|
size="small"></el-input-number>
|
||||||
<el-dropdown>
|
<el-dropdown>
|
||||||
<span style="line-height: 30px;margin-left: 10px">{{ scope.row.selectedUnit }}</span>
|
<span style="line-height: 30px;margin-left: 10px">{{ scope.row.selectedUnit }}</span>
|
||||||
|
|
@ -156,6 +156,10 @@ const goodsSelect = (row: any) => {
|
||||||
row.selectedNum = 1
|
row.selectedNum = 1
|
||||||
row.selectedUnit = row.packagingUnit
|
row.selectedUnit = row.packagingUnit
|
||||||
row.selectedPrice = row.unitPrice
|
row.selectedPrice = row.unitPrice
|
||||||
|
row.shouldNumber = 1;
|
||||||
|
row.idCode = row.idCode.split(",")
|
||||||
|
|
||||||
|
|
||||||
if (goodsDetail.value.find((i: any) => i.id == row.id)) {
|
if (goodsDetail.value.find((i: any) => i.id == row.id)) {
|
||||||
ElMessage.warning("数据已存在,只能加数量")
|
ElMessage.warning("数据已存在,只能加数量")
|
||||||
goodsDetail.value.find((i: any) => i.id == row.id).selectedNum += 1
|
goodsDetail.value.find((i: any) => i.id == row.id).selectedNum += 1
|
||||||
|
|
@ -178,7 +182,16 @@ const selectUnit = (item: any, unit: any) => {
|
||||||
|
|
||||||
}
|
}
|
||||||
const emit = defineEmits(["totalPriceChange", 'focus'])
|
const emit = defineEmits(["totalPriceChange", 'focus'])
|
||||||
const handleNumChange = () => {
|
const handleNumChange = (row:any) => {
|
||||||
|
//应采数量
|
||||||
|
let shouldNumber = 0;
|
||||||
|
if (row.selectedUnit == row.packagingUnit) {
|
||||||
|
shouldNumber = row.selectedNum
|
||||||
|
} else {
|
||||||
|
shouldNumber = Math.ceil(row.selectedNum / row.minPackagingNumber)
|
||||||
|
}
|
||||||
|
row.shouldNumber = shouldNumber
|
||||||
|
|
||||||
emit('totalPriceChange')
|
emit('totalPriceChange')
|
||||||
}
|
}
|
||||||
const getTotalPrice = () => {
|
const getTotalPrice = () => {
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@ const emit = defineEmits(['totalPriceChange', 'focus'])
|
||||||
const serviceSelect = (row: any) => {
|
const serviceSelect = (row: any) => {
|
||||||
row.selectedNum = 1
|
row.selectedNum = 1
|
||||||
row.selectedUnit = row.unit
|
row.selectedUnit = row.unit
|
||||||
|
|
||||||
row.selectedPrice = row.unitPrice
|
row.selectedPrice = row.unitPrice
|
||||||
if (itemDetail.value.find((i: any) => i.id == row.id)) {
|
if (itemDetail.value.find((i: any) => i.id == row.id)) {
|
||||||
ElMessage.warning("数据已存在,只能加数量")
|
ElMessage.warning("数据已存在,只能加数量")
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
@totalPriceChange="getOrderTotalPrice" :statusDisabled="statusDisabled==1"></GoodsDetail>
|
@totalPriceChange="getOrderTotalPrice" :statusDisabled="statusDisabled==1"></GoodsDetail>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom">
|
<div class="bottom">
|
||||||
<TotalPrice v-model="formData.totalPrice" @edit="saveAndCharge" :status="!(statusDisabled)&&formData.status==0"></TotalPrice>
|
<TotalPrice v-model="formData.totalPrice" @save="charge" :status="formData.status" @openCheckOut ="openCheckoutDetail(formData.goodsDetail)"></TotalPrice>
|
||||||
</div>
|
</div>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -67,6 +67,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<CheckoutDetail ref="checkoutDetailRef"></CheckoutDetail>
|
||||||
<Settlement
|
<Settlement
|
||||||
ref="settlementRef"
|
ref="settlementRef"
|
||||||
v-model="socialCard"
|
v-model="socialCard"
|
||||||
|
|
@ -87,11 +88,11 @@ import DiagnosisSearchInput from "@/components/outpatient/DiagnosisSearchInput.v
|
||||||
import Settlement from "@/components/charge/Settlement.vue";
|
import Settlement from "@/components/charge/Settlement.vue";
|
||||||
import TotalPrice from "@/components/charge/TotalPrice.vue";
|
import TotalPrice from "@/components/charge/TotalPrice.vue";
|
||||||
import psnCertTypes from "@/assets/config/directory/psnCertTypes.json"
|
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 RecordsLog from "@/components/charge/RecordsLog.vue";
|
||||||
import PatientCard from "@/components/charge/PatientCard.vue";
|
import PatientCard from "@/components/charge/PatientCard.vue";
|
||||||
import {apiConfig} from "@/assets/config/apiConfig.ts";
|
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 socialCard = ref<any>({payInfo: {}})
|
||||||
const formData = ref<any>({
|
const formData = ref<any>({
|
||||||
|
|
@ -110,6 +111,117 @@ const delDraft = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const settlementRef = ref()
|
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];
|
||||||
|
if (!item.traceAbilityCodeList || item.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
|
||||||
|
nextTick(() => {
|
||||||
|
settlementRef.value?.init(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<any>("")
|
||||||
|
const patientCardRef = ref()
|
||||||
|
const clickItem = async (item: any, status: any) => {
|
||||||
|
statusDisabled.value = status
|
||||||
|
formData.value = await post('medical/record/getByDiagnosisCode', {diagnosisCode: item.code})
|
||||||
|
//添加追溯码应采字段
|
||||||
|
for (let i =0;i<formData.value.goodsDetail.length;i++){
|
||||||
|
let goodsItem =formData.value.goodsDetail[i]
|
||||||
|
if (goodsItem.packagingUnit == goodsItem.selectedUnit){
|
||||||
|
goodsItem.shouldNumber = goodsItem.selectedNum;
|
||||||
|
}else {
|
||||||
|
goodsItem.shouldNumber = Math.ceil(goodsItem.selectedNum / goodsItem.minPackagingNumber);
|
||||||
|
}
|
||||||
|
goodsItem.idCode = goodsItem.idCode?.split(",")
|
||||||
|
}
|
||||||
|
|
||||||
|
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<any[]>([])
|
||||||
|
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()
|
||||||
|
})
|
||||||
const saveAndCharge = () => {
|
const saveAndCharge = () => {
|
||||||
post('charge/save', {data: {...formData.value, doctorId: doctorId.value}}).then((res: any) => {
|
post('charge/save', {data: {...formData.value, doctorId: doctorId.value}}).then((res: any) => {
|
||||||
formData.value.code = res
|
formData.value.code = res
|
||||||
|
|
@ -171,43 +283,44 @@ const orderCanceled = () => {
|
||||||
chargeQueueRef.value?.getOrderList()
|
chargeQueueRef.value?.getOrderList()
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getDockerList()
|
getDockerList()
|
||||||
list()
|
list()
|
||||||
})
|
|
||||||
const getOrderTotalPrice = () => {
|
|
||||||
let totalPrice = 0
|
|
||||||
formData.value.itemDetail?.forEach((item: any) => {
|
|
||||||
totalPrice += item.selectedPrice * item.selectedNum
|
|
||||||
})
|
})
|
||||||
formData.value.goodsDetail.forEach((item: any) => {
|
const getOrderTotalPrice = () => {
|
||||||
totalPrice += item.selectedPrice * item.selectedNum
|
let totalPrice = 0
|
||||||
})
|
formData.value.itemDetail?.forEach((item: any) => {
|
||||||
formData.value.preTotalPrice = totalPrice
|
totalPrice += item.selectedPrice * item.selectedNum
|
||||||
formData.value.totalPrice = totalPrice
|
})
|
||||||
}
|
formData.value.goodsDetail.forEach((item: any) => {
|
||||||
|
totalPrice += item.selectedPrice * item.selectedNum
|
||||||
|
})
|
||||||
|
formData.value.preTotalPrice = totalPrice
|
||||||
|
formData.value.totalPrice = totalPrice
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
expandTrigger: 'hover' as const,
|
expandTrigger: 'hover' as const,
|
||||||
}
|
}
|
||||||
|
|
||||||
const doctorId = ref<any>('')
|
const doctorId = ref<any>('')
|
||||||
const handleChange = (value: any) => {
|
const handleChange = (value: any) => {
|
||||||
doctorId.value = value[value.length - 1]
|
doctorId.value = value[value.length - 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cardTypeList = ref<any>(Object.entries(psnCertTypes).map(([id, name]) => ({id, name})))
|
||||||
|
const doctorList = ref<any>([])
|
||||||
|
const sectionDoctorOption = ref<any>('')
|
||||||
|
const list = () => {
|
||||||
|
post(apiConfig.OrganizationMemberSearch, {query: {role: 1}}).then((res: any) => {
|
||||||
|
doctorList.value = res
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const cardTypeList = ref<any>(Object.entries(psnCertTypes).map(([id, name]) => ({id, name})))
|
|
||||||
const doctorList = ref<any>([])
|
|
||||||
const sectionDoctorOption = ref<any>('')
|
|
||||||
const list = () => {
|
|
||||||
post(apiConfig.OrganizationMemberSearch, {query: {role: 1}}).then((res: any) => {
|
|
||||||
doctorList.value = res
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const getStatus=(status:any)=>{
|
const getStatus=(status:any)=>{
|
||||||
statusDisabled.value = status
|
statusDisabled.value = status
|
||||||
formData.value = {
|
formData.value = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue