import { request } from '@/service/request';

/**
 *
 * @param data 导入渠道商品数据
 * @returns
 */
export function fetchImportGoods(data: { file: File }) {
  return request({
    url: '/platform/channelProd/import',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}

/** 分页查询渠道商品
 *
 * @param data
 * @returns
 */
export function fetchGetGoodsList(data: any) {
  return request<Api.goods.ShopSku[]>({
    url: '/shop/shopProd/page',
    method: 'get',
    params: data
  });
}

/**
 * 设置销售渠道及价格
 * @param data
 * @returns
 */
export function fetchSetUpChannels(data: any) {
  return request<any>({
    url: '/platform/channelProd/setUpChannels',
    method: 'PUT',
    data
  });
}
/**
 * 获取全部渠道商
 * @returns
 */
export function fetchGetAllChannelList() {
  return request<Api.goods.Channel[]>({
    url: '/platform/channel/listAll',
    method: 'get'
  });
}

/**
 * 导出商品
 * @param params
 * @returns
 */
export function fetchExportAllGoods(params: any) {
  return request({
    url: '/platform/channelProd/export',
    method: 'get',
    params
  });
}
