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

@@ -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%;
}