bindingCard.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. var checktype=false;
  2. (function() {
  3. new Vue({
  4. el: "#app",
  5. data: {
  6. code:"",
  7. cardNo:"",
  8. initdata:{
  9. name:"",
  10. mobile:"",
  11. },
  12. data:{},
  13. btnshow:false,
  14. },
  15. mounted: function() {
  16. var vm = this
  17. checkUserAgent();
  18. vm.code=JSON.parse(localStorage.getItem("wlyyAgent")).uid
  19. vm.data=vm.initdata
  20. },
  21. methods: {
  22. //校验就诊卡
  23. getData:function(){
  24. var vm=this
  25. if(vm.cardNo){
  26. var loading = dialog({
  27. contentType: 'load',
  28. skin: 'bk-popup',
  29. content:'校验中...'
  30. });
  31. loading.showModal();
  32. sendPost("patient/card/validByCard", {cardNo:vm.cardNo}, "json", "get",function(){
  33. loading.close();
  34. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  35. vm.setInit()
  36. }, function(res){
  37. loading.close();
  38. if(res.status == 200){
  39. if(res.data.code==0){
  40. vm.data=res.data
  41. vm.btnshow=true
  42. }else{
  43. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.data.message}).show();
  44. vm.setInit()
  45. }
  46. }else{
  47. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  48. vm.setInit()
  49. }
  50. })
  51. }else{
  52. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请填写就诊卡号'}).show();
  53. }
  54. },
  55. //添加就诊卡
  56. addCard:function(){
  57. var vm = this
  58. var loading = dialog({
  59. contentType: 'load',
  60. skin: 'bk-popup',
  61. content:'绑定中...'
  62. });
  63. loading.showModal();
  64. sendPost("patient/card/bindCard", {cardNo:vm.cardNo,patient:vm.code}, "json", "post",function(){
  65. loading.close();
  66. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  67. vm.setInit()
  68. }, function(res){
  69. loading.close();
  70. if(res.status == 200){
  71. vm.setMorenDialog(res.data.id)
  72. }else{
  73. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  74. vm.setInit()
  75. }
  76. })
  77. },
  78. //设置默认弹框
  79. setMorenDialog:function(id){
  80. var vm = this
  81. dialog({title:'绑定成功', content:'您已添加就诊卡,是否设为默认缴费查询用卡?',okValue: '是', ok: function (){vm.setMoren(id);vm.back()}, cancelValue: '否',cancel: function () {vm.back()} }).showModal();
  82. },
  83. //设置默认
  84. setMoren:function(id){
  85. sendPost("/patient/card/defaultOpe", {id:id,isDefault:1}, "json", "post",function(){
  86. }, function(res){
  87. if(res.status == 200){
  88. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}).show();
  89. }else{
  90. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  91. }
  92. })
  93. },
  94. //数据置空
  95. setInit:function(){
  96. var vm = this
  97. vm.data=vm.initdata
  98. vm.btnshow=false
  99. },
  100. back:function(){
  101. setTimeout(function(){
  102. window.location.href='../../payment/html/patientIDCards.html';
  103. },500)
  104. },
  105. },
  106. })
  107. })()
  108. function queryInit(){
  109. // window.myvue.getData()
  110. }