import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PaymentStageVO, PaymentStageForm, PaymentStageQuery } from '@/api/oa/base/paymentStage/types';

/**
 * 查询回款阶段列表
 * @param query
 * @returns {*}
 */

export const listPaymentStage = (query?: PaymentStageQuery): AxiosPromise<PaymentStageVO[]> => {
  return request({
    url: '/oa/base/paymentStage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询回款阶段详细
 * @param paymentStageId
 */
export const getPaymentStage = (paymentStageId: string | number): AxiosPromise<PaymentStageVO> => {
  return request({
    url: '/oa/base/paymentStage/' + paymentStageId,
    method: 'get'
  });
};

/**
 * 新增回款阶段
 * @param data
 */
export const addPaymentStage = (data: PaymentStageForm) => {
  return request({
    url: '/oa/base/paymentStage',
    method: 'post',
    data: data
  });
};

/**
 * 修改回款阶段
 * @param data
 */
export const updatePaymentStage = (data: PaymentStageForm) => {
  return request({
    url: '/oa/base/paymentStage',
    method: 'put',
    data: data
  });
};

/**
 * 删除回款阶段
 * @param paymentStageId
 */
export const delPaymentStage = (paymentStageId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/base/paymentStage/' + paymentStageId,
    method: 'delete'
  });
};

/**
 * 下拉框查询回款阶段列表
 * @param query
 * @returns {*}
 */
export function getBasePaymentStageList (query) {
    return request({
        url: '/oa/base/paymentStage/getBasePaymentStageList',
        method: 'get',
        params: query
    });
};
