import request from '@/utils/request'

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

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

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

//获取编号
export function getSupplierContractCode() {
  return request({
    url: '/finance/contract/supplier-contract/getSupplierContractCode',
    method: 'get'
  })
}
// 查询列表
export function listSupplier(query) {
  return request({
    url: '/finance/contract/supplier-contract/page',
    method: 'get',
    params: query
  })
}


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

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

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

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

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