import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AccountsReceivableVO, AccountsReceivableForm } from './types';

/** 查询应收账款列表 */
export function listAccountsReceivable(query: any): AxiosPromise<AccountsReceivableVO[]> {
    return request({
        url: '/customer/accountsReceivable/list',
        method: 'get',
        params: query
    });
}

/** 获取详细数据 */
export function getAccountsReceivable(id: string | number): AxiosPromise<AccountsReceivableVO> {
    return request({
        url: `/customer/accountsReceivable/${id}`,
        method: 'get'
    });
}

/** 新增应收账款 */
export function addAccountsReceivable(data: AccountsReceivableForm): AxiosPromise<void> {
    return request({
        url: '/customer/accountsReceivable',
        method: 'post',
        data: data
    });
}

/** 修改应收账款 */
export function updateAccountsReceivable(data: AccountsReceivableForm): AxiosPromise<void> {
    return request({
        url: '/customer/accountsReceivable',
        method: 'put',
        data: data
    });
}

/** 删除应收账款 */
export function delAccountsReceivable(id: string | number | (string | number)[]): AxiosPromise<void> {
    return request({
        url: `/customer/accountsReceivable/${id}`,
        method: 'delete'
    });
}
