import request from '@/utils/request'

// 查询商品订单列表
export function listPurchaseGoods(query) {
  return request({
    url: '/mapi/order/purchaseGoods/list',
    method: 'get',
    params: query
  })
}

// 查询商品订单详细
export function getPurchaseGoods(id) {
  return request({
    url: '/mapi/order/purchaseGoods/' + id,
    method: 'get'
  })
}

// 新增商品订单
export function addPurchaseGoods(data) {
  return request({
    url: '/mapi/order/purchaseGoods',
    method: 'post',
    data: data
  })
}

// 修改商品订单
export function updatePurchaseGoods(data) {
  return request({
    url: '/mapi/order/purchaseGoods',
    method: 'put',
    data: data
  })
}

// 删除商品订单
export function delPurchaseGoods(id) {
  return request({
    url: '/mapi/order/purchaseGoods/' + id,
    method: 'delete'
  })
}


// 修改商品订单状态
export function updatePurchaseGoodsStatus(id,status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/mapi/order/purchaseGoods/updateStatus',
    method: 'post',
    data: data
  })
}

// 查询商品出货订单列表
export function sellGoodsList(query) {
  return request({
    url: '/mapi/order/purchaseGoods/sellGoodsList',
    method: 'get',
    params: query
  })
}

// 商品出货-接单(确认订单)
export function confirmOrder(id) {
  return request({
    url: '/mapi/order/purchaseGoods/confirmOrder',
    method: 'get',
    params: {orderId: id}
  })
}


// 确认收货
export function confirmReceivePurchaseGoods(id) {
  return request({
    url: '/mapi/order/purchaseGoods/confirmReceiveGoodsByOrderGoods',
    method: 'get',
    params: {orderId: id}
  })
}

// 商品出货-拒单
export function refuseOrder(id) {
  return request({
    url: '/mapi/order/purchaseGoods/refuseOrder',
    method: 'get',
    params: {orderId: id}
  })
}

// 商品出货-出货
export function sellOrder(id) {
  return request({
    url: '/mapi/order/purchaseGoods/sellOrder',
    method: 'get',
    params: {orderId: id}
  })
}

// 商品出货-出货
export function confirmReceiveGoodsByOrderGoods(id) {
  return request({
    url: '/mapi/order/purchaseGoods/confirmReceiveGoodsByOrderGoods',
    method: 'get',
    params: {orderId: id}
  })
}

// 商品出货订单列表--总部工厂的门店订单列表
export function sellGoodsListByHqFactory(query) {
  return request({
    url: '/mapi/order/purchaseGoods/sellGoodsListByHqFactory',
    method: 'get',
    params: query
  })
}

// 进销存出货-出货-快递配送
export function outOrderGoods(data) {
  return request({
    url: '/mapi/order/purchaseGoods/outOrderGoods',
    method: 'post',
    data: data
  })
}
// 进销存出货-出货-自送
export function outOrderGoodsBySelf(query) {
  return request({
    url: '/mapi/order/purchaseGoods/outOrderGoodsBySelf',
    method: 'get',
    params: { orderId:query }
  })
}
//查询订单物流轨迹
export function getDeliveryPath(query) {
  return request({
    url: '/mapi/order/purchaseGoods/getDeliveryPath',
    method: 'get',
    params: query
  })
}

