follow_manage.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. var postUrl = "doctor/sign/sign_info";
  2. var docType;
  3. var curType;
  4. var pageTotal = 999999999999; //分页最大次数
  5. var pageSize = 15; //一次加载几条数据
  6. var date = new Date(),
  7. dateStr = date.format("yyyy-MM-dd");
  8. mui.plusReady(function() {
  9. var self = plus.webview.currentWebview();
  10. // 初始化关注数,总关注数
  11. getSignCount(handleSucc99);
  12. //初始化续签管理页面的iscroll
  13. mui.init({
  14. pullRefresh: {
  15. container: '#pullrefresh',
  16. down: {
  17. style:'circle',
  18. callback: pulldownRefresh
  19. },
  20. up: {
  21. auto:true,
  22. contentrefresh: '正在加载...',
  23. callback: pullupRefresh
  24. }
  25. }
  26. });
  27. var count = 0;
  28. function pullupRefresh() {
  29. mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > pageTotal)); //参数为true代表没有更多数据了。
  30. var table = document.body.querySelector('.mui-table-view');
  31. var cells = document.body.querySelectorAll('.mui-table-view-cell');
  32. var newCount = $(".mui-table-view").children()&&$(".mui-table-view").children().length;
  33. var page=newCount/pageSize | 0;
  34. loadMore(".mui-table-view", 99, page);
  35. }
  36. /**
  37. * 下拉刷新具体业务实现
  38. */
  39. function pulldownRefresh() {
  40. var table = document.body.querySelector('.mui-table-view');
  41. var cells = document.body.querySelectorAll('.mui-table-view-cell');
  42. loadMore(".mui-table-view", 99, 0);
  43. mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
  44. mui.toast("刷新成功");
  45. }
  46. mui('.gzgl-list').on('tap','.c-gzgl-action',function(){
  47. var concernCode = $(this).parent().attr("data-concernCode");
  48. var code = $(this).parent().attr("data-code");
  49. mui.openWindow('../html/guanzhuxinxi.html', {
  50. extras: {
  51. concernCode:concernCode,
  52. code:code,
  53. }
  54. })
  55. })
  56. });
  57. function getXqDataNew(handelSucc, page) {
  58. var url = "/doctor/concern/getConcernPatients";
  59. sendGet(url, {
  60. page: page || 0,
  61. pageSize: 15
  62. }, null, handelSucc);
  63. };
  64. //签约管理增加签约统计功能,分别统计待审核、待缴费、已签约数量。在三个页切按钮下方增加统计数字
  65. function getSignCount(handelSucc) {
  66. var url = "/doctor/concern/getConcernCounts";
  67. sendGet(url, {}, null, handelSucc);
  68. };
  69. //签约管理增加签约统计功能,分别统计待审核、待缴费、已签约数量。在三个页切按钮下方增加统计数字 (处理函数))
  70. function handleSucc99(res){
  71. plus.nativeUI.closeWaiting();
  72. $('#already_paid').html(res.data&&res.data.countPatientStatus1||0);
  73. $('#general_concern').html(res.data&&res.data.countPatientAll||0);
  74. $('.qy-barner').removeClass('c-hide');
  75. }
  76. //判断要不要显示加载更多
  77. function isShowMore(res,page){//res 数据moreObj 要显示或隐藏的加载更多按钮
  78. // var pageNow=res.data.page;//当前第几页
  79. // var pageAll=res.data.totalPage; //总共几页
  80. if(res&&res.data.length<pageSize)pageTotal=page
  81. }
  82. /*
  83. * 拼接模板数据
  84. */
  85. function dealTmpl(res, tmplId, ulId) {
  86. document.getElementById(ulId).innerHTML = template(tmplId, res);
  87. }
  88. /*
  89. * 加载更多
  90. */
  91. function loadMore(ulId, type, page) {
  92. plus.nativeUI.showWaiting("加载中,请稍候...");
  93. var id = $(ulId).children().last().attr("data-id");
  94. getXqDataNew(function(res){
  95. // var list = _.map(res.data, function(o){
  96. // o.jsonStr = JSON.stringify(o);
  97. // return o;
  98. // })
  99. var tmplId = "gzgl_tmpl";
  100. var obj = {list:res.data};
  101. if(!obj.list.length) $(".no_result_wrap").removeClass('c-hide');
  102. domUl = $("#dqy_list");
  103. if(page===0)$(".gzgl-list").empty();
  104. $(".gzgl-list").append(template(tmplId, obj));
  105. isShowMore(res,page);
  106. plus.nativeUI.closeWaiting();
  107. }, page);
  108. }
  109. window.addEventListener("updata", function() {
  110. plus.webview.currentWebview().reload(false);
  111. });
  112. window.addEventListener('reloadTab', function(e){
  113. var index = e.detail.tab;
  114. if(index > 2){
  115. curTypeGroup2 = index;
  116. xq_dclObj = null;
  117. xq_djfObj = null;
  118. }else{
  119. curType = index;
  120. }
  121. if(curType == 0 && dqyObj) {
  122. //需要重新刷新页面
  123. dqyObj = "";
  124. }else if(curType == 1 && djfObj){
  125. djfObj = "";
  126. }else if(curType == 2 && yqyObj){
  127. yqyObj = "";
  128. }
  129. $(".sign-comonhd").find(".sanp-flex:eq("+index+")").trigger("click")
  130. });
  131. template.helper("formatShowTime",function(str){
  132. if(str){
  133. return str.substr(0,16);
  134. }else{
  135. return "";
  136. }
  137. });
  138. template.helper("setPhoto", function(p) {
  139. return getImgUrl(p);
  140. });