123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- // 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) => {}
- );
- },
- });
|