patientIDCards.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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:JSON.parse(localStorage.getItem("wlyyAgent")).uid,
  10. surplus:5,
  11. },
  12. mounted:function(){
  13. var vm = this
  14. checkUserAgent();
  15. vm.checkType()
  16. },
  17. methods: {
  18. //获取列表数据
  19. getData:function(){
  20. var vm=this
  21. var loading = dialog({
  22. contentType: 'load',
  23. skin: 'bk-popup'
  24. });
  25. sendPost("patient/card/getCardList", {patient:vm.code}, "json", "get",function(){
  26. loading.close();
  27. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  28. }, function(res){
  29. loading.close();
  30. if(res.status == 200){
  31. vm.dataList=res.data
  32. vm.length=vm.dataList.length
  33. vm.surplus=5-vm.length
  34. if(vm.length>0){
  35. vm.setBtnClass()
  36. }
  37. }else{
  38. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  39. }
  40. })
  41. },
  42. //设置默认就诊卡
  43. setDefault:function(id,isDefault){
  44. var vm=this
  45. sendPost("/patient/card/defaultOpe", {id:id,isDefault:isDefault}, "json", "post",function(){
  46. }, function(res){
  47. if(res.status == 200){
  48. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  49. vm.getData()
  50. }else{
  51. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  52. }
  53. })
  54. },
  55. //跳转绑定就诊卡
  56. gotoBindingCard:function(){
  57. var vm=this
  58. if(vm.surplus>0){
  59. window.location.href='../../payment/html/bindingCard.html';
  60. }else{
  61. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:"最多只能绑定5张就诊卡"}).show();
  62. }
  63. },
  64. gotoPay:function(id){
  65. window.location.href='../../payment/html/patientIDCards-pay.html?id='+id;
  66. },
  67. //屏幕高度太矮,下方按钮随页面滚动,反之固定底部
  68. setBtnClass:function(){
  69. var vm = this
  70. var screemH=window.screen.availHeight;
  71. var bodyH=document.body.clientHeight;
  72. if(screemH-bodyH<70){
  73. vm.BtnClass="mt20"
  74. }
  75. },
  76. //判断是否验证登录通过
  77. checkType:function(){
  78. var vm=this
  79. var timer = setInterval(function(){
  80. if(checktype){
  81. clearInterval(timer);
  82. vm.getData()
  83. }
  84. },100);
  85. },
  86. },
  87. })
  88. })()
  89. function queryInit(){
  90. checktype=true
  91. }