patientIDCards.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. var checktype=false;
  2. (function() {
  3. myvue=new Vue({
  4. el: "#app",
  5. data: {
  6. dataList:[],
  7. BtnClass:"p-fix-bottom-0",
  8. length:0,
  9. code:"",
  10. surplus:5,
  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.showModal();
  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. loading.close();
  32. if(res.status == 200){
  33. vm.dataList=res.data
  34. vm.length=vm.dataList.length
  35. vm.surplus=5-vm.length
  36. if(vm.length>0){
  37. vm.$nextTick(function(){
  38. vm.setBtnClass()
  39. });
  40. }
  41. }else{
  42. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  43. }
  44. })
  45. },
  46. //设置默认就诊卡
  47. setDefault:function(id,isDefault){
  48. var vm=this
  49. var loading = dialog({
  50. contentType: 'load',
  51. skin: 'bk-popup',
  52. content:'设置中...'
  53. });
  54. loading.showModal()
  55. sendPost("/patient/card/defaultOpe", {id:id,isDefault:isDefault}, "json", "post",function(){
  56. }, function(res){
  57. loading.close()
  58. if(res.status == 200){
  59. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  60. vm.getData()
  61. }else{
  62. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  63. }
  64. })
  65. },
  66. //跳转绑定就诊卡
  67. gotoBindingCard:function(){
  68. var vm=this
  69. if(vm.surplus>0){
  70. window.location.href='../../payment/html/bindingCard.html';
  71. }else{
  72. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:"最多只能绑定5张就诊卡"}).show();
  73. }
  74. },
  75. gotoPay:function(id){
  76. window.location.href='../../payment/html/patientIDCards-pay.html?id='+id;
  77. },
  78. //屏幕高度太矮,下方按钮随页面滚动,反之固定底部
  79. setBtnClass:function(){
  80. var vm = this
  81. var screemH=window.screen.availHeight;
  82. var bodyH=document.body.clientHeight;
  83. if(screemH-bodyH<70){
  84. vm.BtnClass="mt20"
  85. }
  86. },
  87. //判断是否验证登录通过
  88. checkType:function(){
  89. var vm=this
  90. var timer = setInterval(function(){
  91. if(checktype){
  92. clearInterval(timer);
  93. vm.getData()
  94. }
  95. },10);
  96. },
  97. },
  98. })
  99. })()
  100. function queryInit(){
  101. checktype=true
  102. }