import request from '@/utils/new-request'
import { exportExcel, exportExcelNew } from '@/utils/filedown'
export function _getQtys() {
  return request({
    url: '/FiannceCustomerDeliveryBill/getQtys',
    method: 'get',
    timeout: 20 * 1000
  })
}

export function _getData(status) {
  return request({
    url: '/FiannceCustomerDeliveryBill/GetData',
    method: 'get',
    params: { status },
    timeout: 20 * 1000
  })
}

export function _getPostData(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/GetData',
    method: 'post',
    data,
    timeout: 30 * 1000
  })
}

export function _getConfirmeds(billId) {
  exportExcel('/FiannceCustomerDeliveryBill/GetConfirmeds?billId=' + billId)
}

export function _getNotConfirmeds(billId) {
  exportExcel('/FiannceCustomerDeliveryBill/GetNotConfirmeds?billId=' + billId)
}

export function _getOriginals(billId) {
  exportExcel('/FiannceCustomerDeliveryBill/GetOriginals?billId=' + billId)
}

export function _getSupplements(billId) {
  exportExcel('/FiannceCustomerDeliveryBill/GetSupplements?billId=' + billId)
}

export function _getDeductions(billId) {
  exportExcel('/FiannceCustomerDeliveryBill/GetDeductions?billId=' + billId)
}

export function _outRemange(data) {
  exportExcelNew('/FiannceCustomerDeliveryBill/DownloadRemittance', data, 'post')
}
export function _addDeliveryBill(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/AddDeliveryBill',
    method: 'post',
    data,
    timeout: 20 * 1000
  })
}
export function _addDeliveryBillAsFile(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/AddDeliveryBillAsFile',
    method: 'post',
    data,
    timeout: 20 * 1000
  })
}
export function _inputSupplementOrDeduction(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/InputSupplementOrDeduction',
    method: 'post',
    data,
    timeout: 3600 * 1000
  })
}

export function _Pass(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/Pass',
    method: 'post',
    data,
    timeout: 20 * 1000
  })
}

export function _Rereject(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/Rereject',
    method: 'post',
    data,
    timeout: 20 * 1000
  })
}

export function _updateConfirmed(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/UpdateConfirmed',
    method: 'post',
    data,
    timeout: 20 * 1000
  })
}

export function _postPayment(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/postPayment',
    method: 'post',
    data,
    timeout: 20 * 1000
  })
}

export function _getPaymentLog(billId) {
  return request({
    url: '/FiannceCustomerDeliveryBill/GetPaymentLog',
    method: 'get',
    params: { billId }
  })
}

export function _getCustomerDeliveryPanelAsync() {
  return request({
    url: '/FiannceCustomerDeliveryBill/GetCustomerDeliveryPanel',
    method: 'get'
  })
}

export function _getCustomerDeliveryPanelDetail() {
  return request({
    url: '/FiannceCustomerDeliveryBill/GetCustomerDeliveryPanelDetail',
    method: 'get'
  })
}

export function _deleteBill(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/deleteBill',
    method: 'post',
    data,
    timeout: 20 * 1000
  })
}

export function _computeBillClaimemAmount(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/CalcClaim',
    method: 'post',
    data,
    timeout: 20 * 1000
  })
}

export function _getRemittancePageResult(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/GetRemittancePageResult',
    method: 'post',
    data,
    timeout: 20 * 1000
  })
}

export function _getClaims(billId) {
  exportExcelNew('/FiannceCustomerDeliveryBill/GetClaims?billId=' + billId)
}

export function _getOutCustomer(billId, type) {
  exportExcelNew('/FiannceCustomerDeliveryBill/GetOutCustomer?billId=' + billId + '&type=' + type)
}

export function _getOutYCCustomer(billId, type) {
  exportExcelNew('/FiannceCustomerDeliveryBill/GetOutCustomer?billId=' + billId + '&type=' + type + '&isYC=true')
}

export function _getOutCustomerBatch(billId, type, billingCycle, name) {
  exportExcelNew(
    `/FiannceCustomerDeliveryBill/GetOutCustomerBatch?billId=${billId}&type=${type}&billingCycle=${billingCycle}&isYC=true`,
    {},
    'GET',
    `行运易-${name}账单`
  )
}

// 账单重跑
export function _ReProcessDeliveryBill(data) {
  return request({
    url: '/FiannceCustomerDeliveryBill/ReProcessDeliveryBill',
    method: 'post',
    data,
    timeout: 20 * 1000
  })
}
