var checktype=false; (function() { new Vue({ el: "#app", data: { code:"", cardNo:"", initdata:{ name:"", mobile:"", }, data:{}, btnshow:false, }, mounted: function() { var vm = this checkUserAgent(); vm.code=JSON.parse(localStorage.getItem("wlyyAgent")).uid vm.data=vm.initdata }, methods: { //校验就诊卡 getData:function(){ var vm=this if(vm.cardNo){ var loading = dialog({ contentType: 'load', skin: 'bk-popup', content:'校验中...' }); loading.showModal(); sendPost("patient/card/validByCard", {cardNo:vm.cardNo}, "json", "get",function(){ loading.close(); dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show(); vm.setInit() }, function(res){ loading.close(); if(res.status == 200){ if(res.data.code==0){ vm.data=res.data vm.btnshow=true }else{ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.data.message}).show(); vm.setInit() } }else{ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show(); vm.setInit() } }) }else{ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请填写就诊卡号'}).show(); } }, //添加就诊卡 addCard:function(){ var vm = this var loading = dialog({ contentType: 'load', skin: 'bk-popup', content:'绑定中...' }); loading.showModal(); sendPost("patient/card/bindCard", {cardNo:vm.cardNo,patient:vm.code}, "json", "post",function(){ loading.close(); dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show(); vm.setInit() }, function(res){ loading.close(); if(res.status == 200){ vm.setMorenDialog(res.data.id) }else{ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show(); vm.setInit() } }) }, //设置默认弹框 setMorenDialog:function(id){ var vm = this dialog({title:'绑定成功', content:'您已添加就诊卡,是否设为默认缴费查询用卡?',okValue: '是', ok: function (){vm.setMoren(id);vm.back()}, cancelValue: '否',cancel: function () {vm.back()} }).showModal(); }, //设置默认 setMoren:function(id){ sendPost("/patient/card/defaultOpe", {id:id,isDefault:1}, "json", "post",function(){ }, function(res){ if(res.status == 200){ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show(); }else{ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show(); } }) }, //数据置空 setInit:function(){ var vm = this vm.data=vm.initdata vm.btnshow=false }, back:function(){ setTimeout(function(){ window.location.href='../../payment/html/patientIDCards.html'; },500) }, }, }) })() function queryInit(){ // window.myvue.getData() }