import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/shopping/consign/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
/* 查询平台兜底订单 */
export const getPlatformList = (current, size, params) => {
  return request({
    // url: '/api/shopping/consign/platform_list',
    url: '/api/v1/getConsignALLList',
    method: 'post',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id, isSearchAll) => {
  return request({
    // url: '/api/shopping/consign/detail',
    url: '/api/v1/getConsignListByConfigId',
    method: 'post',
    params: {
      consignConfigId: id,
      isSearchAll: isSearchAll
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/shopping/consign/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/shopping/consign/save',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/shopping/consign/update',
    method: 'post',
    data: row
  })
}
/* 批量确认打款 */
export const payMoneyApi = (consignConfigId, consignId, payType,orderConsignIds) => {
  return request({
    url: '/api/v1/checkConsignPay',
    method: 'post',
    params: {},
    data: {
      consignConfigId,
      consignId,
      payType,
      orderConsignIds
    }
  })
}

/* 线下认打款查询详情 */
export const payMoneyOfflineApi = (ids) => {
  return request({
    url: '/api/shopping/consign/getRemitDetail',
    method: 'post',
    params: {},
    data: { key: ids}
  })
}

/* 线下认打款 确定 */
export const payMoneyOfflineConfirmApi = (ids) => {
  return request({
    url: '/api/shopping/consign/offlineRemit',
    method: 'post',
    params: {},
    data: { key: ids}
  })
}

/* 获取统计数据 */
export const getStatistics = () => {
  return request({
    url: '/api/v1/getStatisticsConsign',
    method: 'post',
  })
}

// 交割数据分页
export const getDeliveryPage = (current, size, params) => {
  return request({
    url: '/api/shopping/consign/deliveryPage',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
//根据用户Id查询未交割的分页数据
export const getNoDeliveryPageByUserId = (current, size, params) => {
  return request({
    url: '/api/shopping/consign/noDeliveryPageByUserId',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

//根据用户Id查询未交割的分页数据
export const batchDelivery = (ids) => {
  return request({
    url: '/api/shopping/consign/batchDelivery',
    method: 'post',
    data: { key: ids}
  })
}

export const expExcelDelivery = () => {
  return request({
    url: '/api/shopping/consign/expExcelDelivery',
    method: 'post',
    responseType: 'blob'
  })
}
