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; // 审批状态名称
|
reviewerId?: number; // 审核人用户编号
|
reviewerName?: string; // 审核人姓名
|
reviewTime?: string; // 审核时间
|
reviewRemark?: string; // 审核意见(不通过时即不通过原因)
|
payStatus?: number; // 支付状态(账务联动预留)
|
remark?: string; // 备注
|
createTime?: 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) {
|
return requestClient.put<boolean>('/aftersales/compensation/submit', null, {
|
params: { id },
|
});
|
}
|
|
/** 获得审批人编号集合,供列表页判断是否展示审核按钮 */
|
export function getCompensationApproverIds() {
|
return requestClient.get<number[]>('/aftersales/compensation/approver-ids');
|
}
|
|
/**
|
* 审核赔付/服务补偿单(审批中 → 审核通过 / 审核不通过)
|
*
|
* @param id 赔付单编号
|
* @param pass true=审核通过 / false=审核不通过
|
* @param reviewRemark 审核意见,pass=false 时必填
|
*/
|
export function auditCompensation(
|
id: number,
|
pass: boolean,
|
reviewRemark?: string,
|
) {
|
return requestClient.put<boolean>('/aftersales/compensation/audit', {
|
id,
|
pass,
|
reviewRemark,
|
});
|
}
|