patientIDCards-pay.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. dataList:[],
  12. cardId:Request.id,
  13. code:"",
  14. data:{
  15. "id": "",
  16. "patient": "",
  17. "hisId": "",
  18. "cardNo": "",
  19. "name": "",
  20. "idCard": "",
  21. "mobile": "",
  22. "inpCardNo": "",
  23. "isDefault": 0,
  24. "createDate": "",
  25. "cardMoney": "",
  26. "cardInpMoney": null
  27. },
  28. BtnClass:"p-fix-bottom-0",
  29. length:1,
  30. },
  31. mounted:function(){
  32. var vm = this
  33. loading.showModal();
  34. checkUserAgent();
  35. vm.code=JSON.parse(localStorage.getItem("wlyyAgent")).uid
  36. vm.checkType()
  37. },
  38. methods: {
  39. //获取列表数据
  40. getData:function(){
  41. var vm=this
  42. sendPost("patient/card/getCardList", {patient:vm.code}, "json", "get",function(){
  43. loading.close();
  44. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  45. }, function(res){
  46. if(res.status == 200){
  47. if(res.data.length>0){
  48. var data={}
  49. if(Request.id){
  50. data=res.data.filter(function(item){
  51. return item.id==Request.id
  52. })[0]
  53. if(!data){
  54. data=res.data.filter(function(item){
  55. return item.isDefault==1
  56. })[0]
  57. }
  58. }else{
  59. data=res.data.filter(function(item){
  60. return item.isDefault==1
  61. })[0]
  62. }
  63. if(!data){
  64. data=res.data[0]
  65. }
  66. vm.cardId=data.id
  67. vm.getCardInfo()
  68. }else{
  69. loading.close();
  70. dialog({
  71. content: "请先绑定就诊卡,再进行在线就诊缴费业务!",
  72. okValue: '确定',
  73. ok: function(){
  74. window.location.href='../../payment/html/patientIDCards.html';
  75. },
  76. // cancelValue: '我再看看',
  77. // cancel: function(){}
  78. }).showModal()
  79. }
  80. }else{
  81. loading.close();
  82. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  83. }
  84. })
  85. },
  86. getCardInfo:function(){
  87. var vm=this
  88. sendPost("patient/card/getCardInfo", {id:vm.cardId}, "json", "get",function(){
  89. loading.close();
  90. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  91. }, function(res){
  92. loading.close();
  93. if(res.status == 200){
  94. vm.data=res.data
  95. if(vm.length>0){
  96. vm.$nextTick(function(){
  97. vm.setBtnClass()
  98. });
  99. }
  100. }else{
  101. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  102. }
  103. })
  104. },
  105. //解绑就诊卡
  106. untieCard:function(){
  107. var vm=this
  108. dialog({title:'解绑提示', content:'是否确定解绑就诊卡?',okValue: '确定', ok: function (){vm.setuntieCard();}, cancelValue: '取消',cancel: function () {} }).showModal();
  109. },
  110. setuntieCard:function(){
  111. var vm=this
  112. sendPost("patient/card/unBindCard", {_method:"DELETE",id:vm.cardId}, "json", "post",function(){
  113. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  114. }, function(res){
  115. if(res.status == 200){
  116. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  117. vm.backtoCards()
  118. }else{
  119. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  120. }
  121. })
  122. },
  123. //跳转去支付
  124. gotoPay:function(paytype){ //paytype 1为门诊缴费 2为住院缴费
  125. var vm=this
  126. window.location.href='../../payment/html/payment.html?id='+vm.cardId+'&paytype='+paytype;
  127. },
  128. //跳转去缴费查询列表
  129. gotoList:function(){
  130. var vm=this
  131. window.location.href='../../payment/html/paymentList.html?id='+vm.cardId;
  132. },
  133. //返回我的卡包页面
  134. backtoCards:function(){
  135. setTimeout(function(){
  136. window.location.href='../../payment/html/patientIDCards.html';
  137. },500)
  138. },
  139. //屏幕高度太矮,下方按钮随页面滚动,反之固定底部
  140. setBtnClass:function(){
  141. var vm = this
  142. var screemH=window.screen.availHeight;
  143. var bodyH=document.body.clientHeight;
  144. if(screemH-bodyH<180){
  145. vm.BtnClass="mt20"
  146. }
  147. },
  148. //判断是否验证登录通过
  149. checkType:function(){
  150. var vm=this
  151. var timer = setInterval(function(){
  152. if(checktype){
  153. clearInterval(timer);
  154. vm.getData()
  155. }
  156. },10);
  157. },
  158. },
  159. })
  160. })()
  161. function queryInit(){
  162. checktype=true
  163. }