import request from '@/utils/request'

export function getSupplyMonitorSuppliers(params) {
  return request({
    url: '/api/supply/monitor/suppliers',
    method: 'get',
    params,
    timeout: 60000
  })
}

export function getSupplyMonitorCompare(params) {
  return request({
    url: '/api/supply/monitor/compare',
    method: 'get',
    params,
    timeout: 60000
  })
}

export function getSupplyPaymentPlan(params) {
  return request({
    url: '/api/supply/monitor/payment-plan',
    method: 'get',
    params,
    timeout: 60000
  })
}


export function getSupplyPaymentSummary(params) {
  return request({
    url: '/api/supply/monitor/payment-summary',
    method: 'get',
    params,
    timeout: 60000
  })
}

export function getSupplyReceiptReconciliation(params) {
  return request({
    url: '/api/supply/monitor/receipt-reconciliation',
    method: 'get',
    params,
    timeout: 60000
  })
}
export function getSupplyOverviewStats() {
  return request({
    url: '/api/supplier/overview',
    method: 'get',
    timeout: 60000
  })
}
// 鑾峰彇浜у搧渚涘簲鍟嗚鎯咃紙鎴愭湰/浜や粯/璐︽湡锛?
export function getProductDetails(code) {
  return request({
    url: `/api/supplier/product/${code}/details`,
    method: 'get'
  })
}

// 渚涘簲鍟嗙患鍚堣瘎浼?
export function evaluateSupplier(productCode) {
  return request({
    url: '/api/supplier/evaluate',
    method: 'post',
    data: {
      product_code: productCode
    }
  })
}

// 鑾峰彇鏉冮噸閰嶇疆
export function getWeightsConfig() {
  return request({
    url: '/api/supplier/config/weights',
    method: 'get'
  })
}

// 鏇存柊鏉冮噸閰嶇疆
export function updateWeightsConfig(weights) {
  return request({
    url: '/api/supplier/config/weights',
    method: 'put',
    data: weights
  })
}


