| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- // pages/payment-details/payment-details.js
- import {
- pointsDetail,
- getMoneyDetail
- } from '../../services/index.js'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list: [],
- title: {
- integral: '积分明细',
- wallet: '收支明细'
- },
- isLast: false,
- pageNo: 1
- },
- /**
- * 获取积分明细
- *
- */
- integral(pageNo = this.data.pageNo) {
- let params = {
- user_id: wx.getStorageSync('user_id'),
- user_token: wx.getStorageSync('user_token'),
- member_id: wx.getStorageSync('member_id'),
- pageNo
- }
- pointsDetail(params).then(res => {
- if (res.errcode === 0) {
- if (res.data.pointsList && res.data.pointsList.length) {
- pageNo++;
- this.setData({
- isLast: res.data.isLast,
- list: [...this.data.list, ...res.data.pointsList],
- pageNo,
- })
- }
- }
- })
- },
- /**
- * 获取支付明细
- */
- wallet(pageNo = this.data.pageNo) {
- let params = {
- user_id: wx.getStorageSync('user_id'),
- user_token: wx.getStorageSync('user_token'),
- member_id: wx.getStorageSync('member_id'),
- pageNo
- }
- getMoneyDetail(params).then(res => {
- if (res.errcode === 0) {
- if (res.data.mpMoneyDetailAPIList && res.data.mpMoneyDetailAPIList.length) {
- pageNo++;
- this.setData({
- isLast: res.data.isLast,
- list: [...this.data.list, ...res.data.mpMoneyDetailAPIList],
- pageNo,
- })
- }
- }
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- /*
- @integral 积分
- @wallet 钱包
- */
- if (options.type) {
- wx.setNavigationBarTitle({
- title: this.data.title[options.type],
- })
- this.setData({
- type: options.type
- })
- // 获取页面列表
- this[options.type]();
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- const isLast = this.data.isLast;
- if (isLast) {
- } else {
- this[this.data.type]();
- }
- },
- })
|