| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 | 
							- mui.init();
 
- var docInfo  = null;
 
- var pageIndex = 1;
 
- var pageSize = 10;
 
- var scroller1;
 
- mui.plusReady(function(){
 
- 	var self = plus.webview.currentWebview();
 
- 	docInfo = JSON.parse(plus.storage.getItem("docInfo"));
 
- 	queryInit();
 
- })
 
- function queryInit(){
 
- 	plus.nativeUI.showWaiting();
 
-  	initData();
 
-  	bindEvents();
 
- 	function bindEvents(){		
 
- 		$(".c-list").on("click","li",function(event){
 
- 			var parentLi = $(this).closest("li");
 
- 			var id = parentLi.attr("data-id");
 
- 			openWebviewExtras("detail-appointment.html",{dataId:id});
 
- 		});
 
- 		
 
- 		$(".btntrue").bind("click",function(){
 
- 			openWebview("../../search/html/xuanzejumin_one.html",{origin:'wdyy'});
 
- 		})
 
- 		scroller1 =  $("#wrapper2").initScroll(
 
- 			{
 
- 				pullDownAction: function(){	
 
- 					location.reload();
 
- 				},pullUpAction: function() {
 
- 					getMyAppo();
 
- 				}
 
- 			}
 
- 		);
 
- 		
 
- 	}
 
- 	
 
- 	
 
- 	function initData(){
 
- 		$(".c-list").html("");
 
- 		pageIndex = 1;
 
- 		getMyAppo();	
 
- 	}
 
- 	
 
- 	function getMyAppo(){
 
- 		var data={};
 
- 		data.doctor = docInfo.code;
 
- 		data.pageIndex = pageIndex;
 
- 		data.pageSize = pageSize;
 
- 		sendPost('third/guahao/GetDoctorReservationList', data, getListFail, successFun);
 
- 	}
 
- 	
 
- 	function successFun(res){
 
- 		plus.nativeUI.closeWaiting();
 
- 		if(res.status==200){
 
- 			updatePullUpText(scroller1,res.data);
 
- 			if(res.data&&res.data.length>0){
 
- 				pageIndex=pageIndex+1;
 
- 				appendMyAppo(res.data);
 
- 			}else{
 
- 				if(pageIndex==1){
 
- 					$(".main").hide();
 
- 					$(".div-no-info").show();
 
- 				}else{
 
- 					mui.toast("无更多数据");
 
- 				}
 
- 			}
 
- 			if(res.data.length < pageSize){
 
- 				$(".pullUp").hide();
 
- 			}else{
 
- 				$(".pullUp").show();
 
- 			}
 
- 			scroller1.refresh();
 
- 		}else{
 
- 			getListFail(res);
 
- 		}
 
- 	}
 
- 	
 
- 	function getListFail(res){
 
- 		plus.nativeUI.closeWaiting();
 
- 		if (res && res.msg) {
 
- 			mui.toast(res.msg);
 
- 		} else {
 
- 			mui.toast("加载失败!");
 
- 		}
 
- 	}
 
- 	
 
- 	
 
- 	function appendMyAppo(dataList){
 
- 		var appoHtml ="";
 
- 		for(var j in dataList){
 
- 			var data = dataList[j];	
 
- 			appoHtml+='<li class="mt10" data-id="'+data.id+'" data-doctorCode="'+data.doctorCode+'" data-orgCode="'+data.orgCode+'" data-deptCode="'+data.deptCode+'" >'
 
- 						+'<div class="n-list dr-item c-border">'
 
- 							+'<div class="n-list-li pl10">'
 
- 								+'<div class="n-list-key">'
 
- 									+'<div class="n-avatar-l img-round">'
 
- 										+'<img src="'+ getImgUrl(data.photo) +'">'
 
- 									+'</div>'
 
- 								+'</div>'
 
- 								+'<div class="pl15">'
 
- 									+'<div>'
 
- 										+'<span class="c-f16 c-bold c-323232">'+data.name+'</span>'
 
- 									+'</div>'
 
- 									+'<div class="c-f12 c-909090 pt5">挂号时间:  '
 
- 										+'<span>'+data.czrq+'<span>'
 
- 									+'</div>'
 
- 								+'</div>'
 
- 							+'</div>'
 
- 							+'<div class="div-remark pl20 pt10 pb5">'
 
- 								+'<div>'
 
- 									+'<div class="left-yuan cb-333333"></div>'
 
- 									+'<div class="left-status c-333333 ml10 f-fs14">预约医生:'+data.doctorName+'</div>'
 
- 								+'</div>'
 
- 								+'<div>'
 
- 									+'<div class="left-yuan cb-333333"></div>'
 
- 									+'<div class="left-status c-333333 ml10 f-fs14">预约医院:'+data.orgName+'</div>'
 
- 								+'</div>'
 
- 								+'<div>'
 
- 									+'<div class="left-yuan cb-333333"></div>'
 
- 									+'<div class="left-status c-333333 ml10 f-fs14">就诊时间:'+data.startTime+'</div>'
 
- 								+'</div>'
 
- 							+'</div>'
 
- 						+'</div>'
 
- 					+'</li>';
 
- 		}
 
- 		$(".c-list").append(appoHtml);
 
- 		$(".main").show();
 
- 		$("#footer").show();
 
- 	}
 
- 	
 
- 	var updatePullUpText= function(scroller,list) {
 
- 		var $wrap = $(scroller.wrapper),
 
- 			$pullupLabel = $wrap.find('.pullUpLabel');
 
- 			$(".pullUp").removeClass("loading");
 
- 		if(!list || !list.length) {
 
- 			$pullupLabel.text('没有更多');
 
- 		} else {
 
- 			$pullupLabel.text('上拉加载更多');	
 
- 		}
 
- 		scroller.on('refresh',function() {	
 
- 			if(!list || !list.length) {
 
- 				$pullupLabel.text('没有更多');
 
- 			} else {
 
- 				$pullupLabel.text('上拉加载更多');
 
- 			}
 
- 		});
 
- 	}
 
- }
 
- window.addEventListener('update', function(e) {
 
- 	queryInit();
 
- });
 
 
  |