var teamCode, iscroller, page = 0,//第几页 pageNum = 10,//每页显示的数量 $eventListWrapper = $('#view_wrap'), $noResultWrap = $('#no_result_wrap'); mui.plusReady(function() { teamCode = plus.storage.getItem("selectedTeamId"); // console.log(teamCode); getTijianList(teamCode,0,pageNum,true); isShowPlBtns(teamCode); initScroller() }) $("#closeBtn").on("tap", function(){ $(".information").hide(); }); mui("#jktj_list").on("tap", ".tixing-true", function(e) { var $li = $(this).parent(); var patientCode = $li.attr("data-code"); tjtxSingle(patientCode, $li); isShowPlBtns(teamCode); }); mui("#jktj_list").on("click", ".tixing-false", function(e) { return false; }); $('#tj_all_tx').on("click", function(e){ mui.confirm("您确定给7天被未被提醒的居民发送体检提醒吗?", "提示", ["立即提醒", "不了,谢谢"], function(e){ if(e.index == 0){ tjtxSingleAll(teamCode); } }) }) // 滚动条实例初始化 function initScroller() { //阻尼系数 var deceleration = mui.os.ios?0.003:0.0009; mui('.mui-scroll-wrapper').scroll({ bounce: false, indicators: true, //是否显示滚动条 deceleration:deceleration }); iscroller = mui(".mui-scroll").pullToRefresh({ up: { callback: function() { page++; // console.log(page); // alert(page); getTijianList(teamCode,page,pageNum); // this.endPullUpToRefresh(); } }, down: { callback: function() { var self = this; page = 0; getTijianList(teamCode,0,pageNum,true); self.endPullDownToRefresh(); } } }); } function getTijianList(teamCode,pageNum,pageSize,isInit){ var url = "/doctor/patient_label_info/getOldPatientByTeamCode", params = {adminTeamCode: teamCode,page: pageNum,pagesize: pageSize}; plus.nativeUI.showWaiting(); sendGet(url, params, null, function(res){ if(res.status==200){ plus.nativeUI.closeWaiting(); var list = res.data; if(list.length == 0) { if(isInit){ $eventListWrapper.hide(); $noResultWrap.show(); }else{ iscroller.endPullUpToRefresh(true); } } else { $noResultWrap.hide(); $eventListWrapper.show(); var html = template('tjshow_list', {list:list}); if(isInit) { $("#jktj_list").html(html); if(res.data.length == pageSize){ iscroller.finished = false; } } else { $("#jktj_list").append(html) } if(res.data && res.data.length < pageSize) { iscroller.endPullUpToRefresh(true); }else{ iscroller.endPullUpToRefresh(false); } } } else { // plus.nativeUI.closeWaiting(); $eventListWrapper.hide(); $noResultWrap.show(); mui.toast(res.msg); } }); } function isShowPlBtns(teamCode){ var url = "/doctor/patient_label_info/isShowRemindBtns", params = {adminTeamCode: teamCode}; $jfAllBtn = $("#tj_all_tx"); plus.nativeUI.showWaiting(); sendGet(url, params, null, function(res){ if(res.status==200){ if(res.data==0){ $jfAllBtn.hide(); } else { $jfAllBtn.show(); // mui.toast(res.msg); } } else { plus.nativeUI.closeWaiting(); mui.toast(res.msg); } }); } function tjtxSingle(patientCode,$dom){ plus.nativeUI.showWaiting(); sendPost("/doctor/patient_label_info/singleRemindPhyExam", {patient: patientCode}, null, function(res){ plus.nativeUI.closeWaiting(); if(res.status == 200){ $dom.find(".tixing-true").removeClass("tixing-true").html("已提醒").addClass("tixing-false"); mui.toast(res.msg); } else { mui.toast(res.msg); } }) } $(".yiwen-icon").on("tap", function(){ $(".information").show(); }); function tjtxSingleAll(teamCode){ plus.nativeUI.showWaiting(); sendPost("/doctor/patient_label_info/remindPhyExams", {adminTeamCode:teamCode}, null, function(res){ plus.nativeUI.closeWaiting(); var $tjAllBtn = $('#tj_all_tx'); if(res.status == 200){ mui.toast("提醒成功"); $('.tixing-true').addClass("tixing-false").html("已提醒").removeClass("tixing-true"); $tjAllBtn.hide(); } else { mui.toast(res.msg); } } )} template.helper("setPhoto", function(p) { return getImgUrl(p); });