import request from '@/utils/request'

// 创建报价单管理
export function createOffer(data) {
  return request({
    url: '/ecw/offer/create',
    method: 'post',
    data: data
  })
}

// 更新报价单管理
export function updateOffer(data) {
  return request({
    url: '/ecw/offer/update',
    method: 'put',
    data: data
  })
}

// 删除报价单管理
export function deleteOffer(id) {
  return request({
    url: '/ecw/offer/delete?id=' + id,
    method: 'delete'
  })
}

// 获得报价单管理
export function getOffer(id) {
  return request({
    url: '/ecw/offer/get?offerId=' + id,
    method: 'get'
  })
}

// 获得报价单管理分页
export function getOfferPage(query) {
  return request({
    url: '/ecw/offer/page',
    method: 'get',
    params: query
  })
}

// 导出报价单管理 Excel
export function exportOfferExcel(query) {
  return request({
    url: '/ecw/offer/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 更新报价单结果
export function updateOfferResult(data) {
  return request({
    url: '/ecw/offer/update/result',
    method: 'put',
    data: data
  })
}

// 获取费用清单列表
export function getProductFeeList(prodCreateReqVO){
  return request({
    url: '/ecw/offer/calculation/prod-fee-List',
    method: 'post',
    data: prodCreateReqVO
  })
}

// 获取费用清单
export function getProductFee(calculationFeeParamVO){
  return request({
    url: '/ecw/offer/calculation/fee-List',
    method: 'post',
    data: calculationFeeParamVO
  })
}

// 特价申请
export function createOfferSpecial(data) {
  return request({
    url: '/ecw/offer/special/apply',
    method: 'put',
    data: data
  })
}

// 特价详情
export function getOfferSpecial(offerProdId, params) {
  return request({
    url: '/ecw/offer/special/info/' + offerProdId,
    method: 'get',
    params
  })
}

// 特价详情
export function getOfferSpecialByApproveId(approveId) {
  return request({
    url: '/ecw/offer/special/info?approveId=' + approveId,
    method: 'get'
  })
}


// 取消报价管理
export function cancel(id) {
  return request({
    url: '/ecw/offer/cancel',
    method: 'delete',
    params: {id}
  })
}

// 恢复取消的报价管理
export function recovery(id) {
  return request({
    url: '/ecw/offer/recovery',
    method: 'delete',
    params: {id}
  })
}

// 获取部门报价单列表
export function offerDeptPage(params) {
  return request({
    url: '/ecw/offer/dept/page',
    method: 'get',
    params
  })
}

// 导出部分报价单 exportDeptOfferExcel
export function exportDeptOfferExcel(query) {
  return request({
    url: '/ecw/offer/dept/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}