import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VipPaymentVO, VipPaymentForm, VipPaymentQuery } from '@/api/dgtmedicine/vipPayment/types';

/**
 * 查询会员缴费记录列表
 * @param query
 * @returns {*}
 */

export const listVipPayment = (query?: VipPaymentQuery): AxiosPromise<VipPaymentVO[]> => {
    return request({
        url: '/dgtmedicine/vipPayment/list',
        method: 'get',
        params: query
    });
};

/**
 * 查询会员缴费记录详细
 * @param id
 */
export const getVipPayment = (id: string | number): AxiosPromise<VipPaymentVO> => {
    return request({
        url: '/dgtmedicine/vipPayment/getInfo/' + id,
        method: 'get'
    });
};

/**
 * 新增会员缴费记录
 * @param data
 */
export const addVipPayment = (data: VipPaymentForm) => {
    return request({
        url: '/dgtmedicine/vipPayment/add',
        method: 'post',
        data: data
    });
};

/**
 * 修改会员缴费记录
 * @param data
 */
export const updateVipPayment = (data: VipPaymentForm) => {
    return request({
        url: '/dgtmedicine/vipPayment/edit',
        method: 'post',
        data: data
    });
};

/**
 * 上传发票
 * @param data
 */
export const uploadInvoice = (data: { id: string | number; invoiceUrl: String }) => {
    return request({
        url: '/dgtmedicine/vipPayment/uploadInvoice',
        method: 'post',
        data: data
    });
};

/**
 * 删除会员缴费记录
 * @param id
 */
export const delVipPayment = (id: string | number | Array<string | number>) => {
    return request({
        url: '/dgtmedicine/vipPayment/remove/' + id,
        method: 'get'
    });
};
/**
 * 确认对公转账支付
 * @param id
 */
export const VipConfirmPay = (id: string | number) => {
    return request({
        url: '/dgtmedicine/vipPayment/confirmLevelPay/' + id,
        method: 'get'
    });
};
