import request from '@/utils/request'

// 创建供应商
export function createSupplier(data) {
  return request({
    url: '/ecw/supplier/create',
    method: 'post',
    data: data
  })
}

// 更新供应商
export function updateSupplier(data) {
  return request({
    url: '/ecw/supplier/update',
    method: 'put',
    data: data
  })
}

// 删除供应商
export function deleteSupplier(id) {
  return request({
    url: '/ecw/supplier/delete?id=' + id,
    method: 'delete'
  })
}

// 获得供应商列表
export function getSupplierList(query) {
  return request({
    url: '/ecw/supplier/list',
    method: 'get',
    params: query
  })
}

// 获得供应商
export function getSupplier(id) {
  return request({
    url: '/ecw/supplier/get?id=' + id,
    method: 'get'
  })
}

// 获得供应商分页
export function getSupplierPage(query) {
  return request({
    url: '/ecw/supplier/page',
    method: 'get',
    params: query
  })
}

// 导出供应商 Excel
export function exportSupplierExcel(query) {
  return request({
    url: '/ecw/supplier/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 创建清关文件号码
export function createFileNo(data) {
  return request({
    url: '/ecw/clearance-file-no/create',
    method: 'post',
    data: data
  })
}

// 更新供应商
export function updateFileNo(data) {
  return request({
    url: '/ecw/clearance-file-no/update',
    method: 'put',
    data: data
  })
}

// 获得清关文件号码
export function getFileNoPage(query) {
  return request({
    url: '/ecw/clearance-file-no/page',
    method: 'get',
    params: query
  })
}