patientIDCards.js 2.6 KB

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