From 4c0207c6e697cafb752502fe551fb2ab7e64ce4b Mon Sep 17 00:00:00 2001 From: luo Date: Fri, 10 Jul 2026 18:09:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=86=E5=BE=AE=E4=BF=A1=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=94=B9=E6=88=90=E6=94=AF=E4=BB=98=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/index.ts | 2 +- src/api/modules/paymentSettings.ts | 80 ++++++++++++++++ src/api/modules/wechatConfig.ts | 78 --------------- src/locales/langs/en.json | 2 + src/locales/langs/zh.json | 2 +- src/router/routes/asyncRoutes.ts | 18 ++-- src/router/routesAlias.ts | 4 +- src/types/api/index.ts | 4 +- .../{wechatConfig.ts => paymentSettings.ts} | 20 ++-- src/types/api/setting.ts | 2 +- src/types/components.d.ts | 43 +++++++++ src/utils/business/paymentConfig.ts | 6 +- src/views/dashboard/analysis/index.vue | 4 +- ...atConfig.vue => ActivePaymentSettings.vue} | 26 ++--- .../detail.vue | 18 ++-- .../index.vue | 96 +++++++++---------- 16 files changed, 226 insertions(+), 179 deletions(-) create mode 100644 src/api/modules/paymentSettings.ts delete mode 100644 src/api/modules/wechatConfig.ts rename src/types/api/{wechatConfig.ts => paymentSettings.ts} (80%) rename src/views/dashboard/analysis/widget/{ActiveWechatConfig.vue => ActivePaymentSettings.vue} (90%) rename src/views/settings/{wechat-config => payment-settings}/detail.vue (94%) rename src/views/settings/{wechat-config => payment-settings}/index.vue (91%) diff --git a/src/api/modules/index.ts b/src/api/modules/index.ts index 4fe694c..0f1f1b7 100644 --- a/src/api/modules/index.ts +++ b/src/api/modules/index.ts @@ -21,7 +21,7 @@ export { ShopSeriesGrantService } from './shopSeriesGrant' export { OrderService } from './order' export { AssetService } from './asset' export { AgentRechargeService } from './agentRecharge' -export { WechatConfigService } from './wechatConfig' +export { PaymentSettingsService } from './paymentSettings' export { ExchangeService } from './exchange' export { RefundService } from './refund' export { DataCleanupService } from './dataCleanup' diff --git a/src/api/modules/paymentSettings.ts b/src/api/modules/paymentSettings.ts new file mode 100644 index 0000000..86d13ac --- /dev/null +++ b/src/api/modules/paymentSettings.ts @@ -0,0 +1,80 @@ +/** + * 支付配置管理 API + */ + +import { BaseService } from '../BaseService' +import type { BaseResponse } from '@/types/api' +import type { + PaymentSettings, + PaymentSettingsQueryParams, + PaymentSettingsListResponse, + CreatePaymentSettingsRequest, + UpdatePaymentSettingsRequest +} from '@/types/api/paymentSettings' + +const PAYMENT_SETTINGS_BASE_URL = '/api/admin/wechat-configs' + +export class PaymentSettingsService extends BaseService { + /** + * 获取支付配置列表 + */ + static getPaymentSettings( + params?: PaymentSettingsQueryParams + ): Promise> { + return this.get>(PAYMENT_SETTINGS_BASE_URL, params) + } + + /** + * 获取支付配置详情 + */ + static getPaymentSettingsById(id: number): Promise> { + return this.get>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`) + } + + /** + * 创建支付配置 + */ + static createPaymentSettings( + data: CreatePaymentSettingsRequest + ): Promise> { + return this.post>(PAYMENT_SETTINGS_BASE_URL, data) + } + + /** + * 更新支付配置 + */ + static updatePaymentSettings( + id: number, + data: UpdatePaymentSettingsRequest + ): Promise> { + return this.put>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`, data) + } + + /** + * 删除支付配置 + */ + static deletePaymentSettings(id: number): Promise> { + return this.delete>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`) + } + + /** + * 激活支付配置 + */ + static activatePaymentSettings(id: number): Promise> { + return this.post>(`${PAYMENT_SETTINGS_BASE_URL}/${id}/activate`) + } + + /** + * 停用支付配置 + */ + static deactivatePaymentSettings(id: number): Promise> { + return this.post>(`${PAYMENT_SETTINGS_BASE_URL}/${id}/deactivate`) + } + + /** + * 获取当前生效的支付配置 + */ + static getActivePaymentSettings(): Promise> { + return this.get>(`${PAYMENT_SETTINGS_BASE_URL}/active`) + } +} diff --git a/src/api/modules/wechatConfig.ts b/src/api/modules/wechatConfig.ts deleted file mode 100644 index cfc2e62..0000000 --- a/src/api/modules/wechatConfig.ts +++ /dev/null @@ -1,78 +0,0 @@ -/** - * 支付配置管理 API - */ - -import { BaseService } from '../BaseService' -import type { BaseResponse } from '@/types/api' -import type { - WechatConfig, - WechatConfigQueryParams, - WechatConfigListResponse, - CreateWechatConfigRequest, - UpdateWechatConfigRequest -} from '@/types/api/wechatConfig' - -const PAYMENT_CONFIG_BASE_URL = '/api/admin/wechat-configs' - -export class WechatConfigService extends BaseService { - /** - * 获取支付配置列表 - */ - static getWechatConfigs( - params?: WechatConfigQueryParams - ): Promise> { - return this.get>(PAYMENT_CONFIG_BASE_URL, params) - } - - /** - * 获取支付配置详情 - */ - static getWechatConfigById(id: number): Promise> { - return this.get>(`${PAYMENT_CONFIG_BASE_URL}/${id}`) - } - - /** - * 创建支付配置 - */ - static createWechatConfig(data: CreateWechatConfigRequest): Promise> { - return this.post>(PAYMENT_CONFIG_BASE_URL, data) - } - - /** - * 更新支付配置 - */ - static updateWechatConfig( - id: number, - data: UpdateWechatConfigRequest - ): Promise> { - return this.put>(`${PAYMENT_CONFIG_BASE_URL}/${id}`, data) - } - - /** - * 删除支付配置 - */ - static deleteWechatConfig(id: number): Promise> { - return this.delete>(`${PAYMENT_CONFIG_BASE_URL}/${id}`) - } - - /** - * 激活支付配置 - */ - static activateWechatConfig(id: number): Promise> { - return this.post>(`${PAYMENT_CONFIG_BASE_URL}/${id}/activate`) - } - - /** - * 停用支付配置 - */ - static deactivateWechatConfig(id: number): Promise> { - return this.post>(`${PAYMENT_CONFIG_BASE_URL}/${id}/deactivate`) - } - - /** - * 获取当前生效的支付配置 - */ - static getActiveWechatConfig(): Promise> { - return this.get>(`${PAYMENT_CONFIG_BASE_URL}/active`) - } -} diff --git a/src/locales/langs/en.json b/src/locales/langs/en.json index 1566d08..41fda89 100644 --- a/src/locales/langs/en.json +++ b/src/locales/langs/en.json @@ -458,6 +458,8 @@ }, "settings": { "title": "Settings Management", + "paymentSettings": "Payment Settings", + "detailsOfPaymentConfiguration": "Payment Configuration Details", "paymentMerchant": "Payment Merchant", "developerApi": "Developer API", "commissionTemplate": "Commission Template" diff --git a/src/locales/langs/zh.json b/src/locales/langs/zh.json index 014e09d..c5bb2ce 100644 --- a/src/locales/langs/zh.json +++ b/src/locales/langs/zh.json @@ -410,7 +410,7 @@ }, "settings": { "title": "设置管理", - "wechatPayConfiguration": "微信配置", + "paymentSettings": "支付设置", "detailsOfPaymentConfiguration": "支付配置详情", "withdrawalSettings": "提现配置", "passwordSettings": "密码设置" diff --git a/src/router/routes/asyncRoutes.ts b/src/router/routes/asyncRoutes.ts index b6e2e22..cac5663 100644 --- a/src/router/routes/asyncRoutes.ts +++ b/src/router/routes/asyncRoutes.ts @@ -640,13 +640,13 @@ export const asyncRoutes: AppRouteRecord[] = [ icon: '' }, children: [ - // 微信配置 + // 支付设置 { - path: 'wechat-config', - name: 'WechatConfig', - component: RoutesAlias.WechatConfig, + path: 'payment-settings', + name: 'PaymentSettings', + component: RoutesAlias.PaymentSettings, meta: { - title: 'menus.settings.wechatPayConfiguration', + title: 'menus.settings.paymentSettings', keepAlive: true } }, @@ -661,11 +661,11 @@ export const asyncRoutes: AppRouteRecord[] = [ roles: ['R_SUPER', 'R_ADMIN'] } }, - // 微信支付配置详情 + // 支付设置详情 { - path: 'wechat-config/detail/:id', - name: 'WechatConfigDetailRoute', - component: RoutesAlias.WechatConfigDetail, + path: 'payment-settings/detail/:id', + name: 'PaymentSettingsDetailRoute', + component: RoutesAlias.PaymentSettingsDetail, meta: { title: 'menus.settings.detailsOfPaymentConfiguration', isHide: true, diff --git a/src/router/routesAlias.ts b/src/router/routesAlias.ts index 08cc885..9754c20 100644 --- a/src/router/routesAlias.ts +++ b/src/router/routesAlias.ts @@ -82,8 +82,8 @@ export enum RoutesAlias { // 设置管理 WithdrawalSettings = '/settings/withdrawal-settings', // 提现配置 - WechatConfig = '/settings/wechat-config', // 微信配置 - WechatConfigDetail = '/settings/wechat-config/detail', // 微信支付配置详情 + PaymentSettings = '/settings/payment-settings', // 支付设置 + PaymentSettingsDetail = '/settings/payment-settings/detail', // 支付设置详情 OperationPasswordSettings = '/settings/operation-password', // 操作密码设置 // 轮询管理 diff --git a/src/types/api/index.ts b/src/types/api/index.ts index cf2c39d..8527887 100644 --- a/src/types/api/index.ts +++ b/src/types/api/index.ts @@ -75,8 +75,8 @@ export * from './asset' // 代理充值相关 export * from './agentRecharge' -// 微信支付配置相关 -export * from './wechatConfig' +// 支付设置相关 +export * from './paymentSettings' // 退款管理相关 export * from './refund' diff --git a/src/types/api/wechatConfig.ts b/src/types/api/paymentSettings.ts similarity index 80% rename from src/types/api/wechatConfig.ts rename to src/types/api/paymentSettings.ts index ffaa857..5369fd1 100644 --- a/src/types/api/wechatConfig.ts +++ b/src/types/api/paymentSettings.ts @@ -1,5 +1,5 @@ /** - * 微信支付配置管理相关类型定义 + * 支付设置相关类型定义 */ // 支付渠道类型 @@ -66,8 +66,8 @@ type PaymentConfigWritableFields = Partial< FuiouConfigFields > -// 支付配置 -export interface WechatConfig +// 支付设置 +export interface PaymentSettings extends PaymentConfigBase, MiniappConfigFields, OfficialAccountConfigFields, @@ -76,7 +76,7 @@ export interface WechatConfig FuiouConfigFields {} // 查询参数 -export interface WechatConfigQueryParams { +export interface PaymentSettingsQueryParams { page?: number page_size?: number provider_type?: PaymentProviderType @@ -84,23 +84,23 @@ export interface WechatConfigQueryParams { } // 列表响应 -export interface WechatConfigListResponse { - items: WechatConfig[] +export interface PaymentSettingsListResponse { + items: PaymentSettings[] page: number size: number total: number page_size?: number } -// 创建微信支付配置请求 -export interface CreateWechatConfigRequest extends PaymentConfigWritableFields { +// 创建支付设置请求 +export interface CreatePaymentSettingsRequest extends PaymentConfigWritableFields { name: string provider_type: PaymentProviderType description?: string } -// 更新微信支付配置请求 -export interface UpdateWechatConfigRequest extends PaymentConfigWritableFields { +// 更新支付设置请求 +export interface UpdatePaymentSettingsRequest extends PaymentConfigWritableFields { name?: string description?: string provider_type?: PaymentProviderType diff --git a/src/types/api/setting.ts b/src/types/api/setting.ts index 49e9796..9a168e6 100644 --- a/src/types/api/setting.ts +++ b/src/types/api/setting.ts @@ -20,7 +20,7 @@ export interface PaymentMerchantSetting { publicKey: string notifyUrl?: string } - // 微信配置 + // 微信支付配置 wechat?: { enabled: boolean appId: string diff --git a/src/types/components.d.ts b/src/types/components.d.ts index 7a1259c..bcc764c 100644 --- a/src/types/components.d.ts +++ b/src/types/components.d.ts @@ -83,12 +83,55 @@ declare module 'vue' { CreateRefundDialog: typeof import('./../components/business/CreateRefundDialog.vue')['default'] CustomerAccountDialog: typeof import('./../components/business/CustomerAccountDialog.vue')['default'] DetailPage: typeof import('./../components/common/DetailPage.vue')['default'] + ElAlert: typeof import('element-plus/es')['ElAlert'] + ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElButton: typeof import('element-plus/es')['ElButton'] + ElCalendar: typeof import('element-plus/es')['ElCalendar'] + ElCard: typeof import('element-plus/es')['ElCard'] + ElCascader: typeof import('element-plus/es')['ElCascader'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] + ElCol: typeof import('element-plus/es')['ElCol'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] + ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] + ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] + ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] + ElDialog: typeof import('element-plus/es')['ElDialog'] + ElDivider: typeof import('element-plus/es')['ElDivider'] + ElDrawer: typeof import('element-plus/es')['ElDrawer'] + ElDropdown: typeof import('element-plus/es')['ElDropdown'] + ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] + ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] + ElEmpty: typeof import('element-plus/es')['ElEmpty'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] + ElIcon: typeof import('element-plus/es')['ElIcon'] ElInput: typeof import('element-plus/es')['ElInput'] + ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] + ElMenu: typeof import('element-plus/es')['ElMenu'] + ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] + ElOption: typeof import('element-plus/es')['ElOption'] + ElPagination: typeof import('element-plus/es')['ElPagination'] + ElPopover: typeof import('element-plus/es')['ElPopover'] + ElProgress: typeof import('element-plus/es')['ElProgress'] + ElRadio: typeof import('element-plus/es')['ElRadio'] + ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] + ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] + ElRow: typeof import('element-plus/es')['ElRow'] + ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] + ElSelect: typeof import('element-plus/es')['ElSelect'] + ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] + ElSwitch: typeof import('element-plus/es')['ElSwitch'] + ElTable: typeof import('element-plus/es')['ElTable'] + ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] + ElTabPane: typeof import('element-plus/es')['ElTabPane'] + ElTabs: typeof import('element-plus/es')['ElTabs'] + ElTag: typeof import('element-plus/es')['ElTag'] + ElTimeline: typeof import('element-plus/es')['ElTimeline'] + ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem'] + ElTooltip: typeof import('element-plus/es')['ElTooltip'] + ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect'] + ElUpload: typeof import('element-plus/es')['ElUpload'] + ElWatermark: typeof import('element-plus/es')['ElWatermark'] ExportTaskCreateDialog: typeof import('./../components/business/ExportTaskCreateDialog.vue')['default'] HorizontalSubmenu: typeof import('./../components/core/layouts/art-menus/art-horizontal-menu/widget/HorizontalSubmenu.vue')['default'] ImportDialog: typeof import('./../components/business/ImportDialog.vue')['default'] diff --git a/src/utils/business/paymentConfig.ts b/src/utils/business/paymentConfig.ts index 934c8c6..8ef49f2 100644 --- a/src/utils/business/paymentConfig.ts +++ b/src/utils/business/paymentConfig.ts @@ -1,4 +1,4 @@ -import type { PaymentProviderType, WechatConfig } from '@/types/api' +import type { PaymentProviderType, PaymentSettings } from '@/types/api' const PAYMENT_PROVIDER_LABELS: Record = { wechat: '微信直连', @@ -11,7 +11,7 @@ export const getPaymentProviderText = (type: PaymentProviderType): string => { } export const getPaymentMerchantId = ( - config: Pick + config: Pick ): string => { if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') { return config.wx_mch_id || '-' @@ -25,7 +25,7 @@ export const getPaymentMerchantId = ( } export const getPaymentNotifyUrl = ( - config: Pick + config: Pick ): string => { if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') { return config.wx_notify_url || '-' diff --git a/src/views/dashboard/analysis/index.vue b/src/views/dashboard/analysis/index.vue index c8e4ea1..ef82f36 100644 --- a/src/views/dashboard/analysis/index.vue +++ b/src/views/dashboard/analysis/index.vue @@ -4,7 +4,7 @@ - + @@ -46,7 +46,7 @@ import CommissionSummary from './widget/CommissionSummary.vue' import CommissionStats from './widget/CommissionStats.vue' import WithdrawalSettings from './widget/WithdrawalSettings.vue' - import ActiveWechatConfig from './widget/ActiveWechatConfig.vue' + import ActivePaymentSettings from './widget/ActivePaymentSettings.vue' import { usePermission } from '@/composables/usePermission' defineOptions({ name: 'Analysis' }) diff --git a/src/views/dashboard/analysis/widget/ActiveWechatConfig.vue b/src/views/dashboard/analysis/widget/ActivePaymentSettings.vue similarity index 90% rename from src/views/dashboard/analysis/widget/ActiveWechatConfig.vue rename to src/views/dashboard/analysis/widget/ActivePaymentSettings.vue index 6cb4295..049eba4 100644 --- a/src/views/dashboard/analysis/widget/ActiveWechatConfig.vue +++ b/src/views/dashboard/analysis/widget/ActivePaymentSettings.vue @@ -1,5 +1,5 @@