import request from '@/utils/request'

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

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

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

// 目的港
export function getDestPort(params) {
  return request({
    url: '/salesOrder/getDestPortList',
    method: 'get',
    params
  })
}

// -------------------------------------------

// 订单列表
export function getOrderList(params) {
  return request({
    url: '/salesOrder/list',
    method: 'get',
    params
  })
}

// 查销售合同
export function getSalesContract(params) {
  return request({
    url: '/salesOrder/salesContractList',
    method: 'get',
    params
  })
}

// 商品列表
export function getSalesOrderGoods(params) {
  return request({
    url: '/salesOrder/commodityList',
    method: 'get',
    params
  })
}

// 销售订单-保存
export function saveOrder(data) {
  return request({
    url: '/salesOrder/save',
    method: 'post',
    data
  })
}

// 销售订单-提交
export function submitOrder(data) {
  return request({
    url: '/salesOrder/submit',
    method: 'post',
    data
  })
}

// 销售订单-删除
export function deleteSaleOrder(params) {
  return request({
    url: '/salesOrder/delete',
    method: 'get',
    params
  })
}

// 销售订单-详情
export function getSalesOrderDetail(params) {
  return request({
    url: '/salesOrder/detail',
    method: 'get',
    params
  })
}

// 销售订单-发货
export function submitTrans(data) {
  return request({
    url: '/salesOrder/deliver',
    method: 'post',
    data
  })
}

// 发票 --------------------------------------

// 发票列表
export function getInvoiceList(params) {
  return request({
    url: '/salesOrderInvoice/list',
    method: 'get',
    params
  })
}

// 下载发票
export function downLoadInvoice(params) {
  return request({
    url: '/salesOrderInvoice/download',
    method: 'get',
    params
  })
}

export function getInvoiceDetail(params) {
  return request({
    url: '/salesOrderInvoice/detail',
    method: 'get',
    params
  })
}

// 物流 ---------------------------------------

// 物流列表
export function getTransportList(params) {
  return request({
    url: '/salesOrderLogistics/list',
    method: 'get',
    params
  })
}

export function getTransportDetail(params) {
  return request({
    url: '/salesOrderLogistics/detail',
    method: 'get',
    params
  })
}
