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() } })