patientIDCards-pay.js 4.8 KB

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