// orderRecord/index.js var app = getApp(); var util = require("../utils/util.js"); Page({ /** * 页面的初始数据 */ data: { appAssetsUrl: app.appAssetsUrl, params: { page: 1, limit: 10, }, total: { total: 0, currPage: 0, totalPage: 0, }, noMore: false, listData: [], member: {}, nodata: util.nodata(), }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { // this.PushVipInfo(); this.loadList(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () {}, /** * 生命周期函数--监听页面显示 */ onShow: function () {}, /** * 生命周期函数--监听页面隐藏 */ onHide: function () {}, /** * 生命周期函数--监听页面卸载 */ onUnload: function () {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.setData({ params: { page: ++this.data.params.page, limit: 10, }, }); this.loadList(); }, /** * 用户点击右上角分享 */ onShareAppMessage: function () {}, //查询会员信息 PushVipInfo() { let that = this; let id = util.getUserId(); if (id) { app._post_form( "member/apiSelectMeberInfo", "application/json", { id }, function (res) { if (res.code === 0) { that.setData({ member: res.member, }); } } ); } }, loadList() { if (this.data.total.total > 0) { if (this.data.total.currPage == this.data.total.totalPage) { wx.showToast({ title: "没有更多哦~", icon: "none", }); return false; } } wx.showLoading({ title: "努力加载中...", }); app._get( "order/orderPage", { ...this.data.params, memberId: util.getUserId(), }, (res) => { if (res.code === 0) { this.setData({ listData: [...this.data.listData, ...res.page.list], total: { total: res.page.totalCount, currPage: res.page.currPage, totalPage: res.page.totalPage, }, }); wx.hideLoading(); } }, (err) => { console.log(err, 111) wx.showToast({ icon: 'error', title: '服务端异常', }) }, (complete) => {} ); }, });