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
50
51
52
53
54
55
56
57
58
59
60
61
62
| import { customerLogPage } from '../../api/index'
| Page({
|
| /**
| * 页面的初始数据
| */
| data: {
| activeTabs: '1',
|
| dataList: [],
| total: 0,
| page: 1,
| capacity: 10,
| },
| onLoad(options) {
| this.getList()
| },
| onPullDownRefresh: function () {
| console.log('下拉刷新');
| this.setData({ dataList: [], page: 1, total: 0 })
| 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 => {
| if(res.data && res.data.records){
| const temp = res.data.records.map(item => {
| if(item.budget > 10000){
| item.budget = (item.budget / 10000).toFixed(2) + '万'
| }
| return item
| })
| this.setData({
| dataList: [ ...this.data.dataList, ...temp ],
| total: res.data.total,
| })
| }
| })
| },
| tabsChange(e) {
| const activeTabs = e.currentTarget.dataset.val
| this.setData({ activeTabs, dataList: [], total: 0, page: 0, })
| this.getList()
| }
| })
|
|