import type { PageParam, PageResult } from '@vben/request';
|
|
import { requestClient } from '#/api/request';
|
|
export namespace CrmCancellationApi {
|
export interface Cancellation {
|
id?: number;
|
cancellationNo?: string;
|
customerId?: number;
|
customerName?: string;
|
contractId?: number;
|
contractNo?: string;
|
cancellationType?: string;
|
cancelReason?: string;
|
expectedCancelDate?: string;
|
actualCancelDate?: string;
|
refundAmount?: number;
|
applyUserId?: number;
|
applyUserName?: string;
|
applyTime?: string;
|
auditStatus?: number;
|
// 以下为审核派生字段,由后端在审核时写入,前端只读展示
|
reviewerId?: number; // 审核人ID(实际执行审核的用户)
|
reviewerName?: string; // 审核人姓名
|
reviewTime?: string; // 审核时间
|
reviewRemark?: string; // 审核意见(审核通过时的意见 / 审核不通过时的原因)
|
remark?: string;
|
createTime?: string;
|
}
|
export interface PageParams extends PageParam {
|
cancellationNo?: string;
|
customerId?: number;
|
cancellationType?: string;
|
auditStatus?: number;
|
}
|
}
|
|
/** 查询销户申请分页 */
|
export function getCancellationPage(
|
params: CrmCancellationApi.PageParams,
|
) {
|
return requestClient.get<PageResult<CrmCancellationApi.Cancellation>>(
|
'/crm/cancellation/page',
|
{ params },
|
);
|
}
|
|
/** 查询销户申请详情 */
|
export function getCancellation(id: number) {
|
return requestClient.get<CrmCancellationApi.Cancellation>(
|
`/crm/cancellation/get?id=${id}`,
|
);
|
}
|
|
/** 新增销户申请 */
|
export function createCancellation(data: CrmCancellationApi.Cancellation) {
|
return requestClient.post('/crm/cancellation/create', data);
|
}
|
|
/** 修改销户申请 */
|
export function updateCancellation(data: CrmCancellationApi.Cancellation) {
|
return requestClient.put('/crm/cancellation/update', data);
|
}
|
|
/**
|
* 提交审批(草稿 / 审核不通过 → 审批中)
|
* 审批人由「系统管理 - 审批配置」统一配置,提交时无需指定。
|
*/
|
export function submitCancellation(id: number) {
|
return requestClient.put('/crm/cancellation/submit', null, { params: { id } });
|
}
|
|
/** 获得销户申请的审批人编号集合,供列表页判断是否展示审核按钮 */
|
export function getCancellationApproverIds() {
|
return requestClient.get<number[]>('/crm/cancellation/approver-ids');
|
}
|
|
/**
|
* 审核销户申请(审批中 → 审核通过 / 审核不通过)
|
*
|
* 仅审批配置中的审批人可调用(多人时或签);pass=false 时 reviewRemark(不通过原因)必填。
|
*/
|
export function auditCancellation(
|
id: number,
|
pass: boolean,
|
reviewRemark?: string,
|
) {
|
return requestClient.put('/crm/cancellation/audit', {
|
id,
|
pass,
|
reviewRemark,
|
});
|
}
|
|
/** 删除销户申请 */
|
export function deleteCancellation(id: number) {
|
return requestClient.delete(`/crm/cancellation/delete?id=${id}`);
|
}
|
|
/** 导出销户申请 */
|
export function exportCancellation(params: Record<string, unknown>) {
|
return requestClient.download('/crm/cancellation/export-excel', { params });
|
}
|