const app = getApp();
const api = require('@/utils/api.js');
const Constants = require('@/utils/Constants');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show: false,
    noMore: false,
    loading: false,
    pageInfo: {
      pageSize: 6,
      currentPage: 1
    },
    page: '',
    list: [],
    form: {
      customerFrom: null,
      salesChannel: null,
      org: null,
      staff: null,
      orgName: '',
      staffName: '',
      customerFromName: '',
      salesChannelName: '',
    },
    searchText: '',
    statusList: [{
      text: '供应商',
      value: 1,
      checked: true
    },
    {
      text: '客户',
      value: 2,
      checked: false
    },
    ],
    statusItem: {
      text: '客户',
      value: 2
    },
    objectType: '',
  },
  /**
   * @desc : 单据状态点击事件
   * @author : 于继渤
   * @date : 2022/5/24 12:16
   */
  dropdowncommit(e) {
    this.selectComponent("#statusItem").toggle(false) //取消选中样式
    console.log("dropdowncommit", e)

    let dataList = e.detail.dataList
    let type = e.currentTarget.dataset.type
    let statusItem = this.data.statusItem
    statusItem.text = dataList.join(", "); // 使用逗号和空格作为分隔符
    this.setData({
      objectType: e.detail.values,
      statusItem
    })


    this.doSearch()

  },

  /**
   * @desc : 确定事件
   * @author : 于继渤
   * @date : 2022/6/02 09:16
   */
  submit() {

    let list = this.data.list


    var pages = getCurrentPages();
    var prevPage = pages[pages.length - 2]; //上一个页面
    let objItem = {}
    list.forEach(element => {
      if (element.checked) {
        objItem = element
        delete objItem.cpId
        delete objItem.ascpId
        delete objItem.sale1Id
        delete objItem.sale2Id
        delete objItem.orgCode
        delete objItem.orgId
        delete objItem.orgName
        delete objItem.whId
        delete objItem.whName
        delete objItem.remarks
      }
    });


    prevPage.setData({
      objItem
    })
    wx.navigateBack({
      delta: 1
    })
  },

  /**
   * @desc : checkbox点击事件
   * @author : 于继渤
   * @date : 2022/5/23 15:16
   */
  catchtapCheck(e) {
    let item = e.currentTarget.dataset.item
    let list = this.data.list
    list.forEach(res => {
      if (res.objId === item.objId) {
        res.checked = true
      } else {
        res.checked = false
      }
    })
    this.setData({
      list: list
    })
  },

  /**
   * @desc : 小程序销售订单选客户分页查询
   * @author : 于继渤
   * @date : 2022/5/23 15:16
   */
  getData(e) {
    // this.setData({
    //   loading: true
    // })
    let param = {}
    param.searchText = this.data.searchText ? this.data.searchText : '' //查询条件

    let tList = [
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市浑南区辽宁精研药物评价试验平台给你看",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": null,
        "cpId": null,
        "customerPhone": "15512319963",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "15512319963-1002TO",
        "objId": 3660,
        "objName": "😲",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "15512319963",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市皇姑区沈阳市轻工艺术学校S",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": null,
        "deliveryPhone": "",
        "cpId": null,
        "customerPhone": "45545464666",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "45545464666-1002XT",
        "objId": 3809,
        "objName": "LA🎈🎈🎈",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "45545464666",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市浑南区浑南区沈阳国际软件园(高深东路南)111",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": "",
        "cpId": null,
        "customerPhone": "21212212125",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "11291129112-1002XR",
        "objId": 3807,
        "objName": "🍔1129",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "21212212125",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市浑南区浑南区沈阳国际软件园(高深东路南)可冷了",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": null,
        "cpId": null,
        "customerPhone": "55865856666",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "55865856666-1002R4",
        "objId": 3568,
        "objName": "110901",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "55865856666",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市沈北新区中国医科大学(沈北校区)功能里",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": "",
        "cpId": null,
        "customerPhone": "21212212125",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "21212212125-1002TQ",
        "objId": 3662,
        "objName": "🚔",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "21212212125",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市浑南区沈阳市浑南区人民政府(新聪街西)1",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": "",
        "cpId": null,
        "customerPhone": "13623432321",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "13623432321-1002QS",
        "objId": 3556,
        "objName": "ALI",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "13623432321",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市和平区皇寺路(地铁站)11",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": "",
        "cpId": null,
        "customerPhone": "13333333333",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "13333333333-1002RZ",
        "objId": 3599,
        "objName": "李四",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "13333333333",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市和平区全季酒店(沈阳西塔店)1",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": null,
        "cpId": null,
        "customerPhone": "12446454888",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "12446454888-1002PX",
        "objId": 3525,
        "objName": "110601",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "12446454888",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市和平区全季酒店(沈阳西塔店)1",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": null,
        "cpId": null,
        "customerPhone": "12446454888",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "12446454888-1002PY",
        "objId": 3526,
        "objName": "110601",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "12446454888",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市浑南区浑南区沈阳国际软件园(高深东路南)吧",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": "",
        "cpId": null,
        "customerPhone": "22555565856",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "22555565856-1002PZ",
        "objId": 3527,
        "objName": "110602",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "22555565856",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市沈河区市府广场东(公交站)去",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": "",
        "cpId": null,
        "customerPhone": "12122344564",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "12122344564-1002Q0",
        "objId": 3528,
        "objName": "110603",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "12122344564",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市沈河区市府广场东(公交站)去",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": null,
        "deliveryPhone": null,
        "cpId": null,
        "customerPhone": "12122344564",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "12122344564-1002Q1",
        "objId": 3529,
        "objName": "110603",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "12122344564",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      },
      {
        "accountType": null,
        "accountname": null,
        "addressFull": "辽宁省沈阳市浑南区浑南区月星国际城(白塔河一路南) 他",
        "ascpId": null,
        "categoryCode": null,
        "categoryId": null,
        "categoryName": null,
        "channelId": null,
        "code": null,
        "contactName": "",
        "deliveryPhone": null,
        "cpId": null,
        "customerPhone": "15848454848",
        "defSettlementType": 0,
        "defWhId": null,
        "erpOrgCode": null,
        "erpStaffCode": null,
        "flgStore": false,
        "flgValid": true,
        "id": null,
        "imageReceiptCode": null,
        "jobId": 0,
        "keyWords": null,
        "name": null,
        "objCode": "15848454848-1002QL",
        "objId": 3549,
        "objName": "110701",
        "objType": 2,
        "objTypeName": "客户",
        "orgAscpId": null,
        "orgAscpName": null,
        "orgCode": null,
        "orgId": null,
        "orgName": null,
        "orgSale2Id": null,
        "orgSale2Name": null,
        "orgSalesChannel": null,
        "orgSalesChannelName": null,
        "parentId": null,
        "phone": "15848454848",
        "postId": null,
        "postName": null,
        "qvUserid": null,
        "remarks": null,
        "sale1Id": null,
        "sale2Id": null,
        "salesChannel": null,
        "salesChannelName": null,
        "sumAmount": null,
        "toiletsNum": null,
        "typeId": 0,
        "typeName": null,
        "whId": null,
        "whName": null
      }
    ]
    this.setData({
      list: tList
    })
    param.pageSize = this.data.pageInfo.pageSize
    param.currentPage = this.data.pageInfo.currentPage
    param.objectType = this.data.objectType ? this.data.objectType.split(",").map(Number) : [1]
    // api.request(Constants.BASIC_COMMON_API + 'get_supplier_and_customer', 'POST', param).then(res => {
    //   this.setData({
    //     loading: false
    //   })

    //   if (res.data.code === 200) {
    //     let tList = this.data.list;
    //     let list = res.data.data.list; //后台返回数据
    //     if (!list || list.length == 0) {
    //       // 如果不是翻页，需要清空
    //       if (e != 'more') {
    //         this.setData({
    //           list: [],
    //           noMore: false
    //         })
    //       } else {
    //         this.setData({
    //           noMore: true
    //         })
    //       }
    //       return
    //     }
    //     if (list.length < this.data.pageInfo.pageSize) {
    //       this.setData({
    //         noMore: false
    //       })
    //     }
    //     tList = tList.concat(list)
    //     this.setData({
    //       list: tList
    //     })
    //   }
    // })
  },

  /**
   * @desc : 查询
   * @author : 于继渤
   * @date : 2022/5/24 08:49
   */
  doSearch() {
    let pageInfo = this.data.pageInfo;
    pageInfo.pageSize = 6;
    pageInfo.currentPage = 1;
    this.setData({
      show: false,
      noMore: false,
      pageInfo: pageInfo,
      list: []
    })
    this.getData()
  },

  /**
   * @desc : 页面上拉触底事件的处理函数
   * @author : 于继渤
   * @date : 2022/5/24 08:49
   */
  onReachBottom: function () {
    if (this.data.loading || this.data.noMore) {
      return;
    }
    this.setData({
      pageInfo: {
        pageSize: this.data.pageInfo.pageSize,
        currentPage: this.data.pageInfo.currentPage + 1
      }
    })
    this.getData('more')
  },


  /**
   * @desc : 下拉打开
   * @author : 于继渤
   * @date : 2022/6/02 09:16
   */
  openSearchPop(e) {
    let type = e.currentTarget.dataset.type
    if (type === 'customerFrom') {
      this.setData({
        customerSourceFlag: true
      })
    } else if (type === 'salesChannel') {
      this.setData({
        channelSourceFlag: true
      })
    } else if (type === 'org') {
      this.setData({
        orgSourceFlag: true
      })
    } else if (type === 'staff') {
      this.setData({
        staffSourceFlag: true
      })
    }

  },

  /**
   * @desc : 下拉关闭事件
   * @author : 于继渤
   * @date : 2022/6/02 09:16
   */
  muticlose(e) {
    let id = e.currentTarget.id
    if (id === 'customerFrom') {
      this.selectComponent("#customerFrom").toggle(false);
    } else if (id === 'salesChannel') {
      this.selectComponent("#salesChannel").toggle(false);
    } else if (id === 'org') {
      this.selectComponent("#org").toggle(false);
    } else if (id === 'staff') {
      this.selectComponent("#staff").toggle(false);
    }

  },
  /**
   * @desc : 组件单选确定
   * @author : 于继渤
   * @date : 2022/6/02 09:16
   */
  mutiSearch(e) {
    let id = e.target.id
    let form = this.data.form
    if (id === 'customerFrom') {
      // form.customerSourceName = e.detail.name
      form.customerFrom = e.detail.id
      form.customerFromName = e.detail.name
      this.selectComponent("#customerFrom").toggle();
    } else if (id === 'salesChannel') {
      form.salesChannel = e.detail.id
      form.salesChannelName = e.detail.name
      this.selectComponent("#salesChannel").toggle();
    } else if (id === 'staff') {
      form.staff = e.detail.id
      form.staffName = e.detail.name
      this.selectComponent("#staff").toggle();
    } else if (id === 'org') {
      form.orgId = e.detail.id
      form.orgName = e.detail.name
      this.selectComponent("#org").toggle();
    }

    this.setData({
      form: form
    })
    this.doSearch()
  },


  /**
   * @desc : 生命周期函数--监听页面加载
   * @author : 于继渤
   * @date : 2022/6/02 09:16
   */
  onLoad: function (options) {

    //加载数据
    this.doSearch()

  },

})