changeCards.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. var checktype=false;
  2. (function() {
  3. myvue=new Vue({
  4. el: "#app",
  5. data: {
  6. dataList:[],
  7. code:"",
  8. },
  9. mounted:function(){
  10. var vm = this
  11. checkUserAgent();
  12. vm.code=JSON.parse(localStorage.getItem("wlyyAgent")).uid
  13. vm.checkType()
  14. },
  15. methods: {
  16. //获取列表数据
  17. getData:function(){
  18. var vm=this
  19. var loading = dialog({
  20. contentType: 'load',
  21. skin: 'bk-popup'
  22. });
  23. sendPost("patient/card/getCardList", {patient:vm.code}, "json", "get",function(){
  24. loading.close();
  25. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  26. }, function(res){
  27. loading.close();
  28. if(res.status == 200){
  29. vm.dataList=res.data
  30. }else{
  31. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  32. }
  33. })
  34. },
  35. //设置默认就诊卡
  36. setDefault:function(id,isDefault){
  37. var vm=this
  38. sendPost("/patient/card/defaultOpe", {id:id,isDefault:isDefault}, "json", "post",function(){
  39. }, function(res){
  40. if(res.status == 200){
  41. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  42. vm.getData()
  43. }else{
  44. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  45. }
  46. })
  47. },
  48. gotoPage:function(id){
  49. window.location.href='../../payment/html/patientIDCards-pay.html?id='+id;
  50. },
  51. //判断是否验证登录通过
  52. checkType:function(){
  53. var vm=this
  54. var timer = setInterval(function(){
  55. if(checktype){
  56. clearInterval(timer);
  57. vm.getData()
  58. }
  59. },10);
  60. },
  61. },
  62. })
  63. })()
  64. function queryInit(){
  65. checktype=true
  66. }