import request from '@/utils/request'

// 查询历史列表
export function listHistoryData(query) {
  return request({
    url: '/contract/customer-contract/customer-contract-history/page',
    method: 'get',
    params: query
  })
}

// 查询历史详细
export function getHistoryData(dictCode) {
  return request({
    url: '/contract/customer-contract/customer-contract-history/get?id=' + dictCode,
    method: 'get'
  })
}

// 开启销售合同
export function open(data) {
  return request({
    url: '/contract/customer-contract/open',
    method: 'put',
    data: data
  })
}
// 关闭销售合同
export function close(data) {
  return request({
    url: '/contract/customer-contract/close',
    method: 'put',
    data: data
  })
}
//终止销售合同
export function terminate(data) {
  return request({
    url: '/contract/customer-contract/terminate',
    method: 'put',
    data: data
  })
}
//修改销售合同状态
export function editCustomerStatus(data) {
  return request({
    url: '/contract/customer-contract/editCustomerStatus',
    method: 'put',
    data: data
  })
}
//变更销售合同信息
export function alter(data) {
  return request({
    url: '/contract/customer-contract/alter',
    method: 'put',
    data: data
  })
}

//获取编号
export function getCustomerContractCode() {
  return request({
    url: '/contract/customer-contract/getCustomerContractCode',
    method: 'get'
  })
}
// 查询列表
export function listCustomer(query) {
  return request({
    url: '/contract/customer-contract/page',
    method: 'get',
    params: query
  })
}
// 查询列表（不分页）
export function listSimpleCustomerContract(query) {
  return request({
    url: '/contract/customer-contract/list',
    method: 'get',
    params: query
  })
}

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

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

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

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

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