123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- var Request = GetRequest();
- var checktype=false;
- var loading = dialog({
- contentType: 'load',
- skin: 'bk-popup',
- });
- (function() {
- new Vue({
- el: "#app",
- data: {
- cardId:"", //当前cardid
- isloading:true,
- countTime:6,
- result:{},
- successResult:{
- status:"success-pay",
- msg:"就诊账单已完成缴费,可在就诊卡-缴费-已缴费账单中查看。",
- Img:"../images/jiaofeichengong_icon.png",
- txt:"缴费成功",
- },
- synchronizationResult:{
- status:"synchronization-pay",
- msg:"很抱歉,结算系统繁忙,充值款仍在同步至就诊卡,无法自动完成结算。稍后您可以返回就诊卡查看到款进度,到款后再次发起结算缴费。",
- Img:"../images/jiaofeishibai_icon.png",
- txt:"缴费失败",
- },
- failureResult:{
- status:"failure-pay",
- msg:"系统繁忙,请重新充值缴费。",
- Img:"../images/jiaofeishibai_icon.png",
- txt:"缴费失败",
- },
- healthType:["","账单结算缴费","住院缴费充值"],
- initdata:{"patientName":"","healthNo":"","healthType":1,"payAmount":"","createDate":"",},
- carddata:{},
- },
- mounted: function() {
- var vm = this
- checkUserAgent();
- vm.checkType()
- vm.cardId=Request.cardId
- },
- methods: {
- getCardInfo:function(){
- 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){
- loading.close();
- if(res.status == 200){
- vm.carddata=res.data
- }else{
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
- }
- })
- },
- //用于判断订单是否同步,是否可进行缴费结算
- getList:function(){
- var vm=this
- sendPost("/third/hy/pay/getHyPaySeqNo", {wxSeqNo: Request.seqNo}, "json", "get",function(){
- loading.close();
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
- }, function(res){
- if(res.status == 200){
- if(res.data){ //同步成功,可以进行支付
- if(vm.carddata.hisId){
- vm.isloading=false
- vm.data=vm.initdata
- vm.torePay()
- }else{
- setTimeout(function(){
- vm.showTime2()
- },1000);
- }
- }else{
- setTimeout(function(){
- vm.showTime()
- },1000);
- }
- }else{
- dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
- }
- })
- },
- showTime:function(){
- var vm=this
- vm.countTime -= 1;
- if(vm.countTime<=0){
- vm.isloading=false
- vm.getData()
- vm.result=vm.synchronizationResult
- }else{
- vm.getList()
- }
- },
- showTime2:function(){
- var vm=this
- vm.countTime -= 1;
- if(vm.countTime<=0){
- vm.isloading=false
- vm.getData()
- vm.result=vm.synchronizationResult
- }else{
- if(vm.carddata.hisId){
- vm.isloading=false
- vm.data=vm.initdata
- vm.torePay()
- }else{
- setTimeout(function(){
- vm.showTime2()
- },1000);
- }
- }
- },
- //缴费结算
- torePay: function() {
- var vm = this
- var reloading = dialog({
- contentType: 'load',
- skin: 'bk-popup',
- content:'缴费结算中...'
- });
- reloading.showModal();
- sendPost("/third/hy/paySettle/outpSettle", {
- hisId: vm.carddata.hisId
- }, "json", "get", function() {
- reloading.close();
- dialog({
- contentType: 'tipsbox',
- bottom: true,
- skin: 'bk-popup',
- content: '请求失败'
- }).show();
- }, function(res) {
- reloading.close();
- if(res.status == 200) {
- if(res.data.code == 0) {
- vm.getData()
- }else{
- vm.getData()
- vm.result=vm.failureResult
- vm.result.msg=res.data.message
- }
- } else {
- dialog({
- contentType: 'tipsbox',
- bottom: true,
- skin: 'bk-popup',
- content: res.msg || '数据查询失败'
- }).show();
- }
- })
- },
- //获取数据
- getData:function(){
- var vm=this,healthNo=""
- if(Request.healthNo.length>13){
- healthNo=healthNo.substr(0,1)+"*******"+healthNo.substr(healthNo.length-4,4)
- }
- vm.result=vm.successResult
- vm.data={"patientName":getQueryString('patientName'),"healthNo":healthNo,"payAmount":Request.payAmount,"createDate":getQueryString('createDate'),"healthType":1,}
- },
- backClick:function(){
- window.location.href='../../payment/html/paymentList.html?id='+Request.cardId; //充值查询页面
- },
- backClick2:function(){
- window.location.href='../../payment/html/repayment.html?id='+Request.cardId; //缴费结算页面
- },
- //就诊卡页面
- gotoPatientIDCard:function(){
- window.location.href='../../payment/html/patientIDCards-pay.html?id='+Request.cardId;
- },
- //判断是否验证登录通过
- checkType:function(){
- var vm=this
- var timer = setInterval(function(){
- if(checktype){
- clearInterval(timer);
- if(Request.seqNo){ //从微信支付页进入
- vm.getCardInfo()
- vm.getList()
- }else{
- vm.isloading=false
- vm.getData()
- }
- }
- },10);
- },
- },
- })
- })()
- function queryInit(){
- checktype=true
- }
- function getQueryString(name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- var r = window.location.search.substr(1).match(reg);
- if (r != null) return decodeURI(r[2]); return null;
- }
|