var checktype=false; (function() { myvue=new Vue({ el: "#app", data: { dataList:[], BtnClass:"p-fix-bottom-0", length:0, code:"", surplus:5, }, mounted:function(){ var vm = this checkUserAgent(); vm.code=JSON.parse(localStorage.getItem("wlyyAgent")).uid vm.checkType() }, methods: { //获取列表数据 getData:function(){ var vm=this var loading = dialog({ contentType: 'load', skin: 'bk-popup' }); loading.showModal(); sendPost("patient/card/getCardList", {patient:vm.code}, "json", "get",function(){ loading.close(); dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show(); }, function(res){ loading.close(); if(res.status == 200){ vm.dataList=res.data vm.length=vm.dataList.length vm.surplus=5-vm.length if(vm.length>0){ vm.$nextTick(function(){ vm.setBtnClass() }); } }else{ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show(); } }) }, //设置默认就诊卡 setDefault:function(id,isDefault){ var vm=this var loading = dialog({ contentType: 'load', skin: 'bk-popup', content:'设置中...' }); loading.showModal() sendPost("/patient/card/defaultOpe", {id:id,isDefault:isDefault}, "json", "post",function(){ }, function(res){ loading.close() if(res.status == 200){ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show(); vm.getData() }else{ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show(); } }) }, //跳转绑定就诊卡 gotoBindingCard:function(){ var vm=this if(vm.surplus>0){ window.location.href='../../payment/html/bindingCard.html'; }else{ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:"最多只能绑定5张就诊卡"}).show(); } }, gotoPay:function(id){ window.location.href='../../payment/html/patientIDCards-pay.html?id='+id; }, //屏幕高度太矮,下方按钮随页面滚动,反之固定底部 setBtnClass:function(){ var vm = this var screemH=window.screen.availHeight; var bodyH=document.body.clientHeight; if(screemH-bodyH<70){ vm.BtnClass="mt20" } }, //判断是否验证登录通过 checkType:function(){ var vm=this var timer = setInterval(function(){ if(checktype){ clearInterval(timer); vm.getData() } },10); }, }, }) })() function queryInit(){ checktype=true }