import request from '@/utils/request'

export function getInitOrder(params) {
  return request({
    url: '/api/supply/getinitorder',
    method: 'get',
    params: params
  })
}

export function savePurchaseOrder(data, supplier_name, start_time, end_time, rate_of_concession, discount_amount) {
  return request({
    url: '/api/supply/savepurchaseorder?supplier_name=' + supplier_name + '&start_time=' + start_time + '&end_time=' + end_time + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount,
    method: 'post',
    data: data
  })
}

export function getAllSupply(params) {
  return request({
    url: '/api/supply/getallsupply',
    method: 'get',
    params: params
  })
}

export function getAllPurchaseOrderList(params) {
  return request({
    url: '/api/supply/getallpurchaseorderlist',
    method: 'get',
    params: params
  })
}

export function updatePurchaseOrder(data, supplier_name, start_time, end_time, rate_of_concession, discount_amount, id, number) {
  return request({
    url: '/api/supply/updatepurchaseorder?supplier_name=' + supplier_name + '&start_time=' + start_time + '&end_time=' + end_time + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount + '&id=' + id + '&number=' + number,
    method: 'post',
    data: data
  })
}

export function checkPurchaseOrder(id, params) {
  return request({
    url: '/api/supply/checkpurchaseorder?id=' + id,
    method: 'Get',
    params: params
  })
}

export function getPurchaseOrderDetail(id, params) {
  return request({
    url: '/api/supply/getpurchaseorderdetail?id=' + id,
    method: 'get',
    params: params
  })
}

export function addGoodOrder(data, supplier_name, start, arrearage, payment, warehousing_id, number, rate_of_concession, discount_amount) {
  return request({
    url: '/api/supply/addgoodorder?supplier_id=' + supplier_name + '&start=' + start + '&arrerage=' + arrearage + '&payment=' + payment + '&warehousing_id=' + warehousing_id + '&number=' + number + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount,
    method: 'post',
    data: data
  })
}

export function getAllGoodOrderList(params) {
  return request({
    url: '/api/supply/getallgoodorderlist',
    method: 'get',
    params: params
  })
}

export function getGoodOrderDetail(id, params) {
  return request({
    url: '/api/supply/getgoodorderdetail?id=' + id,
    method: 'get',
    params: params
  })
}

export function getGoodOrderDetailList(id, ids, params) {
  return request({
    url: '/api/supply/getgoodorderdetaillist?id=' + id + '&ids=' + ids,
    method: 'get',
    params: params
  })
}

export function updateGoodOrder(data, supplier_name, start, arrearage, payment, warehose_out_id, number, rate_of_concession, discount_amount, good_number) {
  return request({
    url: '/api/supply/updategoodorder?supplier_id=' + supplier_name + '&start=' + start + '&arrerage=' + arrearage + '&payment=' + payment + '&warehose_out_id=' + warehose_out_id + '&number=' + number + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount + '&good_number=' + good_number,
    method: 'post',
    data: data
  })
}

export function deletePurchaseOrder(id, params) {
  console.log('id232323223', id)
  return request({
    url: '/api/supply/deletepurchorder?id=' + id,
    method: 'Get',
    params: params
  })
}

export function getAllOrderCountList(id, params) {
  return request({
    url: '/api/supply/getallordercountlist?id=' + id,
    method: 'get',
    params: params
  })
}

export function getPurchaseOrderInfo(id, ids, params) {
  return request({
    url: '/api/supply/getpurchaseorderinfo?id=' + id + '&ids=' + ids,
    method: 'get',
    params: params
  })
}

export function getGoodOrderList(id, params) {
  return request({
    url: '/api/supply/getgoodorderlist?id=' + id,
    method: 'get',
    params: params
  })
}

export function getReturnOrder(id, params) {
  return request({
    url: '/api/supply/getreturnorder?id=' + id,
    method: 'get',
    params: params
  })
}

export function getGoodOrderCountList(id, warehousing_id, params) {
  return request({
    url: '/api/supply/getgoodordercountlist?id=' + id + '&warehousing_id=' + warehousing_id,
    method: 'get',
    params: params
  })
}

export function ModefySupplyWarehousing(params) {
  return request({
    url: '/api/supply/modefysupplywarehousing',
    method: 'get',
    params: params
  })
}

