repaymentResult.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. cardId:"", //当前cardid
  12. isloading:true,
  13. countTime:6,
  14. result:{},
  15. successResult:{
  16. status:"success-pay",
  17. msg:"就诊账单已完成缴费,可在就诊卡-缴费-已缴费账单中查看。",
  18. Img:"../images/jiaofeichengong_icon.png",
  19. txt:"缴费成功",
  20. },
  21. synchronizationResult:{
  22. status:"synchronization-pay",
  23. msg:"很抱歉,结算系统繁忙,充值款仍在同步至就诊卡,无法自动完成结算。稍后您可以返回就诊卡查看到款进度,到款后再次发起结算缴费。",
  24. Img:"../images/jiaofeishibai_icon.png",
  25. txt:"缴费失败",
  26. },
  27. failureResult:{
  28. status:"failure-pay",
  29. msg:"系统繁忙,请重新充值缴费。",
  30. Img:"../images/jiaofeishibai_icon.png",
  31. txt:"缴费失败",
  32. },
  33. healthType:["","账单结算缴费","住院缴费充值"],
  34. initdata:{"patientName":"","healthNo":"","healthType":1,"payAmount":"","createDate":"",},
  35. carddata:{},
  36. },
  37. mounted: function() {
  38. var vm = this
  39. checkUserAgent();
  40. vm.checkType()
  41. vm.cardId=Request.cardId
  42. },
  43. methods: {
  44. getCardInfo:function(){
  45. var vm=this
  46. sendPost("patient/card/getCardInfo", {id:vm.cardId}, "json", "get",function(){
  47. loading.close();
  48. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  49. }, function(res){
  50. loading.close();
  51. if(res.status == 200){
  52. vm.carddata=res.data
  53. }else{
  54. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  55. }
  56. })
  57. },
  58. //用于判断订单是否同步,是否可进行缴费结算
  59. getList:function(){
  60. var vm=this
  61. sendPost("/third/hy/pay/getHyPaySeqNo", {wxSeqNo: Request.seqNo}, "json", "get",function(){
  62. loading.close();
  63. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  64. }, function(res){
  65. if(res.status == 200){
  66. if(res.data){ //同步成功,可以进行支付
  67. if(vm.carddata.hisId){
  68. vm.isloading=false
  69. vm.data=vm.initdata
  70. vm.torePay()
  71. }else{
  72. setTimeout(function(){
  73. vm.showTime2()
  74. },1000);
  75. }
  76. }else{
  77. setTimeout(function(){
  78. vm.showTime()
  79. },1000);
  80. }
  81. }else{
  82. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  83. }
  84. })
  85. },
  86. showTime:function(){
  87. var vm=this
  88. vm.countTime -= 1;
  89. if(vm.countTime<=0){
  90. vm.isloading=false
  91. vm.getData()
  92. vm.result=vm.synchronizationResult
  93. }else{
  94. vm.getList()
  95. }
  96. },
  97. showTime2:function(){
  98. var vm=this
  99. vm.countTime -= 1;
  100. if(vm.countTime<=0){
  101. vm.isloading=false
  102. vm.getData()
  103. vm.result=vm.synchronizationResult
  104. }else{
  105. if(vm.carddata.hisId){
  106. vm.isloading=false
  107. vm.data=vm.initdata
  108. vm.torePay()
  109. }else{
  110. setTimeout(function(){
  111. vm.showTime2()
  112. },1000);
  113. }
  114. }
  115. },
  116. //缴费结算
  117. torePay: function() {
  118. var vm = this
  119. var reloading = dialog({
  120. contentType: 'load',
  121. skin: 'bk-popup',
  122. content:'缴费结算中...'
  123. });
  124. reloading.showModal();
  125. sendPost("/third/hy/paySettle/outpSettle", {
  126. hisId: vm.carddata.hisId
  127. }, "json", "get", function() {
  128. reloading.close();
  129. dialog({
  130. contentType: 'tipsbox',
  131. bottom: true,
  132. skin: 'bk-popup',
  133. content: '请求失败'
  134. }).show();
  135. }, function(res) {
  136. reloading.close();
  137. if(res.status == 200) {
  138. if(res.data.code == 0) {
  139. vm.getData()
  140. }else{
  141. vm.getData()
  142. vm.result=vm.failureResult
  143. vm.result.msg=res.data.message
  144. }
  145. } else {
  146. dialog({
  147. contentType: 'tipsbox',
  148. bottom: true,
  149. skin: 'bk-popup',
  150. content: res.msg || '数据查询失败'
  151. }).show();
  152. }
  153. })
  154. },
  155. //获取数据
  156. getData:function(){
  157. var vm=this,healthNo=""
  158. if(Request.healthNo.length>13){
  159. healthNo=healthNo.substr(0,1)+"*******"+healthNo.substr(healthNo.length-4,4)
  160. }
  161. vm.result=vm.successResult
  162. vm.data={"patientName":getQueryString('patientName'),"healthNo":healthNo,"payAmount":Request.payAmount,"createDate":getQueryString('createDate'),"healthType":1,}
  163. },
  164. backClick:function(){
  165. window.location.href='../../payment/html/paymentList.html?id='+Request.cardId; //充值查询页面
  166. },
  167. backClick2:function(){
  168. window.location.href='../../payment/html/repayment.html?id='+Request.cardId; //缴费结算页面
  169. },
  170. //就诊卡页面
  171. gotoPatientIDCard:function(){
  172. window.location.href='../../payment/html/patientIDCards-pay.html?id='+Request.cardId;
  173. },
  174. //判断是否验证登录通过
  175. checkType:function(){
  176. var vm=this
  177. var timer = setInterval(function(){
  178. if(checktype){
  179. clearInterval(timer);
  180. if(Request.seqNo){ //从微信支付页进入
  181. vm.getCardInfo()
  182. vm.getList()
  183. }else{
  184. vm.isloading=false
  185. vm.getData()
  186. }
  187. }
  188. },10);
  189. },
  190. },
  191. })
  192. })()
  193. function queryInit(){
  194. checktype=true
  195. }
  196. function getQueryString(name) {
  197. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  198. var r = window.location.search.substr(1).match(reg);
  199. if (r != null) return decodeURI(r[2]); return null;
  200. }