var patiCode = "", patiName = "", teamCode = "", teamName = ""; new Promise(function(resolve, reject) { var html = template('table_tmpl',{ data: { consult: {}, followup: {}, reservation: {}, guidance: {}, article: {} } }); $('#wrapper').html(html); mui.plusReady(function() { var self = plus.webview.currentWebview(); patiCode = self.patiCode; patiName = self.patiName; teamCode = self.teamCode; teamName = self.teamName; $('#team_name').text(teamName); $('#patientName').text(patiName); initScroller(); resolve(true); }) }).then(function() { initData(); }).catch(function(e) { console && console.error(e); }) function initData(){ getReqPromise("doctor/patient/service/statistics",{ patient: patiCode, teamCode: teamCode }, 'POST', true).then(function(res) { if(res.status == 200) { var html = template('table_tmpl',res); $('#wrapper').html(html); } else { mui.toast(res.msg); } }).catch(function(e) { console && console.error(e); }); } function initScroller(){ //阻尼系数 var deceleration = mui.os.ios?0.003:0.0009; mui('.mui-scroll-wrapper').scroll({ bounce: false, indicators: true, //是否显示滚动条 deceleration:deceleration }); mui(".mui-scroll").pullToRefresh({ down: { callback: function() { var self = this; setTimeout(function() { initData(); self.endPullDownToRefresh(); }, 1000); } } }); }