''
liukangdong
2024-07-24 18b0c32356c91c355d3ffae1d3f99c1043ba203e
wechat_staff/pages/kefu/select.js
@@ -1,12 +1,19 @@
// pages/discover/discover.js
import { getCustomerList } from '../../api/index'
Page({
  /**
   * 页面的初始数据
   */
  data: {
    activeTabs: '0',
    bottomLift: 0
    bottomLift: 0,
    keyWords: '',
    dataList: [],
    total: 0,
    flag: 0,
    page: 1,
    pageSize: 10,
  },
  /**
@@ -17,10 +24,49 @@
    this.setData({
      bottomLift: app.bottomLift
    })
    this.getList()
  },  
  tabsClick(e) {
    const activeTabs = e.currentTarget.dataset.tab
    this.setData({activeTabs})
    const flag = e.currentTarget.dataset.tab
    this.setData({flag})
    this.setData({total: 0,dataList: [], page: 1})
    this.getList()
  },
  reloadList() {
    this.setData({total: 0,dataList: [], page: 1})
    this.getList()
  },
  scrolltolower() {
    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 { flag, page, pageSize, keyWords } = this.data
    getCustomerList({
      flag, page, pageSize, keyWords
    }).then(res => {
      if(res.data){
        this.setData({
          total: res.data.total,
          dataList: [...this.data.dataList, ...res.data.data]
        })
      }
    })
  },
  jumpClient() {
    wx.switchTab({
      url: '/pages/client/index',
    })
  },
  handleSub() {
    console.log('点击饿了');