import { createService } from '@/utils/createRequest'
const request9518 = createService(process.env.VUE_APP_9518_API)

// 收件  start
export function _getData(data) {
  return request9518({
    url: '/FBAOrder/GetReceivingInfo',
    method: 'post',
    timeout: 20 * 1000,
    data
  })
}
export function _getBoxsData(id) {
  return request9518({
    url: '/FBAOrder/GetReceivingBoxs',
    method: 'post',
    timeout: 10 * 1000,
    params: { id }
  })
}
export function _getBoxsDatas(data) {
  return request9518({
    url: '/FBAOrder/GetReceivingBoxsByIds',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}
export function _updateBoxsData(data) {
  return request9518({
    url: '/FBAOrder/UpdateReceivingBoxs',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}
export function _goToPrint(data) {
  return request9518({
    url: '/FBAOrder/GoToPrint',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}

export function _smallToLarge(data) {
  return request9518({
    url: '/FBAOrder/SmallToLarge',
    method: 'post',
    timeout: 60 * 1000,
    data
  })
}

// 收件  end
// 打单  start
export function _getPrintList(data) {
  return request9518({
    url: '/FBAOrder/GetPrintList',
    method: 'post',
    timeout: 20 * 1000,
    data
  })
}
export function _getPrint(id) {
  return request9518({
    url: '/FBAOrder/GetPrint',
    method: 'post',
    timeout: 10 * 1000,
    params: { orderId: id }
  })
}
export function _updatePrintBoxs(data) {
  return request9518({
    url: '/FBAOrder/UpdatePrintBoxs',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}
export function _goToIncome(data) {
  return request9518({
    url: '/FBAOrder/GoToIncome',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}
export function _updateOrderPrintQty(Id, OrderPrintQty) {
  return request9518({
    url: '/FBAOrder/UpdateOrderPrintQty',
    method: 'get',
    timeout: 10 * 1000,
    params: { orderId: Id, OrderPrintQty }
  })
}
/**
 * 批量更新是否打印面单
 * @param {*} data.Ids
 * @returns
 */
export function _BatchUpdateOrderPrintQty(data) {
  return request9518({
    url: '/FBAOrder/BatchUpdateOrderPrintQty',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}
// 打单  end
// 空派收入 start
export function _getCustomerConfirmList(data) {
  return request9518({
    url: '/FBAOrder/GetCustomerConfirmList',
    method: 'post',
    timeout: 20 * 1000,
    data
  })
}
export function _getCustomerConfirm(id) {
  return request9518({
    url: '/FBAOrder/GetCustomerConfirm',
    method: 'post',
    timeout: 10 * 1000,
    params: { orderId: id }
  })
}
export function _updateCustomerConfirm(data) {
  return request9518({
    url: '/FBAOrder/UpdateCustomerConfirm',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}
export function _getBatchConfirmWeight(data) {
  return request9518({
    url: '/FBAOrder/GetBatchConfirmWeight',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}
export function _updateBatchConfirmWeight(data) {
  return request9518({
    url: '/FBAOrder/UpdateBatchConfirmWeight',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}

export function _getBatchConfirmIncidenta(data) {
  return request9518({
    url: '/FBAOrder/GetBatchConfirmIncidenta',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}
export function _updateBatchConfirmIncidenta(data) {
  return request9518({
    url: '/FBAOrder/UpdateBatchConfirmIncidenta',
    method: 'post',
    timeout: 20 * 1000,
    data
  })
}

export function _goToSettlement(data) {
  return request9518({
    url: '/FBAOrder/GoToSettlement',
    method: 'post',
    timeout: 30 * 1000,
    data
  })
}
// 空派收入 end

// 空派结算 start
export function _getSettlementConfirmList(data) {
  return request9518({
    url: '/FBAOrder/GetSettlementConfirmList',
    method: 'post',
    timeout: 20 * 1000,
    data
  })
}
export function _getSettlementConfirm(id) {
  return request9518({
    url: '/FBAOrder/GetSettlementConfirm',
    method: 'post',
    timeout: 20 * 1000,
    params: { orderId: id }
  })
}
export function _updateSettlementConfirm(data) {
  return request9518({
    url: '/FBAOrder/UpdateSettlementConfirm',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}

export function _updateBatchSettlementWeight(data) {
  return request9518({
    url: '/FBAOrder/UpdateBatchSettlementWeight',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}

export function _getBatchSettlementWeight(data) {
  return request9518({
    url: '/FBAOrder/GetBatchSettlementWeight',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}

export function _getBatchSettlementIncidenta(data) {
  return request9518({
    url: '/FBAOrder/GetBatchSettlementIncidenta',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}
export function _updateBatchSettlementIncidenta(data) {
  return request9518({
    url: '/FBAOrder/UpdateBatchSettlementIncidenta',
    method: 'post',
    timeout: 20 * 1000,
    data
  })
}

export function _goToEnd(data) {
  return request9518({
    url: '/FBAOrder/GoToEnd',
    method: 'post',
    timeout: 30 * 1000,
    data
  })
}

export function _SettlementConfirmOperation(id) {
  return request9518({
    url: '/FBAOrder/SettlementConfirmOperation',
    method: 'get',
    timeout: 10 * 1000,
    params: { orderId: id }
  })
}

// 空派结算 end

// 费用相关 start
/**
 *
 * @param {*} data.OrderId 订单Id
 * @param {*} data.PublicExpressId 公开渠道
 * @param {*} data.CustomerId 客户Id
 * @param {*} data.TransactionTime 收货时间
 * @param {*} data.gWeight 最终计费重
 * @param {*} data.ZipCode 邮编
 * @returns
 */
export function _getUnitPrice(data) {
  return request9518({
    url: '/FBAOrder/GetUnitPrice',
    method: 'post',
    timeout: 10 * 1000,
    data
  })
}

export function _updateSettlementConfirmForTable(data) {
  return request9518({
    url: '/FBAOrder/UpdateSettlementConfirmForTable',
    method: 'post',
    timeout: 20 * 1000,
    data
  })
}
// 费用相关 end

/**
 * 获取图片
 */
export function _GetBoxPictures(BoxNumber) {
  return request9518({
    url: '/FBAOrder/GetBoxPictures',
    method: 'post',
    timeout: 20 * 1000,
    params: { BoxNumber }
  })
}
/**
 * 移除图片
 */
export function _RemoveBoxPicture(data) {
  return request9518({
    url: '/FBAOrder/RemoveBoxPicture',
    method: 'post',
    timeout: 20 * 1000,
    data
  })
}

/**
 * 图片上传
 */
export function _FBAOrderUpdateFile(BoxNumber, formData) {
  return request9518({
    url: '/FBAOrder/UpdateFile',
    method: 'post',
    timeout: 20 * 1000,
    transformRequest: [function(data, headers) {
      headers['Content-Type'] = 'multipart/form-data;charset=UTF-8'
      return data
    }],
    params: { BoxNumber },
    data: formData
  })
}

/**
 * 更新客户确认的箱号备注
 * @param {*} data
 * @returns
 */
export function _getBoxlDCRData(data) {
  return request9518({
    url: '/FBAOrder/GetBoxIDCR',
    method: 'post',
    timeout: 20 * 1000,
    data
  })
}

/**
 * 销售确认
 * @param {*} Id
 * @returns
 */
export function _getSalesmanConfirmFee(Id) {
  return request9518({
    url: '/FBAOrder/SalesmanConfirmFee',
    method: 'get',
    timeout: 20 * 1000,
    params: { Id }
  })
}

/**
 * fba修改创建渠道
 * @param {*} data
 * @returns
 */
export function _saveModifyCreateOrderChannelId(data) {
  return request9518({
    url: '/FBAOrder/ModifyCreateOrderChannelId',
    method: 'post',
    timeout: 30 * 1000,
    data
  })
}
