patientIDCards.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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:"",
  10. surplus:5,
  11. hasEleCard:true,
  12. },
  13. mounted:function(){
  14. var vm = this
  15. checkUserAgent();
  16. vm.code=JSON.parse(localStorage.getItem("wlyyAgent")).uid
  17. vm.checkType()
  18. vm.initBtnScroll()
  19. },
  20. methods: {
  21. //获取列表数据
  22. getData:function(){
  23. var vm=this
  24. var loading = dialog({
  25. contentType: 'load',
  26. skin: 'bk-popup'
  27. });
  28. loading.showModal();
  29. sendPost("patient/card/getCardList", {patient:vm.code}, "json", "get",function(){
  30. loading.close();
  31. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  32. }, function(res){
  33. loading.close();
  34. if(res.status == 200){
  35. vm.dataList=_.map(res.data,function(item,index){
  36. if(item.type=="2"){
  37. // vm.hasEleCard=true
  38. item.cardNo=item.cardNo.substr(0,1)+"*******"+item.cardNo.substr(item.cardNo.length-4,4)
  39. }
  40. return item
  41. })
  42. vm.length=vm.dataList.length
  43. // vm.surplus=5-vm.length
  44. if(vm.length>0){
  45. vm.$nextTick(function(){
  46. vm.setBtnClass()
  47. });
  48. }
  49. }else{
  50. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  51. }
  52. })
  53. },
  54. //设置默认就诊卡
  55. setDefault:function(id,isDefault,str){
  56. var vm=this
  57. var loading = dialog({
  58. contentType: 'load',
  59. skin: 'bk-popup',
  60. content:'设置中...'
  61. });
  62. dialog({
  63. content: str, cancelValue: '否', okValue: '是',
  64. cancel: function () { },
  65. ok: function () {
  66. loading.showModal()
  67. sendPost("/patient/card/defaultOpe", { id: id, isDefault: isDefault }, "json", "post", function () {
  68. }, function (res) {
  69. loading.close()
  70. if (res.status == 200) {
  71. dialog({ contentType: 'tipsbox', bottom: true, skin: 'bk-popup', content: res.msg }).show();
  72. vm.getData()
  73. } else {
  74. dialog({ contentType: 'tipsbox', bottom: true, skin: 'bk-popup', content: '数据获取失败' }).show();
  75. }
  76. })
  77. },
  78. }).showModal();
  79. },
  80. initBtnScroll: function () {
  81. var vm=this
  82. var fileName = ['就诊卡','电子健康卡']
  83. var fileCode = ['1', '2']
  84. $('.scrollBtn').mobiscroll({
  85. theme: 'ios',
  86. lang: 'zh',
  87. customWheels: true,
  88. wheels: [
  89. [{
  90. keys: fileCode,
  91. values: fileName
  92. }]
  93. ],
  94. onSelect: function (valueText, inst) {
  95. var dd = eval("[" + valueText + "]");
  96. if (dd[0].keys == 1) {
  97. window.location.href='../../payment/html/bindingCard.html';
  98. } else {
  99. vm.gotoEHCard()
  100. }
  101. },
  102. });
  103. },
  104. //跳转绑定就诊卡
  105. gotoBindingCard:function(){
  106. var vm=this
  107. // if(vm.surplus>0){
  108. window.location.href='../../payment/html/bindingCard.html';
  109. // }else{
  110. // dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:"最多只能绑定5张就诊卡"}).show();
  111. // }
  112. },
  113. //前往电子健康卡
  114. gotoEHCard:function(id){
  115. var href='../../payment/html/electronicHealthCard.html'
  116. if(id){
  117. href=href+'?id='+id
  118. }
  119. window.location.href=href
  120. },
  121. gotoPay:function(id,type){
  122. if(type=="1"){
  123. window.location.href='../../payment/html/patientIDCards-pay.html?id='+id;
  124. }else{
  125. this.gotoEHCard(id)
  126. }
  127. },
  128. //屏幕高度太矮,下方按钮随页面滚动,反之固定底部
  129. setBtnClass:function(){
  130. var vm = this
  131. var screemH=window.screen.availHeight;
  132. var bodyH=document.body.clientHeight;
  133. if(screemH-bodyH<130){
  134. vm.BtnClass="mt20"
  135. }
  136. },
  137. //判断是否验证登录通过
  138. checkType:function(){
  139. var vm=this
  140. var timer = setInterval(function(){
  141. if(checktype){
  142. clearInterval(timer);
  143. vm.getData()
  144. }
  145. },10);
  146. },
  147. },
  148. })
  149. })()
  150. function queryInit(){
  151. checktype=true
  152. }