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

/**
 * 设置销售渠道及价格
 * @param data
 * @returns
 */
export function fetchSetUpChannels(data: any) {
  return request<any>({
    url: '/smqjh-pms/v1/videoProduct/saveOrUpdatePrice',
    method: 'post',
    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/v1/videoProduct/import',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}

/**
 * 修改商品状态
 * @returns
 */
export function fetchChangeStatus(data: any) {
  return request({
    url: '/smqjh-pms/v1/videoProduct/updateProductStatus',
    method: 'get',
    params: data
  });
}

/**
 * 修改商品封面
 * @returns
 */
export function fetchUpdateProductImg(data: any) {
  return request({
    url: '/smqjh-pms/v1/videoProduct/updateProductImg',
    method: 'post',
    params: data
  });
}

/**
 * 修改商品名称
 * @returns
 */
export function fetchUpdateName(data: any) {
  return request({
    url: '/smqjh-pms/v1/videoProduct/updateName',
    method: 'post',
    data
  });
}

/**
 * 获取第三方平台余额
 * @returns
 */
export function fetchFindThirdPartyBalance() {
  return request({
    url: '/smqjh-pms/v1/videoProduct/findThirdPartyBalance',
    method: 'get'
  });
}
