|
@ -43,34 +43,29 @@ var loading = dialog({
|
|
|
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 && vm.hasInpCardNo(item)
|
|
|
})[0]
|
|
|
if(!vm.data){
|
|
|
vm.data=res.data.filter(function(item){
|
|
|
return item.isDefault==1 && vm.hasInpCardNo(item)
|
|
|
})[0]
|
|
|
}
|
|
|
}else{
|
|
|
vm.data=res.data.filter(function(item){
|
|
|
return item.isDefault==1 && vm.hasInpCardNo(item)
|
|
|
})[0]
|
|
|
}
|
|
|
if(!vm.data){
|
|
|
vm.data=res.data[0]
|
|
|
if(!vm.hasInpCardNo(vm.data)){
|
|
|
dialog({
|
|
|
content: "请先绑定住院就诊卡!",
|
|
|
okValue: '确定',
|
|
|
ok: function(){
|
|
|
window.location.href='../../payment/html/patientIDCards.html';
|
|
|
},
|
|
|
}).showModal()
|
|
|
}
|
|
|
}
|
|
|
vm.cardId=vm.data.id
|
|
|
vm.getCardInfo()
|
|
|
var cardList=[]
|
|
|
_.each(res.data,function(obj,idx){
|
|
|
sendPost("patient/card/getCardInfo", {id:obj.id}, "json", "get",function(){
|
|
|
dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
|
|
|
}, function(res1){
|
|
|
if(res1.status == 200){
|
|
|
cardList.push(res1.data)
|
|
|
}else{
|
|
|
dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
if(cardList.length==res.data.length){
|
|
|
vm.comfireCardInfo(cardList)
|
|
|
}else{
|
|
|
var t = setInterval(function(){
|
|
|
if(cardList.length==res.data.length){
|
|
|
loading.close();
|
|
|
vm.comfireCardInfo(cardList)
|
|
|
clearInterval(t)
|
|
|
}
|
|
|
},200);
|
|
|
}
|
|
|
}else{
|
|
|
dialog({
|
|
|
content: "请先绑定就诊卡!",
|
|
@ -85,39 +80,66 @@ var loading = dialog({
|
|
|
dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
//获取列表数据
|
|
|
getCardInfo:function(){
|
|
|
},
|
|
|
//确认该页支付卡
|
|
|
comfireCardInfo:function(cardList){
|
|
|
var vm=this
|
|
|
sendPost("patient/card/getCardInfo", {id:vm.cardId}, "json", "get",function(){
|
|
|
loading.close();
|
|
|
dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
|
|
|
}, function(res){
|
|
|
if(res.status == 200){
|
|
|
loading.close();
|
|
|
vm.data=res.data
|
|
|
if(vm.paytype=="2"){
|
|
|
vm.surplusMoney=vm.data.cardInpMoney?vm.data.cardInpMoney:0
|
|
|
vm.cardNo=vm.data.inpCardNo
|
|
|
if(vm.data.type=="2"){
|
|
|
vm.cardNo=vm.data.inpCardNo.substr(0,1)+"*************"+vm.data.inpCardNo.substr(vm.data.inpCardNo.length-4,4)
|
|
|
}
|
|
|
}else{
|
|
|
vm.surplusMoney=vm.data.cardMoney?vm.data.cardMoney:0
|
|
|
vm.cardNo=vm.data.cardNo
|
|
|
if(vm.data.type=="2"){
|
|
|
vm.cardNo=vm.data.cardNo.substr(0,1)+"*************"+vm.data.cardNo.substr(vm.data.cardNo.length-4,4)
|
|
|
}
|
|
|
}
|
|
|
if(Request.repayAmout){ //从缴费结算进入
|
|
|
vm.payMoney=parseFloat(vm.repayAmout-vm.surplusMoney).toFixed(2)
|
|
|
vm._payMoney=vm.payMoney
|
|
|
}
|
|
|
}else{
|
|
|
loading.close();
|
|
|
dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
|
|
|
}
|
|
|
})
|
|
|
if(Request.id){
|
|
|
vm.data=cardList.filter(function(item){
|
|
|
return item.id==Request.id && vm.hasInpCardNo(item)
|
|
|
})[0]
|
|
|
if(!vm.data){
|
|
|
vm.data=cardList.filter(function(item){
|
|
|
return item.isDefault==1 && vm.hasInpCardNo(item)
|
|
|
})[0]
|
|
|
}
|
|
|
}else{
|
|
|
vm.data=cardList.filter(function(item){
|
|
|
return item.isDefault==1 && vm.hasInpCardNo(item)
|
|
|
})[0]
|
|
|
}
|
|
|
if(!vm.data){
|
|
|
if(Request.paytype==2){
|
|
|
var ispass=_.every(cardList,function(obj,idx){
|
|
|
vm.data=obj
|
|
|
var aaaa=vm.hasInpCardNo(obj)
|
|
|
return !vm.hasInpCardNo(obj)
|
|
|
})
|
|
|
if(ispass){
|
|
|
dialog({
|
|
|
content: "请先绑定住院就诊卡!",
|
|
|
okValue: '确定',
|
|
|
ok: function(){
|
|
|
window.location.href='../../payment/html/patientIDCards.html';
|
|
|
},
|
|
|
}).showModal()
|
|
|
}
|
|
|
}else{
|
|
|
vm.data=cardList[0]
|
|
|
}
|
|
|
}
|
|
|
vm.cardId=vm.data.id
|
|
|
vm.setCardInfo()
|
|
|
},
|
|
|
setCardInfo:function(){
|
|
|
var vm=this
|
|
|
if(vm.paytype=="2"){
|
|
|
vm.surplusMoney=vm.data.cardInpMoney?vm.data.cardInpMoney:0
|
|
|
vm.cardNo=vm.data.inpCardNo
|
|
|
if(vm.data.type=="2"){
|
|
|
vm.cardNo=vm.data.inpCardNo.substr(0,1)+"*************"+vm.data.inpCardNo.substr(vm.data.inpCardNo.length-4,4)
|
|
|
}
|
|
|
}else{
|
|
|
vm.surplusMoney=vm.data.cardMoney?vm.data.cardMoney:0
|
|
|
vm.cardNo=vm.data.cardNo
|
|
|
if(vm.data.type=="2"){
|
|
|
vm.cardNo=vm.data.cardNo.substr(0,1)+"*************"+vm.data.cardNo.substr(vm.data.cardNo.length-4,4)
|
|
|
}
|
|
|
}
|
|
|
if(Request.repayAmout){ //从缴费结算进入
|
|
|
vm.payMoney=parseFloat(vm.repayAmout-vm.surplusMoney).toFixed(2)
|
|
|
vm._payMoney=vm.payMoney
|
|
|
}
|
|
|
},
|
|
|
//去支付
|
|
|
toPayment:function(){
|
|
@ -285,13 +307,14 @@ var loading = dialog({
|
|
|
}
|
|
|
},
|
|
|
hasInpCardNo:function(item){
|
|
|
var vm=this
|
|
|
var ispass=true
|
|
|
if(Request.paytype==2){
|
|
|
if(item.inpCardNo&&(item.inpStatus==0||item.inpStatus==1)){
|
|
|
ispass=true
|
|
|
}else{
|
|
|
ispass=false
|
|
|
}
|
|
|
if(item.inpCardNo&&(item.inpStatus=="0"||item.inpStatus=="1")){
|
|
|
ispass=true
|
|
|
}else{
|
|
|
ispass=false
|
|
|
}
|
|
|
}
|
|
|
return ispass
|
|
|
},
|