import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ApproveVO, ApproveForm, ApproveQuery } from '@/api/supplier/approve/types';

/**
 * 查询供应商审核列表
 * @param query
 * @returns {*}
 */

export const listApprove = (query?: ApproveQuery): AxiosPromise<ApproveVO[]> => {
  return request({
    url: '/customer/approve/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询供应商审核详细
 * @param id
 */
export const getApprove = (id: string | number): AxiosPromise<ApproveVO> => {
  return request({
    url: '/customer/approve/' + id,
    method: 'get'
  });
};

/**
 * 新增供应商审核
 * @param data
 */
export const addApprove = (data: ApproveForm) => {
  return request({
    url: '/customer/approve',
    method: 'post',
    data: data
  });
};

/**
 * 修改供应商审核
 * @param data
 */
export const updateApprove = (data: ApproveForm) => {
  return request({
    url: '/customer/approve',
    method: 'put',
    data: data
  });
};

/**
 * 删除供应商审核
 * @param id
 */
export const delApprove = (id: string | number | Array<string | number>) => {
  return request({
    url: '/customer/approve/' + id,
    method: 'delete'
  });
};
