import type { PageParam, PageResult } from '@vben/request';
|
|
import { requestClient } from '#/api/request';
|
|
export namespace AfterSaleCompensationApi {
|
/** 售后赔付/服务补偿单 */
|
export interface Compensation {
|
id?: number;
|
compensationNo?: string; // 赔付单号
|
compensationType?: number; // 赔付类型:1故障赔付 2服务补偿
|
ticketId?: number; // 关联售后工单编号
|
customerId?: number; // 客户编号
|
customerName?: string; // 客户名称
|
saleOrderId?: number; // 关联销售订单编号
|
amount?: number; // 赔付金额
|
payee?: string; // 赔付对象
|
reason?: string; // 赔付原因
|
auditStatus?: number; // 审批状态:0未提交 10审批中 20审核通过 30审核不通过 40已取消
|
auditStatusName?: string; // 审批状态名称
|
processInstanceId?: string; // 审批流程实例编号
|
auditUserId?: number; // 审核人
|
auditTime?: string; // 审核时间
|
auditRemark?: string; // 审核备注
|
payStatus?: number; // 支付状态(账务联动预留)
|
remark?: string; // 备注
|
createTime?: string;
|
}
|
|
/** 审批参数 */
|
export interface AuditReq {
|
id: number;
|
auditStatus: number; // 20通过 30驳回
|
remark?: string;
|
}
|
}
|
|
/** 创建赔付/服务补偿单 */
|
export function createCompensation(data: AfterSaleCompensationApi.Compensation) {
|
return requestClient.post<number>('/aftersales/compensation/create', data);
|
}
|
|
/** 更新赔付/服务补偿单 */
|
export function updateCompensation(data: AfterSaleCompensationApi.Compensation) {
|
return requestClient.put<boolean>('/aftersales/compensation/update', data);
|
}
|
|
/** 删除赔付/服务补偿单 */
|
export function deleteCompensation(id: number) {
|
return requestClient.delete<boolean>('/aftersales/compensation/delete', {
|
params: { id },
|
});
|
}
|
|
/** 获取赔付/服务补偿单 */
|
export function getCompensation(id: number) {
|
return requestClient.get<AfterSaleCompensationApi.Compensation>(
|
`/aftersales/compensation/get?id=${id}`,
|
);
|
}
|
|
/** 获取赔付/服务补偿单分页 */
|
export function getCompensationPage(params: PageParam) {
|
return requestClient.get<PageResult<AfterSaleCompensationApi.Compensation>>(
|
'/aftersales/compensation/page',
|
{ params },
|
);
|
}
|
|
/** 提交赔付/服务补偿单审批 */
|
export function submitCompensation(id: number, processDefinitionKey: string) {
|
return requestClient.put<boolean>('/aftersales/compensation/submit', null, {
|
params: { id, processDefinitionKey },
|
});
|
}
|
|
/** 审批赔付/服务补偿单 */
|
export function auditCompensation(data: AfterSaleCompensationApi.AuditReq) {
|
return requestClient.put<boolean>('/aftersales/compensation/audit', data);
|
}
|
|
/** 获取赔付/服务补偿单审批流程定义列表 */
|
export function getApproveProcessList() {
|
return requestClient.get<{ id: string; name: string; version: number; key: string }[]>(
|
'/aftersales/compensation/approve-process-list',
|
);
|
}
|