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

// 出库单列表
export function listSellerStockOutbound(query) {
  return request({
    url: '/agri/seller/stock/outbound/list',
    method: 'get',
    params: query,
    headers: sellerShopHeaders()
  })
}

// 出库单详情
export function getSellerStockOutbound(outboundId) {
  return request({
    url: '/agri/seller/stock/outbound/' + outboundId,
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 手工创建出库单
export function createSellerStockOutbound(data) {
  return request({
    url: '/agri/seller/stock/outbound',
    method: 'post',
    data: data,
    headers: sellerShopHeaders()
  })
}

// 经办人下拉
export function listStockOutboundOperators() {
  return request({
    url: '/agri/seller/stock/outbound/operators',
    method: 'get',
    headers: sellerShopHeaders()
  })
}

// 商品选择器（stock>0）
export function listStockOutboundGoodsOptions(query) {
  return request({
    url: '/agri/seller/stock/outbound/goods/options',
    method: 'get',
    params: query,
    headers: sellerShopHeaders()
  })
}

// 条码/商品编号录入
export function getStockOutboundGoodsByBarcode(barcode) {
  return request({
    url: '/agri/seller/stock/outbound/goods/byBarcode',
    method: 'get',
    params: { barcode },
    headers: sellerShopHeaders()
  })
}
