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

/**
 * 设置销售渠道及价格
 * @param data
 * @returns
 */
export function fetchSetUpChannels(data: any) {
  return request<any>({
    url: '/smqjh-pms/api/v1/channelProd/setUpChannels',
    method: 'PUT',
    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'
  });
}

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