feat: 支付商户
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* API 类型统一导出
|
||||
*/
|
||||
|
||||
@@ -78,6 +78,9 @@ export * from './agentRecharge'
|
||||
// 支付设置相关
|
||||
export * from './paymentSettings'
|
||||
|
||||
// 支付商户与商户池相关
|
||||
export * from './paymentMerchantPools'
|
||||
|
||||
// 系统配置相关
|
||||
export * from './systemConfig'
|
||||
|
||||
@@ -131,3 +134,5 @@ export * from './audit'
|
||||
|
||||
// 企业微信审批配置相关
|
||||
export * from './wecom'
|
||||
|
||||
|
||||
|
||||
207
src/types/api/paymentMerchantPools.ts
Normal file
207
src/types/api/paymentMerchantPools.ts
Normal file
@@ -0,0 +1,207 @@
|
||||
/**
|
||||
* 支付商户与商户池相关类型定义
|
||||
*/
|
||||
|
||||
import type { BaseResponse, PaginationData, PaginationParams } from './common'
|
||||
|
||||
export type PaymentMerchantMethod = 'wechat' | 'alipay'
|
||||
|
||||
export type PaymentMerchantProviderType = 'wechat' | 'wechat_v2' | 'fuiou' | 'alipay'
|
||||
|
||||
export type PaymentPoolStrategy = 'amount' | 'count' | 'time'
|
||||
|
||||
export type PaymentStatisticCycle = 'round' | 'day' | 'month'
|
||||
|
||||
export type PaymentTimePeriodUnit = 'minute' | 'hour' | 'day'
|
||||
|
||||
export type PaymentCredentialValue = string | number | boolean | null
|
||||
|
||||
export type PaymentCredentials = Record<
|
||||
string,
|
||||
PaymentCredentialValue | PaymentCredentialValue[] | Record<string, PaymentCredentialValue>
|
||||
>
|
||||
|
||||
/**
|
||||
* 仅用于前端表单编辑场景:携带本地 ID 用于稳定 v-for 渲染与局部删除。
|
||||
* 提交时会去除 localId,仅保留后端契约的 key / value 字段。
|
||||
*/
|
||||
export interface PaymentCredentialEntry {
|
||||
key: string
|
||||
value: string
|
||||
/** 仅前端使用,提交时丢弃 */
|
||||
localId?: string
|
||||
}
|
||||
|
||||
export interface PaymentMerchant {
|
||||
id: number
|
||||
name: string
|
||||
payment_method: PaymentMerchantMethod
|
||||
provider_type: PaymentMerchantProviderType
|
||||
merchant_identity: string
|
||||
enabled: boolean
|
||||
remark: string
|
||||
credential_version: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface PaymentMerchantQueryParams extends PaginationParams {
|
||||
/** 可选:按名称模糊筛选 */
|
||||
name?: string
|
||||
payment_method?: PaymentMerchantMethod
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
export type PaymentMerchantPageResult = PaginationData<PaymentMerchant>
|
||||
|
||||
export interface CreatePaymentMerchantRequest {
|
||||
name: string
|
||||
payment_method: PaymentMerchantMethod
|
||||
provider_type: PaymentMerchantProviderType
|
||||
merchant_identity: string
|
||||
credentials: PaymentCredentials
|
||||
enabled: boolean
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface UpdatePaymentMerchantRequest {
|
||||
name?: string
|
||||
enabled?: boolean
|
||||
remark?: string
|
||||
/** 仅在显式更换凭证时填写;未填写时后端保持原值 */
|
||||
credentials?: PaymentCredentials
|
||||
}
|
||||
|
||||
export interface PaymentMerchantPool {
|
||||
id: number
|
||||
name: string
|
||||
payment_method: PaymentMerchantMethod
|
||||
member_ids: number[]
|
||||
enabled: boolean
|
||||
strategy: PaymentPoolStrategy
|
||||
statistic_cycle: PaymentStatisticCycle
|
||||
threshold_amount: number
|
||||
threshold_count: number
|
||||
time_period_started_at: string
|
||||
time_period_unit: PaymentTimePeriodUnit
|
||||
time_period_value: number
|
||||
routing_epoch: number
|
||||
remark: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface PaymentMerchantPoolQueryParams extends PaginationParams {
|
||||
payment_method?: PaymentMerchantMethod
|
||||
}
|
||||
|
||||
export type PaymentMerchantPoolPageResult = PaginationData<PaymentMerchantPool>
|
||||
|
||||
export interface PaymentMerchantPoolPayload {
|
||||
name: string
|
||||
payment_method: PaymentMerchantMethod
|
||||
member_ids: number[]
|
||||
enabled: boolean
|
||||
strategy: PaymentPoolStrategy
|
||||
statistic_cycle?: PaymentStatisticCycle
|
||||
threshold_amount?: number
|
||||
threshold_count?: number
|
||||
time_period_started_at?: string
|
||||
time_period_unit?: PaymentTimePeriodUnit
|
||||
time_period_value?: number
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface WechatAuthorizationConfig {
|
||||
enabled: boolean
|
||||
miniapp_app_id: string
|
||||
oa_app_id: string
|
||||
oa_oauth_redirect_url: string
|
||||
}
|
||||
|
||||
export interface UpdateWechatAuthorizationRequest {
|
||||
enabled: boolean
|
||||
miniapp_app_id?: string
|
||||
miniapp_app_secret?: string
|
||||
oa_app_id?: string
|
||||
oa_app_secret?: string
|
||||
oa_token?: string
|
||||
oa_aes_key?: string
|
||||
oa_oauth_redirect_url?: string
|
||||
}
|
||||
|
||||
export type PaymentMerchantResponse = BaseResponse<PaymentMerchant>
|
||||
export type PaymentMerchantPageResponse = BaseResponse<PaymentMerchantPageResult>
|
||||
export type PaymentMerchantPoolResponse = BaseResponse<PaymentMerchantPool>
|
||||
export type PaymentMerchantPoolPageResponse = BaseResponse<PaymentMerchantPoolPageResult>
|
||||
export type WechatAuthorizationResponse = BaseResponse<WechatAuthorizationConfig>
|
||||
|
||||
export const PAYMENT_METHOD_OPTIONS: Array<{ label: string; value: PaymentMerchantMethod }> = [
|
||||
{ label: '微信支付', value: 'wechat' },
|
||||
{ label: '支付宝', value: 'alipay' }
|
||||
]
|
||||
|
||||
export const PAYMENT_PROVIDER_OPTIONS: Array<{
|
||||
label: string
|
||||
value: PaymentMerchantProviderType
|
||||
paymentMethod: PaymentMerchantMethod
|
||||
}> = [
|
||||
{ label: '微信直连', value: 'wechat', paymentMethod: 'wechat' },
|
||||
{ label: '微信直连 V2', value: 'wechat_v2', paymentMethod: 'wechat' },
|
||||
{ label: '富友支付', value: 'fuiou', paymentMethod: 'wechat' },
|
||||
{ label: '支付宝', value: 'alipay', paymentMethod: 'alipay' }
|
||||
]
|
||||
|
||||
export const PAYMENT_POOL_STRATEGY_OPTIONS: Array<{ label: string; value: PaymentPoolStrategy }> = [
|
||||
{ label: '按金额轮换', value: 'amount' },
|
||||
{ label: '按笔数轮换', value: 'count' },
|
||||
{ label: '按时间轮换', value: 'time' }
|
||||
]
|
||||
|
||||
export const PAYMENT_STATISTIC_CYCLE_OPTIONS: Array<{
|
||||
label: string
|
||||
value: PaymentStatisticCycle
|
||||
}> = [
|
||||
{ label: '每轮', value: 'round' },
|
||||
{ label: '每天', value: 'day' },
|
||||
{ label: '每月', value: 'month' }
|
||||
]
|
||||
|
||||
export const PAYMENT_TIME_PERIOD_UNIT_OPTIONS: Array<{
|
||||
label: string
|
||||
value: PaymentTimePeriodUnit
|
||||
}> = [
|
||||
{ label: '分钟', value: 'minute' },
|
||||
{ label: '小时', value: 'hour' },
|
||||
{ label: '天', value: 'day' }
|
||||
]
|
||||
|
||||
export function getPaymentMethodLabel(value?: PaymentMerchantMethod): string {
|
||||
return PAYMENT_METHOD_OPTIONS.find((item) => item.value === value)?.label || '-'
|
||||
}
|
||||
|
||||
export function getPaymentProviderLabel(value?: PaymentMerchantProviderType): string {
|
||||
return PAYMENT_PROVIDER_OPTIONS.find((item) => item.value === value)?.label || '-'
|
||||
}
|
||||
|
||||
export function getPaymentPoolStrategyLabel(value?: PaymentPoolStrategy): string {
|
||||
return PAYMENT_POOL_STRATEGY_OPTIONS.find((item) => item.value === value)?.label || '-'
|
||||
}
|
||||
|
||||
export function getPaymentStatisticCycleLabel(value?: PaymentStatisticCycle): string {
|
||||
return PAYMENT_STATISTIC_CYCLE_OPTIONS.find((item) => item.value === value)?.label || '-'
|
||||
}
|
||||
|
||||
export function getPaymentTimePeriodUnitLabel(value?: PaymentTimePeriodUnit): string {
|
||||
return PAYMENT_TIME_PERIOD_UNIT_OPTIONS.find((item) => item.value === value)?.label || '-'
|
||||
}
|
||||
|
||||
/**
|
||||
* 商户池在编辑场景下可选成员:来自同支付方式且已启用的支付商户
|
||||
*/
|
||||
export interface PaymentMerchantPoolMemberOption {
|
||||
id: number
|
||||
name: string
|
||||
payment_method: PaymentMerchantMethod
|
||||
enabled: boolean
|
||||
}
|
||||
@@ -40,6 +40,8 @@ export interface RouteMeta extends Record<string | number | symbol, unknown> {
|
||||
exportTaskScene?: ExportTaskScene
|
||||
/** 是否固定标签页 */
|
||||
fixedTab?: boolean
|
||||
/** 仅允许指定 user_type 访问(1=超级管理员,2=平台用户),为空时不做用户类型限制 */
|
||||
allowedUserTypes?: number[]
|
||||
}
|
||||
|
||||
// 扩展路由记录
|
||||
|
||||
Reference in New Issue
Block a user