changeCards.js 1.8 KB

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