import { config, networkUtils } from '../../utils';

const { request } = networkUtils;
const { api } = config;
const { rfq } = api;
const { quote } = rfq;

export async function query(params: object) {
  return request({
    url: quote,
    method: 'get',
    data: params,
  });
}

export async function getSingle(params: object) {
  return request({
    url: `${quote}/price`,
    method: 'get',
    data: params,
  });
}

export async function create(params: object) {
  return request({
    url: quote,
    method: 'post',
    data: params,
  });
}

export async function remove(ids: number[]) {
  return request({
    url: quote,
    method: 'delete',
    data: ids,
  });
}

export async function update(params: object) {
  // console.log("update-params==>",params);
  return request({
    url: `${quote}/confirm`,
    method: 'post',
    data: params,
  });
}

export async function items(params: object) {
  return request({
    url: `${quote}/items`,
    method: 'get',
    data: params,
  });
}

export async function checkCompList(params: object) {
  return request({
    url: `${quote}/checkCompList`,
    method: 'get',
    data: params,
  })
}

export async function isPurchasingStaff() {
  return request({
    url: `${quote}/purchasingStaff`,
    method: 'get',
  });
}
