fix: 将微信配置改成支付配置
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m41s

This commit is contained in:
luo
2026-07-10 18:09:19 +08:00
parent 5b8d6610ab
commit 4c0207c6e6
16 changed files with 226 additions and 179 deletions

View File

@@ -21,7 +21,7 @@ export { ShopSeriesGrantService } from './shopSeriesGrant'
export { OrderService } from './order' export { OrderService } from './order'
export { AssetService } from './asset' export { AssetService } from './asset'
export { AgentRechargeService } from './agentRecharge' export { AgentRechargeService } from './agentRecharge'
export { WechatConfigService } from './wechatConfig' export { PaymentSettingsService } from './paymentSettings'
export { ExchangeService } from './exchange' export { ExchangeService } from './exchange'
export { RefundService } from './refund' export { RefundService } from './refund'
export { DataCleanupService } from './dataCleanup' export { DataCleanupService } from './dataCleanup'

View File

@@ -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<BaseResponse<PaymentSettingsListResponse>> {
return this.get<BaseResponse<PaymentSettingsListResponse>>(PAYMENT_SETTINGS_BASE_URL, params)
}
/**
* 获取支付配置详情
*/
static getPaymentSettingsById(id: number): Promise<BaseResponse<PaymentSettings>> {
return this.get<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`)
}
/**
* 创建支付配置
*/
static createPaymentSettings(
data: CreatePaymentSettingsRequest
): Promise<BaseResponse<PaymentSettings>> {
return this.post<BaseResponse<PaymentSettings>>(PAYMENT_SETTINGS_BASE_URL, data)
}
/**
* 更新支付配置
*/
static updatePaymentSettings(
id: number,
data: UpdatePaymentSettingsRequest
): Promise<BaseResponse<PaymentSettings>> {
return this.put<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`, data)
}
/**
* 删除支付配置
*/
static deletePaymentSettings(id: number): Promise<BaseResponse<void>> {
return this.delete<BaseResponse<void>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`)
}
/**
* 激活支付配置
*/
static activatePaymentSettings(id: number): Promise<BaseResponse<PaymentSettings>> {
return this.post<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}/activate`)
}
/**
* 停用支付配置
*/
static deactivatePaymentSettings(id: number): Promise<BaseResponse<PaymentSettings>> {
return this.post<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}/deactivate`)
}
/**
* 获取当前生效的支付配置
*/
static getActivePaymentSettings(): Promise<BaseResponse<PaymentSettings>> {
return this.get<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/active`)
}
}

View File

