patientIDCards-pay.js 6.4 KB

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