import request from '@/utils/new-request'
import requestMessage from '@/utils/request_message'

export function _queryPage(data) {
  return request({
    url: 'FinanceQuotation/QueryQuotationApproveRecord',
    method: 'post',
    timeout: 5 * 60 * 1000,
    data
  })
}

export function _getDetails(approveId) {
  const params = { id: approveId }
  return request({
    url: 'FinanceQuotation/GetQuotationDetail',
    method: 'get',
    timeout: 5 * 60 * 1000,
    params
  })
}

export function _export(customerIds, time) {
  return request({
    baseURL: process.env.VUE_APP_47_API,
    url: 'FinanceQuotation/ExportQuotation',
    method: 'post',
    responseType: 'blob',
    timeout: 30 * 60 * 1000,
    data: { customerIds: customerIds, time: time }
  })
}

/**
 * 通过
 * @param {*} data
 * @returns
 */
export function _handleQuotationApproved(data) {
  return request({
    url: 'FinanceQuotation/HandleQuotationApproved?ddid=' + data,
    method: 'post',
    timeout: 5 * 60 * 1000
  })
}

/**
 * 通过
 * @param {*} data
 * @returns
 */
export function _newHandleQuotationApproved(data) {
  return requestMessage({
    baseURL: process.env.VUE_APP_New_API,
    url: 'FinanceQuotation/HandleQuotationApproved?ddid=' + data,
    method: 'post',
    timeout: 5 * 60 * 1000
  })
}

/**
 * 驳回
 * @param {*} data
 * @returns
 */
export function _handleQuotationReject(data) {
  return request({
    url: 'FinanceQuotation/HandleQuotationReject?ddid=' + data,
    method: 'post',
    timeout: 5 * 60 * 1000
  })
}
