liu
昨天 0af5e35af8338cc8a2e38c19ab79efbb9eff0b2c
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
87
88
89
90
91
92
93
94
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,
  });
}