k94314517
2024-07-25 a75b18a4157ab486e0b51c438ac165ab3a08e3e0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { customerLogPage } from '../../api/index'
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    activeTabs: '1',
 
    dataList: [],
    total: 0,
    page: 1,
    capacity: 10,
  },
  onLoad(options) {
    this.getList()
  },
  onReachBottom() {
    console.log('触底事件');
    const { total, dataList, page } = this.data
    if(total > dataList.length){
      this.setData({ page: page + 1 })
      this.getList()
    }else{
      wx.showToast({
        title: '暂无更多数据',
        icon: 'none'
      })
    }
  },
  getList() {
    const { page,  capacity, activeTabs} = this.data
    customerLogPage({
      model: {
        type: activeTabs
      },page,capacity
    }).then(res => {
      this.setData({
        dataList: res.data.records,
        total: res.data.total,
      })
    })
  },
  tabsChange(e) {
    const activeTabs = e.currentTarget.dataset.val
    this.setData({ activeTabs, dataList: [], total: 0, page: 0,  })
    this.getList()
  }
})