/**
 * 会员管理接口
 */
import request from '@/utils/request'
import qs from 'qs'
// 会员查询
export function getMemberListPage(params) {
  return request({
    url: '/sanitation/staff/listPage',
    method: 'get',
    params
  })
}
// 会员查询
export function getMemberList(pid) {
  return request({
    url: '/sanitation/staff/list',
    method: 'get',
    params: {
      pid: pid
    }
  })
}

// 添加会员
export function addMember(params) {
  return request({
    url: '/sanitation/staff/add',
    method: 'post',
    params,
    paramsSerializer: params => {
      return qs.stringify(params, { indices: false })
    }
  })
}
// 修改会员
export function updateMember(params) {
  return request({
    url: '/sanitation/staff/update',
    method: 'post',
    params,
    paramsSerializer: params => {
      return qs.stringify(params, { indices: false })
    }
  })
}
// 删除会员
export function delMember(ids) {
  return request({
    url: '/sanitation/staff/delete',
    method: 'post',
    params: {
      ids
    },
    paramsSerializer: params => {
      return qs.stringify(params, { indices: false })
    }
  })
}
// 会员出勤记录查询
export function getAttendanceList(params) {
  return request({
    url: '/sanitation/staff/attendanceList',
    method: 'get',
    params
  })
}

// 会员出勤记录查询
export function exportAttendanceList(params, config) {
  return request({
    url: '/sanitation/staff/attendance/export',
    method: 'get',
    timeout: 120000,
    params,
    ...config,
    responseType: 'blob' // 这一步也很关键，一定要加上 responseType 值为 blob
  })
}
