按起止时间查询数据并实现“上拉显示更多”

来源:互联网 发布:免身份证开卡软件 编辑:程序博客网 时间:2024/05/16 13:05
<!doctype html><html><head><meta charset="UTF-8"><title></title><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><link href="css/mui.min.css" rel="stylesheet" /><link href="css/icons-extra.css" rel="stylesheet" /><link rel="stylesheet" type="text/css" href="css/mui.picker.min.css" /><style>html,body,.mui-content {height: 0px;margin: 0px;background-color: #efeff4;}h5.mui-content-padded {margin-left: 3px;margin-top: 20px !important;}h5.mui-content-padded:first-child {margin-top: 12px !important;}.mui-btn {font-size: 16px;padding-left: 18px;padding-right: 18px;margin: 3px;}.ui-alert {text-align: center;padding: 20px 10px;font-size: 16px;}* {-webkit-touch-callout: none;-webkit-user-select: none;}h4 {font-size: 16px;}</style></head><body><div class="mui-content"><div class="mui-content-padded "><div class="mui-card"><div class="mui-input-row" style="padding: 5px;"><label>起始日期</label><input readonly="readonly" type="text" class="ddate mui-input-clear" placeholder="点击选择起始日期" id='pickDateBtnStart' data-options='{"type":"date","beginYear":2017,"endYear":2019}' style="border: none;"></div></div><div class="mui-card"><div class="mui-input-row" style="padding: 5px;"><label>截止日期</label><input readonly="readonly" type="text" class="ddate mui-input-clear" placeholder="点击选择结束日期" id='pickDateBtnStop' data-options='{"type":"date","beginYear":2017,"endYear":2019}' style="border: none;"></div></div><div class="mui-button-row"><button id="confirmBtn" type="button" class="mui-btn mui-btn mui-btn-primary ">提    交</button></div></br><div id="pullrefresh"><ul id="alreadyVerifyTransportList" class="mui-table-view own-gray-color"></ul></div></div></div><script src="js/mui.min.js"></script><script src="js/own.js" charset="UTF-8"></script><script src="js/mui.picker.min.js"></script><script type="text/javascript">mui.init({swipeBack: false,pullRefresh: {container: '#pullrefresh',//down: {//contentdown: '下拉可刷新',//contentover: '释放立即刷新',//contentrefresh: '正在加载..',//callback: pulldownRefresh//},up: {contentrefresh: '正在加载..',contentnomore: '没有更多数据了',callback: pullupRefresh}}});var alreadyVerifyTransportList;var page = 1;//查询记录的当前页码var pages = 0;//查询记录总页数var s = '';var recordamount;//查询记录总条数var recordperpage=3;//查询记录每页显示条数mui.plusReady(function() {wishListwebview = plus.webview.currentWebview();var alreadyVerifyTransportList = document.getElementById('alreadyVerifyTransportList');plus.webview.currentWebview().addEventListener('hide', function() {document.getElementById("pickDateBtnStart").value='';document.getElementById("pickDateBtnStop").value='';alreadyVerifyTransportList.innerHTML='';}, false);});mui(".ddate").each(function() {var textControl = this;textControl.addEventListener('tap', function() {mui('#pullrefresh').pullRefresh().disablePullupToRefresh();var optionsJson = this.getAttribute('data-options') || '{}';var options = JSON.parse(optionsJson);var id = this.getAttribute('id');var picker = new mui.DtPicker(options);picker.show(function(rs) {textControl.value = rs.text;picker.dispose();mui('#pullrefresh').pullRefresh().enablePullupToRefresh();});}, false);});document.getElementById("confirmBtn").addEventListener('tap', function() {infoStart = document.getElementById("pickDateBtnStart").value;infoStop = document.getElementById("pickDateBtnStop").valueif(!infoStart || infoStart.trim() == "") {alert("请选择起始时间!")} else {if(!infoStop || infoStop.trim() == "") {alert("请选择截止时间!")} else {loadData(infoStart, infoStop, 1);mui('#pullrefresh').pullRefresh().refresh(true);}}}, false);function loadData(infoStart, infoStop, page) {var address = 'backstage/tsg/searcholdauditinfo';var baseurl= geturl();var finalurl = baseurl + address;mui.ajax({url:finalurl,//url: 'http://10.1.138.223:8080/JYSystem/backstage/boundlist/listboundinfo',data: JSON.stringify({starttime: infoStart,endtime: infoStop,pagesize: 3,//查询记录每页显示条数,即recordperpagepageindex: page//查询记录的当前页码,初始为1}),dataType: 'json', //服务器返回json格式数据type: 'post', //HTTP请求类型timeout: 10000, //超时时间设置为10秒;headers: {'Content-Type': 'application/json'},success: function(data) {//服务器返回响应,根据响应结果,分析是否登录成功;var alreadyVerifyTransportList = document.getElementById('alreadyVerifyTransportList');recordamount = data.total; //查询记录总条数pages=Math.ceil(recordamount/3);//查询记录总条数除以每页显示条数后向上取整,得到显示总页数if(page == 1) s = "";                        total = data.data.length; //当前页面数据条数if((page == 1)&&(total== 0)){s = '<li class="mui-table-view-cell" style="font-size: 14px;text-align: center;">没有已审数据</li>';//document.getElementById("pullrefresh").style.display = 'none';mui('#pullrefresh').pullRefresh().disablePullupToRefresh();} if(total > 0) {for(var i = 0; i <total; i++) {var currentRow = data.data[i];s = s + '<li class="mui-table-view-cell">';s = s + '<h4>车号:' + currentRow.car_no;s = s + ',     磅单号:' + currentRow.pound_seq_no + '</h4>';s = s + '<h5>请求时间:' + currentRow.requesttime + '</h5>';s = s + '<h5>请求人:' + currentRow.requester+ '</h5>';s = s + '<h5>审核时间:' + currentRow.audittime+ '</h5>';s = s + '<h5>审核结果:' + currentRow.auditstate+ '</h5>';s = s + '</li>';}//alreadyVerifyTransportList.innerHTML = s;//localStorage.setItem("total", total);} else {//alreadyVerifyTransportList.innerHTML = '<li class="mui-table-view-cell" style="font-size: 14px;text-align: center;">没有已发货物数据</li>';//localStorage.setItem("total", 0);//s = s +'<li class="mui-table-view-cell" style="font-size: 14px;text-align: center;">没有更多数据</li>';}alreadyVerifyTransportList.innerHTML = s;},error: function(xhr, type, errorThrown) {//异常处理;localStorage.setItem("total", 0);mui.toast('获取数据失败');}});}//function pulldownRefresh() {////setTimeout(function() {//getPickerdata();//setTimeout(function() {//getlist('1');//}, 100);//mui('#pullrefresh').pullRefresh().endPulldownToRefresh();//}, 1000);//}function pullupRefresh() {var copythis = this;if(pages && page < pages) {page += 1;loadData(infoStart, infoStop, page);copythis.endPullupToRefresh(false);} else {page = 1;setTimeout(function() {copythis.endPullupToRefresh(true);});}}</script></body></html>

阅读全文
0 0