|
@ -1,75 +1,143 @@
|
|
|
var Request = GetRequest();
|
|
|
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.code=JSON.parse(localStorage.getItem("wlyyAgent")).uid
|
|
|
vm.patient=JSON.parse(localStorage.getItem("wlyyAgent")).uid
|
|
|
vm.checkType()
|
|
|
// vm.patient="31ced409777a4d89968ff7a9444d41ef"
|
|
|
// vm.getData()
|
|
|
},
|
|
|
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
|
|
|
}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();
|
|
|
}
|
|
|
},
|
|
|
//前往电子健康卡
|
|
|
gotoEHCard:function(){
|
|
|
window.location.href='../../payment/html/electronicHealthCard.html';
|
|
|
},
|
|
|
gotoPay:function(id){
|
|
|
window.location.href='../../payment/html/patientIDCards-pay.html?id='+id;
|
|
|
},
|
|
|
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:'您已添加电子健康卡,是否设为默认充值查询用卡?',okValue: '是', ok: function (){vm.setMoren(id);}, cancelValue: '否',cancel: 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(){
|
|
|
var vm = this
|
|
|
var data=vm.data
|
|
|
vm.cardNo=data.cardNo.substr(0,1)+"*************"+data.cardNo.substr(data.cardNo.length-5,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;
|
|
|
},
|
|
|
gotoPay:function(id){
|
|
|
window.location.href='../../payment/html/patientIDCards-pay.html?id='+id;
|
|
|
},
|
|
|
//判断是否验证登录通过
|
|
|
checkType:function(){
|
|
|
var vm=this
|