const app = getApp(); Page({ data: { list: [], pagination: { page: 1, pages: 1, count: 1, }, }, onLoad() { app.waitLogin().then(() => { this.getList(); }); }, getList(newPage = 1) { wx.ajax({ method: "POST", url: "?r=zd/gift-order/get-order-list", data: { page: newPage, }, }).then((res) => { let list = res.page == 1 ? res.list : [...this.data.list, ...res.list]; this.setData({ list: list, pagination: { page: res.page, pages: res.pages, count: res.count, }, }); }); }, handleDetail(e: any) { const { id } = e.currentTarget.dataset; wx.navigateTo({ url: `/gift/pages/orderDetail/index?id=${id}`, }); }, onReachBottom() { const { page, pages } = this.data.pagination; if (pages > page) { this.getList(page + 1); } }, });