export function saveGoodReturnOrder(data, warehouse_out_id, start_time, rate_of_concession, discount_amount, arrearage, payment, supplier_id) {
  return request({
    url: '/api/supply/savegoodreturnOrder?warehouse_out_id=' + warehouse_out_id + '&start_time=' + start_time + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount + '&arrerage=' + arrearage + '&payment=' + payment + '&supplier_id=' + supplier_id,
    method: 'post',
    data: data
  })
}

export function getAllGoodReturnOrderList(params) {
  return request({
    url: '/api/supply/getallgoodreturnorderlist',
    method: 'get',
    params: params
  })
}

export function getSupplierId(params) {
  return request({
    url: '/api/supply/getsupplycode',
    method: 'get',
    params: params
  })
}

export function getsupplytype(params) {
  return request({
    url: '/api/supply/getsupplytype',
    method: 'get',
    params: params
  })
}

export function getGoodReturnDetail(id, params) {
  return request({
    url: '/api/supply/getgoodreturndetail?id=' + id,
    method: 'get',
    params: params
  })
}

export function getexporthistory(params) {
  return request({
    url: '/api/supply/getsupplylist',
    method: 'get',
    params: params
  })
}

export function delsupplys(id, data) {
  return request({
    url: '/api/supply/delsupply?id=' + id,
    method: 'post',
    data: data
  })
}

export function getsupplyandcontactone(params) {
  return request({
    url: '/api/supply/getsupplyandcontactone',
    method: 'get',
    params: params
  })
}

export function updateGoodReturn(data, warehouse_out_id, start_time, rate_of_concession, discount_amount, arrearage, payment, supplier_id, return_number) {
  return request({
    url: '/api/supply/updategoodreturn?warehouse_out_id=' + warehouse_out_id + '&start=' + start_time + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount + '&arrerage=' + arrearage + '&payment=' + payment + '&supplier_id=' + supplier_id + '&return_number=' + return_number,
    method: 'post',
    data: data
  })
}

export function MofyGoodOrder(params) {
  return request({
    url: '/api/supply/mofygoodorder',
    method: 'get',
    params: params
  })
}

export function UpdateSupplyWahouseingInfo(params) {
  return request({
    url: '/api/supply/updatesupplywarehousing',
    method: 'get',
    params: params
  })
}

export function deleteGoodOrder(id, params) {
  return request({
    url: '/api/supply/deletegoodorder?id=' + id,
    method: 'get',
    params: params
  })
}

export function getSupplyWarehouseOutById(id, params) {
  return request({
    url: '/api/supply/getsupplywarehouseoutbyid?id=' + id,
    method: 'get',
    params: params
  })
}

export function delcontactone(params) {
  return request({
    url: '/api/supply/delcontactone',
    method: 'get',
    params: params
  })
}

export function savesupply(data) {
  return request({
    url: '/api/supply/savesupply',
    method: 'post',
    data: data
  })
}

export function updatesupply(data) {
  console.log(data, 'oopo')
  return request({
    url: '/api/supply/updatesupply',
    method: 'post',
    data: data
  })
}

export function checkGoodOrderById(id, params) {
  return request({
    url: '/api/supply/checkgoodorderbyid?id=' + id,
    method: 'get',
    params: params
  })
}

// export function getsupplytype(params) {
//   return request({
//     url: '/api/supply/getsupplytype' ,
//     method: 'get',
//     params: params
//   })
// }

export function checkReturnOrder(params) {
  return request({
    url: '/api/supply/checkreturnorder',
    method: 'Get',
    params: params
  })
}

export function deletePurchOder(params) {
  return request({
    url: '/api/supply/deletepurchaseorder',
    method: 'get',
    params: params
  })
}

export function deleteGoodOrderById(params) {
  return request({
    url: '/api/supply/deletegoodorderbyid',
    method: 'get',
    params: params
  })
}

export function deleteReturnOrder(id, params) {
  return request({
    url: '/api/supply/deletereturnorder?id=' + id,
    method: 'Get',
    params: params
  })
}

export function deleteReturnOrderById(params) {
  return request({
    url: '/api/supply/deletereturnorderbyid',
    method: 'get',
    params: params
  })
}

export function modefyReturnOrder(params) {
  return request({
    url: '/api/supply/modefyreturnorder',
    method: 'get',
    params: params
  })
}

