|
@ -2,7 +2,7 @@
|
|
|
<div class="machine-index">
|
|
|
<div v-show="step===0" class="tc">
|
|
|
<div class="plr15 pt20">
|
|
|
<van-field v-model="deviceNum" label="" placeholder="请输入设备编号" />
|
|
|
<van-field v-model="deviceNum" clearable label="" placeholder="请输入设备编号" />
|
|
|
</div>
|
|
|
<div class="tc mt20">
|
|
|
<van-button color="#17b3ec" @click="init" type="primary"> 启动 </van-button>
|
|
@ -14,20 +14,29 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="video-swipe">
|
|
|
<van-swipe :autoplay="3000" indicator-color="white">
|
|
|
<van-swipe-item>1</van-swipe-item>
|
|
|
<van-swipe-item>2</van-swipe-item>
|
|
|
<van-swipe-item>3</van-swipe-item>
|
|
|
<van-swipe-item>4</van-swipe-item>
|
|
|
<van-swipe :autoplay="0" indicator-color="white">
|
|
|
<template v-if="videoList&& videoList.length">
|
|
|
<van-swipe-item v-for="(item, i) in videoList" :key="i">
|
|
|
<video class="swipe-item-video" :autoplay="i==0" loop controls muted :src="setImgUrl(item.url)"></video>
|
|
|
</van-swipe-item>
|
|
|
</template>
|
|
|
<van-swipe-item v-else>
|
|
|
<!-- <img class="swipe-item-img" src="./img/banner01.png"> -->
|
|
|
<video class="swipe-item-video" autoplay loop controls muted src="./img/default.mp4"></video>
|
|
|
</van-swipe-item>
|
|
|
</van-swipe>
|
|
|
</div>
|
|
|
|
|
|
<div class="img-swipe">
|
|
|
<van-swipe :autoplay="3000" indicator-color="white">
|
|
|
<van-swipe-item>1</van-swipe-item>
|
|
|
<van-swipe-item>2</van-swipe-item>
|
|
|
<van-swipe-item>3</van-swipe-item>
|
|
|
<van-swipe-item>4</van-swipe-item>
|
|
|
<template v-if="imgList && imgList.length">
|
|
|
<van-swipe-item v-for="(item, i) in imgList" :key="i">
|
|
|
<img class="swipe-item-img" :src="setImgUrl(item.url)">
|
|
|
</van-swipe-item>
|
|
|
</template>
|
|
|
<van-swipe-item v-else>
|
|
|
<img class="swipe-item-img" src="./img/banner01.png">
|
|
|
</van-swipe-item>
|
|
|
</van-swipe>
|
|
|
</div>
|
|
|
|
|
@ -60,14 +69,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<Scan v-show="step==2" @onBack="step=1"/>
|
|
|
<Result v-show="step==3" @onBack="step=2"/>
|
|
|
<Scan @onComplete="onComplete" v-show="step==2" @onBack="step=1"/>
|
|
|
<Result @outDrug="sendShipment" :rsType.sync="rsType" :orderdetail="orderdetail" v-show="step==3" @onBack="step=2"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import Scan from './components/Scan.vue';
|
|
|
import Result from './components/Result.vue';
|
|
|
|
|
|
import medicineAbinetApi from '@/api/api-medicineAbinet'
|
|
|
export default {
|
|
|
name: "machineIndex",
|
|
|
components: {
|
|
@ -76,7 +85,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
deviceNum: 'dev_001_T',
|
|
|
deviceNum: 'dev_001',
|
|
|
step: 0,
|
|
|
curImg: '',
|
|
|
illustrationMskShow: false,
|
|
@ -89,15 +98,79 @@ export default {
|
|
|
forceClose: false,
|
|
|
heartbitInterval: '',
|
|
|
currindex: 0,
|
|
|
orderdetail: []
|
|
|
orderdetail: [],
|
|
|
rsType: 1,
|
|
|
imgList: [],
|
|
|
videoList: []
|
|
|
}
|
|
|
},
|
|
|
created(){
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
devinfoAdvList(){
|
|
|
var p = {
|
|
|
equNum: this.deviceNum
|
|
|
}
|
|
|
medicineAbinetApi
|
|
|
.devinfoAdvList(p)
|
|
|
.then(res=>{
|
|
|
console.log('devinfoAdvList', res)
|
|
|
this.$toast.clear()
|
|
|
if(res.status == 200){
|
|
|
res.detailModelList.forEach(v => {
|
|
|
if(v.categoryCode==2){
|
|
|
this.imgList.push(v)
|
|
|
} else {
|
|
|
this.videoList.push(v)
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
this.$toast(res.message || '获取广告失败')
|
|
|
}
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
onComplete(data){
|
|
|
this.checkOrderAndReturn({pickUpNum: data, cardNum: ""})
|
|
|
},
|
|
|
checkOrderAndReturn({pickUpNum="", cardNum=""}){
|
|
|
this.$toast.clear()
|
|
|
this.$loading('加载中..')
|
|
|
let p = {
|
|
|
deviceId: this.deviceNum, //设备编号
|
|
|
pickUpNum, //取药码
|
|
|
cardNum //社保卡号
|
|
|
}
|
|
|
console.log('params', p)
|
|
|
medicineAbinetApi
|
|
|
.checkOrderAndReturn(p)
|
|
|
.then(res=>{
|
|
|
console.log('getDetialOutOfStock', res)
|
|
|
if(res.status == 200){
|
|
|
this.$toast.clear()
|
|
|
res.obj.list.forEach(v=>{
|
|
|
v.success = false
|
|
|
})
|
|
|
this.orderdetail = res.obj.list
|
|
|
this.rsType = res.obj.status==1? 1 : 2
|
|
|
this.step = 3
|
|
|
} else {
|
|
|
this.$toast(res.message || '获取订单失败')
|
|
|
}
|
|
|
})
|
|
|
.catch(err=>{
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
init: function() {
|
|
|
if(!this.deviceNum){
|
|
|
return
|
|
|
}
|
|
|
this.path += this.deviceNum
|
|
|
this.devinfoAdvList()
|
|
|
this.path += this.deviceNum + "_T"
|
|
|
if (typeof(WebSocket) === "undefined") {
|
|
|
alert("您的浏览器不支持socket")
|
|
|
} else {
|
|
@ -136,16 +209,43 @@ export default {
|
|
|
if (msgobj.mess.indexOf("异常") < 0) {
|
|
|
this.currindex++;
|
|
|
if (this.orderdetail.length > this.currindex) {
|
|
|
this.$loading(`正在出第${this.currindex+1}个药..`)
|
|
|
this.nextShipment(this.orderdetail[this.currindex]);
|
|
|
} else {
|
|
|
this.$dialog.alert({
|
|
|
title: '出药提示',
|
|
|
message: '出药完成',
|
|
|
confirmButtonText: "返回首页"
|
|
|
}).then(() => {
|
|
|
this.step = 1
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
this.$toast(msg.data.mess)
|
|
|
}
|
|
|
} else if (msgobj.type == 'BarCodeInfo') {
|
|
|
if (msgobj.mess.indexOf("异常") < 0) {
|
|
|
console.log("读到的条码:" + msg.data.mess)
|
|
|
if (msgobj.mess.indexOf("异常") != -1) {
|
|
|
this.$toast(msg.data.mess)
|
|
|
console.log(msg.data.mess)
|
|
|
return
|
|
|
}
|
|
|
this.checkOrderAndReturn({pickUpNum: msg.data.mess})
|
|
|
} else if(msgobj.type == 'CardInfo'){
|
|
|
if (msgobj.mess.indexOf("异常") != -1) {
|
|
|
this.$toast(msg.data.mess)
|
|
|
return
|
|
|
}
|
|
|
var arr = msgobj.mess.split("\n");
|
|
|
var json = {}
|
|
|
arr.forEach(v => {
|
|
|
var tmp = v.split(":")
|
|
|
json[tmp[0]] = tmp[1]
|
|
|
});
|
|
|
this.checkOrderAndReturn({cardNum: json['卡号']})
|
|
|
}
|
|
|
},
|
|
|
sendReadCard: function() {
|
|
|
this.$loading('加载中..')
|
|
|
var obj = {
|
|
|
type: "ReadCard",
|
|
|
mess: ""
|
|
@ -154,9 +254,18 @@ export default {
|
|
|
},
|
|
|
sendShipment: function() {
|
|
|
this.currindex = 0;
|
|
|
this.$loading(`正在出第${this.currindex+1}个药..`)
|
|
|
//循环订单返回的列表,读取第一个
|
|
|
if (this.orderdetail.length > this.currindex) {
|
|
|
this.nextShipment(this.orderdetail[this.currindex]);
|
|
|
} else {
|
|
|
this.$dialog.alert({
|
|
|
title: '出药提示',
|
|
|
message: '出药完成',
|
|
|
confirmButtonText: "返回首页"
|
|
|
}).then(() => {
|
|
|
this.step = 1
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
nextShipment: function(row) {
|
|
@ -201,7 +310,14 @@ export default {
|
|
|
}
|
|
|
this.socket.send(JSON.stringify(obj));
|
|
|
}, 60 * 1000)
|
|
|
}
|
|
|
},
|
|
|
sendDeviceInfo: function() {
|
|
|
var obj = {
|
|
|
type: "ReadDevice",
|
|
|
mess: ""
|
|
|
}
|
|
|
this.socket.send(JSON.stringify(obj));
|
|
|
},
|
|
|
},
|
|
|
destroyed() {
|
|
|
this.forceClose = true
|
|
@ -231,7 +347,7 @@ export default {
|
|
|
margin: calc(90px / 6) auto 0;
|
|
|
overflow: hidden;
|
|
|
border-radius: 7px;
|
|
|
background-color: #000000;
|
|
|
// background-color: #000000;
|
|
|
video{
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
@ -326,5 +442,19 @@ export default {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.van-swipe{
|
|
|
height: 100%;
|
|
|
.swipe-item-img{
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
display: block;
|
|
|
}
|
|
|
.swipe-item-video{
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
display: block;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</style>
|