import { axios } from '@/utils/request'

/* 用户管理 */

// 用户列表
export const customerList = (params) => {
  const url = `customer/query/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}

// 启用禁用
export const changeStatus = (params) => {
  const url = `customer/enable/${params.id}/${params.state}`
  return axios({
    url: url,
    data: params,
    method: 'get'
  })
}

// 用户详情
export const customerDetails = (params) => {
  const url = `customer/findById/${params.id}`
  return axios({
    url: url,
    data: params,
    method: 'get'
  })
}

// 导出
export const customeExport = (params) => {
  return axios({
    url: `customer/export`,
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}

// 用户管理-乐豆详情
export const customerGoldLogDetail = (params) => {
  const url = `customerGoldLog/query/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 修改乐豆余额
export const updateGold = (params) => {
  return axios({
    url: `customer/updateGold`,
    data: params,
    method: 'post'
  })
}
// 修改手机号码
export const updateMobile = (params) => {
  return axios({
    url: `customer/updateMobile`,
    data: params,
    method: 'post'
  })
}

// 修改用户身份
export const updateRole = (params) => {
  return axios({
    url: `customer/updateRole`,
    data: params,
    method: 'post'
  })
}

// 乐豆明细--所有用户
export const offPartnerGoldLog = (params) => {
  const url = `customerGoldLog/query/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}

//  乐豆明细--总计（所有用户）
export const getStatistic = (params) => {
  const url = `customerGoldLog/getGoldChangeNumTotal`
  return axios.request({
    url: url,
    data: params,
    method: 'post'
  })
}
