paymentResult.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. var Request = GetRequest();
  2. var checktype=false;
  3. var loading = dialog({
  4. contentType: 'load',
  5. skin: 'bk-popup',
  6. });
  7. (function() {
  8. new Vue({
  9. el: "#app",
  10. data: {
  11. result:{},
  12. successResult:{
  13. status:"success-pay",
  14. msg:"恭喜您缴费成功,您将享有医院在线的所有服务,以下为您的缴费信息。",
  15. Img:"../images/jiaofeichengong_icon.png",
  16. txt:"缴费成功",
  17. },
  18. synchronizationResult:{
  19. status:"synchronization-pay",
  20. msg:"系统繁忙,请重新充值缴费。",
  21. Img:"../images/jiaofeishibai_icon.png",
  22. txt:"缴费失败",
  23. },
  24. failureResult:{
  25. status:"failure-pay",
  26. msg:"系统繁忙,请重新充值缴费。",
  27. Img:"../images/jiaofeishibai_icon.png",
  28. txt:"缴费失败",
  29. },
  30. healthType:["","门诊缴费充值","住院缴费充值"],
  31. initdata:{seqNo:"","patientName":"","healthNo":"","healthType":1,"payAmount":"","createDate":"",},
  32. data:{},
  33. frompay:false,
  34. queryList:{
  35. month:"",
  36. healthNo:"",
  37. chargeType:"1", //1:门诊,2:住院,
  38. pageNo:1,
  39. pageSize:1,
  40. },
  41. payTypeList:[{},{type:"weixin",Img:"../images/weixinzhifu_icon.png",text:"微信支付"},{type:"xianjin",Img:"../images/xianjichongzhi_icon.png",text:"现金支付"},{type:"yinlian",Img:"../images/yinlianzhifu_icon.png",text:"银联支付"},{type:"zhifubao",Img:"../images/zhifubaozhifu_icon.png",text:"支付宝支付"}],
  42. },
  43. mounted: function() {
  44. var vm = this
  45. checkUserAgent();
  46. vm.checkType()
  47. },
  48. methods: {
  49. //获取数据
  50. getData:function(){
  51. var vm=this
  52. if(!Request.healthNo){
  53. vm.gerPayOrder() //从支付进入
  54. }else{
  55. vm.gerPayOrderList() //从缴费列表进入
  56. }
  57. },
  58. //从支付进入
  59. gerPayOrder:function(){
  60. var vm=this
  61. loading.showModal();
  62. sendPost("third/hy/pay/gerPayOrder", {seqNo:Request.seqNo}, "json", "get",function(){
  63. loading.close();
  64. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  65. }, function(res){
  66. loading.close();
  67. if(res.status == 200){
  68. vm.data=res.data
  69. vm.filterData()
  70. }else{
  71. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  72. }
  73. })
  74. },
  75. //从缴费列表进入
  76. gerPayOrderList:function(){
  77. var vm=this
  78. vm.data={seqNo:Request.seqNo,"patientName":getQueryString('patientName'),"healthNo":Request.healthNo,"healthType":Request.healthType,"payAmount":Request.payAmount,"createDate":getQueryString('createDate'),"payStatus":Request.payStatus,"payType":Request.payType}
  79. vm.result=vm.successResult
  80. // if(Request.hyStatus==1){
  81. // vm.result=vm.successResult
  82. // }else{
  83. // vm.result=vm.synchronizationResult
  84. // }
  85. },
  86. filterData:function(){
  87. var vm=this
  88. if(!vm.data){vm.data=vm.initdata}
  89. if(Request.payStatus==1){ //充值状态,0未完成,1已完成,2失败
  90. vm.result=vm.successResult
  91. }else{
  92. // if(vm.data.wechatStatus==1){ //未同步
  93. // vm.result=vm.successResult
  94. // vm.data.hyStatus=0
  95. // }else{
  96. vm.result=vm.failureResult
  97. // }
  98. }
  99. },
  100. //
  101. backClick:function(){
  102. window.location.href='../../payment/html/patientIDCards-pay.html?id='+Request.cardId;
  103. },
  104. //判断是否验证登录通过
  105. checkType:function(){
  106. var vm=this
  107. var timer = setInterval(function(){
  108. if(checktype){
  109. clearInterval(timer);
  110. vm.getData()
  111. }
  112. },10);
  113. },
  114. },
  115. })
  116. })()
  117. function queryInit(){
  118. checktype=true
  119. }
  120. function getQueryString(name) {
  121. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  122. var r = window.location.search.substr(1).match(reg);
  123. if (r != null) return decodeURI(r[2]); return null;
  124. }