import request from '@/utils/request'

// 获取产品供应商详情（成本/交付/账期）
export function getProductDetails(code) {
  return request({
    baseURL: process.env.VUE_APP_PYTHON_API,
    url: `/api/supplier/product/${code}/details`,
    method: 'get'
  })
}

// 供应商综合评估
export function evaluateSupplier(productCode) {
  return request({
    baseURL: process.env.VUE_APP_PYTHON_API,
    url: '/api/supplier/evaluate',
    method: 'post',
    data: {
      product_code: productCode
    }
  })
}

// 获取权重配置
export function getWeightsConfig() {
  return request({
    baseURL: process.env.VUE_APP_PYTHON_API,
    url: '/api/supplier/config/weights',
    method: 'get'
  })
}

// 更新权重配置
export function updateWeightsConfig(weights) {
  return request({
    baseURL: process.env.VUE_APP_PYTHON_API,
    url: '/api/supplier/config/weights',
    method: 'put',
    data: weights
  })
}
