hwy 3 months ago
parent
commit
8b688cb834

+ 242 - 249
mini-pro-web/src/router/index.js

@ -1,11 +1,9 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import NavLayout from "@/components/layout/NavLayout"
import NavLayout from '@/components/layout/NavLayout'
import store from '@/store'
import { isSupportHtml5Plus } from '@/utils/platform'
import {
    setTitle
} from "@/utils/title"
import { setTitle } from '@/utils/title'
import Login from '@/views/login/Login'
import Register from '@/views/login/Register'
import FotgetPassword from '@/views/login/FotgetPassword'
@ -15,292 +13,287 @@ import order from './order'
import replenishment from './replenishment'
import device from './device'
import machine from './machine'
import {getPublicKey, getHwlyyDecrypt, checkWlyyLogin, findOneUserFormat} from '@/api/login'
import JSEncrypt from "@/utils/jsencrypt";
import { getPublicKey, getHwlyyDecrypt, checkWlyyLogin, findOneUserFormat } from '@/api/login'
import JSEncrypt from '@/utils/jsencrypt'
import { Toast } from 'vant'
import { findLoginRoleMenuTree } from '@/api/login'
import { _ } from 'core-js'
Vue.use(VueRouter)
const routes = [
    {
        path: '/',
        redirect: '/home'
    },
	{
        path: '/404',
        name: '404',
        component: () => import('@/views/404/404.vue')
    },
    {
        path: '/login',
        name: 'login',
        component: Login,
        meta: {
            title: '登录',
            hasTop: false
        }
    },
    {
        path: '/register',
        name: 'register',
        component: Register,
        meta: {
            title: '注册'
        }
    },
    {
        path: '/fotgetPassword',
        name: 'fotgetPassword',
        component: FotgetPassword,
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404/404.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {
      title: '登录',
      hasTop: false
    }
  },
  {
    path: '/register',
    name: 'register',
    component: Register,
    meta: {
      title: '注册'
    }
  },
  {
    path: '/fotgetPassword',
    name: 'fotgetPassword',
    component: FotgetPassword,
    meta: {
      title: '忘记密码'
    }
  },
  {
    path: '/home',
    name: 'home',
    component: NavLayout,
    redirect: '/home/index',
    children: [
      {
        path: 'index',
        name: 'homeIndex',
        component: () => import('@/views/index/Index'),
        meta: {
            title: '忘记密码',
          title: '首页',
          hasBot: true,
          hasTop: false
        }
    },
    {
        path: '/home',
        name: 'home',
        component: NavLayout,
        redirect: "/home/index",
        children: [{
            path: "index",
            name: "homeIndex",
            component: () => import('@/views/index/Index'),
            meta: {
                title: '首页',
                hasBot: true,
                hasTop: false
            }
        }]
    },
    {
      }
    ]
  },
  {
    path: '/drugList',
    name: 'drugList',
    component: NavLayout,
    children: [
      {
        path: '/drugList',
        name: 'drugList',
        component: NavLayout,
        children: [{
            path: '/drugList',
            name: 'drugList',
            component: DrugList,
            meta: {
                title: '选择药品'
            }
        }]
    },
    {
        path: '/machine/small',
        name: 'machineSmall',
        component: () =>import('@/views/machine/small.vue')
    }
    
        component: DrugList,
        meta: {
          title: '选择药品'
        }
      }
    ]
  },
  {
    path: '/machine/small',
    name: 'machineSmall',
    component: () => import('@/views/machine/small.vue')
  },
  {
    path: '/machine/maxScreen',
    name: 'machineSmall',
    component: () => import('@/views/machine/maxScreen.vue')
  }
]
const whiteList = [
	'/login', 
	'/register', 
	'/fotgetPassword',
    '/machine/index',
    '/machine',
    '/machine/small'
]
const whiteList = ['/login', '/register', '/fotgetPassword', '/machine/index', '/machine', '/machine/small', '/machine/maxScreen']
const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: routes.concat( personal, order, replenishment, device, machine )
  mode: 'history',
  base: process.env.BASE_URL,
  routes: routes.concat(personal, order, replenishment, device, machine)
})
function redirectToLogin(to, from, next) {
    let isApp = to.query.isApp || isSupportHtml5Plus
    if(isApp) {
        next(`/login?isApp=1&redirectUrl=${encodeURIComponent(to.fullPath)}`)
    } else {
      next('/login')
    }
  let isApp = to.query.isApp || isSupportHtml5Plus
  if (isApp) {
    next(`/login?isApp=1&redirectUrl=${encodeURIComponent(to.fullPath)}`)
  } else {
    next('/login')
  }
}
var routerLoaded = false
function formatAuthMenu(menu){
    if(menu){
        return _.map(menu, v=>{
            return {
                name: v.name,
                url: v.url,
                type: v.type,
                children: v.children? formatAuthMenu(v.children) : []
            }
        })
    }
function formatAuthMenu(menu) {
  if (menu) {
    return _.map(menu, v => {
      return {
        name: v.name,
        url: v.url,
        type: v.type,
        children: v.children ? formatAuthMenu(v.children) : []
      }
    })
  }
}
router.beforeEach(async (to, from, next) => {
    if(!to.query.VNK){
        //因为引入navigation组件  beforeEach会执行两次 第一次无VNK 第二次为设置VNK值  所以当VNK不存在时 直接跳过
        next()
        return
    }
    if(to.query._noTop==1){
        store.dispatch('SetNoTop', true)
  if (!to.query.VNK) {
    //因为引入navigation组件  beforeEach会执行两次 第一次无VNK 第二次为设置VNK值  所以当VNK不存在时 直接跳过
    next()
    return
  }
  if (to.query._noTop == 1) {
    store.dispatch('SetNoTop', true)
  }
  new Promise((resolve, reject) => {
    if (to.query._code) {
      authLogin(to.query._code, to).then(res => {
        Toast.clear()
        resolve()
      })
    } else {
      resolve()
    }
    new Promise((resolve, reject)=>{
        if(to.query._code){
            authLogin(to.query._code, to)
                .then(res=>{
                    Toast.clear()
                    resolve()
  })
    .then(res => {
      if (store.getters.user && store.getters.user.accessToken) {
        if (!routerLoaded) {
          findOneUserFormat({
            id: store.getters.user.id
          })
            .then(userInfo2 => {
              var userInfo = _.assignIn(store.getters.user, userInfo2)
              store.dispatch('SetLoginUser', userInfo).then(res => {
                findLoginRoleMenuTree({
                  roleId: store.getters.user.curRoleId
                })
        } else {
            resolve()
        }
    })
    .then(res=>{
        if((store.getters.user && store.getters.user.accessToken)) {
            if(!routerLoaded){
                findOneUserFormat({
                    id: store.getters.user.id
                }).then(userInfo2 => {
                    var userInfo = _.assignIn(store.getters.user, userInfo2);
                    store
                        .dispatch('SetLoginUser', userInfo)
                        .then(res=>{
                            findLoginRoleMenuTree({
                                roleId: store.getters.user.curRoleId
                            })
                            .then(res=>{
                                routerLoaded = true
                                var routeList = formatAuthMenu(res.detailModelList)
                                store.dispatch('SetAuthMenu', routeList)
                                console.log('routeList', routeList)
                                next()
                            })
                            .catch(err=>{
                                console.error(err)
                            })
                        })
                }).catch(err=>{
                  .then(res => {
                    routerLoaded = true
                    var routeList = formatAuthMenu(res.detailModelList)
                    store.dispatch('SetAuthMenu', routeList)
                    console.log('routeList', routeList)
                    next()
                  })
                  .catch(err => {
                    console.error(err)
                })
            } else {
                next()
            }
                  })
              })
            })
            .catch(err => {
              routerLoaded = true
              console.error(err)
            })
        } else {
          next()
        }
      } else {
        routerLoaded = false
        if (whiteList.indexOf(to.path) > -1) {
          console.log('whiteList.indexOf(to.path) > -1')
          next()
        } else {
            routerLoaded = false
            if( whiteList.indexOf(to.path) > -1) {
                console.log("whiteList.indexOf(to.path) > -1");
                
                next()
            } else {
                redirectToLogin(to, from, next)
            }
          redirectToLogin(to, from, next)
        }
      }
    })
    .catch(err=>{
        console.error(err)
    .catch(err => {
      console.error(err)
    })
})
function authLogin(code, to){
    return new Promise((resolve, reject)=>{
        Toast.loading({
            message: '授权登录中..',
            duration: 0,
            forbidClick: true
        })
        getHwlyyDecrypt({code: decodeURIComponent(code)})
            .then(data=>{
                return new Promise((resolve, reject)=>{
                    getPublicKey({})
                        .then(res=>{
                            var encrypt = new JSEncrypt()
                            encrypt.setPublicKey(res.obj.publicKey)
                            resolve(encrypt.encrypt(data.obj.code))
                        })
                        .catch(err=>{
                            reject(err)
                        })
                })
function authLogin(code, to) {
  return new Promise((resolve, reject) => {
    Toast.loading({
      message: '授权登录中..',
      duration: 0,
      forbidClick: true
    })
    getHwlyyDecrypt({ code: decodeURIComponent(code) })
      .then(data => {
        return new Promise((resolve, reject) => {
          getPublicKey({})
            .then(res => {
              var encrypt = new JSEncrypt()
              encrypt.setPublicKey(res.obj.publicKey)
              resolve(encrypt.encrypt(data.obj.code))
            })
            .then(code=>{
                return checkWlyyLogin({
                    code: code,
                    client_id: store.getters.clientId,
                    login_type: 1
                })
            .catch(err => {
              reject(err)
            })
            .then(res=>{
                if(res.obj && res.obj.authCode==1){
                    var userInfo  = res.obj.WlyyUserSimple
                    userInfo.token = userInfo.accessToken
                    userInfo.clientType = to.query.clientType//1 来自i健康app 区域互联网
                    store.dispatch('SetLoginUser', userInfo)
                    findOneUserFormat({
                        id: userInfo.id
                    }).then(userInfo2 => {
                        userInfo = _.assignIn(userInfo, userInfo2);
                        store
                            .dispatch('SetLoginUser', userInfo)
                            .then(res=>{
                                resolve()
                            })
                    }).catch(err=>{
                        console.error(err)
                    })
                    // // "saasAdmin": "管理员"; regionAdmin" "区域管理员" ; communityAdmin "社区管理员" ;  "  "replenisher": "补货员"
                    // // 18补货员 19社区管理员 20区域管理员 21超管
                    // var dictList = {
                    //     18: {
                    //         curRoleCode: "replenisher",
                    //         curRoleName: "补货员"
                    //     },
                    //     19: {
                    //         curRoleCode: "communityAdmin",
                    //         curRoleName: "社区管理员"
                    //     },
                    //     20: {
                    //         curRoleCode: "regionAdmin",
                    //         curRoleName: "区域管理员"
                    //     },
                    //     21: {
                    //         curRoleCode: "saasAdmin",
                    //         curRoleName: "管理员"
                    //     },
                    // }
                    // var { curRoleCode, curRoleName } = dictList[to.query._role]
                    // userInfo.curRoleCode = curRoleCode
                    // userInfo.curRoleName = curRoleName
                    // store
                    //     .dispatch('SetLoginUser', userInfo)
                    //     .then(res=>{
                    //         resolve()
                    //     })
                } else {
                    Toast(res.message|| (res.obj&&res.obj.mes))
                    reject(res)
                }
        })
      })
      .then(code => {
        return checkWlyyLogin({
          code: code,
          client_id: store.getters.clientId,
          login_type: 1
        })
      })
      .then(res => {
        if (res.obj && res.obj.authCode == 1) {
          var userInfo = res.obj.WlyyUserSimple
          userInfo.token = userInfo.accessToken
          userInfo.clientType = to.query.clientType //1 来自i健康app 区域互联网
          store.dispatch('SetLoginUser', userInfo)
          findOneUserFormat({
            id: userInfo.id
          })
            .then(userInfo2 => {
              userInfo = _.assignIn(userInfo, userInfo2)
              store.dispatch('SetLoginUser', userInfo).then(res => {
                resolve()
              })
            })
            .catch(err=>{
                console.error(err)
                // Toast("获取医生数据错误")
                reject(err)
            .catch(err => {
              console.error(err)
            })
    })
          // // "saasAdmin": "管理员"; regionAdmin" "区域管理员" ; communityAdmin "社区管理员" ;  "  "replenisher": "补货员"
          // // 18补货员 19社区管理员 20区域管理员 21超管
          // var dictList = {
          //     18: {
          //         curRoleCode: "replenisher",
          //         curRoleName: "补货员"
          //     },
          //     19: {
          //         curRoleCode: "communityAdmin",
          //         curRoleName: "社区管理员"
          //     },
          //     20: {
          //         curRoleCode: "regionAdmin",
          //         curRoleName: "区域管理员"
          //     },
          //     21: {
          //         curRoleCode: "saasAdmin",
          //         curRoleName: "管理员"
          //     },
          // }
          // var { curRoleCode, curRoleName } = dictList[to.query._role]
          // userInfo.curRoleCode = curRoleCode
          // userInfo.curRoleName = curRoleName
          // store
          //     .dispatch('SetLoginUser', userInfo)
          //     .then(res=>{
          //         resolve()
          //     })
        } else {
          Toast(res.message || (res.obj && res.obj.mes))
          reject(res)
        }
      })
      .catch(err => {
        console.error(err)
        // Toast("获取医生数据错误")
        reject(err)
      })
  })
}
const noSetTitleList = []
router.afterEach((to, from) => {
    // 更新页面标题
    console.log(to,from)
    if (to.meta && to.meta.title && noSetTitleList.indexOf(to.path)==-1) {
        setTitle(to.meta.title)
        store.dispatch("SetPageTitle", to.meta.title)
    }
    else if(noSetTitleList.indexOf(to.path)>-1){
      
    }
    window.scrollTo(0, 0);
  // 更新页面标题
  console.log(to, from)
  if (to.meta && to.meta.title && noSetTitleList.indexOf(to.path) == -1) {
    setTitle(to.meta.title)
    store.dispatch('SetPageTitle', to.meta.title)
  } else if (noSetTitleList.indexOf(to.path) > -1) {
  }
  window.scrollTo(0, 0)
})
export default router

BIN
mini-pro-web/src/views/machine/img/ax.png


BIN
mini-pro-web/src/views/machine/img/i-maxzizhu.png


BIN
mini-pro-web/src/views/machine/img/lck.png


BIN
mini-pro-web/src/views/machine/img/logomax.png


BIN
mini-pro-web/src/views/machine/img/maxBg.png


BIN
mini-pro-web/src/views/machine/img/maxTitle1.png


BIN
mini-pro-web/src/views/machine/img/mzjs.png


BIN
mini-pro-web/src/views/machine/img/ycz.png


BIN
mini-pro-web/src/views/machine/img/zzqy.png


+ 1470 - 0
mini-pro-web/src/views/machine/maxScreen.vue

@ -0,0 +1,1470 @@
<template>
  <div class="maxScreen">
    <div class="step-1">
      <div class="title-banner ">
        <img src="./img/maxTitle1.png" alt="" />
        <img src="./img/i-maxzizhu.png" alt="" />
      </div>
      <div class="wrapper">
        <div class="item" @click="indexFuncClick({ contentType: 1, nextContentType: 13 })">
          <img src="./img/zzqy.png" />
        </div>
        <div class="item" @click="indexFuncClick({ contentType: 1, nextContentType: 4 })">
          <img src="./img/mzjs.png" />
        </div>
        <div class="item" @click="indexFuncClick({ contentType: 1, nextContentType: 20 })">
          <img src="./img/ycz.png" />
        </div>
      </div>
      <div class="video-swipe">
        <van-swipe ref="videoSwipe" @change="videoSwipeChange" :touchable="false" :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" @ended="playEnded($event, i)" :loop="videoList.length == 1" :autoplay="i == 0" muted :src="setImgUrl(item.url)"></video>
            </van-swipe-item>
          </template>
          <van-swipe-item v-else>
            <video class="swipe-item-video" loop autoplay muted src="./img/default.mp4"></video>
          </van-swipe-item>
        </van-swipe>
      </div>
      <div class="activeWrapper">
        <div class="left">
          <img src="./img/ax.png" style="width: 15px;height: 15px;object-fit: cover;margin-right: 5px;" />
          <div style="font-weight: bold;font-size: 11px;color: #3D92E0;">
            医院动态 |
          </div>
        </div>
        <div class="right">关爱老年人健康,家庭医生就在家门口关爱老年人健康,家庭医生就在家门口</div>
      </div>
      <div class="footer">
        <div class="qrcodeTest">
          <div @click="playTest" class="qrcode ">
            <img src="./img/igongzhonghao.png" alt="" />
          </div>
          <div class="text">
            <div>微信【扫一扫】</div>
            <div>关注厦门i健康公众号</div>
          </div>
        </div>
        <div class="qrcodeTest">
          <div class="qrcode ">
            <img src="./img/iapp.png" alt="" />
          </div>
          <div class="text">
            <div>微信【扫一扫】</div>
            <div>下载厦门i健康</div>
          </div>
        </div>
        <div class="qrcodeTest">
          <div class="qrcode ">
            <img src="./img/weixin.png" alt="" />
          </div>
          <div class="text">
            <div>微信【扫一扫】</div>
            <div>打开儿童医保码</div>
          </div>
        </div>
        <div class="qrcodeTest">
          <div class="qrcode ">
            <img src="./img/zhifubao.png" alt="" />
          </div>
          <div class="text">
            <div>支付宝【扫一扫】</div>
            <div>打开儿童医保码</div>
          </div>
        </div>
      </div>
      <div class="lck">
        <div @click="show(2)">取药说明</div>
        <div style="width: 1px;height: 16px;background: #3D92E0;"></div>
        <div @click="show(1)">处方续方说明</div>
        <div style="width: 1px;height: 16px;background: #3D92E0;"></div>
        <div @click="show(3)">门诊结算说明</div>
      </div>
      <div style="text-align: center;margin-top: 9px;">
        <div style="font-weight: 500;font-size: 12px;color: #FFFFFF;white-space: nowrap; transform: scale(0.66);">
          主办方:厦门市思明区人民政府鼓浪屿街道办事处 | 厦门市鼓浪屿医院
        </div>
        <div><img src="./img/logomax.png" alt="" style="height: 13px;width: 162px;" /></div>
      </div>
    </div>
    <div class="illustration-mask" v-show="illustrationMskShow">
      <div class="illustration-inner">
        <img v-show="curImg == 1" class="pic" src="./img/chufang_tankang_img.png" alt="" />
        <img v-show="curImg == 2" class="pic" src="./img/quyao_tankuang_img.png" alt="" />
        <img v-show="curImg == 3" class="pic" src="./img/z-menzhenjiesuanliuc.png" alt="" />
        <div class="close">
          <span>{{ times }}s</span>
          <img @click="close1()" src="./img/z-guanbi.png" alt="" />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { playAudio } from '@/views/machine/utils/audioPlay.js'
import Illustration from './components/Illustration.vue'
import Instro from './components/Instro.vue'
import Recharge from './components/Recharge.vue'
import DrugTaking from './components/DrugTaking.vue'
import TipsDialog from './components/TipsDialog.vue'
import medicineAbinetApi from '@/api/api-medicineAbinet'
import socketUtils from './utils/socket'
import ybUtils from './utils/ybUtils'
import ybApi from '@/api/api-yb'
var countDownFunc,
  timeoutInterval,
  readCardCountDown,
  test = 0,
  closeThread,
  TIMES = 60
export default {
  name: 'machineIndex',
  components: {
    DrugTaking,
    TipsDialog,
    Recharge,
    Instro,
    Illustration
  },
  data() {
    return {
      funcMgn: {
        jiesuan: true,
        quyao: true,
        yujiaojin: true
      },
      curImg: '',
      isErr: 2, //1设备维护  2正常使用
      deviceNum: this.$route.query.deviceNum, //|| '14912202107000001500000000000000',//14912202107000001500000000000000    14912202111000001000000000000000
      step: 0, //0启动页  1首页  2扫码页  3订单页
      times: TIMES,
      curImg: '',
      illustrationMskShow: false,
      socketUrl: '',
      socket: '',
      layerNo: '0',
      wayerNo: '0',
      forceClose: false,
      heartbitInterval: '',
      currindex: 0,
      orderdetail: [],
      rsType: 0, // 1:订单信息 2订单错误  3订单成功  4出药完成  5订单列表
      imgList: [],
      videoList: [],
      inCheckBarcode: false,
      orderInfo: '',
      orderList: [],
      times: 30,
      shippingType: '', //取药方式(1、扫码,2、医保卡)
      inOut: false,
      eventName: '',
      showPrintComplete: false,
      nextOrderDetail: '',
      oldCardNo: '',
      reconnect: false,
      orgCode: '',
      isTest: false,
      cardSn: '',
      cardNo: '',
      idcard: '',
      userName: '',
      isShow: true,
      humidity: '',
      temperature: '',
      prevReadCard: false,
      printType: ''
    }
  },
  watch: {
    step(n) {
      if (n == 2) {
        this.clearCountDown()
        this.countDown()
      } else if (n != 3) {
        this.rsType = 0
        this.oldCardNo = ''
      }
    },
    rsType(n) {
      this.clearCountDown()
      if (n != 4 && this.step == 3) {
        this.countDown()
      }
    }
  },
  created() {
    //由于开太久会导致程序崩溃, 设定每天凌晨3点重载页面
    // setInterval(() => {
    //   var d = new Date()
    //   if (d.getHours() == 3) {
    //     this.systemUpdate()
    //   }
    // }, 30 * 60 * 1000)
    // window.vm2 = this
    // this.init()
    // window.socketUtils = socketUtils
  },
  methods: {
    show(type) {
      this.curImg = type
      this.illustrationMskShow = true
      closeThread = setInterval(() => {
        this.times--
        if (this.times == 0) {
          this.close1()
        }
      }, 1000)
    },
    close1() {
      this.illustrationMskShow = false
      this.times = TIMES
      if (closeThread) {
        clearInterval(closeThread)
      }
    },
    indexFuncClick(data) {
      var { jiesuan, quyao, yujiaojin } = this.funcMgn
      if (data.nextContentType == 13) {
        if (quyao === true) {
          this.onPrevReadCard(data)
        } else {
          this.$toast(quyao || '该功能暂未开放')
        }
      } else if (data.nextContentType == 4) {
        if (jiesuan === true) {
          this.onPrevReadCard(data)
        } else {
          this.$toast(jiesuan || '该功能暂未开放')
        }
      } else if (data.nextContentType == 20) {
        if (yujiaojin === true) {
          this.onPrevReadCard(data)
        } else {
          this.$toast(yujiaojin || '该功能暂未开放')
        }
      }
    },
    loopCharge(v, item, j) {
      return new Promise((resolve, reject) => {
        item.sort = j
        setTimeout(() => {
          resolve()
        }, 1000)
      })
    },
    async playTest() {
      return
      var list = [
        { needCharge: true, chargeList: [{}, {}] },
        { needCharge: true, chargeList: [{}, {}] }
      ]
      var isErr = false
      for (var i = 0; i < list.length; i++) {
        var v = list[i]
        if (v.needCharge) {
          for (var j = 0; j < v.chargeList.length; j++) {
            var res = await this.loopCharge(v, v.chargeList[j], i + j).catch(err => {
              isErr = err
              // api.saveCheckHttpLog.call(this, (err&&err.message) || err, 'chargeByYb', reqParams, _.map(list, v=>{return v.RECIPE_NO}).join(","))
              reject(err)
            })
            console.log(i + ',' + j)
            if (isErr || res) {
              console.log(isErr || res)
              return reject(isErr || res)
            }
          }
        }
      }
      console.log(list)
      return
      this.showTipsDialog({
        contentType: 1,
        payUrl: 'aaa',
        nextContentType: 20
      })
      return
      playAudio(test)
      test++
    },
    SetPrintPageTest() {
      socketUtils.SetPrintPageTest()
    },
    printSettle(obj) {
      this.printType = 2
      // socketUtils.getMessage({
      // 	data: JSON.stringify({
      // 		type: 'PrintComplete',
      // 		mess: '',
      // 	})
      // })
      socketUtils.send(obj)
    },
    clearCountDown() {
      if (countDownFunc) {
        clearInterval(countDownFunc)
      }
    },
    onPrevReadCard(params) {
      playAudio(16)
      this.prevReadCard = params
      readCardCountDown = setTimeout(() => {
        this.$toast.clear()
        this.clearReadCardCountDown()
        if (this.prevReadCard) {
          this.showTipsDialog(this.prevReadCard)
          this.prevReadCard = false
        }
      }, 30000)
      this.$loading(' ')
      this.readcard()
    },
    startSendShipment: function(data) {
      var item = data.item
      if (item.status == -99) {
        this.showTipsDialog({
          contentType: 3,
          message: '该订单已被锁定,请联系药房处理'
        })
        return
      }
      playAudio(2)
      socketUtils.sendShipment(item, data.shippingType)
    },
    showTipsDialog(item) {
      this.$EventBus.$emit('MachineTipsDialog', item)
    },
    readcard(data) {
      if (data == 1) {
        //医保凭证
        var TipsDialog = this.$refs.TipsDialog
        // this.$refs.DrugTaking.toolReadcardMsg({}, TipsDialog.nextContentType)
        // return
        // if(TipsDialog.nextContentType == 20){
        // 	this.$refs.Recharge.show({
        // 		contentType: 1
        // 	})
        // } else {
        // 	this.$refs.DrugTaking.toolReadcardMsg({}, TipsDialog.nextContentType)
        // }
        // return
        ybUtils
          .readCardInfo(
            {
              equ_num: this.deviceNum,
              orgCode: this.orgCode,
              mdtrt_cert_type: '01' //凭证类型01扫医保凭证  02身份证  03医保卡
            },
            this.deviceNum
          )
          .then(res => {
            var CardInfo = res
            res = res.output ? res.output.baseinfo : res.data.output.baseinfo
            this.cardSn = ''
            this.cardNo = res.cardno
            this.idcard = res.certno
            this.userName = res.psn_name
            this.$nextTick(() => {
              if (TipsDialog.nextContentType == 20) {
                this.$refs.Recharge.show({
                  contentType: 1
                })
              } else {
                this.$refs.DrugTaking.toolReadcardMsg({}, TipsDialog.nextContentType, '', CardInfo, '01')
              }
            })
          })
          .catch(err => {
            console.error(err)
            this.showTipsDialog({
              contentType: 3,
              message: (err && err.message) || err
            })
            playAudio(15)
          })
        return
      }
      if (data == 12) {
        // 临时卡
        socketUtils.sendReadCard('ReadTempCard')
        return
      }
      if (data) {
        var TipsDialog = this.$refs.TipsDialog
        this.$refs.DrugTaking.toolReadcardMsg({}, TipsDialog.nextContentType, data)
        return
      }
      socketUtils.sendReadCard()
    },
    init() {
      if (!this.deviceNum) {
        return
      }
      this.findById()
      this.devinfoAdvList()
      socketUtils.$on('inited', () => {
        this.step = 1
        console.log('inited')
      })
      socketUtils.$on('onMessage', msg => {
        if (msg.type == 'CardInfo') {
          var TipsDialog = this.prevReadCard ? this.prevReadCard : this.$refs.TipsDialog
          if (this.prevReadCard || TipsDialog.contentType == 2) {
            if (
              this.prevReadCard &&
              (msg.mess.indexOf('IC卡没有插入') != -1 || msg.mess.indexOf('未插卡') != -1 || msg.mess.indexOf('读取临时卡信息失败') != -1 || msg.mess.indexOf('读取信息失败') != -1)
            ) {
              if (msg.mess.indexOf('读取临时卡信息失败') != -1) {
                //已经读取医保卡和临时卡 并都未读取到卡信息
                this.clearReadCardCountDown()
                this.$toast.clear()
                this.showTipsDialog(this.prevReadCard)
                this.prevReadCard = false
              } else {
                //读取不到医保卡  继续读取临时卡
                this.readcard(12)
              }
              return
            }
            this.clearReadCardCountDown()
            this.$toast.clear()
            this.prevReadCard = false
            if (
              msg.mess.indexOf('异常') != -1 ||
              msg.mess.indexOf('读取信息失败') != -1 ||
              msg.mess.indexOf('读取识别码失败') != -1 ||
              msg.mess.indexOf('读取临时卡信息失败') != -1
            ) {
              playAudio(3)
              this.showTipsDialog({
                contentType: 3,
                message: msg.mess
              })
              return
            }
            //等待读卡的时候 才处理
            var arr = msg.mess.split('\n')
            var json = {}
            arr.forEach(v => {
              var tmp = v.split(':')
              json[tmp[0]] = tmp[1]
            })
            this.cardSn = json['卡识别码']
            this.cardNo = json['卡号']
            this.idcard = json['身份证号']
            this.userName = json['姓名']
            this.$nextTick(() => {
              if (TipsDialog.nextContentType == 20) {
                this.$refs.Recharge.show({
                  contentType: 1
                })
              } else {
                this.$loading(' ')
                this.$refs.TipsDialog.nextContentType = TipsDialog.nextContentType
                this.$refs.DrugTaking.toolReadcardMsg(msg, TipsDialog.nextContentType)
              }
            })
          } else {
            this.clearReadCardCountDown()
            this.$toast.clear()
          }
        } else if (msg.type == 'medical_recharge') {
          // message:"{\"result\":\"succ\",\"resultName\":\"支付成功交易成功\"}"
          var TipsDialog = this.$refs.TipsDialog
          if (!TipsDialog || TipsDialog.contentType != 7) {
            return
          }
          var mess = JSON.parse(msg.mess)
          if (mess.payUrl == TipsDialog.payUrl) {
            if (mess.result == 'succ') {
              this.showTipsDialog({
                contentType: 16
              })
              this.$EventBus.$emit('RechargeEvent', { type: 'onPayed' })
            } else {
              this.showTipsDialog({
                contentType: 3,
                message: mess.resultName
              })
            }
          }
        } else if (msg.type == 'PrintComplete') {
          if (this.printType == 1) {
            this.showTipsDialog({
              contentType: 3,
              message: '您的医嘱已打印,请注意取走医嘱',
              isPickComplete: true
            })
          } else {
            this.showTipsDialog({
              contentType: 8,
              isHis: this.$refs.DrugTaking && this.$refs.DrugTaking.isHis
            })
          }
        } else if (msg.type == 'humidity_temperature') {
          var mess = JSON.parse(msg.mess)
          this.humidity = mess.now_humidity
          this.temperature = mess.now_temperature
        }
      })
      socketUtils.$on('checkNextEvent', msg => {
        this.checkNextEvent(msg.type, msg)
      })
      socketUtils.init({
        deviceNum: this.deviceNum,
        isTest: this.isTest
      })
    },
    findById() {
      this.$loading('加载中..')
      let p = {
        equNum: this.deviceNum
      }
      medicineAbinetApi
        .findDeviceByIdNoLogin(p)
        .then(res => {
          console.log('findDeviceByIdNoLogin', res)
          this.$toast.clear()
          // this.isErr = res.obj.saleStatus==1? 2 : 1
          this.isErr = 2
          this.orgCode = res.obj.belongCommunity
          this.humidity = res.obj.nowHumidity
          this.temperature = res.obj.nowTemperature
          if (res.obj.modules) {
            try {
              this.funcMgn = JSON.parse(res.obj.modules)
            } catch (error) {
              console.error(error)
            }
          }
          // this.funcMgn = {
          // 	jiesuan: "111",
          // 	quyao: "dsfasd",
          // 	yujiaojin: "该功能暂未开放",
          // }
        })
        .catch(err => {
          console.error(err)
        })
    },
    onPrev() {
      this.nextOrderDetail = ''
      this.showPrintComplete = false
      if (this.step == 2) {
        this.step = 1
      } else {
        if (this.rsType == 5) {
          this.step = 1
        } else if (this.rsType == 1 || this.rsType == 2 || this.rsType == 4) {
          var orderLen = this.orderList && this.orderList.length > 1
          if (orderLen) {
            if (this.rsType == 4) {
              this.orderList.splice(this.orderList.indexOf(this.orderInfo), 1)
            }
            this.rsType = 5
          } else {
            this.step = 1
          }
        }
      }
    },
    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 = '', ehcCard = '' }) {
      this.$toast.clear()
      this.$loading('加载中..')
      this.shippingType = pickUpNum ? 1 : 2
      this.oldCardNo = cardNum || ''
      let p = {
        deviceId: this.deviceNum, //设备编号
        pickUpNum, //取药码
        cardNum, //社保卡号 //"DA7292254" ||
        ehcCard //电子社保卡
      }
      // p = {
      // 	deviceId: this.deviceNum, //设备编号
      // 	cardNum: '',
      // 	ehcCard: "2AA15E2786973077D40FF5DEFFB5E7B12D79E3BD50BE59F22559FF361667E22C:0:445D0CE646F8F9DFEF648D36910287B5:3502A0001GZHA0002"
      // }
      console.log('params', p)
      medicineAbinetApi
        .checkOrderAndReturnOrderList(p)
        .then(res => {
          console.log('checkOrderAndReturnOrderList', res)
          if (res.status == 200) {
            this.$toast.clear()
            if (res.obj && res.obj.orderList) {
              var list = _.filter(res.obj.orderList, v => {
                return v.status === 0 || v.status == -5
              })
              if (list.length) {
                list.forEach(v => {
                  var allPrice = 0
                  if (v.status == -5) {
                    v.status = -99
                  }
                  v.drugList.forEach(d => {
                    allPrice += d.price * ((d.quantity && Number(d.quantity)) || 1)
                  })
                  v.price = allPrice.toFixed(2)
                })
                this.orderList = list || []
                if (list.length == 1) {
                  this.showOrderDetail(list[0])
                } else {
                  this.rsType = 5
                  this.step = 3
                }
                this.inCheckBarcode = false
                return
              }
            }
            this.$toast('查不到订单信息')
          } else {
            this.$toast(res.message || '获取订单失败')
          }
          this.inCheckBarcode = false
        })
        .catch(err => {
          console.error(err)
          this.inCheckBarcode = false
        })
    },
    showOrderDetail(item) {
      item.drugList.forEach(v => {
        v.success = false
      })
      this.orderdetail = item.drugList
      this.orderInfo = item
      this.rsType = item.orderStatus == 1 ? 1 : 2
      this.step = 3
    },
    updateOrderOutStatus(shipmentLogId, status, msg) {
      return new Promise((resolve, reject) => {
        var p = {
          shipmentLogId: shipmentLogId || '',
          status: status || '',
          msg: msg || '',
          shippingType: this.shippingType //取药方式(1、扫码,2、医保卡)
        }
        console.log('updateOrderOutStatus', p)
        medicineAbinetApi
          .updateOrderOutStatus(p)
          .then(res => {
            console.log('updateOrderOutStatus', res)
            if (res.status == 200) {
              resolve()
              return
            }
            reject()
          })
          .catch(err => {
            console.error(err)
            reject()
          })
      })
    },
    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: msg,
            confirmButtonText: '返回首页'
          })
          .then(() => {
            this.step = 1
            if (this.eventName) {
              var eventName = this.eventName
              this.eventName = ''
              this.checkNextEvent(eventName)
              return
            }
          })
        return
      }
      this.rsType = 4
      if (this.eventName) {
        var eventName = this.eventName
        this.eventName = ''
        this.checkNextEvent(eventName)
        return
      }
    },
    countDown() {
      this.times = 30
      countDownFunc = setInterval(() => {
        if (this.times === 0) {
          this.clearCountDown()
          this.onPrev()
        }
        this.times--
      }, 1000)
    },
    clearTimeoutInterval() {
      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)
        })
      }, 30 * 1000)
    },
    videoSwipeChange(i) {
      var video = this.$refs.videoSwipe.$el.getElementsByTagName('video')[i]
      video && video.play()
      return
      var videoList = this.$refs.videoSwipe.$el.getElementsByTagName('video')
      if (videoList.length > 1) {
        i++
        if (i >= videoList.length) {
          i = 0
        }
        videoList[i].play()
      }
    },
    playEnded(event, i) {
      if (this.videoList.length == 1) {
        return
      }
      this.$refs.videoSwipe.next()
    },
    systemUpdate() {
      this.$loading('系统将进行更新,请勿操作')
      setTimeout(() => {
        location.reload(true)
      }, 3000)
    },
    checkNextEvent(eventName, data) {
      if (eventName == 'equ_normal') {
        //设备上线
        if (this.inOut) {
          this.eventName = eventName
          return
        }
        this.isErr = 2
      } else if (eventName == 'equ_maintenance') {
        //设备维护
        if (this.inOut) {
          this.eventName = eventName
          return
        }
        this.isErr = 1
      } else if (eventName == 'systemUpdate') {
        //系统更新
        if (this.inOut) {
          this.eventName = eventName
          return
        }
        this.systemUpdate()
      } else if (eventName == 'openDebug') {
        if (!window.vConsole) {
          window.vConsole = new VConsole()
        }
      } else if (eventName == 'closeDebug') {
        if (window.vConsole) {
          window.vConsole.destroy()
          window.vConsole = ''
        }
      } else if (eventName == 'exeUpdate') {
        jsApp.update()
      } else if (eventName == 'indexFuncManage') {
        if (data.mess) {
          this.funcMgn = _.assign(this.funcMgn, JSON.parse(data.mess))
        }
      }
    },
    checkCardNo(item) {
      if (this.oldCardNo) {
        this.nextOrderDetail = item
        this.sendReadCard()
      } else {
        this.showOrderDetail(item)
      }
    },
    SetPrintPage() {
      this.printType = 1
      socketUtils.SetPrintPage()
    },
    onloadeddata(e) {},
    onerror() {},
    onstalled(e) {},
    onsuspend(e) {},
    onemptied(e) {},
    onended(e) {},
    open: function() {
      if (this.reconnect === 1) {
        this.$toast('服务器重连成功')
        this.reconnect = false
      }
      console.log('socket连接成功')
      this.heartbit()
    },
    error: function() {
      console.log('连接错误')
      this.reconnectTimeout()
      return
      // this.socket.close()
    },
    getMessage: function(msg) {
      console.log(msg.data)
      //有收到消息后 重置重连定时器时间
      // this.reconnectTimeout()
      var msgobj = JSON.parse(msg.data)
      if (msgobj.type == 'ShipInfo') {
        if (!this.inOut) {
          //有可能前端15秒已超时  但是后端还没超时  等了1分钟才返回数据
          return
        }
        var item = this.orderdetail[this.currindex]
        if (msgobj.mess == item.layerNo + ';' + item.wayerNo) {
          this.updateOrderOutStatus(item.id, 2, msgobj.mess)
            .then(res => {
              this.currindex++
              if (this.orderdetail.length > this.currindex) {
                this.$loading(`正在出第${this.currindex + 1}个药..`)
                this.nextShipment(this.orderdetail[this.currindex])
              } else {
                this.$toast.clear()
                setTimeout(() => {
                  this.shipComplete()
                }, 200)
              }
            })
            .catch(err => {
              console.error(err)
              this.shipComplete('更新订单状态失败:' + (err && err.message))
            })
        } else {
          this.updateOrderOutStatus(item.id, 3, msgobj.mess)
            .then(res => {
              this.shipComplete(`出药异常中断,请联系管理员(${msgobj.mess})`)
            })
            .catch(err => {
              console.error(err)
              this.shipComplete('更新订单状态失败:' + (err && err.message))
            })
        }
      } else if (msgobj.type == 'BarCodeInfo') {
        if (msgobj.mess.indexOf('异常') != -1) {
          this.$toast(msgobj.mess)
          console.log(msgobj.mess)
          return
        }
        if (this.inCheckBarcode || this.step != 2) {
          return
        }
        this.inCheckBarcode = true
        if (msgobj.mess && msgobj.mess.length > 20) {
          this.checkOrderAndReturn({ ehcCard: msgobj.mess })
        } else {
          this.checkOrderAndReturn({ pickUpNum: msgobj.mess })
        }
      } else if (msgobj.type == 'CardInfo') {
        if (!readCardCountDown) {
          return
        }
        this.clearReadCardCountDown()
        try {
          if (msgobj.mess.indexOf('异常') != -1 || msgobj.mess.indexOf('读取信息失败') != -1) {
            if (this.nextOrderDetail) {
              this.$toast({
                forbidClick: true, // 禁用背景点击
                message: msgobj.mess,
                onClose: () => {
                  this.onPrev()
                }
              })
            } else {
              this.$toast(msgobj.mess)
            }
            return
          }
          var arr = msgobj.mess.split('\n')
          var json = {}
          arr.forEach(v => {
            var tmp = v.split(':')
            json[tmp[0]] = tmp[1]
          })
          var cardNo = json['卡号']
          if (this.nextOrderDetail) {
            if (cardNo != this.oldCardNo) {
              this.$toast({
                forbidClick: true, // 禁用背景点击
                message: '医保卡信息不匹配,请重新操作',
                onClose: () => {
                  this.onPrev()
                }
              })
            } else {
              this.$toast.clear()
              var order = this.nextOrderDetail
              this.nextOrderDetail = ''
              this.showOrderDetail(order)
            }
            return
          }
          this.checkOrderAndReturn({ cardNum: cardNo })
        } catch (e) {
          console.error(e)
        }
      } else if (msgobj.type == 'PrintComplete') {
        this.showPrintComplete = true
        return
        this.$dialog
          .alert({
            title: '',
            message: '打印完成',
            confirmButtonText: '返回首页'
          })
          .then(() => {
            this.onPrev()
          })
      } else if (msgobj.type == 'heart') {
        if (this.heartbitTimeout) {
          clearTimeout(this.heartbitTimeout)
        }
      } else {
        this.checkNextEvent(msgobj.type)
      }
      // var obj = {
      // 	type: "自定义类型",
      // 	mess: "数据",
      // 	devid:"设备号"+"_T"
      // }
    },
    // sendReadCard: function() {
    // 	this.$loading('读取中..')
    // 	this.clearReadCardCountDown()
    // 	readCardCountDown = setTimeout(()=>{
    // 		if(this.nextOrderDetail){
    // 			this.$toast.loading({
    // 				duration: 0,
    // 				forbidClick: true, // 禁用背景点击
    // 				loadingType: 'loading',
    // 				message: "读取医保卡超时",
    // 				onClose: ()=>{
    // 					this.onPrev()
    // 				}
    // 			});
    // 		} else {
    // 			this.$toast('读取医保卡超时')
    // 		}
    // 	}, 20 * 1000)
    // 	var obj = {
    // 		type: "ReadCard",
    // 		mess: ""
    // 	}
    // 	this.send(obj);
    // },
    sendShipment: function() {
      this.clearCountDown()
      this.currindex = 0
      this.$loading(`正在出第${this.currindex + 1}个药..`)
      //循环订单返回的列表,读取第一个
      if (this.orderdetail.length > this.currindex) {
        this.inOut = true
        this.nextShipment(this.orderdetail[this.currindex])
      } else {
        this.shipComplete()
      }
    },
    nextShipment: function(row) {
      this.resetTimeoutInterval()
      //检查刷新是否已经完成数据,没有完成继续,这个设计是为了防断网
      var obj = {
        type: 'Shipment',
        mess: "{detailid:'" + row.id + "'}", //整串返回
        layerNo: row.layerNo,
        wayerNo: row.wayerNo
      }
      this.send(obj)
    },
    send: function(obj) {
      if (obj.type != 'heart') {
        //发送消息时  重置重连定时器时间
        // this.reconnectTimeout()
      }
      this.socket.send(JSON.stringify(obj))
    },
    send2: function() {
      var obj = {
        type: '读取设备功能列表',
        mess: ''
      }
      this.send(obj)
    },
    close: function() {
      console.log('socket已经关闭')
      this.reconnectTimeout()
      return
      this.clearHeartbit()
      if (!this.forceClose) {
        this.reconnect = true
        this.$loading('服务器异常断开,正在重连..')
        setTimeout(() => {
          this.init()
        }, 2000)
      }
      this.forceClose = false
    },
    reconnectTimeout() {
      if (this.reconnect === true) {
        return
      }
      this.clearHeartbit()
      if (!this.forceClose) {
        this.reconnect = true
        this.$loading('服务器异常断开,正在重连..')
        setTimeout(() => {
          this.init()
        }, 2000)
      }
      this.forceClose = false
      return
      if (this.reconnectInterval) {
        clearInterval(this.reconnectInterval)
      }
      this.reconnectInterval = setInterval(() => {
        if (this.socket) {
          this.forceClose = true
          this.socket.close()
        }
        setTimeout(() => {
          this.init()
        }, 200)
      }, 5 * 60 * 1000 + 5000)
    },
    clearHeartbit() {
      if (this.heartbitInterval) {
        clearInterval(this.heartbitInterval)
        this.heartbitInterval = undefined
      }
      if (this.heartbitTimeout) {
        clearInterval(this.heartbitTimeout)
        this.heartbitTimeout = undefined
      }
    },
    heartbit() {
      this.clearHeartbit()
      this.heartbitInterval = setInterval(() => {
        var obj = {
          type: 'heart',
          mess: ''
        }
        this.send(obj)
        //8s没接收到heart的回执  就重连
        // this.heartbitTimeout = setTimeout(()=>{
        // 	this.socket.close()
        // }, 8000)
      }, 30 * 1000)
      // this.reconnectTimeout()
    },
    sendDeviceInfo: function() {
      var obj = {
        type: 'ReadDevice',
        mess: ''
      }
      this.send(obj)
    }
    // SetPrintPage: function() {
    // 	// string type; //text 文本 |line 间隔行|barcode 条码|qrcode 二维码|reset 重置打印机 |nline 走纸【进行【
    // 	// string text;  //文本内容
    // 	// int nLan;//文本编码类型0:GBK   1:UTF-8
    // 	// int nOrgx;//打印的文本位置,各值定义如下:-1 左对齐 -2 居中对齐 -3 右对齐 >=0   在第n点位置开始打印
    // 	// int nWidthTimes;//字符宽度放大的倍数,范围[0,7]
    // 	// int nHeightTimes;// 字符高度放大的倍数,范围[0,7]
    // 	// int FontType;//打印的字体类型,各值定义如下:度值  定义 0:  12*24  1:  9*17
    // 	// int nFontStyle;// 打印的字体类型,各值定义如下:需要合并的把两个值相加得到整数回传 值  定义0x00  正常0x08  加粗0x80    1点下划线0x100   2点下划线0x200 倒置打印 0x400 反显、黑底白字0x1000 每个字符顺时针旋转 90
    // 	// int nBarcodeType;//打印的条码类型,各值定义如下:值   类型 0x41     UPC-A  0x42     UPC-E 0x43     EAN13  0x44     EAN80x45     CODE39 0x46     ITF0x47     CODABAR0x48     CODE93
    // 	// int  nUnitWidth;// 打印的条码宽度,值范围[1,6]
    // 	// int  nUnitHeight;//打印的条码高度,值范围[1,255]
    // 	// int  FontPosition;//可读字符(HRI)的打印位置,各值定义如下:值    定义 0     不打印1     条码上方2     条码下方 3   条码上方和下方
    // 	// int nWidth;// 二维码的宽度,取值范围[1,6}二维码单元宽度越大,QR码越大。
    // 	// int nVersion;// 二维码的规格,取值范围[0,16],0表示自动计算版本。 二维码码版本越大,能编码的字符就越多,QR码也越大。
    // 	// int nErrlevenl;//二维码纠错等级,取值[1,4]
    // 	var printcon =[
    // 		{type:"reset"},
    // 		{type:"nline"},
    // 		{type:"text", text:"智慧药房\n小票凭据\n",nLan:0,nOrgx:-2,nWidthTimes:0,nHeightTimes:0,FontType:0,nFontStyle:0},
    // 		{type:"text", text:"--------------------------------\n",nLan:0,nOrgx:-2,nWidthTimes:0,nHeightTimes:0,FontType:0,nFontStyle:0},
    // 	];
    // 	var allPrice = 0, allcount = 0
    // 	var obj = _.groupBy(this.orderdetail.concat([]), 'drugCode')
    // 	var list = []
    // 	for(var k in obj){
    // 		var tem = obj[k]
    // 		tem[0].quantity = tem.length
    // 		list.push(tem[0])
    // 		tem.forEach(v=>{
    // 			allPrice += v.price
    // 			allcount += 1
    // 		})
    // 	}
    // 	list.forEach(v=>{
    // 		printcon.push({
    // 			type:"text", text: (v.drugName||v.goodsName)+"\n",nLan:0,nOrgx:-1,nWidthTimes:0,nHeightTimes:0,FontType:0,nFontStyle:0
    // 		})
    // 		printcon.push({
    // 			type:"text", text: `数量:${v.quantity}${v.unit}\n规格:${v.specif}\n用法:${v.useWay||''}  ${v.useDose||''}${v.unit||''}  ${v.useRate||''}`,nLan:0,nOrgx:-1,nWidthTimes:0,nHeightTimes:0,FontType:0,nFontStyle:0
    // 		})
    // 		printcon.push({type:"line"})
    // 	})
    // 	var {date, phone, num, remark, time, community, qrCodeContent, info} = this.orderInfo
    // 	// printcon.push({
    // 	// 	type:"text", text: `药品总价:${(allPrice).toFixed(2)}元\n药品数量:${allcount}\n订单金额:${allPrice.toFixed(2)}元\n`,nLan:0,nOrgx:-1,nWidthTimes:0,nHeightTimes:0,FontType:0,nFontStyle:0
    // 	// })
    // 	var infoArr = (info&&info.split(',')) || [],
    // 		infoTextArr = []
    // 	if(infoArr.indexOf("community") != -1){
    // 		infoTextArr.push(`机构名称:${community}\n`)
    // 	}
    // 	if(infoArr.indexOf("phone") != -1){
    // 		infoTextArr.push(`客服电话:${phone}\n`)
    // 	}
    // 	// if(infoArr.indexOf("equNum") != -1){
    // 	// 	infoTextArr.push(`设备编号:${this.deviceNum}\n`)
    // 	// }
    // 	if(infoArr.indexOf("orderNo") != -1){
    // 		infoTextArr.push(`处方单号:${num}\n`)
    // 	}
    // 	if(infoArr.indexOf("shipTime") != -1){
    // 		infoTextArr.push(`取药日期:${date} ${time}\n`)
    // 	}
    // 	if(infoTextArr&&infoTextArr.length){
    // 		printcon.push({type:"text", text:"--------------------------------\n",nLan:0,nOrgx:-2,nWidthTimes:0,nHeightTimes:0,FontType:0,nFontStyle:0})
    // 		printcon.push({
    // 			type:"text", text: infoTextArr.join(''),nLan:0,nOrgx:-1,nWidthTimes:0,nHeightTimes:0,FontType:0,nFontStyle:0
    // 		})
    // 	}
    // 	// printcon.push({
    // 	// 	type:"text", text: `商家名称:${community}\n客服电话:${phone}\n药柜编码:${this.deviceNum}\n销售单号:${num}\n取药日期:${date}\n取药时间:${time}\n`,nLan:0,nOrgx:-1,nWidthTimes:0,nHeightTimes:0,FontType:0,nFontStyle:0
    // 	// })
    // 	printcon.push({type:"text", text:"--------------------------------\n",nLan:0,nOrgx:-2,nWidthTimes:0,nHeightTimes:0,FontType:0,nFontStyle:0})
    // 	printcon.push({
    // 		type:"text", text: `备注:${remark||""}\n`,nLan:0,nOrgx:-1,nWidthTimes:0,nHeightTimes:0,FontType:0,nFontStyle:0
    // 	})
    // 	// if(qrCodeContent){
    // 		printcon.push({type:"qrcode",text: qrCodeContent||"http://weixin.qq.com/r/hj9vd_LEAL9-raYU92qU", nWidth:6,nVersion:0,nErrlevenl:4})
    // 	// }
    // 	printcon.push({type:"nline"})
    // 	printcon.push({type:"nline"})
    // 	printcon.push({type:"nline"})
    // 	printcon.push({type:"nline"})
    // 	printcon.push({type:"nline"})
    // 	console.log('printcon', printcon)
    // 	var obj = {
    // 		type: "PrintPage",
    // 		mess: JSON.stringify(printcon),
    // 	}
    // 	this.send(obj);
    // },
  },
  destroyed() {
    this.forceClose = true
    clearInterval(this.heartbitInterval)
    this.clearCountDown()
  }
}
</script>
<style lang="scss" scoped>
.maxScreen {
  width: 100vw;
  height: 100vh;
  background: url('./img/maxBg.png') no-repeat;
  background-size: cover;
  .step-1 {
    .title-banner {
      padding-top: 33px;
      img {
        display: block;
        margin: 0 auto;
        &:first-child {
          width: 254px;
          height: 29px;
          margin-left: 63px;
        }
        &:nth-child(2) {
          width: 250px;
          height: 24px;
          margin-top: 10px;
          margin-left: 58px;
        }
      }
    }
    .banner-list {
      width: 333px;
      margin: calc(94px / 6) auto 0;
      -webkit-box-pack: justify;
      color: #fff;
      .banner-list-item-1 {
        background-image: url('./img/i-quyao.png');
        background-size: 100% 100%;
        width: 178px;
        height: 117px;
        font-size: 23px;
        line-height: 28px;
        font-weight: 700;
        padding-left: 102px;
        letter-spacing: 5px;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-box-pack: center;
      }
      .banner-list-item-2 {
        background-image: url('./img/i-jiesuan.png');
        background-size: 100% 100%;
        width: 144px;
        height: 53px;
        display: -webkit-box;
        -webkit-box-align: center;
        padding-left: 51px;
      }
      .banner-list-item-3 {
        background-image: url('./img/i-yujiao.png');
        background-size: 100% 100%;
        width: 144px;
        height: 53px;
        margin-top: 11px;
        display: -webkit-box;
        -webkit-box-align: center;
        padding-left: 51px;
      }
    }
    .wrapper {
      padding: 0 21px;
      display: flex;
      margin-top: 115px;
      justify-content: space-between;
      align-items: center;
      .item {
        width: 107px;
        height: 96px;
        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
    }
    .video-swipe {
      width: 333px;
      height: 101px;
      margin: calc(90px / 6) auto 0;
      overflow: hidden;
      border-radius: 7px;
      video {
        width: 100%;
        height: 100%;
        display: block;
      }
      .van-swipe-item {
        &::after {
          content: '';
          position: absolute;
          width: 100%;
          height: 100%;
          top: 0;
          left: 0;
          z-index: 2;
          opacity: 0;
        }
      }
    }
    .img-swipe {
      width: 333px;
      height: 101px;
      margin: calc(83px / 6) auto 0;
      overflow: hidden;
      border-radius: 7px;
      background-color: #000000;
      img {
        width: 100%;
        height: 100%;
        display: block;
      }
    }
    .activeWrapper {
      display: flex;
      align-items: center;
      width: 333px;
      height: 25px;
      background: #d3e9f7;
      border-radius: 13px;
      margin: calc(90px / 6) auto 0;
      color: #3d92e0;
      .left {
        display: flex;
        align-items: center;
        padding: 0 8px;
      }
      .right {
        width: 70%;
        overflow: hidden;
        white-space: nowrap;
        font-size: 11px;
        text-overflow: ellipsis;
        -o-text-overflow: ellipsis;
      }
    }
    .footer {
      display: flex;
      justify-content: space-around;
      margin-top: 32px;
      .qrcodeTest {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        font-weight: 400;
        color: #fff;
        .text {
          white-space: nowrap;
          bottom: 0;
          display: flex;
          flex-direction: column;
          align-items: center;
          transform: scale(0.58);
        }
      }
      .qrcode {
        padding-top: 2px;
        img {
          width: 58px;
          height: 58px;
          display: block;
        }
      }
    }
    .lck {
      width: 316px;
      height: 34px;
      margin: 0 auto;
      background: url('./img/lck.png') no-repeat;
      background-size: cover;
      display: flex;
      align-items: center;
      padding: 0 22px;
      font-weight: 600;
      font-size: 11px;
      color: #1c7cd5;
      justify-content: space-around;
    }
  }
  .illustration-mask {
    position: fixed;
    width: 100vw;
    height: 100vh;
    left: 0;
    top: 0;
    background: rgba($color: #000000, $alpha: 0.5);
    .illustration-inner {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translateX(-50%) translateY(-50%);
      background: #000000;
      border-radius: calc(20px / 6);
      .pic {
        display: block;
        width: 333px;
        img {
        }
      }
      .close {
        position: absolute;
        right: 5px;
        top: 5px;
        img {
          width: 20px;
          height: 20px;
          vertical-align: middle;
        }
        span {
          color: #ff3153;
          font-size: 15px;
          font-weight: 600;
          vertical-align: middle;
          margin-right: 4px;
        }
      }
    }
  }
}
</style>