// import { ResultType } from '@/@types/enumHelper'
// import router from '@/router'
// import UserActions from '@/store/modules/user/actions'//{ UserActionsType }

// import { UserGetter } from '@/store/modules/user/getters'
// import { dispatchAction, getStoreGetter, setStoreState } from '@/store/utils'
// import message from '@/utils/message'
import { StaticConfig } from '@/config/app'
import { ref,reactive } from 'vue'
import customer2,{CutomerParams} from '@/api/customer2'
interface Params {
  selectVal: string
  selectWay: number
}
interface timeParams {
  timeWay: number
}
const CustomerModule = () => {
  //调用方法
  const getCustomerList =(param:CutomerParams)=>{
    customer2.getCustomerList(param).then(res=>{
      console.log(res,'数据');
      if(res.data.Code==1){
        data.dataList = res.data.Data.PageData;
        msg.pageCount = res.data.Data.PageCount;
      }
    })
  }
  const title = ref(StaticConfig.appsuffix)
  //控制页显示条数
  const pagination = reactive({
    rowsPerPage:0
  })
  const data = reactive({
    columns:[{
        name: 'CustomerName',
        label: '客户',
        field: 'CustomerName',
        align: 'left',
      },
      { name: 'StageName', align: 'center', field:'StageName', label: '客户阶段'},    
      { name: 'LableList', label: '客户标签', field:'LableList', align: 'left'},
      { name: 'carbs', label: '内容标签', field:'carbs', align: 'left' },
      { name: 'CreateTime', label: '创建时间', field:'CreateTime', align: 'left' },
      { name: 'sodium', label: '负责人', field:'sodium', align: 'left' },
      { name: 'LastFollowUpTime', label: '上次跟进', field:'LastFollowUpTime', align: 'left' },
      { name: 'Source', label: '渠道活码来源', field:'Source', align: 'left'},
      // { name: 'num', label: '7日内客户回复消息数', align: 'left'},
      // { name: 'num', label: '7日内员工发送消息数', align: 'left'},
      { name: 'FriendTime', label: '添加好友时间', field:'FriendTime',  align: 'left'},
      { name: 'CheckInNum', label: '签到拜访', field:'CheckInNum', align: 'left'},
    ],
    selected:[],
    dataList:[]
  })
  const msg = reactive({
    PageIndex: 1,
    PageSize: 10,
    pageCount: 0,
    CorpName: '', //企业名称
    CustomerName: '', //备注名
    WeChatName: '', //昵称
    CustomerMobile: '', //手机号码
    CreateSTime: '', //创建开始时间
    CreateETime: '', //创建结束时间
    FriendSTime: '', //好友开始时间
    FriendETime: '', //好友结束时间
    Q_NotFollowUpDay: 0, //几天未跟进
    Q_Friends: '', //好友关系 多选逗号分隔、
    Q_AddWay: '', //获取来源 多选英文逗号分隔
    EmpId: 0, //员工id
    CustomerType: 0, //类型1微信用户 2企业微信用户
    SelectList: [], //自定义查询
    OrderBy: 1, //排序
    AddCondition: 0 //查询条件
  })
  const TypeList = reactive([{
    Name:'企业',
    Id:0
  },{
    Name:'昵称',
    Id:1
  },{
    Name:'备注名',
    Id:2
  },{
    Name:'电话',
    Id:3
  }])
  const TimeList = reactive([{
    Name:'客户创建时间',
    Id:1
  },{
    Name:'好友添加时间',
    Id:2
  }])
  const SeletObj:Params = reactive({
    selectVal:'',
    selectWay:0
  })
  const TimeObj:timeParams = reactive({
    timeWay:0
  })
  //选择方式
  const getSelectWay = () => {
    msg.CorpName = '';
    msg.WeChatName = '';
    msg.CustomerName = '';
    msg.CustomerMobile = '';
    //1企业名称 2姓名 3备注名 4手机号
    if(SeletObj.selectWay==0){  
      msg.CorpName = SeletObj.selectVal;
    }
    if(SeletObj.selectWay==1){
      msg.WeChatName = SeletObj.selectVal;
    }
    if(SeletObj.selectWay==2){
      msg.CustomerName = SeletObj.selectVal;
    }
    if(SeletObj.selectWay==3){
      msg.CustomerMobile = SeletObj.selectVal;
    }
  }
  const changePage = (val:any) => {
    console.log(val);
  }

  return { getCustomerList,data,msg,title,TypeList,SeletObj,getSelectWay,TimeObj,TimeList,changePage,pagination}
}

export default CustomerModule
