import request from '@/utils/request'

// 根据条件查询成员
export function employeesList(data) {
  return request({
    url: '/user/userList',
    method: 'post',
    data: {
      loginName: data.loginName,
      userName: data.userName,
      pageNum: data.pageNum,
      pageSize: data.pageSize
    }
  })
}
// 获取角色暂定写死
export function userRoleById(data) {
  return request({
    url: '/user/userRole',
    method: 'post',
    data: {
      pageNum: data.pageNum,
      pageSize: data.pageSize,
      roleName: data.roleName
    }
  })
}
// 添加用户角色
export function addUser(data) {
  return request({
    url: '/user/addUser',
    method: 'post',
    data: {
      pageNum: data.pageNum,
      pageSize: data.pageSize,
      roleName: data.roleName,
      remark: data.remark,
      userName: data.userName,
      loginName: data.loginName,
      menuArray: data.menuArray
    }
  })
}
// 查看用户角色
export function selectUser(data) {
  return request({
    url: '/user/selectById',
    method: 'post',
    data: {
      id: data.id
    }
  })
}
// 修改用户角色
export function upDate(data) {
  return request({
    url: '/user/upDate',
    method: 'post',
    data: {
      id: data.id,
      pageNum: data.pageNum,
      pageSize: data.pageSize,
      roleName: data.roleName,
      remark: data.remark,
      userName: data.userName,
      loginName: data.loginName,
      menuArray: data.menuArray
    }
  })
}
// 修改用户当前状态
export function upDateStatus(data) {
  return request({
    url: '/user/upDateStatus',
    method: 'post',
    data: {
      id: data.id,
      status: data.status
    }
  })
}

// 获取审核列表
export function userVerifyAll(data) {
  return request({
    url: '/user/verify/all',
    method: 'get',
    params: {
      phone: data.phone,
      userName: data.userName,
      idCard: data.idCard,
      pageNum: data.pageNum,
      pageSize: data.pageSize
    }
  })
}

// 审核用户
export function userVerifyAudit(data) {
  return request({
    url: '/user/verify/audit/' + data.userVerifyId,
    method: 'put',
    params: {
      verifyStatus: data.verifyStatus,
      roleState: data.type,
      remark: data.remark
    }
  })
}

// 校验移动端手机号是否注册
export function taUserHas(data) {
  return request({
    url: '/ta/user/has',
    method: 'get',
    params: {
      ownerTel: data.ownerTel
    }
  })
}

// 校验移动端手机号是否注册以及户主
export function taUserHasOwner(data) {
  return request({
    url: '/ta/user/hasOwner',
    method: 'get',
    params: {
      phaseId: data.phaseId,
      buildingId: data.buildingId,
      unitId: data.unitId,
      levelId: data.levelId,
      roomNoId: data.roomNoId
    }
  })
}

