import { request } from '@/service/request';
/**
 * 分页获取商品
 * @param params
 * @returns
 */
export function fetchProductList(data: any) {
  return request({
    url: '/smqjh-pms/api/v1/goods/goodsList',
    method: 'get',
    params: data
  });
}

/**
 * 获取全部渠道商
 * @returns
 */
export function fetchGetAllChannelList() {
  return request<Api.goods.Channel[]>({
    url: '/smqjh-system/api/v1/channel/listAll',
    method: 'get'
  });
}
/**
 * 获取一级渠道商
 * @returns
 */
export function fetchGetChannelList() {
  return request<Api.goods.Channel[]>({
    url: '/smqjh-system/api/v1/channel/listFirstChannel',
    method: 'get'
  });
}

/**
 *
 * 删除商品
 * @returns
 */
export function fetchDelGoods(id: string) {
  return request({
    url: `/smqjh-pms/api/v1/goods/${id}`,
    method: 'delete'
  });
}

/**
 * 保存商品
 * @returns
 */
export function fetchAddGoods(data: any) {
  return request({
    url: '/smqjh-pms/api/v1/goods/addDJKGoods',
    method: 'post',
    data
  });
}

/**
 * 保存商品
 * @returns
 */
export function fetchEditGoods(data: any) {
  return request({
    url: '/smqjh-pms/api/v1/goods/updateDJKGoods',
    method: 'put',
    data
  });
}

/**
 * 商品详情
 * @returns
 */
export function fetchGoodsDetail(id: any) {
  return request({
    url: '/smqjh-pms/api/v1/goods/info',
    method: 'get',
    params: { id }
  });
}
