|
@ -81,7 +81,7 @@
|
|
|
import Scan from './components/Scan.vue';
|
|
|
import Result from './components/Result.vue';
|
|
|
import medicineAbinetApi from '@/api/api-medicineAbinet'
|
|
|
var countDownFunc
|
|
|
var countDownFunc, timeoutInterval, readCardCountDown
|
|
|
export default {
|
|
|
name: "machineIndex",
|
|
|
components: {
|
|
@ -110,7 +110,6 @@ export default {
|
|
|
orderInfo: '',
|
|
|
orderList: [],
|
|
|
times: 30,
|
|
|
inReadCard: false,
|
|
|
shippingType: '', //取药方式(1、扫码,2、医保卡)
|
|
|
inOut: false
|
|
|
}
|
|
@ -198,10 +197,10 @@ export default {
|
|
|
return v.status===0
|
|
|
})
|
|
|
if(list.length){
|
|
|
this.orderList = list || []
|
|
|
if(list.length == 1){
|
|
|
this.showOrderDetail(res.obj.orderList[0])
|
|
|
this.showOrderDetail(list[0])
|
|
|
} else {
|
|
|
this.orderList = res.obj.orderList || []
|
|
|
this.rsType = 5
|
|
|
this.step = 3
|
|
|
}
|
|
@ -292,7 +291,7 @@ export default {
|
|
|
} else {
|
|
|
this.updateOrderOutStatus(item.id, 3, msgobj.mess)
|
|
|
.then(res=>{
|
|
|
this.shipComplete(msgobj.mess)
|
|
|
this.shipComplete(`出药异常中断,请联系管理员(${msgobj.mess})`)
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
@ -308,9 +307,13 @@ export default {
|
|
|
if(this.inCheckBarcode || this.step!=2){
|
|
|
return
|
|
|
}
|
|
|
this.inCheckBarcode = true
|
|
|
this.checkOrderAndReturn({pickUpNum: msgobj.mess})
|
|
|
} else if(msgobj.type == 'CardInfo'){
|
|
|
this.inReadCard = false
|
|
|
if(!readCardCountDown){
|
|
|
return
|
|
|
}
|
|
|
this.clearReadCardCountDown()
|
|
|
if (msgobj.mess.indexOf("异常") != -1) {
|
|
|
this.$toast(msgobj.mess)
|
|
|
return
|
|
@ -342,19 +345,18 @@ export default {
|
|
|
},
|
|
|
sendReadCard: function() {
|
|
|
this.$loading('加载中..')
|
|
|
this.inReadCard = true
|
|
|
this.clearReadCardCountDown()
|
|
|
readCardCountDown = setTimeout(()=>{
|
|
|
this.$toast('读取医保卡失败')
|
|
|
}, 10 * 1000)
|
|
|
|
|
|
var obj = {
|
|
|
type: "ReadCard",
|
|
|
mess: ""
|
|
|
}
|
|
|
this.socket.send(JSON.stringify(obj));
|
|
|
setTimeout(()=>{
|
|
|
if(this.inReadCard){
|
|
|
this.inReadCard = false
|
|
|
this.$toast('读取医保卡失败')
|
|
|
}
|
|
|
}, 10 * 1000)
|
|
|
},
|
|
|
|
|
|
sendShipment: function() {
|
|
|
clearInterval(countDownFunc)
|
|
|
this.currindex = 0;
|
|
@ -368,6 +370,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
nextShipment: function(row) {
|
|
|
this.resetTimeoutInterval()
|
|
|
//检查刷新是否已经完成数据,没有完成继续,这个设计是为了防断网
|
|
|
var obj = {
|
|
|
type: "Shipment",
|
|
@ -517,13 +520,18 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
shipComplete(msg){
|
|
|
if(!this.inOut){
|
|
|
//已出药完成
|
|
|
return
|
|
|
}
|
|
|
this.inOut = false
|
|
|
this.clearTimeoutInterval()
|
|
|
this.$toast.clear()
|
|
|
this.orderList.splice(this.orderList.indexOf(this.orderInfo), 1)
|
|
|
if(msg){
|
|
|
this.$dialog.alert({
|
|
|
title: '',
|
|
|
message: '出药异常中断,请联系管理员',
|
|
|
message: msg,
|
|
|
confirmButtonText: "返回首页"
|
|
|
}).then(() => {
|
|
|
this.step = 1
|
|
@ -541,6 +549,29 @@ export default {
|
|
|
}
|
|
|
this.times--
|
|
|
}, 1000)
|
|
|
},
|
|
|
clearTimeoutInterval(){
|
|
|
if(timeoutInterval){
|
|
|
clearTimeout(timeoutInterval)
|
|
|
}
|
|
|
},
|
|
|
clearReadCardCountDown(){
|
|
|
if(readCardCountDown){
|
|
|
clearTimeout(readCardCountDown)
|
|
|
readCardCountDown = undefined
|
|
|
}
|
|
|
},
|
|
|
resetTimeoutInterval(){
|
|
|
this.clearTimeoutInterval()
|
|
|
timeoutInterval = setTimeout(()=>{
|
|
|
var msg = "出药超时,请联系管理员"
|
|
|
var item = this.orderdetail[this.currindex]
|
|
|
this.shipComplete(msg)
|
|
|
this.updateOrderOutStatus(item.id, 3, msg)
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
}, 15 * 1000)
|
|
|
}
|
|
|
},
|
|
|
destroyed() {
|