bindingCard.js 5.1 KB

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