changeCards.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. var Request = GetRequest();
  2. var checktype=false;
  3. (function() {
  4. myvue=new Vue({
  5. el: "#app",
  6. data: {
  7. dataList:[],
  8. code:"",
  9. divClass:"jiuzhen",
  10. divName:"就诊"
  11. },
  12. mounted:function(){
  13. var vm = this
  14. checkUserAgent();
  15. vm.code=JSON.parse(localStorage.getItem("wlyyAgent")).uid
  16. vm.checkType()
  17. },
  18. methods: {
  19. //获取列表数据
  20. getData:function(){
  21. var vm=this
  22. var loading = dialog({
  23. contentType: 'load',
  24. skin: 'bk-popup'
  25. });
  26. loading.show()
  27. sendPost("patient/card/getCardList", {patient:vm.code}, "json", "get",function(){
  28. loading.close();
  29. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  30. }, function(res){
  31. if(res.status == 200){
  32. var cardList=[]
  33. _.each(res.data,function(obj,idx){
  34. sendPost("patient/card/getCardInfo", {id:obj.id}, "json", "get",function(){
  35. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  36. }, function(res1){
  37. if(res1.status == 200){
  38. cardList.push(res1.data)
  39. }else{
  40. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  41. }
  42. })
  43. })
  44. if(cardList.length==res.data.length){
  45. vm.setListInfo(cardList)
  46. }else{
  47. var t = setInterval(function(){
  48. if(cardList.length==res.data.length){
  49. loading.close();
  50. vm.setListInfo(cardList)
  51. clearInterval(t)
  52. }
  53. },200);
  54. }
  55. }else{
  56. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  57. }
  58. })
  59. },
  60. setListInfo:function(cardList){
  61. var vm=this
  62. if(Request.paytype==2){
  63. vm.dataList=cardList.filter(function(item){
  64. item.cardNo=item.inpCardNo
  65. item.divClass="zhuyuan"
  66. item.divName="住院"
  67. if(item.type=="2"){
  68. item.cardNo=item.inpCardNo.substr(0,1)+"*******"+item.inpCardNo.substr(item.inpCardNo.length-4,4)
  69. }
  70. var isInpStatus=item.inpStatus==0||item.inpStatus==1 //
  71. return item.inpCardNo && isInpStatus
  72. })
  73. _.each(vm.dataList,function(item){
  74. item.divClass="zhuyuan"
  75. item.divName="住院"
  76. })
  77. $(document).attr('title','选择住院号');
  78. }else{
  79. vm.dataList=cardList.map(function(item){
  80. if(item.type=="1"){
  81. item.divClass="jiuzhen"
  82. item.divName="门诊"
  83. }else{
  84. item.cardNo=item.cardNo.substr(0,1)+"*******"+item.cardNo.substr(item.cardNo.length-4,4)
  85. item.divClass="electronic"
  86. item.divName="健康卡"
  87. }
  88. return item
  89. })
  90. }
  91. },
  92. //设置默认就诊卡
  93. setDefault:function(id,isDefault){
  94. var vm=this
  95. sendPost("/patient/card/defaultOpe", {id:id,isDefault:isDefault}, "json", "post",function(){
  96. }, function(res){
  97. if(res.status == 200){
  98. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  99. vm.getData()
  100. }else{
  101. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  102. }
  103. })
  104. },
  105. gotoPage:function(id){
  106. if(Request.pre=="paymentList"){ //跳到充值查询页面
  107. window.location.href='../../payment/html/paymentList.html?id='+id+'&origin='+Request.origin;
  108. }else if(Request.pre=="waitingDoctorList"){ //跳到候诊查询页面
  109. window.location.href='../../informationSearch/html/waitingDoctorList.html?id='+id+'&origin='+Request.origin;
  110. }else if(Request.pre=="payment"){ //跳到支付页面
  111. window.location.href='../../payment/html/payment.html?id='+id+"&paytype="+Request.paytype+'&origin='+Request.origin;
  112. }else if(Request.pre=="repayment"){ //跳到缴费结算页面
  113. window.location.href='../../payment/html/repayment.html?id='+id+'&origin='+Request.origin;
  114. }else if(Request.pre=="reportList"){ //跳到检验检查报告列表页面
  115. window.location.href='../../informationSearch/html/reportList.html?id='+id+'&origin='+Request.origin;
  116. }else{ //默认跳转充值查询页面
  117. window.location.href='../../payment/html/paymentList.html?id='+id+'&origin='+Request.origin;
  118. }
  119. },
  120. //判断是否验证登录通过
  121. checkType:function(){
  122. var vm=this
  123. var timer = setInterval(function(){
  124. if(checktype){
  125. clearInterval(timer);
  126. vm.getData()
  127. }
  128. },10);
  129. },
  130. },
  131. })
  132. })()
  133. function queryInit(){
  134. checktype=true
  135. }