mui.init({ pullRefresh: { container: '#pullrefresh', down: {}, up: { contentrefresh: '正在加载...', callback: pullupRefresh } } }); var pageNumber = 0, pagesize = 10; function pullupRefresh() { pageNumber += 1; var btnArray = ['否', '是']; $.ajax(base_path + '/rebackStatic/unIncomeOrderCast3?dates=' + new Date().getTime(), { data: { "pageSize": pagesize, "pageNumber": pageNumber, "openid": getParam("openid") }, dataType: 'json', type: 'post', timeout: 15000, xhrFields: { withCredentials: true }, crossDomain: true, success: function(dt) { if(dt.isRedirect) { location.href = dt.redirectURL; } else { if(dt.status) { var chanpin_data = []; if(dt.data.list != null) { chanpin_data = dt.data.list } document.querySelector("#accounts").innerHTML = dt.data.salesNumber; mui('#pullrefresh').pullRefresh().endPullupToRefresh(chanpin_data.length < pagesize); var table = document.body.querySelector('.my-tab-view-pull'); mui(chanpin_data).each(function(index) { var li = document.createElement('li'); li.className = 'mui-table-view-cell ft-12'; /*li.innerHTML = '
' + this.strDate.substr(0, this.strDate.length - 2) + '' + this.num + '台
';*/ li.innerHTML = '
' + decodeURI(this.name) + '' + this.num + '台
'; table.appendChild(li) }) } else { mui.confirm(dt.message, '提示', btnArray, function(e) { if(e.index == 1) {} }) } } }, error: function(xhr, type, errorThrown) { console.log(xhr) } }) }; mui.ready(function() { mui('#pullrefresh').pullRefresh().pullupLoading(); getCartNum(); document.querySelector('.loading-bg').style.display = 'none' }); var addTimer = function() { var list = [], interval; return function(id, time) { if(!interval) { interval = setInterval(go, 1000) } list.push({ ele: document.getElementById(id), time: time }) }; function go() { for(var i = 0; i < list.length; i += 1) { list[i].ele.innerHTML = getTimerString(list[i].time ? list[i].time -= 1 : 0); if(!list[i].time) { list.splice(i--, 1) } } } function getTimerString(time) { d = Math.floor(time / 86400), h = Math.floor((time % 86400) / 3600), m = Math.floor(((time % 86400) % 3600) / 60), s = Math.floor(((time % 86400) % 3600) % 60); if(time > 0) { return "剩余" + d + "天" + h + ":" + m + ":" + s } else { return "即将入账" } } }();