import request from '@/utils/request'

// 查询平台商品列表
export function listGoods(query) {
  return request({
    url: '/agri/goods/list',
    method: 'get',
    params: query
  })
}

// 查询待审核数量
export function getGoodsPendingCount() {
  return request({
    url: '/agri/goods/pendingCount',
    method: 'get'
  })
}

// 查询商品详情
export function getGoods(goodsId) {
  return request({
    url: '/agri/goods/' + goodsId,
    method: 'get'
  })
}

// 按店铺查分类下拉（检索联动）
export function goodsCategoryOptions(shopId) {
  return request({
    url: '/agri/goods/categoryOptions',
    method: 'get',
    params: { shopId: shopId, level: '2' }
  })
}

// 审核商品
export function auditGoods(data) {
  return request({
    url: '/agri/goods/audit',
    method: 'put',
    data: data
  })
}

// 下架商品
export function offShelfGoods(data) {
  return request({
    url: '/agri/goods/offShelf',
    method: 'put',
    data: data
  })
}
