You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
999 B
48 lines
999 B
const app = getApp<IAppOption>(); |
|
|
|
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); |
|
} |
|
}, |
|
});
|
|
|