jiangping
2024-07-24 680028df90e18299ea72d242a28a3ddcd9a0441c
wechat_staff/pages/kefu/select.js
@@ -1,12 +1,21 @@
// pages/discover/discover.js
import { getCustomerList, getCrmAuthUrl } from '../../api/index'
const { HYEventBus } = require('hy-event-store')
const eventBus = new HYEventBus()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    activeTabs: '0',
    bottomLift: 0
    bottomLift: 0,
    keyWords: '',
    dataList: [],
    total: 0,
    flag: 0,
    page: 1,
    pageSize: 10,
  },
  /**
@@ -17,10 +26,52 @@
    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() {
    getCrmAuthUrl({type:1}).then(res => {
      console.log(res.data)
      this.setData({ url: res.data })
      wx.navigateTo({
        url: '/pages/webView/index?link=' + res.data,
      })
    })
  },
  handleSub() {
    console.log('点击饿了');