import request from '@/utils/request'
// 销售合同列表
export function getSalesList(data) {
  return request({
    url: '/salesContract/get/page',
    method: 'post',
    data
  })
}

// 销售合同-导入商品
export function importGoods(data) {
  return request({
    url: '/client/salesContract/import/commodity',
    method: 'post',
    data
  })
}

// 销售合同-保存销售合同基础信息
export function saveSalesContract(data) {
  return request({
    url: '/salesContract/save/baseInfo',
    method: 'post',
    data
  })
}

// 销售合同-商品信息-下载模板
export function downloadGoodsTemplate(params) {
  return request({
    url: '/salesContract/downloadTemplate',
    method: 'get',
    params,
    responseType: 'arraybuffer'
  })
}

// 销售合同-商品名称list
export function getGoodsNameList(params) {
  return request({
    url: '/salesContract/get/commodity',
    method: 'get',
    params
  })
}

// 销售合同-保存销售合同条款
export function saveSalesContractTerms(data) {
  return request({
    url: '/salesContract/save/terms',
    method: 'post',
    data
  })
}

// 销售合同-销售合同详情
export function getSalesContractDetail(params) {
  return request({
    url: `/salesContract/get/${params.contractId}`,
    method: 'get'
  })
}

// 销售合同-删除合同文件
export function deleteSaleContractFile(params) {
  return request({
    url: `/salesContract/delete/${params.contractId}`,
    method: 'get'
  })
}

// 销售合同-下载合同文件
export function downloadSaleContractFile(params) {
  return request({
    url: `/salesContract/download/${params.contractId}`,
    method: 'get',
    responseType: 'arraybuffer'
  })
}

// 销售合同-上传合同文件
export function uploadSaleContractFile(data) {
  return request({
    url: `/salesContract/upload`,
    method: 'post',
    data
  })
}

// 企业信息我的企业查询
export function getMyEnterprise(params) {
  return request({
    url: '/enterprise/myEnterprise',
    method: 'get',
    params
  })
}

// 查询当前企业贸易平台查询
export function getTradePlatform(params) {
  return request({
    url: '/tradingPlatform/can/match',
    method: 'get',
    params
  })
}

// 通过企业id查询进口商品信息接口
export function getCommodityByEnterpriseId(params) {
  return request({
    url: '/importerEntity/getByUserId',
    method: 'get',
    params
  })
}

// 根据id查询供应商列表
export function getSupplierList(params) {
  return request({
    url: '/vendorEntity/getByUserId',
    method: 'get',
    params
  })
}

// 销售合同-上传合同文件
export function uploadContract(params) {
  return request({
    url: '/salesContract/upload/' + params,
    method: 'get'
  })
}

// 销售合同-下载合同文件
export function downloadContract(params) {
  return request({
    url: '/salesContract/download/' + params,
    method: 'get'
  })
}

// 销售合同-删除合同文件
export function deleteContract(params) {
  return request({
    url: '/salesContract/delete/' + params,
    method: 'get'
  })
}

// 查询小图商品明细
export function getCommoditySpid(params) {
  return request({
    url: '/salesContract/get/commoditySpid',
    method: 'get',
    params
  })
}
