import request from '@/utils/request'

// 查询【请填写功能名称】列表
export function listQuotation(query) {
  return request({
    url: '/business/quotation/list',
    method: 'get',
    params: query
  })
}

// 查询【请填写功能名称】详细
export function getQuotationDetail(id) {
  return request({
    url: '/business/quotation/' + id,
    method: 'get'
  })
}

// 新增【请填写功能名称】
export function addQuotation(data) {
  return request({
    url: '/business/quotation',
    method: 'post',
    data: data
  })
}

export function copyVersion(data) {
  return request({
    url: '/business/quotation/copy',
    method: 'post',
    data: data
  })
}

// 修改【请填写功能名称】
export function updateQuotation(data) {
  return request({
    url: '/business/quotation',
    method: 'put',
    data: data
  })
}

// 删除【请填写功能名称】
export function delQuotation(id) {
  return request({
    url: '/business/quotation/' + id,
    method: 'delete'
  })
}

// 根据项目id查询报价列表
export function listByProjectId(projectId) {
  return request({
    url: '/business/quotation/listByProjectId/' + projectId,
    method: 'get'
  })
}

export function getPrice(quotationId) {
  return request({
    url: '/business/quotation/price/' + quotationId,
    method: 'get'
  })
}

// 议价通过
export function auditBargain(data) {
  return request({
    url: '/business/quotation/auditBargain',
    method: 'post',
    data: data
  })
}

// 根据报价ID获取销售折扣价格
export function getSalesDiscount(quotationId) {
  return request({
    url: '/business/quotation/salesDiscount/' + quotationId,
    method: 'get',
  })
}

// 根据审批节点获取销售折扣价格
export function getSalesDiscountByFlow(flowStatus) {
  return request({
    url: '/business/quotation/salesDiscount/flow',
    method: 'get',
    params: {
      flowStatus: flowStatus,
    }
  })
}
/** 根据代理商  展示对应的梯型列表*/
export function getQuotation4Contract(query) {
  return request({
    url: '/business/quotation/getQuotation4Contract',
    method: 'get',
    params: query
  })
}


export function uploadQuotationImage(data) {
  return request({
    url: '/business/quotation/uploadQuotationImage',
    method: 'post',
    data
  })
}

export function getQuotationImage(id) {
  return request({
    url: '/business/quotation/getQuotationImage/' + id,
    method: 'get',
  })
}

export function getQuotationPDF(id) {
  return request({
    url: '/business/quotation/export/' + id,
    method: 'post',
    preview: true,
    responseType: 'blob'
  })
}
