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 { 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'

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": {
"title": "Settings Management",
"paymentSettings": "Payment Settings",
"detailsOfPaymentConfiguration": "Payment Configuration Details",
"paymentMerchant": "Payment Merchant",
"developerApi": "Developer API",
"commissionTemplate": "Commission Template"

View File

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

View File

@@ -640,13 +640,13 @@ export const asyncRoutes: AppRouteRecord[] = [
icon: '&#xe715;'
},
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,

View File

@@ -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', // 操作密码设置
// 轮询管理

View File

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

View File

@@ -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

View File

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

View File

@@ -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']

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> = {
wechat: '微信直连',
@@ -11,7 +11,7 @@ export const getPaymentProviderText = (type: PaymentProviderType): string => {
}
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 => {
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<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 => {
if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') {
return config.wx_notify_url || '-'

View File

@@ -4,7 +4,7 @@
<CommissionSummary v-if="hasPermission('dashboard_analysis:commission_summary')" />
<CommissionStats v-if="hasPermission('dashboard_analysis:commission_stats')" />
<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-col :xl="14" :lg="15" :xs="24">-->
@@ -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' })

View File

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

View File

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

View File

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