From e975e6af4bc9f1ac891e3192e018047c24da1599 Mon Sep 17 00:00:00 2001 From: sexygoat <1538832180@qq.com> Date: Tue, 17 Mar 2026 14:06:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E:=20=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E9=85=8D=E7=BD=AE-=E4=BB=A3=E7=90=86=E5=85=85=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/agentRecharge.ts | 61 ++ src/api/modules/index.ts | 2 + src/api/modules/order.ts | 15 + src/api/modules/wechatConfig.ts | 78 ++ src/router/routes/asyncRoutes.ts | 128 ++- src/router/routesAlias.ts | 6 +- src/types/api/agentRecharge.ts | 65 ++ src/types/api/index.ts | 6 + src/types/api/order.ts | 20 +- src/types/api/wechatConfig.ts | 135 +++ src/views/dashboard/analysis/index.vue | 5 + .../analysis/widget/ActiveWechatConfig.vue | 238 +++++ .../analysis/widget/CommissionSummary.vue | 129 ++- src/views/finance/agent-recharge/detail.vue | 235 +++++ src/views/finance/agent-recharge/index.vue | 642 +++++++++++++ .../order-management/order-list/index.vue | 56 +- src/views/product/shop/index.vue | 30 +- src/views/settings/wechat-config/detail.vue | 307 +++++++ src/views/settings/wechat-config/index.vue | 863 ++++++++++++++++++ 19 files changed, 2940 insertions(+), 81 deletions(-) create mode 100644 src/api/modules/agentRecharge.ts create mode 100644 src/api/modules/wechatConfig.ts create mode 100644 src/types/api/agentRecharge.ts create mode 100644 src/types/api/wechatConfig.ts create mode 100644 src/views/dashboard/analysis/widget/ActiveWechatConfig.vue create mode 100644 src/views/finance/agent-recharge/detail.vue create mode 100644 src/views/finance/agent-recharge/index.vue create mode 100644 src/views/settings/wechat-config/detail.vue create mode 100644 src/views/settings/wechat-config/index.vue diff --git a/src/api/modules/agentRecharge.ts b/src/api/modules/agentRecharge.ts new file mode 100644 index 0000000..b033f40 --- /dev/null +++ b/src/api/modules/agentRecharge.ts @@ -0,0 +1,61 @@ +/** + * 代理充值相关 API + */ + +import { BaseService } from '../BaseService' +import type { + AgentRecharge, + AgentRechargeQueryParams, + AgentRechargeListResponse, + CreateAgentRechargeRequest, + ConfirmOfflinePaymentRequest, + BaseResponse +} from '@/types/api' + +export class AgentRechargeService extends BaseService { + /** + * 获取代理充值订单列表 + * @param params 查询参数 + */ + static getAgentRecharges( + params?: AgentRechargeQueryParams + ): Promise> { + return this.get>( + '/api/admin/agent-recharges', + params + ) + } + + /** + * 获取代理充值订单详情 + * @param id 充值订单ID + */ + static getAgentRechargeById(id: number): Promise> { + return this.getOne(`/api/admin/agent-recharges/${id}`) + } + + /** + * 创建代理充值订单 + * @param data 创建充值订单请求参数 + */ + static createAgentRecharge( + data: CreateAgentRechargeRequest + ): Promise> { + return this.post>('/api/admin/agent-recharges', data) + } + + /** + * 确认线下充值 + * @param id 充值订单ID + * @param data 确认线下充值请求参数 + */ + static confirmOfflinePayment( + id: number, + data: ConfirmOfflinePaymentRequest + ): Promise> { + return this.post>( + `/api/admin/agent-recharges/${id}/offline-pay`, + data + ) + } +} diff --git a/src/api/modules/index.ts b/src/api/modules/index.ts index ed2c0b4..74036b0 100644 --- a/src/api/modules/index.ts +++ b/src/api/modules/index.ts @@ -26,6 +26,8 @@ export { PackageManageService } from './packageManage' export { ShopSeriesGrantService } from './shopSeriesGrant' export { OrderService } from './order' export { AssetService } from './asset' +export { AgentRechargeService } from './agentRecharge' +export { WechatConfigService } from './wechatConfig' // TODO: 按需添加其他业务模块 // export { SettingService } from './setting' diff --git a/src/api/modules/order.ts b/src/api/modules/order.ts index aff9c23..21c62b6 100644 --- a/src/api/modules/order.ts +++ b/src/api/modules/order.ts @@ -9,6 +9,8 @@ import type { OrderListResponse, CreateOrderRequest, CreateOrderResponse, + PurchaseCheckRequest, + PurchaseCheckResponse, BaseResponse } from '@/types/api' @@ -44,4 +46,17 @@ export class OrderService extends BaseService { static cancelOrder(id: number): Promise { return this.post(`/api/admin/orders/${id}/cancel`, {}) } + + /** + * 套餐购买预检 + * @param data 预检请求参数 + */ + static purchaseCheck( + data: PurchaseCheckRequest + ): Promise> { + return this.post>( + '/api/admin/orders/purchase-check', + data + ) + } } diff --git a/src/api/modules/wechatConfig.ts b/src/api/modules/wechatConfig.ts new file mode 100644 index 0000000..eae8e50 --- /dev/null +++ b/src/api/modules/wechatConfig.ts @@ -0,0 +1,78 @@ +/** + * 微信支付配置管理 API + */ + +import { BaseService } from '../BaseService' +import type { BaseResponse } from '@/types/api' +import type { + WechatConfig, + WechatConfigQueryParams, + WechatConfigListResponse, + CreateWechatConfigRequest, + UpdateWechatConfigRequest +} from '@/types/api/wechatConfig' + +export class WechatConfigService extends BaseService { + /** + * 获取支付配置列表 + */ + static getWechatConfigs( + params?: WechatConfigQueryParams + ): Promise> { + return this.get>('/api/admin/wechat-configs', params) + } + + /** + * 获取支付配置详情 + */ + static getWechatConfigById(id: number): Promise> { + return this.get>(`/api/admin/wechat-configs/${id}`) + } + + /** + * 创建支付配置 + */ + static createWechatConfig( + data: CreateWechatConfigRequest + ): Promise> { + return this.post>('/api/admin/wechat-configs', data) + } + + /** + * 更新支付配置 + */ + static updateWechatConfig( + id: number, + data: UpdateWechatConfigRequest + ): Promise> { + return this.put>(`/api/admin/wechat-configs/${id}`, data) + } + + /** + * 删除支付配置 + */ + static deleteWechatConfig(id: number): Promise> { + return this.delete>(`/api/admin/wechat-configs/${id}`) + } + + /** + * 激活支付配置 + */ + static activateWechatConfig(id: number): Promise> { + return this.post>(`/api/admin/wechat-configs/${id}/activate`) + } + + /** + * 停用支付配置 + */ + static deactivateWechatConfig(id: number): Promise> { + return this.post>(`/api/admin/wechat-configs/${id}/deactivate`) + } + + /** + * 获取当前生效的支付配置 + */ + static getActiveWechatConfig(): Promise> { + return this.get>('/api/admin/wechat-configs/active') + } +} diff --git a/src/router/routes/asyncRoutes.ts b/src/router/routes/asyncRoutes.ts index d36ffcf..542ddc6 100644 --- a/src/router/routes/asyncRoutes.ts +++ b/src/router/routes/asyncRoutes.ts @@ -1146,6 +1146,37 @@ export const asyncRoutes: AppRouteRecord[] = [ ] }, + { + path: '/finance', + name: 'FinanceManagement', + component: RoutesAlias.Home, + meta: { + title: '财务管理', + icon: '' + }, + children: [ + { + path: 'agent-recharge', + name: 'AgentRecharge', + component: RoutesAlias.AgentRecharge, + meta: { + title: '代理充值', + keepAlive: true + } + }, + { + path: 'agent-recharge/detail/:id', + name: 'AgentRechargeDetailRoute', + component: RoutesAlias.AgentRechargeDetail, + meta: { + title: '充值详情', + isHide: true, + keepAlive: false + } + } + ] + }, + { path: '/commission', name: 'CommissionManagement', @@ -1196,44 +1227,63 @@ export const asyncRoutes: AppRouteRecord[] = [ } } ] - } + }, - // { - // path: '/settings', - // name: 'Settings', - // component: RoutesAlias.Home, - // meta: { - // title: 'menus.settings.title', - // icon: '' - // }, - // children: [ - // { - // path: 'payment-merchant', - // name: 'PaymentMerchant', - // component: RoutesAlias.PaymentMerchant, - // meta: { - // title: 'menus.settings.paymentMerchant', - // keepAlive: true - // } - // }, - // { - // path: 'developer-api', - // name: 'DeveloperApi', - // component: RoutesAlias.DeveloperApi, - // meta: { - // title: 'menus.settings.developerApi', - // keepAlive: true - // } - // }, - // { - // path: 'commission-template', - // name: 'CommissionTemplate', - // component: RoutesAlias.CommissionTemplate, - // meta: { - // title: 'menus.settings.commissionTemplate', - // keepAlive: true - // } - // } - // ] - // } + { + path: '/settings', + name: 'Settings', + component: RoutesAlias.Home, + meta: { + title: '设置管理', + icon: '' + }, + children: [ + { + path: 'wechat-config', + name: 'WechatConfig', + component: RoutesAlias.WechatConfig, + meta: { + title: '微信支付配置', + keepAlive: true + } + }, + { + path: 'wechat-config/detail/:id', + name: 'WechatConfigDetailRoute', + component: RoutesAlias.WechatConfigDetail, + meta: { + title: '支付配置详情', + isHide: true, + keepAlive: false + } + } + // { + // path: 'payment-merchant', + // name: 'PaymentMerchant', + // component: RoutesAlias.PaymentMerchant, + // meta: { + // title: 'menus.settings.paymentMerchant', + // keepAlive: true + // } + // }, + // { + // path: 'developer-api', + // name: 'DeveloperApi', + // component: RoutesAlias.DeveloperApi, + // meta: { + // title: 'menus.settings.developerApi', + // keepAlive: true + // } + // }, + // { + // path: 'commission-template', + // name: 'CommissionTemplate', + // component: RoutesAlias.CommissionTemplate, + // meta: { + // title: 'menus.settings.commissionTemplate', + // keepAlive: true + // } + // } + ] + } ] diff --git a/src/router/routesAlias.ts b/src/router/routesAlias.ts index d896690..ef7bcaf 100644 --- a/src/router/routesAlias.ts +++ b/src/router/routesAlias.ts @@ -113,6 +113,8 @@ export enum RoutesAlias { CarrierManagement = '/finance/carrier-management', // 运营商管理 OrderList = '/account/orders', // 订单管理 OrderDetail = '/account/orders/detail', // 订单详情 + AgentRecharge = '/finance/agent-recharge', // 代理充值 + AgentRechargeDetail = '/finance/agent-recharge/detail', // 代理充值详情 // 佣金管理 WithdrawalApproval = '/finance/commission/withdrawal-approval', // 提现审批 @@ -123,7 +125,9 @@ export enum RoutesAlias { // 设置管理 PaymentMerchant = '/settings/payment-merchant', // 支付商户 DeveloperApi = '/settings/developer-api', // 开发者API - CommissionTemplate = '/settings/commission-template' // 分佣模板 + CommissionTemplate = '/settings/commission-template', // 分佣模板 + WechatConfig = '/settings/wechat-config', // 微信支付配置 + WechatConfigDetail = '/settings/wechat-config/detail' // 微信支付配置详情 } // 主页路由 diff --git a/src/types/api/agentRecharge.ts b/src/types/api/agentRecharge.ts new file mode 100644 index 0000000..36f8468 --- /dev/null +++ b/src/types/api/agentRecharge.ts @@ -0,0 +1,65 @@ +/** + * 代理充值相关类型定义 + */ + +// 充值状态 +export enum AgentRechargeStatus { + PENDING = 1, // 待支付 + COMPLETED = 2, // 已完成 + CANCELLED = 3 // 已取消 +} + +// 支付方式 +export type AgentRechargePaymentMethod = 'wechat' | 'offline' + +// 支付通道 +export type AgentRechargePaymentChannel = 'wechat_direct' | 'fuyou' | 'offline' + +// 代理充值订单 +export interface AgentRecharge { + id: number + recharge_no: string + agent_wallet_id: number + shop_id: number + shop_name: string + amount: number // 充值金额(单位:分) + status: AgentRechargeStatus + payment_method: AgentRechargePaymentMethod + payment_channel: AgentRechargePaymentChannel + payment_config_id: number | null + payment_transaction_id: string + created_at: string + paid_at: string | null + completed_at: string | null + updated_at: string +} + +// 查询代理充值订单列表参数 +export interface AgentRechargeQueryParams { + page?: number + page_size?: number + shop_id?: number + status?: AgentRechargeStatus + start_date?: string + end_date?: string +} + +// 代理充值订单列表响应 +export interface AgentRechargeListResponse { + page: number + page_size: number + total: number + list: AgentRecharge[] +} + +// 创建代理充值订单请求 +export interface CreateAgentRechargeRequest { + amount: number // 充值金额(单位:分),范围 10000 ~ 100000000 + payment_method: AgentRechargePaymentMethod + shop_id: number +} + +// 确认线下充值请求 +export interface ConfirmOfflinePaymentRequest { + operation_password: string +} diff --git a/src/types/api/index.ts b/src/types/api/index.ts index 6f75f84..216cae5 100644 --- a/src/types/api/index.ts +++ b/src/types/api/index.ts @@ -79,3 +79,9 @@ export * from './order' // 资产管理相关 export * from './asset' + +// 代理充值相关 +export * from './agentRecharge' + +// 微信支付配置相关 +export * from './wechatConfig' diff --git a/src/types/api/order.ts b/src/types/api/order.ts index 1ce0d93..31b0305 100644 --- a/src/types/api/order.ts +++ b/src/types/api/order.ts @@ -17,7 +17,7 @@ export type OrderType = 'single_card' | 'device' export type BuyerType = 'personal' | 'agent' // 订单支付方式 -export type OrderPaymentMethod = 'wallet' | 'wechat' | 'alipay' +export type OrderPaymentMethod = 'wallet' | 'wechat' | 'alipay' | 'offline' // 订单佣金状态 export enum OrderCommissionStatus { @@ -84,7 +84,25 @@ export interface CreateOrderRequest { package_ids: number[] iot_card_id?: number | null device_id?: number | null + payment_method: OrderPaymentMethod // 支付方式 } // 创建订单响应 (返回订单详情) export type CreateOrderResponse = Order + +// 套餐购买预检请求 +export interface PurchaseCheckRequest { + order_type: OrderType // 订单类型 (single_card:单卡购买, device:设备购买) + package_ids: number[] // 套餐ID列表 + resource_id: number // 资源ID (IoT卡ID或设备ID) +} + +// 套餐购买预检响应 +export interface PurchaseCheckResponse { + need_force_recharge: boolean // 是否需要强充 + force_recharge_amount?: number // 强充金额(分) + total_package_amount?: number // 套餐总价(分) + actual_payment?: number // 实际支付金额(分) + wallet_credit?: number // 钱包到账金额(分) + message?: string // 提示信息 +} diff --git a/src/types/api/wechatConfig.ts b/src/types/api/wechatConfig.ts new file mode 100644 index 0000000..a834499 --- /dev/null +++ b/src/types/api/wechatConfig.ts @@ -0,0 +1,135 @@ +/** + * 微信支付配置管理相关类型定义 + */ + +// 支付渠道类型 +export type PaymentProviderType = 'wechat' | 'fuiou' + +// 微信支付配置 +export interface WechatConfig { + id: number + name: string + description: string + provider_type: PaymentProviderType + is_active: 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 + + // 微信支付配置 + wx_mch_id: string + wx_api_v2_key: string + wx_api_v3_key: string + wx_notify_url: string + wx_serial_no: string + wx_cert_content: string + wx_key_content: string + + // 富友支付配置 + fy_api_url: string + fy_ins_cd: string + fy_mchnt_cd: string + fy_term_id: string + fy_notify_url: string + fy_private_key: string + fy_public_key: string + + created_at: string + updated_at: string +} + +// 查询参数 +export interface WechatConfigQueryParams { + page?: number + page_size?: number + provider_type?: PaymentProviderType + is_active?: boolean +} + +// 列表响应 +export interface WechatConfigListResponse { + items: WechatConfig[] + page: number + page_size: number + total: number +} + +// 创建微信支付配置请求 +export interface CreateWechatConfigRequest { + name: string + provider_type: PaymentProviderType + description?: string + + // 小程序配置 + 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 + + // 微信支付配置 + wx_mch_id?: string + wx_api_v2_key?: string + wx_api_v3_key?: string + wx_notify_url?: string + wx_serial_no?: string + wx_cert_content?: string + wx_key_content?: string + + // 富友支付配置 + fy_api_url?: string + fy_ins_cd?: string + fy_mchnt_cd?: string + fy_term_id?: string + fy_notify_url?: string + fy_private_key?: string + fy_public_key?: string +} + +// 更新微信支付配置请求 +export interface UpdateWechatConfigRequest { + name?: string + description?: string + provider_type?: PaymentProviderType + + // 小程序配置 + 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 + + // 微信支付配置 + wx_mch_id?: string + wx_api_v2_key?: string + wx_api_v3_key?: string + wx_notify_url?: string + wx_serial_no?: string + wx_cert_content?: string + wx_key_content?: string + + // 富友支付配置 + fy_api_url?: string + fy_ins_cd?: string + fy_mchnt_cd?: string + fy_term_id?: string + fy_notify_url?: string + fy_private_key?: string + fy_public_key?: string +} diff --git a/src/views/dashboard/analysis/index.vue b/src/views/dashboard/analysis/index.vue index 944e04d..aa7634c 100644 --- a/src/views/dashboard/analysis/index.vue +++ b/src/views/dashboard/analysis/index.vue @@ -8,6 +8,10 @@
提现配置
+ +
支付配置
+ + @@ -54,6 +58,7 @@ import VolumeServiceLevel from './widget/VolumeServiceLevel.vue' import CommissionSummary from './widget/CommissionSummary.vue' import WithdrawalSettings from './widget/WithdrawalSettings.vue' + import ActiveWechatConfig from './widget/ActiveWechatConfig.vue' defineOptions({ name: 'Analysis' }) diff --git a/src/views/dashboard/analysis/widget/ActiveWechatConfig.vue b/src/views/dashboard/analysis/widget/ActiveWechatConfig.vue new file mode 100644 index 0000000..8023afa --- /dev/null +++ b/src/views/dashboard/analysis/widget/ActiveWechatConfig.vue @@ -0,0 +1,238 @@ + + + + + diff --git a/src/views/dashboard/analysis/widget/CommissionSummary.vue b/src/views/dashboard/analysis/widget/CommissionSummary.vue index 601bd40..bae7733 100644 --- a/src/views/dashboard/analysis/widget/CommissionSummary.vue +++ b/src/views/dashboard/analysis/widget/CommissionSummary.vue @@ -1,6 +1,15 @@ diff --git a/src/views/finance/agent-recharge/index.vue b/src/views/finance/agent-recharge/index.vue new file mode 100644 index 0000000..ca3dd48 --- /dev/null +++ b/src/views/finance/agent-recharge/index.vue @@ -0,0 +1,642 @@ + + + + + diff --git a/src/views/order-management/order-list/index.vue b/src/views/order-management/order-list/index.vue index faaf392..0633a70 100644 --- a/src/views/order-management/order-list/index.vue +++ b/src/views/order-management/order-list/index.vue @@ -177,7 +177,12 @@ style="width: 100%" > - + +