const util = require('@/utils/util.js')
const mixins = require('@/mixins/index.js')
const app = getApp()
Page({
  mixins: [mixins],
  /**
   * 页面的初始数据
   */
  data: {
    pageFlag: false,
    commonService: app.globalData['commonService'],
    contentList: [
      { code: 'staffCode', title: '编码' },
      { code: 'staffName', title: '名称' },
      { code: 'isMain', title: '主业务员', type: 'switch' },
      { code: 'commission', title: '提成比率', type: 'commission', idKey: 'staffId' },
    ]
  },
  /**
    * @desc :   处理接口返回数据
    * @date : 2024/2/1 15:49
    * @author : 于继渤
    */
  handleSearchData(tableData) {
    tableData.forEach(res => {
      res['commission'] = Number(100)
    })
    this.setData({
      tableData: tableData
    })
  },
  /**
      * @desc : 加载数据
      * @author : 于继渤
      * @date : 2024/1/23 9:16
      */
  getData(params) {
    return this.excute(this.data.commonService, this.data.commonService.getStaff, params);
  },

  /**
      * @desc : 选择 确定事件
      * @author : 于继渤
      * @date : 2024/1/23 9:16
      */
  toMulti(e) {
    let item = e.detail
    // 给父页面传递数据
    const eventChannel = this.getOpenerEventChannel();
    eventChannel.emit('bindData', {
      staffMain: item.main,
      staffList: item.list,
      staffItem: item.item

    })
    wx.navigateBack({
      delta: 1
    })
  }

})