import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SalesLeadsVO, LeadsQuery } from './types';

/** 查询销售线索列表 */
export function listLeads(query: LeadsQuery): AxiosPromise<SalesLeadsVO[]> {
    query.projectType = '销售线索';
    return request({
        url: '/customer/salesleads/list',
        method: 'get',
        params: query
    });
}

/** 获取销售线索详细信息 */
export function getLeads(id: string | number): AxiosPromise<SalesLeadsVO> {
    return request({
        url: '/customer/salesleads/' + id,
        method: 'get'
    });
}

/** 新增销售线索 */
export function addLeads(data: any): AxiosPromise<void> {
    return request({
        url: '/customer/salesleads',
        method: 'post',
        data: data
    });
}

/** 修改销售线索 */
export function updateLeads(data: any): AxiosPromise<void> {
    return request({
        url: '/customer/salesleads',
        method: 'put',
        data: data
    });
}

/** 删除销售线索 */
export function delLeads(ids: string | number | (string | number)[]): AxiosPromise<void> {
    return request({
        url: '/customer/salesleads/' + ids,
        method: 'delete'
    });
}

/** 转移销售线索 */
export function transferLeads(data: any): AxiosPromise<void> {
    return request({
        url: '/customer/salesleads/transfer',
        method: 'post',
        data: data
    });
}

/** 批量认领销售线索 */
export function claimLeads(data: any): AxiosPromise<void> {
    return request({
        url: '/customer/salesleads/claim',
        method: 'post',
        data: data
    });
}