@@ -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<BaseResponse<WechatConfigListResponse>> {
return this.get<BaseResponse<WechatConfigListResponse>>(PAYMENT_CONFIG_BASE_URL, params)
}
/**
* 获取支付配置详情
*/
static getWechatConfigById(id: number): Promise<BaseResponse<WechatConfig>> {
return this.get<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}`)
}
/**
* 创建支付配置
*/
static createWechatConfig(data: CreateWechatConfigRequest): Promise<BaseResponse<WechatConfig>> {
return this.post<BaseResponse<WechatConfig>>(PAYMENT_CONFIG_BASE_URL, data)
}
/**
* 更新支付配置
*/
static updateWechatConfig(
id: number,
data: UpdateWechatConfigRequest
): Promise<BaseResponse<WechatConfig>> {
return this.put<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}`, data)
}
/**
* 删除支付配置
*/
static deleteWechatConfig(id: number): Promise<BaseResponse<void>> {
return this.delete<BaseResponse<void>>(`${PAYMENT_CONFIG_BASE_URL}/${id}`)
}
/**
* 激活支付配置
*/
static activateWechatConfig(id: number): Promise<BaseResponse<WechatConfig>> {
return this.post<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}/activate`)
}
/**
* 停用支付配置
*/
static deactivateWechatConfig(id: number): Promise<BaseResponse<WechatConfig>> {
return this.post<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}/deactivate`)
}
/**
* 获取当前生效的支付配置
*/
static getActiveWechatConfig(): Promise<BaseResponse<WechatConfig>> {
return this.get<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/active`)
}
}

View File

@@ -458,6 +458,8 @@
}, },
"settings": { "settings": {
"title": "Settings Management", "title": "Settings Management",
"paymentSettings": "Payment Settings",
"detailsOfPaymentConfiguration": "Payment Configuration Details",
"paymentMerchant": "Payment Merchant", "paymentMerchant": "Payment Merchant",
"developerApi": "Developer API", "developerApi": "Developer API",
"commissionTemplate": "Commission Template" "commissionTemplate": "Commission Template"

View File

@@ -410,7 +410,7 @@
}, },
"settings": { "settings": {
"title": "设置管理", "title": "设置管理",
"wechatPayConfiguration": "微信配置", "paymentSettings": "支付设置",
"detailsOfPaymentConfiguration": "支付配置详情", "detailsOfPaymentConfiguration": "支付配置详情",
"withdrawalSettings": "提现配置", "withdrawalSettings": "提现配置",
"passwordSettings": "密码设置" "passwordSettings": "密码设置"

View File

@@ -640,13 +640,13 @@ export const asyncRoutes: AppRouteRecord[] = [
icon: '&#xe715;' icon: '&#xe715;'
}, },
children: [ children: [
// 微信配 // 支付设
{ {
path: 'wechat-config', path: 'payment-settings',
name: 'WechatConfig', name: 'PaymentSettings',
component: RoutesAlias.WechatConfig, component: RoutesAlias.PaymentSettings,
meta: { meta: {
title: 'menus.settings.wechatPayConfiguration', title: 'menus.settings.paymentSettings',
keepAlive: true keepAlive: true
} }
}, },
@@ -661,11 +661,11 @@ export const asyncRoutes: AppRouteRecord[] = [
roles: ['R_SUPER', 'R_ADMIN'] roles: ['R_SUPER', 'R_ADMIN']
} }
}, },
// 微信支付置详情 // 支付置详情
{ {
path: 'wechat-config/detail/:id', path: 'payment-settings/detail/:id',
name: 'WechatConfigDetailRoute', name: 'PaymentSettingsDetailRoute',
component: RoutesAlias.WechatConfigDetail, component: RoutesAlias.PaymentSettingsDetail,
meta: { meta: {
title: 'menus.settings.detailsOfPaymentConfiguration', title: 'menus.settings.detailsOfPaymentConfiguration',
isHide: true, isHide: true,

View File

@@ -82,8 +82,8 @@ export enum RoutesAlias {
// 设置管理 // 设置管理
WithdrawalSettings = '/settings/withdrawal-settings', // 提现配置 WithdrawalSettings = '/settings/withdrawal-settings', // 提现配置
WechatConfig = '/settings/wechat-config', // 微信配 PaymentSettings = '/settings/payment-settings', // 支付设
WechatConfigDetail = '/settings/wechat-config/detail', // 微信支付置详情 PaymentSettingsDetail = '/settings/payment-settings/detail', // 支付置详情
OperationPasswordSettings = '/settings/operation-password', // 操作密码设置 OperationPasswordSettings = '/settings/operation-password', // 操作密码设置
// 轮询管理 // 轮询管理

View File

@@ -75,8 +75,8 @@ export * from './asset'
// 代理充值相关 // 代理充值相关
export * from './agentRecharge' export * from './agentRecharge'
// 微信支付置相关 // 支付置相关
export * from './wechatConfig' export * from './paymentSettings'
// 退款管理相关 // 退款管理相关
export * from './refund' export * from './refund'

View File

@@ -1,5 +1,5 @@
/** /**
* *
*/ */
// 支付渠道类型 // 支付渠道类型
@@ -66,8 +66,8 @@ type PaymentConfigWritableFields = Partial<
FuiouConfigFields FuiouConfigFields
> >
// 支付 // 支付
export interface WechatConfig export interface PaymentSettings
extends PaymentConfigBase, extends PaymentConfigBase,
MiniappConfigFields, MiniappConfigFields,
OfficialAccountConfigFields, OfficialAccountConfigFields,
@@ -76,7 +76,7 @@ export interface WechatConfig
FuiouConfigFields {} FuiouConfigFields {}
// 查询参数 // 查询参数
export interface WechatConfigQueryParams { export interface PaymentSettingsQueryParams {
page?: number page?: number
page_size?: number page_size?: number
provider_type?: PaymentProviderType provider_type?: PaymentProviderType
@@ -84,23 +84,23 @@ export interface WechatConfigQueryParams {
} }
// 列表响应 // 列表响应
export interface WechatConfigListResponse { export interface PaymentSettingsListResponse {
items: WechatConfig[] items: PaymentSettings[]
page: number page: number
size: number size: number
total: number total: number
page_size?: number page_size?: number
} }
// 创建微信支付置请求 // 创建支付置请求
export interface CreateWechatConfigRequest extends PaymentConfigWritableFields { export interface CreatePaymentSettingsRequest extends PaymentConfigWritableFields {
name: string name: string
provider_type: PaymentProviderType provider_type: PaymentProviderType
description?: string description?: string
} }
// 更新微信支付置请求 // 更新支付置请求
export interface UpdateWechatConfigRequest extends PaymentConfigWritableFields { export interface UpdatePaymentSettingsRequest extends PaymentConfigWritableFields {
name?: string name?: string
description?: string description?: string
provider_type?: PaymentProviderType provider_type?: PaymentProviderType

View File

@@ -20,7 +20,7 @@ export interface PaymentMerchantSetting {
publicKey: string publicKey: string
notifyUrl?: string notifyUrl?: string
} }
// 微信配置 // 微信支付配置
wechat?: { wechat?: {
enabled: boolean enabled: boolean
appId: string appId: string

View File

@@ -83,12 +83,55 @@ declare module 'vue' {
CreateRefundDialog: typeof import('./../components/business/CreateRefundDialog.vue')['default'] CreateRefundDialog: typeof import('./../components/business/CreateRefundDialog.vue')['default']
CustomerAccountDialog: typeof import('./../components/business/CustomerAccountDialog.vue')['default'] CustomerAccountDialog: typeof import('./../components/business/CustomerAccountDialog.vue')['default']
DetailPage: typeof import('./../components/common/DetailPage.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'] 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'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCol: typeof import('element-plus/es')['ElCol']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] 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'] ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElInput: typeof import('element-plus/es')['ElInput'] 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'] ExportTaskCreateDialog: typeof import('./../components/business/ExportTaskCreateDialog.vue')['default']
HorizontalSubmenu: typeof import('./../components/core/layouts/art-menus/art-horizontal-menu/widget/HorizontalSubmenu.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'] ImportDialog: typeof import('./../components/business/ImportDialog.vue')['default']

View File

@@ -1,4 +1,4 @@
import type { PaymentProviderType, WechatConfig } from '@/types/api' import type { PaymentProviderType, PaymentSettings } from '@/types/api'
const PAYMENT_PROVIDER_LABELS: Record<PaymentProviderType, string> = { const PAYMENT_PROVIDER_LABELS: Record<PaymentProviderType, string> = {
wechat: '微信直连', wechat: '微信直连',
@@ -11,7 +11,7 @@ export const getPaymentProviderText = (type: PaymentProviderType): string => {
} }
export const getPaymentMerchantId = ( export const getPaymentMerchantId = (
config: Pick<WechatConfig, 'provider_type' | 'wx_mch_id' | 'fy_mchnt_cd'> config: Pick<PaymentSettings, 'provider_type' | 'wx_mch_id' | 'fy_mchnt_cd'>
): string => { ): string => {
if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') { if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') {
return config.wx_mch_id || '-' return config.wx_mch_id || '-'
@@ -25,7 +25,7 @@ export const getPaymentMerchantId = (
} }
export const getPaymentNotifyUrl = ( export const getPaymentNotifyUrl = (
config: Pick<WechatConfig, 'provider_type' | 'wx_notify_url' | 'fy_notify_url' | 'ali_notify_url'> config: Pick<PaymentSettings, 'provider_type' | 'wx_notify_url' | 'fy_notify_url' | 'ali_notify_url'>
): string => { ): string => {
if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') { if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') {
return config.wx_notify_url || '-' return config.wx_notify_url || '-'

View File

@@ -4,7 +4,7 @@
<CommissionSummary v-if="hasPermission('dashboard_analysis:commission_summary')" /> <CommissionSummary v-if="hasPermission('dashboard_analysis:commission_summary')" />
<CommissionStats v-if="hasPermission('dashboard_analysis:commission_stats')" /> <CommissionStats v-if="hasPermission('dashboard_analysis:commission_stats')" />
<WithdrawalSettings v-if="hasPermission('dashboard_analysis:withdrawal_settings')" /> <WithdrawalSettings v-if="hasPermission('dashboard_analysis:withdrawal_settings')" />
<ActiveWechatConfig v-if="hasPermission('dashboard_analysis:wechat_config')" /> <ActivePaymentSettings v-if="hasPermission('dashboard_analysis:payment_settings')" />
<!--<el-row :gutter="20">--> <!--<el-row :gutter="20">-->
<!-- <el-col :xl="14" :lg="15" :xs="24">--> <!-- <el-col :xl="14" :lg="15" :xs="24">-->
@@ -46,7 +46,7 @@
import CommissionSummary from './widget/CommissionSummary.vue' import CommissionSummary from './widget/CommissionSummary.vue'
import CommissionStats from './widget/CommissionStats.vue' import CommissionStats from './widget/CommissionStats.vue'
import WithdrawalSettings from './widget/WithdrawalSettings.vue' import WithdrawalSettings from './widget/WithdrawalSettings.vue'
import ActiveWechatConfig from './widget/ActiveWechatConfig.vue' import ActivePaymentSettings from './widget/ActivePaymentSettings.vue'
import { usePermission } from '@/composables/usePermission' import { usePermission } from '@/composables/usePermission'
defineOptions({ name: 'Analysis' }) defineOptions({ name: 'Analysis' })

View File

@@ -1,5 +1,5 @@
<template> <template>
<ElCard shadow="never" class="active-wechat-config-widget"> <ElCard shadow="never" class="active-payment-settings-widget">
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
<div class="header-left"> <div class="header-left">
@@ -94,9 +94,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { WechatConfigService } from '@/api/modules' import { PaymentSettingsService } from '@/api/modules'
import { ElTag } from 'element-plus' import { ElTag } from 'element-plus'
import type { WechatConfig } from '@/types/api' import type { PaymentSettings } from '@/types/api'
import { formatDateTime } from '@/utils/business/format' import { formatDateTime } from '@/utils/business/format'
import { import {
getPaymentConfigStatus, getPaymentConfigStatus,
@@ -106,26 +106,26 @@
} from '@/utils/business/paymentConfig' } from '@/utils/business/paymentConfig'
import { usePermission } from '@/composables/usePermission' import { usePermission } from '@/composables/usePermission'
defineOptions({ name: 'ActiveWechatConfigWidget' }) defineOptions({ name: 'ActivePaymentSettingsWidget' })
const { hasPermission } = usePermission() const { hasPermission } = usePermission()
// //
const activeConfig = ref<WechatConfig | null>(null) const activeConfig = ref<PaymentSettings | null>(null)
const getProviderTypeText = (type: WechatConfig['provider_type']): string => { const getProviderTypeText = (type: PaymentSettings['provider_type']): string => {
return getPaymentProviderText(type) return getPaymentProviderText(type)
} }
const getMerchantId = (config: WechatConfig): string => { const getMerchantId = (config: PaymentSettings): string => {
return getPaymentMerchantId(config) return getPaymentMerchantId(config)
} }
const getNotifyUrl = (config: WechatConfig): string => { const getNotifyUrl = (config: PaymentSettings): string => {
return getPaymentNotifyUrl(config) return getPaymentNotifyUrl(config)
} }
const getCredentialStatus = (config: WechatConfig): string => { const getCredentialStatus = (config: PaymentSettings): string => {
if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') { if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') {
const certStatus = getPaymentConfigStatus(config.wx_cert_content) const certStatus = getPaymentConfigStatus(config.wx_cert_content)
const keyStatus = getPaymentConfigStatus(config.wx_key_content) const keyStatus = getPaymentConfigStatus(config.wx_key_content)
@@ -156,12 +156,12 @@
// //
const loadActiveConfig = async () => { const loadActiveConfig = async () => {
// //
if (!hasPermission('dashboard_analysis:wechat_config')) { if (!hasPermission('dashboard_analysis:payment_settings')) {
return return
} }
try { try {
const res = await WechatConfigService.getActiveWechatConfig() const res = await PaymentSettingsService.getActivePaymentSettings()
if (res.code === 0 && res.data) { if (res.code === 0 && res.data) {
activeConfig.value = res.data activeConfig.value = res.data
} }
@@ -176,7 +176,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.active-wechat-config-widget { .active-payment-settings-widget {
:deep(.el-card__header) { :deep(.el-card__header) {
padding: 18px 20px; padding: 18px 20px;
background: var(--el-fill-color-light); background: var(--el-fill-color-light);
@@ -276,7 +276,7 @@
} }
@media (width <= 768px) { @media (width <= 768px) {
.active-wechat-config-widget { .active-payment-settings-widget {
.card-header { .card-header {
.header-left, .header-left,
.header-right { .header-right {

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="wechat-config-detail-page"> <div class="payment-settings-detail-page">
<ElCard shadow="never"> <ElCard shadow="never">
<!-- 页面头部 --> <!-- 页面头部 -->
<div class="detail-header"> <div class="detail-header">
@@ -31,18 +31,18 @@
import { ArrowLeft, Loading } from '@element-plus/icons-vue' import { ArrowLeft, Loading } from '@element-plus/icons-vue'
import DetailPage from '@/components/common/DetailPage.vue' import DetailPage from '@/components/common/DetailPage.vue'
import type { DetailSection } from '@/components/common/DetailPage.vue' import type { DetailSection } from '@/components/common/DetailPage.vue'
import { WechatConfigService } from '@/api/modules' import { PaymentSettingsService } from '@/api/modules'
import type { WechatConfig } from '@/types/api' import type { PaymentSettings } from '@/types/api'
import { formatDateTime } from '@/utils/business/format' import { formatDateTime } from '@/utils/business/format'
import { getPaymentConfigStatus, getPaymentProviderText } from '@/utils/business/paymentConfig' import { getPaymentConfigStatus, getPaymentProviderText } from '@/utils/business/paymentConfig'
defineOptions({ name: 'WechatConfigDetail' }) defineOptions({ name: 'PaymentSettingsDetail' })
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const loading = ref(false) const loading = ref(false)
const detailData = ref<WechatConfig | null>(null) const detailData = ref<PaymentSettings | null>(null)
const configId = computed(() => Number(route.params.id)) const configId = computed(() => Number(route.params.id))
const pageTitle = computed(() => `支付配置详情 #${configId.value}`) const pageTitle = computed(() => `支付配置详情 #${configId.value}`)
@@ -176,9 +176,9 @@
] ]
} }
// //
const wechatPaySection: DetailSection = { const wechatPaySection: DetailSection = {
title: '微信配置', title: '微信支付配置',
fields: [ fields: [
{ {
label: '微信商户号', label: '微信商户号',
@@ -289,7 +289,7 @@
const fetchDetail = async () => { const fetchDetail = async () => {
loading.value = true loading.value = true
try { try {
const res = await WechatConfigService.getWechatConfigById(configId.value) const res = await PaymentSettingsService.getPaymentSettingsById(configId.value)
if (res.code === 0) { if (res.code === 0) {
detailData.value = res.data detailData.value = res.data
} }
@@ -306,7 +306,7 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.wechat-config-detail-page { .payment-settings-detail-page {
padding: 20px; padding: 20px;
} }

View File

@@ -1,6 +1,6 @@
<template> <template>
<ArtTableFullScreen> <ArtTableFullScreen>
<div class="wechat-config-page" id="table-full-screen"> <div class="payment-settings-page" id="table-full-screen">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<ArtSearchBar <ArtSearchBar
v-model:filter="searchForm" v-model:filter="searchForm"
@@ -22,7 +22,7 @@
<ElButton <ElButton
type="primary" type="primary"
@click="showCreateDialog" @click="showCreateDialog"
v-if="hasAuth('wechat_config:create')" v-if="hasAuth('payment_settings:create')"
>新增支付配置</ElButton >新增支付配置</ElButton
> >
</template> </template>
@@ -226,7 +226,7 @@
<template v-if="form.provider_type === 'wechat' || form.provider_type === 'wechat_v2'"> <template v-if="form.provider_type === 'wechat' || form.provider_type === 'wechat_v2'">
<ElDivider content-position="left"> <ElDivider content-position="left">
<span class="divider-title">微信配置</span> <span class="divider-title">微信支付配置</span>
</ElDivider> </ElDivider>
<ElRow :gutter="20"> <ElRow :gutter="20">
<ElCol :span="12"> <ElCol :span="12">
@@ -361,15 +361,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { h, nextTick, onMounted, reactive, ref } from 'vue' import { h, nextTick, onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { WechatConfigService } from '@/api/modules' import { PaymentSettingsService } from '@/api/modules'
import { ElMessage, ElMessageBox, ElSwitch, ElTag } from 'element-plus' import { ElMessage, ElMessageBox, ElSwitch, ElTag } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import type { import type {
CreateWechatConfigRequest, CreatePaymentSettingsRequest,
PaymentProviderType, PaymentProviderType,
UpdateWechatConfigRequest, UpdatePaymentSettingsRequest,
WechatConfig, PaymentSettings,
WechatConfigQueryParams PaymentSettingsQueryParams
} from '@/types/api' } from '@/types/api'
import type { SearchFormItem } from '@/types' import type { SearchFormItem } from '@/types'
import { useCheckedColumns } from '@/composables/useCheckedColumns' import { useCheckedColumns } from '@/composables/useCheckedColumns'
@@ -383,7 +383,7 @@
isMaskedPaymentConfigValue isMaskedPaymentConfigValue
} from '@/utils/business/paymentConfig' } from '@/utils/business/paymentConfig'
defineOptions({ name: 'WechatConfigList' }) defineOptions({ name: 'PaymentSettingsList' })
type PaymentConfigFormModel = { type PaymentConfigFormModel = {
id: number id: number
@@ -455,7 +455,7 @@
const { hasAuth } = useAuth() const { hasAuth } = useAuth()
const router = useRouter() const router = useRouter()
const canUpdateWechatConfigStatus = hasAuth('wechat_config:status') const canUpdatePaymentSettingsStatus = hasAuth('payment_settings:status')
const loading = ref(false) const loading = ref(false)
const submitLoading = ref(false) const submitLoading = ref(false)
@@ -463,7 +463,7 @@
const dialogVisible = ref(false) const dialogVisible = ref(false)
const dialogType = ref<'add' | 'edit'>('add') const dialogType = ref<'add' | 'edit'>('add')
const formRef = ref<FormInstance>() const formRef = ref<FormInstance>()
const configList = ref<WechatConfig[]>([]) const configList = ref<PaymentSettings[]>([])
const originalFormState = ref<PaymentConfigFormModel | null>(null) const originalFormState = ref<PaymentConfigFormModel | null>(null)
const createInitialFormState = (): PaymentConfigFormModel => ({ const createInitialFormState = (): PaymentConfigFormModel => ({
@@ -501,7 +501,7 @@
fy_public_key: '' fy_public_key: ''
}) })
const mapConfigToForm = (detail: WechatConfig): PaymentConfigFormModel => ({ const mapConfigToForm = (detail: PaymentSettings): PaymentConfigFormModel => ({
...createInitialFormState(), ...createInitialFormState(),
...detail, ...detail,
description: detail.description || '', description: detail.description || '',
@@ -666,7 +666,7 @@
label: '配置名称', label: '配置名称',
minWidth: 160, minWidth: 160,
showOverflowTooltip: true, showOverflowTooltip: true,
formatter: (row: WechatConfig) => { formatter: (row: PaymentSettings) => {
return h( return h(
'span', 'span',
{ {
@@ -685,20 +685,20 @@
label: '配置描述', label: '配置描述',
minWidth: 180, minWidth: 180,
showOverflowTooltip: true, showOverflowTooltip: true,
formatter: (row: WechatConfig) => row.description || '-' formatter: (row: PaymentSettings) => row.description || '-'
}, },
{ {
prop: 'provider_type', prop: 'provider_type',
label: '支付渠道类型', label: '支付渠道类型',
width: 130, width: 130,
formatter: (row: WechatConfig) => getPaymentProviderText(row.provider_type) formatter: (row: PaymentSettings) => getPaymentProviderText(row.provider_type)
}, },
{ {
prop: 'is_active', prop: 'is_active',
label: '激活状态', label: '激活状态',
width: 110, width: 110,
formatter: (row: WechatConfig) => { formatter: (row: PaymentSettings) => {
if (canUpdateWechatConfigStatus) { if (canUpdatePaymentSettingsStatus) {
return h(ElSwitch, { return h(ElSwitch, {
modelValue: row.is_active, modelValue: row.is_active,
activeText: '已激活', activeText: '已激活',
@@ -718,47 +718,47 @@
label: '商户号', label: '商户号',
width: 150, width: 150,
showOverflowTooltip: true, showOverflowTooltip: true,
formatter: (row: WechatConfig) => getPaymentMerchantId(row) formatter: (row: PaymentSettings) => getPaymentMerchantId(row)
}, },
{ {
prop: 'miniapp_app_id', prop: 'miniapp_app_id',
label: '小程序AppID', label: '小程序AppID',
width: 160, width: 160,
showOverflowTooltip: true, showOverflowTooltip: true,
formatter: (row: WechatConfig) => row.miniapp_app_id || '-' formatter: (row: PaymentSettings) => row.miniapp_app_id || '-'
}, },
{ {
prop: 'oa_app_id', prop: 'oa_app_id',
label: '公众号AppID', label: '公众号AppID',
width: 160, width: 160,
showOverflowTooltip: true, showOverflowTooltip: true,
formatter: (row: WechatConfig) => row.oa_app_id || '-' formatter: (row: PaymentSettings) => row.oa_app_id || '-'
}, },
{ {
prop: 'ali_app_id', prop: 'ali_app_id',
label: '支付宝AppID', label: '支付宝AppID',
width: 160, width: 160,
showOverflowTooltip: true, showOverflowTooltip: true,
formatter: (row: WechatConfig) => row.ali_app_id || '-' formatter: (row: PaymentSettings) => row.ali_app_id || '-'
}, },
{ {
prop: 'notify_url', prop: 'notify_url',
label: '支付回调地址', label: '支付回调地址',
minWidth: 200, minWidth: 200,
showOverflowTooltip: true, showOverflowTooltip: true,
formatter: (row: WechatConfig) => getPaymentNotifyUrl(row) formatter: (row: PaymentSettings) => getPaymentNotifyUrl(row)
}, },
{ {
prop: 'created_at', prop: 'created_at',
label: '创建时间', label: '创建时间',
width: 180, width: 180,
formatter: (row: WechatConfig) => formatDateTime(row.created_at) formatter: (row: PaymentSettings) => formatDateTime(row.created_at)
}, },
{ {
prop: 'updated_at', prop: 'updated_at',
label: '更新时间', label: '更新时间',
width: 180, width: 180,
formatter: (row: WechatConfig) => formatDateTime(row.updated_at) formatter: (row: PaymentSettings) => formatDateTime(row.updated_at)
} }
]) ])
@@ -770,14 +770,14 @@
const getTableData = async () => { const getTableData = async () => {
loading.value = true loading.value = true
try { try {
const params: WechatConfigQueryParams = { const params: PaymentSettingsQueryParams = {
page: pagination.page, page: pagination.page,
page_size: pagination.page_size, page_size: pagination.page_size,
provider_type: searchForm.provider_type, provider_type: searchForm.provider_type,
is_active: searchForm.is_active !== undefined ? searchForm.is_active === 1 : undefined is_active: searchForm.is_active !== undefined ? searchForm.is_active === 1 : undefined
} }
const res = await WechatConfigService.getWechatConfigs(params) const res = await PaymentSettingsService.getPaymentSettings(params)
if (res.code === 0) { if (res.code === 0) {
configList.value = res.data.items || [] configList.value = res.data.items || []
pagination.page = res.data.page || pagination.page pagination.page = res.data.page || pagination.page
@@ -825,9 +825,9 @@
}) })
} }
const showEditDialog = async (row: WechatConfig) => { const showEditDialog = async (row: PaymentSettings) => {
try { try {
const res = await WechatConfigService.getWechatConfigById(row.id) const res = await PaymentSettingsService.getPaymentSettingsById(row.id)
if (res.code === 0 && res.data) { if (res.code === 0 && res.data) {
const mappedForm = mapConfigToForm(res.data) const mappedForm = mapConfigToForm(res.data)
Object.assign(form, mappedForm) Object.assign(form, mappedForm)
@@ -853,8 +853,8 @@
formRef.value?.clearValidate() formRef.value?.clearValidate()
} }
const buildCreatePayload = (): CreateWechatConfigRequest => { const buildCreatePayload = (): CreatePaymentSettingsRequest => {
const payload: CreateWechatConfigRequest = { const payload: CreatePaymentSettingsRequest = {
name: trimString(form.name), name: trimString(form.name),
provider_type: form.provider_type, provider_type: form.provider_type,
ali_pay_expire_minutes: form.ali_pay_expire_minutes, ali_pay_expire_minutes: form.ali_pay_expire_minutes,
@@ -878,11 +878,11 @@
return payload return payload
} }
const buildUpdatePayload = (): UpdateWechatConfigRequest => { const buildUpdatePayload = (): UpdatePaymentSettingsRequest => {
const initial = originalFormState.value const initial = originalFormState.value
if (!initial) return {} if (!initial) return {}
const payload: UpdateWechatConfigRequest = {} const payload: UpdatePaymentSettingsRequest = {}
const currentName = trimString(form.name) const currentName = trimString(form.name)
const initialName = trimString(initial.name) const initialName = trimString(initial.name)
if (currentName !== initialName) { if (currentName !== initialName) {
@@ -936,7 +936,7 @@
submitLoading.value = true submitLoading.value = true
try { try {
if (dialogType.value === 'add') { if (dialogType.value === 'add') {
await WechatConfigService.createWechatConfig(buildCreatePayload()) await PaymentSettingsService.createPaymentSettings(buildCreatePayload())
ElMessage.success('创建成功') ElMessage.success('创建成功')
} else { } else {
const payload = buildUpdatePayload() const payload = buildUpdatePayload()
@@ -945,7 +945,7 @@
return return
} }
await WechatConfigService.updateWechatConfig(form.id, payload) await PaymentSettingsService.updatePaymentSettings(form.id, payload)
ElMessage.success('更新成功') ElMessage.success('更新成功')
} }
@@ -958,8 +958,8 @@
} }
} }
const handleStatusChange = async (row: WechatConfig, newStatus: string | number | boolean) => { const handleStatusChange = async (row: PaymentSettings, newStatus: string | number | boolean) => {
if (!hasAuth('wechat_config:status')) { if (!hasAuth('payment_settings:status')) {
ElMessage.warning('您没有修改激活状态的权限') ElMessage.warning('您没有修改激活状态的权限')
return return
} }
@@ -969,10 +969,10 @@
row.is_active = newBoolStatus row.is_active = newBoolStatus
try { try {
if (newBoolStatus) { if (newBoolStatus) {
await WechatConfigService.activateWechatConfig(row.id) await PaymentSettingsService.activatePaymentSettings(row.id)
ElMessage.success('激活成功') ElMessage.success('激活成功')
} else { } else {
await WechatConfigService.deactivateWechatConfig(row.id) await PaymentSettingsService.deactivatePaymentSettings(row.id)
ElMessage.success('停用成功') ElMessage.success('停用成功')
} }
await getTableData() await getTableData()
@@ -982,7 +982,7 @@
} }
} }
const handleDelete = async (row: WechatConfig) => { const handleDelete = async (row: PaymentSettings) => {
try { try {
await ElMessageBox.confirm(`确定要删除支付配置"${row.name}"吗?`, '删除确认', { await ElMessageBox.confirm(`确定要删除支付配置"${row.name}"吗?`, '删除确认', {
confirmButtonText: '确定', confirmButtonText: '确定',
@@ -990,7 +990,7 @@
type: 'warning' type: 'warning'
}) })
await WechatConfigService.deleteWechatConfig(row.id) await PaymentSettingsService.deletePaymentSettings(row.id)
ElMessage.success('删除成功') ElMessage.success('删除成功')
await getTableData() await getTableData()
} catch (error) { } catch (error) {
@@ -1000,24 +1000,24 @@
} }
} }
const handleViewDetail = (row: WechatConfig) => { const handleViewDetail = (row: PaymentSettings) => {
router.push({ router.push({
path: `${RoutesAlias.WechatConfig}/detail/${row.id}` path: `${RoutesAlias.PaymentSettings}/detail/${row.id}`
}) })
} }
const handleNameClick = (row: WechatConfig) => { const handleNameClick = (row: PaymentSettings) => {
if (hasAuth('wechat_config:detail')) { if (hasAuth('payment_settings:detail')) {
handleViewDetail(row) handleViewDetail(row)
} else { } else {
ElMessage.warning('您没有查看详情的权限') ElMessage.warning('您没有查看详情的权限')
} }
} }
const getActions = (row: WechatConfig) => { const getActions = (row: PaymentSettings) => {
const actions: any[] = [] const actions: any[] = []
if (hasAuth('wechat_config:edit')) { if (hasAuth('payment_settings:edit')) {
actions.push({ actions.push({
label: '编辑', label: '编辑',
handler: () => showEditDialog(row), handler: () => showEditDialog(row),
@@ -1025,7 +1025,7 @@
}) })
} }
if (hasAuth('wechat_config:delete')) { if (hasAuth('payment_settings:delete')) {
actions.push({ actions.push({
label: '删除', label: '删除',
handler: () => handleDelete(row), handler: () => handleDelete(row),
@@ -1042,7 +1042,7 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.wechat-config-page { .payment-settings-page {
height: 100%; height: 100%;
} }