import request from '@/utils/request'

// 状态修改
export function changeUserStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/customer/info/update-open-status',
    method: 'put',
    data: data
  })
}

//获取编号
export function getCustomerCode() {
  return request({
    url: '/customer/info/getCustomerCode',
    method: 'get'
  })
}
// 查询列表
export function listCustomer(query) {
  return request({
    url: '/customer/info/page',
    method: 'get',
    params: query
  })
}

// 获取精简信息列表  isOpen不传查全部的 传0就是开启的 1就是关闭的
export function listSimpleCustomer(query) {
  return request({
    url: '/customer/info/list',
    method: 'get',
    params: query
  })
}

// 查询详细
export function getCustomer(dictId) {
  return request({
    url: '/customer/info/get?id=' + dictId,
    method: 'get'
  })
}

// 新增
export function addCustomer(data) {
  return request({
    url: '/customer/info/create',
    method: 'post',
    data: data
  })
}

// 修改
export function updateCustomer(data) {
  return request({
    url: '/customer/info/update',
    method: 'put',
    data: data
  })
}

// 删除
export function delCustomer(dictId) {
  return request({
    url: '/customer/info/delete?id=' + dictId,
    method: 'delete'
  })
}

// 导出
export function exportCustomer(query) {
  return request({
    url: '/customer/info/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}