var checktype=false; (function() { myvue=new Vue({ el: "#app", data: { dataList:[], BtnClass:"p-fix-bottom-0", length:0, code:"", surplus:5, hasEleCard:true, }, mounted:function(){ var vm = this checkUserAgent(); vm.code=JSON.parse(localStorage.getItem("wlyyAgent")).uid vm.checkType() vm.initBtnScroll() }, 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=_.map(res.data,function(item,index){ if(item.type=="2"){ // vm.hasEleCard=true item.cardNo=item.cardNo.substr(0,1)+"*******"+item.cardNo.substr(item.cardNo.length-4,4) } return item }) 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,str){ var vm=this var loading = dialog({ contentType: 'load', skin: 'bk-popup', content:'设置中...' }); dialog({ content: str, cancelValue: '否', okValue: '是', cancel: function () { }, ok: function () { 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(); } }) }, }).showModal(); }, initBtnScroll: function () { var vm=this var fileName = ['就诊卡','电子健康卡'] var fileCode = ['1', '2'] $('.scrollBtn').mobiscroll({ theme: 'ios', lang: 'zh', customWheels: true, wheels: [ [{ keys: fileCode, values: fileName }] ], onSelect: function (valueText, inst) { var dd = eval("[" + valueText + "]"); if (dd[0].keys == 1) { window.location.href='../../payment/html/bindingCard.html'; } else { vm.gotoEHCard() } }, }); }, //跳转绑定就诊卡 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(); // } }, //前往电子健康卡 gotoEHCard:function(id){ var href='../../payment/html/electronicHealthCard.html' if(id){ href=href+'?id='+id } window.location.href=href }, gotoPay:function(id,type){ if(type=="1"){ window.location.href='../../payment/html/patientIDCards-pay.html?id='+id; }else{ this.gotoEHCard(id) } }, //屏幕高度太矮,下方按钮随页面滚动,反之固定底部 setBtnClass:function(){ var vm = this var screemH=window.screen.availHeight; var bodyH=document.body.clientHeight; if(screemH-bodyH<130){ vm.BtnClass="mt20" } }, //判断是否验证登录通过 checkType:function(){ var vm=this var timer = setInterval(function(){ if(checktype){ clearInterval(timer); vm.getData() } },10); }, }, }) })() function queryInit(){ checktype=true }