123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- var Request = GetRequest();
- var d = dialog({ contentType: 'load', skin: 'bk-popup' });
- var checktype=false;
- (function() {
- myvue=new Vue({
- el: "#app",
- data: {
- isloading:true,
- loaddingTxt:"受理中...",
- patient:"", //当前用户code
- data:{}, //电子健康卡数据
- cardNo:"", //加密后卡号
- isSuccess:true,
- },
- mounted:function(){
- var vm = this
- checkUserAgent();
- vm.patient=JSON.parse(localStorage.getItem("wlyyAgent")).uid
- vm.checkType()
- // vm.patient="31ced409777a4d89968ff7a9444d41ef"
- // vm.getData()
- },
- methods: {
- getData:function(){
- var vm=this
- if(Request.id){ //有id直接获取电子健康卡
- vm.getCardDataById()
- }else if(Request.Code){ //上饶页面返回后进入//0:授权失败 1:新用户注册成功 2:新用户注册失败 3:老用户升级成功 4:老用户升级失败
- if(Request.Code==1||Request.Code==3){
- vm.registerEleDecoder()
- }else{
- var msg=""
- if(Request.Code==2){
- msg="新用户注册失败"
- }else if(Request.Code==4){
- msg="老用户升级失败"
- }else{
- msg="授权失败"
- }
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:msg}).show();
- vm.loaddingTxt=msg
- vm.isSuccess=false
- }
- }else { //判断本人是否有卡 有:获取,无:跳转上饶页面注册
- vm.validateEle()
- }
- },
- getCardDataById:function(){ //有id直接获取电子健康卡
- var vm=this
- vm.loaddingTxt="加载中..."
- sendPost("patient/card/getCardInfo", {id:Request.id}, "json", "get",function(){
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
- }, function(res){
- if(res.status == 200){
- if(res.data.patient==vm.patient){ //判断是否当前用户
- vm.data=res.data
- vm.setCardInfo()
- vm.isloading=false
- }else{
- vm.validateEle()
- }
- }else{
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
- }
- })
- },
- validateEle:function(){ //判断本人是否有卡 有:获取,无:跳转上饶页面注册
- var vm=this
- var backUrl=window.location.href
- if(backUrl.indexOf("?")>-1){backUrl=backUrl.split("?")[0]}
- sendPost("/third/hr/validateEle", {patient:vm.patient,backUrl:backUrl}, "json", "get",function(){
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
- }, function(res){
- if(res.status == 200){
- if(res.data.code == 200){
- vm.data=res.data.data
- vm.setCardInfo()
- vm.isloading=false
- }else{
- window.location.href=res.data.url
- }
- }else{
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
- }
- })
- },
- registerEleDecoder:function(){ //上饶页面返回后进入
- var vm=this
- sendPost("/third/hr/registerEle/callback/decoder", {patient:vm.patient,jsonStr:Request.Data}, "json", "post",function(){
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
- }, function(res){
- if(res.status == 200){
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
- vm.data=res.data
- vm.setCardInfo()
- vm.isloading=false
- vm.setMorenDialog(vm.data.id)
- }else{
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
- }
- })
- },
- //设置默认弹框
- setMorenDialog:function(id){
- var vm = this
- dialog({title:'绑定成功', content:'您已添加电子健康卡,是否设为默认充值查询用卡?', cancelValue: '是',okValue: '否',cancel: function () {vm.setMoren(id);},ok: function (){}, }).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();
- }
- })
- },
- setCardInfo:function(){
- var vm = this
- var data=vm.data
- vm.cardNo=data.cardNo.substr(0,1)+"*******"+data.cardNo.substr(data.cardNo.length-4,4)
- if(data.idCard){
- var sexType=data.idCard.length==18?data.idCard.substr(data.idCard.length-2,1):data.idCard.substr(data.idCard.length-1,1)
- if(parseInt(sexType)%2==1){
- vm.data.sex="男"
- }else{
- vm.data.sex="女"
- }
- }
- },
- restart:function(){ //注册失败后重试
- var vm=this
- vm.validateEle()
- },
- gotoRepay:function(id){
- window.location.href='../../payment/html/repayment.html?id='+id+'&origin='+Request.origin;
- },
- gotoPay:function(id){
- window.location.href='../../payment/html/patientIDCards-pay.html?id='+id;
- },
- synchronization:function(){ //维山专用,同步his电子健康卡
- d.show();
- sendPost("/third/hr/registerEle/archive/all", {}, "json", "get",function(){
- }, function(res){
- d.close();
- 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();
- }
- })
- },
- //判断是否验证登录通过
- checkType:function(){
- var vm=this
- var timer = setInterval(function(){
- if(checktype){
- clearInterval(timer);
- vm.getData()
- }
- },10);
- },
- },
- })
- })()
- function queryInit(){
- checktype=true
- }
|