var Request = GetRequest(); var checktype = false; var loading = dialog({ contentType: 'load', skin: 'bk-popup', }); (function() { new Vue({ el: "#app", data: { data: {}, dataList: [], length: 0, code: "", cardlenght: 0, TypeList: [{}, { type: "jiuzhen", text: "门诊", pretext: "候诊" }, { type: "jiancha", text: "检查检验", pretext: "候检" }], }, mounted: function() { var vm = this checkUserAgent(); vm.checkType() vm.code = JSON.parse(localStorage.getItem("wlyyAgent")).uid }, methods: { //获取就诊卡 getData: function() { var vm = this 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) { if(res.data.length > 0) { vm.cardlenght = res.data.length if(Request.id) { vm.data = res.data.filter(function(item) { return item.id == Request.id })[0] } else { vm.data = res.data.filter(function(item) { return item.isDefault == 1 })[0] if(!vm.data) { vm.data = res.data[0] } } vm.getList() } else { dialog({ content: "请先绑定就诊卡,再查看候诊信息!", okValue: '确定', ok: function() { window.location.href = '../../payment/html/patientIDCards.html'; }, // cancelValue: '我再看看', // cancel: function(){} }).showModal() } } else { loading.close(); dialog({ contentType: 'tipsbox', bottom: true, skin: 'bk-popup', content: '数据获取失败' }).show(); } }) }, //获取列表数据 getList: function() { var vm = this sendPost("patient/diag/waitVisit", { cardNo: vm.data.cardNo }, "json", "get", function() { loading.close(); dialog({ contentType: 'tipsbox', bottom: true, skin: 'bk-popup', content: '请求失败' }).show(); }, function(res) { loading.close(); if(res.status == 200) { if(res.data.code == "0") { vm.dataList = res.data.data vm.length = vm.dataList.length } else { dialog({ contentType: 'tipsbox', bottom: true, skin: 'bk-popup', content: res.data.message }).show(); } } else { dialog({ contentType: 'tipsbox', bottom: true, skin: 'bk-popup', content: '数据获取失败' }).show(); } }) }, //跳转我的就诊卡页面 gotoCards: function() { window.location.href = '../../payment/html/patientIDCards.html'; }, //跳转切换就诊卡 changeCards: function() { window.location.href = '../../payment/html/changeCards.html?pre=waitingDoctorList'; }, //判断是否验证登录通过 checkType: function() { var vm = this var timer = setInterval(function() { if(checktype) { clearInterval(timer); vm.getData() } }, 10); }, }, }) })() function queryInit() { checktype = true }