This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<ElTag v-else type="info" effect="plain" size="small">未配置</ElTag>
|
||||
</div>
|
||||
<div v-if="activeConfig" class="header-right">
|
||||
<span class="creator-info">创建于 {{ formatDateTime(activeConfig.created_at) }}</span>
|
||||
<span class="creator-info">更新于 {{ formatDateTime(activeConfig.updated_at) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -61,6 +61,30 @@
|
||||
<div class="info-value">{{ activeConfig.is_active ? '已激活' : '未激活' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div
|
||||
class="info-icon"
|
||||
style="background: linear-gradient(135deg, #fa709a 0%, #fee140 100%)"
|
||||
>
|
||||
<i class="el-icon">🔔</i>
|
||||
</div>
|
||||
<div class="info-content">
|
||||
<div class="info-label">支付回调地址</div>
|
||||
<div class="info-value">{{ getNotifyUrl(activeConfig) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div
|
||||
class="info-icon"
|
||||
style="background: linear-gradient(135deg, #30cfd0 0%, #330867 100%)"
|
||||
>
|
||||
<i class="el-icon">🔐</i>
|
||||
</div>
|
||||
<div class="info-content">
|
||||
<div class="info-label">凭证状态</div>
|
||||
<div class="info-value">{{ getCredentialStatus(activeConfig) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-content">
|
||||
<i class="el-icon-info" style="font-size: 48px; color: var(--el-text-color-placeholder)"></i>
|
||||
@@ -72,8 +96,14 @@
|
||||
<script setup lang="ts">
|
||||
import { WechatConfigService } from '@/api/modules'
|
||||
import { ElTag } from 'element-plus'
|
||||
import type { WechatConfig, PaymentProviderType } from '@/types/api'
|
||||
import type { WechatConfig } from '@/types/api'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import {
|
||||
getPaymentConfigStatus,
|
||||
getPaymentMerchantId,
|
||||
getPaymentNotifyUrl,
|
||||
getPaymentProviderText
|
||||
} from '@/utils/business/paymentConfig'
|
||||
import { usePermission } from '@/composables/usePermission'
|
||||
|
||||
defineOptions({ name: 'ActiveWechatConfigWidget' })
|
||||
@@ -83,23 +113,43 @@
|
||||
// 当前生效的支付配置
|
||||
const activeConfig = ref<WechatConfig | null>(null)
|
||||
|
||||
// 获取支付渠道类型文本
|
||||
const getProviderTypeText = (type: PaymentProviderType): string => {
|
||||
const typeMap: Record<PaymentProviderType, string> = {
|
||||
wechat: '微信直连',
|
||||
fuiou: '富友支付'
|
||||
}
|
||||
return typeMap[type] || type
|
||||
const getProviderTypeText = (type: WechatConfig['provider_type']): string => {
|
||||
return getPaymentProviderText(type)
|
||||
}
|
||||
|
||||
// 获取商户号
|
||||
const getMerchantId = (config: WechatConfig): string => {
|
||||
if (config.provider_type === 'wechat') {
|
||||
return config.wx_mch_id || '-'
|
||||
return getPaymentMerchantId(config)
|
||||
}
|
||||
|
||||
const getNotifyUrl = (config: WechatConfig): string => {
|
||||
return getPaymentNotifyUrl(config)
|
||||
}
|
||||
|
||||
const getCredentialStatus = (config: WechatConfig): 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)
|
||||
if (certStatus === '已配置' && keyStatus === '已配置') {
|
||||
return '证书/密钥已配置'
|
||||
}
|
||||
if (certStatus === '未配置' && keyStatus === '未配置') {
|
||||
return '未配置'
|
||||
}
|
||||
return '部分配置'
|
||||
}
|
||||
|
||||
if (config.provider_type === 'fuiou') {
|
||||
return config.fy_mchnt_cd || '-'
|
||||
const privateKeyStatus = getPaymentConfigStatus(config.fy_private_key)
|
||||
const publicKeyStatus = getPaymentConfigStatus(config.fy_public_key)
|
||||
if (privateKeyStatus === '已配置' && publicKeyStatus === '已配置') {
|
||||
return '富友密钥已配置'
|
||||
}
|
||||
if (privateKeyStatus === '未配置' && publicKeyStatus === '未配置') {
|
||||
return '未配置'
|
||||
}
|
||||
return '部分配置'
|
||||
}
|
||||
|
||||
return '-'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user