list.js 966 Bytes
import App from '../../../utils/api.js'
import util from '../../../utils/util.js'
Page({
	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=this.data.orderlist ? this.data.orderlist.concat(json.data) : json.data;
				if(json.data.length<10){
					console.log('yyyyy')
					this.hasmore=false;
				}
				this.setData({
					orderlist:orderlist
				})
			}
		})
	},
	getnext(){
		console.log('rrrrr');
		if(this.hasmore){
			this.page+=1;
			this.getlist();
		}
		
	}
})