xiaoyi
2 天以前 f81e5811b9baaaea3645579a6cacad0f75f3d0db
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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',
  );
}