import request from '@/utils/request'
import { sellerShopHeaders } from '@/utils/sellerShop'

// 查询当前店铺订单列表
export function listSellerOrder(query) {
  return request({
    url: '/agri/seller/order/list',
    method: 'get',
    params: query,
    headers: sellerShopHeaders()
  })
}

// 查询订单详情
export function getSellerOrder(orderId) {
  return request({
    url: '/agri/seller/order/' + orderId,
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 整单发货
export function shipSellerOrder(orderId, data) {
  return request({
    url: '/agri/seller/order/' + orderId + '/ship',
    method: 'post',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 更新物流
export function logisticsSellerOrder(orderId, data) {
  return request({
    url: '/agri/seller/order/' + orderId + '/logistics',
    method: 'post',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 登记送达
export function deliveredSellerOrder(orderId, data) {
  return request({
    url: '/agri/seller/order/' + orderId + '/delivered',
    method: 'post',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 删除已关闭订单
export function delSellerOrder(orderId) {
  return request({
    url: '/agri/seller/order/' + orderId,
    method: 'delete',
    headers: sellerShopHeaders()
  })
}
