/* 采购报价 */
import request from '@/assets/js/utils/request'

/* ------------------------------------竞价Start-------------------------------------------- */

// 保存竞价报价金额
export function addBidPriceOffer(data, projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseBidPriceController/addBidPriceOffer/' + projectId,
    method: 'post',
    data
  })
}

// 获取我的报价【最初报价、最新报价、降价幅度、报价次数】
export function getBidOfSupplier(projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseBidPriceController/getBidOfSupplier/' + projectId,
    method: 'get'
  })
}

// 获取供应商竞价信息列表
export function getBidPriceList(projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseBidPriceController/getBidPriceList/' + projectId,
    method: 'get'
  })
}

// 获取竞价规则
export function getBidPriceRules(projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseBidPriceController/getBidPriceRules/' + projectId,
    method: 'get'
  })
}

// 获取竞价状态
export function getBidStatus(projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseBidPriceController/getBidStatus/' + projectId,
    method: 'get'
  })
}

// 采购项目竞价最低报价
export function getMinBidPrice(projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseBidPriceController/getMinBidPrice/' + projectId,
    method: 'get'
  })
}

// 采购项目竞价最低报价列表
export function getMinBidPriceList(projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseBidPriceController/getMinBidPriceList/' + projectId,
    method: 'get'
  })
}

// 获取历史聊天记录
export function getMsg(projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseBidPriceController/getMsg/' + projectId,
    method: 'get'
  })
}

// 保存聊天记录
export function saveMsg(data) {
  return request({
    url: '/bidprocurement/offer/purchaseBidPriceController/saveMsg',
    method: 'post',
    data
  })
}

// 设置竞价状态
export function setBidStatus(data, projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseBidPriceController/setBidStatus/' + projectId,
    method: 'post',
    data
  })
}

/* ------------------------------------竞价End-------------------------------------------- */

/* ------------------------------------询价Start-------------------------------------------- */

// 不分项比价
export function compareQuote(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/compareQuote',
    method: 'post',
    data
  })
}

// 完成并提交定标
export function confirmResult(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/confirmResult',
    method: 'post',
    data
  })
}

// 开启新轮次
export function doAddNewStage(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/doAddNewStage',
    method: 'post',
    data
  })
}

// 保存分项报价数据
export function doAddOfferItem(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/doAddOfferItem',
    method: 'post',
    data
  })
}

// 下载分项报价模板
export const downOfferItemTemplate = '/bidprocurement/offer/purchaseSureController/downOfferItemTemplate/'

// 获取分项报价
export function getOfferItem(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/getOfferItem',
    method: 'post',
    data
  })
}

// 获取供应商报价列表getOfferList
export function getOfferList(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/getOfferList',
    method: 'post',
    data
  })
}

// 获取供应商报价信息
export function getPurchaseItem(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/getPurchaseItem',
    method: 'post',
    data
  })
}

// 获取报价开始、结束时间
export function getPurchaseOfferTime(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/getPurchaseOfferTime',
    method: 'post',
    data
  })
}

// 获取询价大厅统计数据
export function getSignupSuppliesCount(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/getSignupSuppliesCount',
    method: 'post',
    data
  })
}

// 获取最新轮次信息
export function getStageInfo(projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/getStageInfo/' + projectId,
    method: 'get'
  })
}

// 保存供应商一次报价、二次报价
export function offerSave(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/offerSave',
    method: 'post',
    data
  })
}

// 查询供应商报价页面状态
export function querySuplierOfferStatus(projectId) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/querySuplierOfferStatus/' + projectId,
    method: 'get'
  })
}

// 入围/淘汰,首选/备选
export function updateIsPass(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/updateIsPass',
    method: 'post',
    data
  })
}

// 供应商撤销报价
export function updateUseStatus(data) {
  return request({
    url: '/bidprocurement/offer/purchaseSureController/updateUseStatus',
    method: 'post',
    data
  })
}

/* ------------------------------------询价End-------------------------------------------- */
