import request from '@/utils/request'

// 创建商品
export function createGoodsInfo(data) {
  return request({
    url: '/basic/goods-info/create',
    method: 'post',
    data: data
  })
}

// 更新商品
export function updateGoodsInfo(data) {
  return request({
    url: '/basic/goods-info/update',
    method: 'put',
    data: data
  })
}

// 删除商品
export function deleteGoodsInfo(id,goodsId) {
  return request({
    url: '/basic/goods-info/delete?id=' + id + '&goodsId='+goodsId,
    method: 'delete'
  })
}

// 获得商品
export function getGoodsInfo(id) {
  return request({
    url: '/basic/goods-info/get?id=' + id,
    method: 'get'
  })
}

// 根据条件获得商品列表
export function getGoodsInfoQuery(query) {
  return request({
    url: '/basic/goods-info/listQuery',
    method: 'get',
    params: query
  })
}

// 获得商品分页
export function getGoodsInfoPage(query) {
  return request({
    url: '/basic/goods-info/page',
    method: 'get',
    params: query
  })
}

// 获得商品昵称
export function getGoodsNameList(query) {
  return request({
    url: '/basic/goods-info/getGoodsNameList',
    method: 'get',
    params: query
  })
}

// 获取所有商品
export function getGoodsNameLists(query) {
  return request({
    url: '/basic/goods-info/nameList',
    method: 'get',
    params: query
  })
}

// 根据指定的商户id 获取所有名下多个商品
export function getGoodsListByBelongBusinessId(params) {
    return request({
      url: '/basic/goods-info/getGoodsListByBelongBusinessId',
      method: 'get',
      params,
    })
  }

// 根据商户id 获得所有商品
export function getByBusinessInfoId(params) {
    return request({
      url: '/basic/goods-info/getByBusinessInfoId',
      method: 'get',
      params,
    })
  }

// 根据经销商id 获得所有商品包含单位
export function queryListMiniResult(params) {
    return request({
      url: '/basic/goods-info/queryListMiniResult',
      method: 'get',
      params,
    })
  }

export function getByGoodsId(params) {
  return request({
    url: '/basic/goods-info/getByGoodsId',
    method: 'get',
    params,
  })
}
  
