| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- import request from "@/utils/request";
- const API_PATH = "/payment/quota";
- const QuotaAPI = {
- // ========= 原有方法 =========
- listQuota(query?: QuotaPageQuery) {
- return request<ApiResponse<QuotaPageResp>>({
- url: `${API_PATH}`,
- method: "get",
- params: query,
- });
- },
- detailQuota(quotaId: string) {
- return request<ApiResponse<QuotaDetail>>({
- url: `${API_PATH}/${quotaId}`,
- method: "get",
- });
- },
- createQuota(body: QuotaForm) {
- return request<ApiResponse<QuotaOperation>>({
- url: `${API_PATH}`,
- method: "post",
- data: body,
- });
- },
- updateQuota(quotaId: string, body: QuotaForm) {
- return request<ApiResponse>({
- url: `${API_PATH}/${quotaId}`,
- method: "put",
- data: body,
- });
- },
- deleteQuota(quotaId: string) {
- return request<ApiResponse>({
- url: `${API_PATH}/${quotaId}`,
- method: "delete",
- });
- },
- listByEmployee(employeeId: string, query?: QuotaPageQuery) {
- return request<ApiResponse<QuotaPageResp>>({
- url: `${API_PATH}/employee/${employeeId}`,
- method: "get",
- params: query,
- });
- },
- // ========= 手工批量发放额度 =========
- /** 手工批量发放额度 */
- issueBatchCreate(body: IssueBatchCreateForm) {
- return request<ApiResponse<IssueBatchCreateResp>>({
- url: `${API_PATH}/issuebatch/create`,
- method: "post",
- data: body,
- });
- },
- /** 作废手工发放批次 */
- issueBatchCancel(body: IssueBatchCancelForm) {
- return request<ApiResponse<IssueBatchCancelResp>>({
- url: `${API_PATH}/issuebatch/cancel`,
- method: "post",
- data: body,
- });
- },
- /** 查询手工发放发放明细 */
- issueBatchRecords(body: IssueBatchRecordsQuery) {
- return request<ApiResponse<IssueBatchRecordsResp>>({
- url: `${API_PATH}/issuebatch/records`,
- method: "post",
- data: body,
- });
- },
- /** 查询手工发放批次列表 */
- issueBatchList(query?: IssueBatchListQuery) {
- return request<ApiResponse<IssueBatchListResp>>({
- url: `${API_PATH}/issuebatch/list`,
- method: "get",
- params: query,
- });
- },
- };
- export default QuotaAPI;
- // ========= 原有类型 =========
- export interface QuotaPageQuery {
- page_no?: number;
- page_size?: number;
- employee_id?: string;
- institution_id?: string;
- enterprise_id?: string;
- status?: string;
- }
- export interface QuotaPageResp {
- total: number;
- list: QuotaTable[];
- }
- export interface QuotaTable {
- id: number;
- quota_id?: string;
- employee_id?: string;
- institution_id?: string;
- target_type?: string;
- quota_type?: string;
- total_amount?: number;
- available_amount?: number;
- status: string;
- created_time: string;
- }
- export interface QuotaDetail {
- id: number;
- quota_id?: string;
- employee_id?: string;
- institution_id?: string;
- enterprise_id?: string;
- target_type?: string;
- target_id?: string;
- quota_type?: string;
- out_biz_no?: string;
- total_amount?: number;
- available_amount?: number;
- frozen_amount?: number;
- share_mode?: string;
- issue_name?: string;
- valid_from?: string;
- valid_to?: string;
- status: string;
- created_time: string;
- updated_time: string;
- }
- export interface QuotaForm {
- employee_id: string;
- institution_id: string;
- total_amount: number;
- available_amount?: number;
- valid_from?: string;
- valid_to?: string;
- }
- export interface QuotaOperation {
- out_biz_no?: string;
- quota_id?: string;
- result?: boolean;
- }
- // ========= 手工批量发放类型 =========
- export interface IssueTargetInfo {
- issue_quota: string;
- owner_open_id?: string;
- owner_id?: string;
- user_name?: string;
- owner_type?: string;
- }
- export interface IssueBatchCreateForm {
- enterprise_id: string;
- issue_name: string;
- quota_type: string;
- effective_start_date: string;
- effective_end_date: string;
- institution_id: string;
- batch_no: string;
- share_mode: string;
- issue_desc?: string;
- issue_target_info_list?: IssueTargetInfo[];
- }
- export interface IssueQuotaCheckFailedItem {
- user_name?: string;
- owner_type?: string;
- owner_id?: string;
- owner_open_id?: string;
- issue_quota?: string;
- message?: string;
- result?: boolean;
- }
- export interface IssueBatchCreateResp {
- issue_batch_id?: string;
- issue_quota_check_failed_list?: IssueQuotaCheckFailedItem[];
- }
- export interface IssueBatchCancelForm {
- enterprise_id: string;
- institution_id: string;
- issue_batch_id: string;
- }
- export interface IssueBatchCancelResp {
- result: boolean;
- }
- export interface IssueBatchRecordsQuery {
- enterprise_id: string;
- institution_id: string;
- issue_batch_id: string;
- page_size: number;
- page_num: number;
- }
- export interface IssueRecordInfoItem {
- quota_id?: string;
- issue_quota?: string;
- issue_status?: number;
- owner_type?: string;
- owner_id?: string;
- owner_open_id?: string;
- user_name?: string;
- currency?: string;
- }
- export interface IssueBatchRecordsResp {
- page_num: number;
- page_size: number;
- total_page_count: number;
- issue_record_info_list?: IssueRecordInfoItem[];
- }
- // ========= 常量 =========
- export const TARGET_TYPE_OPTIONS = [
- { label: "制度维度", value: "INSTITUTION" },
- { label: "费用类型维度", value: "EXPENSE_TYPE" },
- ];
- export const QUOTA_TYPE_OPTIONS = [
- { label: "余额", value: "CAP" },
- { label: "点券", value: "COUPON" },
- { label: "次卡", value: "COUNT" },
- ];
- export const QUOTA_STATUS_OPTIONS = [
- { label: "正常", value: "QUOTA_ACTIVE" },
- { label: "冻结", value: "QUOTA_FROZEN" },
- { label: "已用完", value: "QUOTA_EXHAUSTED" },
- { label: "已过期", value: "QUOTA_EXPIRED" },
- ];
- export const SHARE_MODE_OPTIONS = [
- { label: "不可转增", value: "0" },
- { label: "可转增", value: "1" },
- ];
- export const STATUS_TAG_TYPE: Record<string, string> = {
- QUOTA_ACTIVE: "success",
- QUOTA_FROZEN: "warning",
- QUOTA_EXHAUSTED: "info",
- QUOTA_EXPIRED: "danger",
- QUOTA_PENDING: "info",
- };
- export const STATUS_LABEL: Record<string, string> = {
- QUOTA_ACTIVE: "正常",
- QUOTA_FROZEN: "冻结",
- QUOTA_EXHAUSTED: "已用完",
- QUOTA_EXPIRED: "已过期",
- QUOTA_PENDING: "待发放",
- };
- export interface IssueBatchListQuery {
- page_no?: number;
- page_size?: number;
- institution_id?: string;
- }
- export interface IssueBatchItem {
- id: number;
- issue_batch_id?: string;
- batch_no: string;
- institution_id: string;
- issue_name: string;
- quota_type: string;
- share_mode: string;
- total_count: number;
- total_amount?: number;
- status: string;
- created_time: string;
- updated_time?: string;
- }
- export interface IssueBatchListResp {
- items: IssueBatchItem[];
- total: number;
- page_no: number;
- page_size: number;
- }
- export const ISSUE_BATCH_STATUS_TAG: Record<string, string> = {
- ACTIVE: "success",
- CANCELLED: "danger",
- };
- export const ISSUE_BATCH_STATUS_LABEL: Record<string, string> = {
- ACTIVE: "有效",
- CANCELLED: "已作废",
- };
|