| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- // pages/commission-details/index.js
- import {
- spreadCommission,
- spreadCount
- } from '../../api/user.js';
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- parameter: {
- 'navbar': '1',
- 'return': '1',
- 'title': '佣金记录',
- 'color': true,
- 'class': '0'
- },
- name: '',
- type: 0,
- page: 0,
- limit: 8,
- recordList: [],
- recordType: 0,
- recordCount: 0,
- status: false,
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({
- type: options.type
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- var type = this.data.type;
- if (type == 1) {
- this.setData({
- 'parameter.title': '提现记录',
- name: '提现总额',
- recordType: 4
- });
- } else if (type == 2) {
- this.setData({
- 'parameter.title': '佣金记录',
- name: '佣金记录',
- recordType: 3
- });
- } else {
- wx.showToast({
- title: '参数错误',
- icon: 'none',
- duration: 1000,
- mask: true,
- success: function (res) {
- setTimeout(function () {
- wx.navigateBack({
- delta: 1,
- })
- }, 1200)
- },
- });
- }
- this.getRecordList();
- this.getRecordListCount();
- },
- /**
- * 获取余额使用记录
- */
- getRecordList: function () {
- var page = this.data.page;
- var limit = this.data.limit;
- var status = this.data.status;
- var recordType = this.data.recordType;
- var recordList = this.data.recordList;
- var recordListNew = [];
- if (status == true) {
- return;
- }
- var that = this;
- spreadCommission(recordType, {
- page: page,
- limit: limit
- }).then(res => {
- var len = res.data.length;
- var recordListData = res.data;
- recordListNew = recordList.concat(recordListData);
- that.setData({
- status: limit > len,
- page: limit + page,
- recordList: recordListNew
- });
- });
- },
- getRecordListCount: function () {
- var that = this;
- spreadCount(that.data.recordType).then(res => {
- that.setData({
- recordCount: res.data.count
- });
- });
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- this.getRecordList();
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|