list.js 1000 Bytes
import App from '../../../utils/api.js'
import util from '../../../utils/util.js'
Page({
	data:{
		orderlist:{},
	},
	onLoad(opt){
		let systeminfo=util.cache('system.info');
		let headerheight=util.cache('headerHeight');
		this.setData({
			contentheight:systeminfo.windowHeight-headerheight
		})
		this.page=0;
		this.hasmore=true;
		this.getlist();
		// console.log(this.getlist())
	},
	getlist(){
		App.Orders.GetOrderListByOpenid({openid:util.cache('openid'),page:this.page,size:10}).then((json)=>{
			console.log(json)
			if(json.ret==200){
				json.data.forEach((v,i)=>{
					v.showdate=util.unixtoTime(v.cdate,'YYYY-MM-DD HH:II:SS')
				})
				let orderlist='orderlist['+this.page+']';
				console.log('yyyyy',orderlist)
				if(json.data.length<10){
					console.log('yyyyy',)
					this.hasmore=false;
				}
				this.setData({
					[orderlist]:json.data
				})
			}
		})
	},
	getnext(){
		console.log('rrrrr',this.hasmore);
		if(this.hasmore){
			this.page+=1;
			this.getlist();
		}
		
	}
})