feat 支付平台配置/通道配置对接

This commit is contained in:
nws
2024-01-14 01:37:56 +08:00
parent d5cfab7cbe
commit 87648e255c
17 changed files with 298 additions and 208 deletions

View File

@@ -41,12 +41,11 @@
</script>
<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-basic-title';
.@{prefix-cls} {
position: relative;
display: flex;
padding-left: 7px;
font-size: 16px;
font-size: 14px;
font-weight: 500;
line-height: 24px;
color: @text-color-base;

View File

@@ -121,7 +121,6 @@
*/
function initClientAndLoginType() {
findClients().then(({ data }) => {
console.log(data)
clients = data
})
findLoginTypes().then(({ data }) => {

View File

@@ -202,7 +202,4 @@
</script>
<style lang="less" scoped>
.vben-basic-title {
font-size: 14px;
}
</style>

View File

@@ -34,10 +34,10 @@ export function findPayWays() {
* 支付宝配置
*/
export interface AlipayConfig extends BaseEntity {
// 是否启用
enable?: boolean
// 支付宝商户appId
appId?: string
// 是否启用
enable: boolean
// 服务器异步通知页面路径
notifyUrl?: string
// 页面跳转同步通知页面路径

View File

@@ -1,5 +1,5 @@
<template>
<basic-drawer showFooter v-bind="$attrs" width="60%" :title="title" :visible="visible" :maskClosable="false" @close="handleCancel">
<basic-drawer showFooter v-bind="$attrs" width="60%" title="支付宝支付配置" :visible="visible" :maskClosable="false" @close="handleCancel">
<a-spin :spinning="confirmLoading">
<a-form
class="small-from-item"
@@ -11,21 +11,30 @@
:wrapper-col="wrapperCol"
>
<a-form-item label="主键" name="id" :hidden="true">
<a-input v-model:value="form.id" :disabled="showable" />
<a-input v-model:value="form.id" />
</a-form-item>
<!-- <a-form-item v-show="showable" label="是否启用" name="activity">-->
<!-- <a-tag>{{ form.enable ? '启用' : '未启用' }}</a-tag>-->
<!-- </a-form-item>-->
<a-form-item label="AppId" name="appId">
<a-input v-model:value="form.appId" :disabled="showable" placeholder="请输入支付宝商户AppId" />
<a-input v-model:value="form.appId" placeholder="请输入支付宝商户AppId" />
</a-form-item>
<a-form-item label="异步通知URL" name="notifyUrl">
<a-input v-model:value="form.notifyUrl" :disabled="showable" placeholder="请输入异步通知URL" />
<a-form-item label="是否启用" name="enable">
<a-switch v-model:checked="form.enable" />
</a-form-item>
<a-form-item name="notifyUrl">
<template #label>
<basic-title helpMessage="此处为本网关接收通知的地址, 而不是客户系统接收通知所需的地址"> 异步通知地址 </basic-title>
</template>
<a-input v-model:value="form.notifyUrl" placeholder="请输入异步通知URL" />
</a-form-item>
<a-form-item name="returnUrl">
<template #label>
<basic-title helpMessage="此处为本网关接收通知的地址, 而不是客户系统接收通知所需的地址"> 同步通知地址 </basic-title>
</template>
<a-input v-model:value="form.returnUrl" placeholder="请输入同步通知URL" />
</a-form-item>
<a-form-item label="支付网关URL" name="serverUrl">
<a-input v-model:value="form.serverUrl" :disabled="showable" placeholder="请输入支付网关URL" />
<a-input v-model:value="form.serverUrl" placeholder="请输入支付网关URL" />
</a-form-item>
<a-form-item label="支持支付方式" name="payWayList">
<a-form-item label="支持支付方式" name="payWays">
<a-select
allowClear
mode="multiple"
@@ -37,21 +46,21 @@
/>
</a-form-item>
<a-form-item label="沙箱环境" name="sandbox">
<a-switch checked-children="" un-checked-children="" v-model:checked="form.sandbox" :disabled="showable" />
<a-switch checked-children="" un-checked-children="" v-model:checked="form.sandbox" />
</a-form-item>
<a-form-item label="认证方式" name="authType">
<a-select allowClear :disabled="showable" v-model:value="form.authType" style="width: 100%" placeholder="选择认证方式">
<a-select allowClearv-model:value="form.authType" style="width: 100%" placeholder="选择认证方式">
<a-select-option key="key">公钥模式</a-select-option>
<a-select-option key="cart">证书模式</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="签名类型" name="signType">
<a-select allowClear :disabled="showable" v-model:value="form.signType" style="width: 100%" placeholder="选择签名类型">
<a-select allowClearv-model:value="form.signType" style="width: 100%" placeholder="选择签名类型">
<a-select-option key="RSA2">RSA2秘钥</a-select-option>
</a-select>
</a-form-item>
<a-form-item v-show="form.authType === 'key'" label="支付宝公钥" name="alipayPublicKey">
<a-textarea :rows="5" v-model:value="form.alipayPublicKey" :disabled="showable" placeholder="请输入支付宝公钥" />
<a-textarea :rows="5" v-model:value="form.alipayPublicKey" placeholder="请输入支付宝公钥" />
</a-form-item>
<a-form-item v-show="form.authType === 'cart'" label="应用公钥证书" name="appCert">
<a-upload
@@ -120,10 +129,10 @@
</a-input>
</a-form-item>
<a-form-item label="应用私钥" name="privateKey">
<a-textarea :rows="5" v-model:value="form.privateKey" :disabled="showable" placeholder="请输入应用私钥" />
<a-textarea :rows="5" v-model:value="form.privateKey" placeholder="请输入应用私钥" />
</a-form-item>
<a-form-item label="备注" name="remark">
<a-textarea v-model:value="form.remark" :disabled="showable" placeholder="请输入备注" />
<a-textarea v-model:value="form.remark" placeholder="请输入备注" />
</a-form-item>
</a-form>
</a-spin>
@@ -148,6 +157,7 @@
import { useUpload } from '/@/hooks/bootx/useUpload'
import { useMessage } from '/@/hooks/web/useMessage'
import Icon from '/@/components/Icon/src/Icon.vue'
import BasicTitle from "/@/components/Basic/src/BasicTitle.vue";
const {
initFormEditType,
handleCancel,
@@ -173,6 +183,7 @@
let payWayList = $ref<LabeledValue[]>([])
let form = $ref({
appId: '',
enable: false,
notifyUrl: '',
returnUrl: '',
serverUrl: '',
@@ -183,7 +194,6 @@
alipayCert: '',
alipayRootCert: '',
privateKey: '',
expireTime: 15,
payWays: [],
sandbox: false,
remark: '',
@@ -192,9 +202,10 @@
// 校验
const rules = computed(() => {
return {
// name: [{ required: true, message: '请输入配置名称' }],
appId: [{ required: true, message: '请输入AppId' }],
enable: [{ required: true, message: '请选择是否启用' }],
notifyUrl: [{ required: true, message: '请输入异步通知页面地址' }],
returnUrl: [{ required: true, message: '请输入同步通知页面地址' }],
serverUrl: [{ required: true, message: '请输入请求网关地址' }],
authType: [{ required: true, message: '请选择认证方式' }],
signType: [{ required: true, message: '请选择加密类型' }],
@@ -205,7 +216,7 @@
privateKey: [{ required: true, message: '请输入支付私钥' }],
sandbox: [{ required: true, message: '请选择是否为沙箱环境' }],
expireTime: [{ required: true, message: '请输入默认超时配置' }],
payWayList: [{ required: true, message: '请选择支持的支付类型' }],
payWays: [{ required: true, message: '请选择支持的支付类型' }],
} as Record<string, Rule[]>
})
// 事件
@@ -242,10 +253,11 @@
...form,
...diffForm(rawForm, form, 'appId', 'alipayPublicKey', 'appCert', 'alipayCert', 'alipayRootCert', 'privateKey'),
})
confirmLoading.value = false
createMessage.success('保存成功')
handleCancel()
emits('ok')
})
confirmLoading.value = false
handleCancel()
emits('ok')
}
/**
* 文件上传

View File

@@ -1,43 +1,13 @@
import { defHttp } from '/@/utils/http/axios'
import { PageResult, Result } from '/#/axios'
import { Result } from '/#/axios'
import { BaseEntity, KeyValue } from '/#/web'
/**
* 分页
*/
export function page(params) {
return defHttp.get<Result<PageResult<WechatPayConfig>>>({
url: '/wechat/pay/page',
params,
})
}
/**
* 查询全部
*/
export function findAll() {
return defHttp.get<Result<WechatPayConfig[]>>({
url: '/wechat/pay/findAll',
})
}
/**
* 获取单条
*/
export function get(id) {
export function getConfig() {
return defHttp.get<Result<WechatPayConfig>>({
url: '/wechat/pay/findById',
params: { id },
})
}
/**
* 添加
*/
export function add(obj: WechatPayConfig) {
return defHttp.post({
url: '/wechat/pay/add',
data: obj,
url: '/wechat/pay/config/getConfig',
})
}
@@ -46,47 +16,17 @@ export function add(obj: WechatPayConfig) {
*/
export function update(obj: WechatPayConfig) {
return defHttp.post({
url: '/wechat/pay/update',
url: '/wechat/pay/config/update',
data: obj,
})
}
/**
* 删除
*/
export function del(id) {
return defHttp.delete({
url: '/wechat/pay/delete',
params: { id },
})
}
/**
* 获取微信支持支付方式
*/
export function findPayWayList() {
return defHttp.get<Result<KeyValue[]>>({
url: '/wechat/pay/findPayWayList',
})
}
/**
* 启用指定的微信配置
*/
export function setUpActivity(id) {
return defHttp.post({
url: '/wechat/pay/setUpActivity',
params: { id },
})
}
/**
* 清除指定的微信配置
*/
export function clearActivity(id) {
return defHttp.post({
url: '/wechat/pay/clearActivity',
params: { id },
url: '/wechat/pay/config/findPayWays',
})
}
@@ -94,18 +34,12 @@ export function clearActivity(id) {
* 微信支付配置
*/
export interface WechatPayConfig extends BaseEntity {
// 名称
name?: string
// 商户编码
mchCode?: string
// 商户应用编码
mchAppCode?: string
// 微信应用AppId
wxAppId?: string
// 微信商户号
wxMchId?: string
// 服务商应用编号
apiVersion?: string
// 是否启用
enable: boolean
// 商户平台「API安全」中的 APIv2 密钥
apiKeyV2?: string
// 商户平台「API安全」中的 APIv3 密钥
@@ -120,18 +54,10 @@ export interface WechatPayConfig extends BaseEntity {
notifyUrl?: string
// 页面跳转同步通知页面路径
returnUrl?: string
// 支持的支付类型
payWays?: string
// 是否沙箱环境
sandbox?: boolean
// 超时配置
expireTime?: number
// 支持的支付类型
payWayList?: KeyValue[]
// 是否启用
activity?: boolean
// 状态
state?: string
payWays?: string[]
// 备注
remark?: string
}

View File

@@ -1,5 +1,5 @@
<template>
<basic-drawer showFooter v-bind="$attrs" width="60%" :title="title" :visible="visible" :maskClosable="false" @close="handleCancel">
<basic-drawer showFooter v-bind="$attrs" width="60%" title="微信支付配置" :visible="visible" :maskClosable="false" @close="handleCancel">
<a-spin :spinning="confirmLoading">
<a-form
class="small-from-item"
@@ -19,52 +19,45 @@
<a-form-item label="应用编号" name="wxAppId">
<a-input v-model:value="form.wxAppId" :disabled="showable" placeholder="请输入微信应用AppId" />
</a-form-item>
<a-form-item label="API版本" name="apiVersion">
<a-radio-group v-model:value="form.apiVersion" button-style="solid">
<a-radio-button value="apiV2"> Api_V2 </a-radio-button>
<a-radio-button value="apiV3"> Api_V3 </a-radio-button>
</a-radio-group>
</a-form-item>
<a-form-item label="AppSecret" name="appSecret">
<a-input v-model:value="form.appSecret" :disabled="showable" placeholder="APPID对应的接口密码用于获取接口调用凭证时使用" />
</a-form-item>
<a-form-item label="超时配置(分钟)" name="expireTime">
<a-input-number
placeholder="请输入默认超时配置"
:min="1"
:max="12000"
:step="1"
:disabled="showable"
v-model:value="form.expireTime"
/>
<a-form-item label="是否启用" name="enable">
<a-switch v-model:checked="form.enable" />
</a-form-item>
<a-form-item label="异步通知UR" name="notifyUrl">
<a-input v-model:value="form.notifyUrl" :disabled="showable" placeholder="请输入服务器异步通知页面路径" />
<a-form-item name="notifyUrl">
<template #label>
<basic-title helpMessage="此处为本网关接收通知的地址, 而不是客户系统接收通知所需的地址"> 异步通知地址 </basic-title>
</template>
<a-input v-model:value="form.notifyUrl" :disabled="showable" placeholder="请输入服务器异步通知地址" />
</a-form-item>
<a-form-item label="同步通知URL" name="returnUrl">
<a-input v-model:value="form.returnUrl" :disabled="showable" placeholder="请输入页面跳转同步通知页面路径" />
<a-form-item name="returnUrl">
<template #label>
<basic-title helpMessage="此处为本网关接收通知的地址, 而不是客户系统接收通知所需的地址"> 同步通知地址 </basic-title>
</template>
<a-input v-model:value="form.returnUrl" :disabled="showable" placeholder="请输入页面跳转同步通知地址" />
</a-form-item>
<a-form-item label="支持支付方式" name="payWayList">
<a-form-item label="支持支付方式" name="payWays">
<a-select
allowClear
mode="multiple"
:disabled="showable"
:options="payWayList"
v-model:value="form.payWayList"
v-model:value="form.payWays"
style="width: 100%"
placeholder="选择支付方式"
/>
</a-form-item>
<a-form-item label="是否启用" v-show="showable" name="activity">
<a-tag>{{ form.activity ? '启用' : '未启用' }}</a-tag>
</a-form-item>
<a-form-item label="APIv2密钥" name="apiKeyV2">
<a-textarea :rows="3" :disabled="showable" v-model:value="form.apiKeyV2" placeholder="请输入APIv2密钥" />
</a-form-item>
<a-form-item label="APIv3密钥" name="apiKeyV3">
<a-textarea :rows="3" :disabled="showable" v-model:value="form.apiKeyV3" placeholder="请输入APIv3密钥" />
</a-form-item>
<a-form-item label="p12证书" name="p12">
<a-form-item name="p12">
<template #label>
<basic-title helpMessage="例如退款、转账时必须要配置p12证书才可以执行"> p12证书 </basic-title>
</template>
<a-upload
v-if="!form.p12"
:disabled="showable"
@@ -105,7 +98,7 @@
import { computed, nextTick } from 'vue'
import { $ref } from 'vue/macros'
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { add, get, update, findPayWayList, WechatPayConfig } from './WechatPayConfig.api'
import { getConfig, update, findPayWayList, WechatPayConfig } from './WechatPayConfig.api'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { FormEditType } from '/@/enums/formTypeEnum'
import { BasicDrawer } from '/@/components/Drawer'
@@ -113,6 +106,7 @@
import { useUpload } from '/@/hooks/bootx/useUpload'
import { useMessage } from '/@/hooks/web/useMessage'
import { LabeledValue } from 'ant-design-vue/lib/select'
import BasicTitle from '/@/components/Basic/src/BasicTitle.vue'
const {
initFormEditType,
@@ -130,28 +124,27 @@
formEditType,
} = useFormEdit()
// 文件上传
const { tokenHeader, uploadAction } = useUpload('/wechat/pay/toBase64')
const { tokenHeader, uploadAction } = useUpload('/wechat/pay/config/toBase64')
const { createMessage } = useMessage()
let editType = $ref<FormEditType>()
// 表单
const formRef = $ref<FormInstance>()
let rawForm
let rawForm: any
let form = $ref<WechatPayConfig>({
id: null,
enable: false,
wxMchId: '',
wxAppId: '',
appSecret: '',
p12: null,
apiKeyV2: '',
apiKeyV3: '',
apiVersion: 'apiV2',
notifyUrl: '',
returnUrl: '',
expireTime: 15,
payWayList: [],
// sandbox: false,
payWays: [],
sandbox: false,
remark: '',
})
// 校验
@@ -160,14 +153,14 @@
wxMchId: [{ required: true, message: '请输入商户号' }],
wxAppId: [{ required: true, message: '请输入应用编号' }],
appSecret: [{ required: true, message: '请输入AppSecret' }],
enable: [{ required: true, message: '请选择是否启用' }],
notifyUrl: [{ required: true, message: '请输入异步通知页面地址' }],
returnUrl: [{ required: true, message: '请输入同步通知页面地址' }],
apiVersion: [{ required: true, message: '请选择支付API版本' }],
apiKeyV2: [{ required: form.apiVersion === 'apiV2', message: '请输入V2秘钥' }],
apiKeyV3: [{ required: form.apiVersion === 'apiV3', message: '请输入V3秘钥' }],
p12: [{ required: form.apiVersion === 'apiV3', message: '请上传p12证书' }],
expireTime: [{ required: true, message: '请输入默认超时配置' }],
payWayList: [{ required: true, message: '请选择支持的支付类型' }],
apiKeyV2: [{ required: true, message: '请输入V2秘钥' }],
// apiKeyV3: [{ required: true, message: '请输入V3秘钥' }],
// p12: [{ required: true, message: '请上传p12证书' }],
payWays: [{ required: true, message: '请选择支持的支付类型' }],
} as Record<string, Rule[]>
})
@@ -175,45 +168,37 @@
// 事件
const emits = defineEmits(['ok'])
// 入口
function init(record) {
/**
* 入口
*/
function init() {
visible.value = true
resetForm()
getInfo()
}
// 获取信息
function getInfo() {
confirmLoading.value = true
findPayWayList().then(({ data }) => {
payWayList = data
})
editType = record.configId ? FormEditType.Edit : FormEditType.Add
initFormEditType(editType)
resetForm()
form.mchCode = record.mchCode
form.mchAppCode = record.mchAppCode
getInfo(record.configId, editType)
}
// 获取信息
function getInfo(id, editType: FormEditType) {
if ([FormEditType.Edit].includes(editType)) {
confirmLoading.value = true
get(id).then(({ data }) => {
rawForm = { ...data }
form = data
confirmLoading.value = false
})
} else {
getConfig().then(({ data }) => {
rawForm = { ...data }
form = data
confirmLoading.value = false
}
})
}
// 保存
function handleOk() {
formRef?.validate().then(async () => {
confirmLoading.value = true
if (formEditType.value === FormEditType.Add) {
await add(form)
} else if (formEditType.value === FormEditType.Edit) {
await update({
...form,
...diffForm(rawForm, form, 'wxMchId', 'wxAppId', 'p12', 'appSecret', 'apiKeyV2', 'apiKeyV3', 'keyPem', 'certPem'),
})
}
await update({
...form,
...diffForm(rawForm, form, 'wxMchId', 'wxAppId', 'p12', 'appSecret', 'apiKeyV2', 'apiKeyV3'),
})
confirmLoading.value = false
handleCancel()
createMessage.success('保存成功')
emits('ok')
})
}

View File

@@ -84,7 +84,7 @@ export interface PayOrder extends BaseEntity {
// 可退款信息
refundableInfos?: RefundableInfo[]
// 支付状态
payStatus?: number
status?: number
// 支付时间
payTime?: string
// 过期时间

View File

@@ -29,7 +29,7 @@
{{ order.refundableBalance }}
</a-descriptions-item>
<a-descriptions-item label="支付状态">
{{ dictConvert('PayStatus', order.payStatus) }}
<a-tag>{{ dictConvert('PayStatus', order.status) }}</a-tag>
</a-descriptions-item>
<a-descriptions-item label="异步支付">
{{ order.asyncPay ? '是' : '否' }}

View File

@@ -15,7 +15,7 @@
</a-form-item>
</template>
<a-form-item label="原因" name="reason">
<a-textarea v-model:value="form.reason" rows="3" />
<a-textarea v-model:value="form.reason" :rows="3" />
</a-form-item>
</a-form>
<template #footer>
@@ -36,7 +36,7 @@
import BasicModal from '/@/components/Modal/src/BasicModal.vue'
import { FormInstance } from 'ant-design-vue/lib/form'
import { useMessage } from '/@/hooks/web/useMessage'
import { nextTick } from "vue";
import { nextTick } from 'vue'
const {
initFormEditType,
@@ -76,7 +76,6 @@
getOrder(id).then(({ data }) => {
const { id, refundableInfos } = data
form.paymentId = id as string
console.log(data)
form.refundChannels = [...(refundableInfos as RefundableInfo[])]
confirmLoading.value = false
})

View File

@@ -53,7 +53,7 @@ export interface RefundRecord extends BaseEntity {
// 可退款信息
refundableInfo?: RefundableInfo[]
// 退款状态
refundStatus?: number
status?: number
// 支付时间
refundTime?: string
// 客户ip

View File

@@ -31,7 +31,7 @@
{{ form.refundTime }}
</a-descriptions-item>
<a-descriptions-item label="退款状态">
<a-tag>{{ dictConvert('PayRefundStatus', form.refundStatus) }}</a-tag>
<a-tag>{{ dictConvert('PayRefundStatus', form.status) }}</a-tag>
</a-descriptions-item>
<a-descriptions-item label="退款终端ip">
{{ form.clientIp }}
@@ -77,20 +77,7 @@
const { dictConvert } = useDict()
// 表单
const formRef = $ref<FormInstance>()
let form = $ref<RefundRecord>({
id: null,
paymentId: '',
refundRequestNo: '',
userId: '',
title: '',
amount: 0,
refundableInfo: [],
refundStatus: 0,
refundTime: '',
clientIp: '',
errorCode: '',
errorMsg: '',
})
let form = $ref<RefundRecord>({})
// 事件
const emits = defineEmits(['ok'])

View File

@@ -34,14 +34,22 @@ export interface SyncRecord extends BaseEntity {
asyncChannel?: string
// 通知消息
syncInfo?: string
// 同步状态
status?: string
// 网关返回状态
gatewayStatus?: string
// 是否进行修复
repairOrder?: boolean
// 支付单修复前状态
beforeStatus?: string
// 支付单修复后状态
afterStatus?: string
// 错误消息
errorMsg?: string
// 同步时间
syncTime?: string
// 终端ip
clientIp?: string
// 请求链路ID
reqId?: string
}
/**
* 支付同步结果

View File

@@ -20,20 +20,24 @@
{{ dictConvert('AsyncPayChannel', form.asyncChannel) }}
</a-descriptions-item>
<a-descriptions-item label="同步消息">
<json-preview :data="JSON.parse(form.syncInfo || '{}')" />
<json-preview :data="XEUtils.toStringJSON(form.syncInfo || '{}')" />
</a-descriptions-item>
<a-descriptions-item label="修复">
<a-descriptions-item label="同步结果">
{{ dictConvert('PaySyncResult', form.gatewayStatus) }}
</a-descriptions-item>
<a-descriptions-item label="是否修复">
<a-tag>{{ form.repairOrder ? '是' : '否' }}</a-tag>
</a-descriptions-item>
<a-descriptions-item label="修复前订单状态" v-if="form.errorMsg">
{{ form.errorMsg }}
</a-descriptions-item>
<a-descriptions-item label="修复后订单状态">
{{ dictConvert('PayStatus', form.afterStatus) }}
</a-descriptions-item>
<a-descriptions-item label="同步时间">
{{ form.syncTime }}
</a-descriptions-item>
<a-descriptions-item label="错误信息" v-if="form.errorMsg">
{{ form.errorMsg }}
</a-descriptions-item>
<a-descriptions-item label="客户端IP">
{{ form.clientIp }}
</a-descriptions-item>
@@ -53,6 +57,8 @@
import { BasicModal } from '/@/components/Modal'
import { useDict } from '/@/hooks/bootx/useDict'
import JsonPreview from '/@/components/CodeEditor/src/json-preview/JsonPreview.vue'
import XEUtils from 'xe-utils'
const {
initFormEditType,
handleCancel,
@@ -78,6 +84,8 @@
confirmLoading.value = true
get(id).then(({ data }) => {
form = data
console.log(XEUtils.toStringJSON(data.syncInfo))
console.log(JSON.parse(data.syncInfo))
confirmLoading.value = false
})
}

View File

@@ -14,9 +14,9 @@
<a-tag>{{ dictConvert('AsyncPayChannel', row.asyncChannel) }}</a-tag>
</template>
</vxe-column>
<vxe-column field="status" title="同步状态">
<vxe-column field="status" title="同步结果">
<template #default="{ row }">
<a-tag>{{ dictConvert('PaySyncStatus', row.status) }}</a-tag>
<a-tag>{{ dictConvert('PaySyncStatus', row.gatewayStatus) }}</a-tag>
</template>
</vxe-column>
<vxe-column field="repairOrder" title="修复">

View File

@@ -0,0 +1,40 @@
import { defHttp } from '/@/utils/http/axios'
import { Result } from '/#/axios'
import { BaseEntity } from '/#/web'
/**
* 获取平台配置项
*/
export function getConfig() {
return defHttp.get<Result<PayPlatformConfig>>({
url: '/platform/config/getConfig',
})
}
/**
* 更新平台配置
*/
export function update(param: PayPlatformConfig) {
return defHttp.post<Result<PayPlatformConfig>>({
url: '/platform/config/update',
data: param,
})
}
/**
* 支付平台配置
*/
export interface PayPlatformConfig extends BaseEntity {
// 网站地址
websiteUrl?: string
// 签名方式
signType?: string
// 签名秘钥
signSecret?: string
// 异步支付通知地址
notifyUrl?: string
// 同步支付通知地址
returnUrl?: string
// 订单默认超时时间(分钟)
orderTimeout?: number
}

View File

@@ -0,0 +1,130 @@
<template>
<div>
<div class="m-3 p-3 bg-white">
<a-spin :spinning="loading">
<a-form ref="formRef" :validate-trigger="['blur', 'change']" :label-col="{ span: 12 }" :model="form" :rules="rules">
<a-row>
<a-col :offset="2" :span="10">
<a-form-item label="网站地址" class="w-400px" name="websiteUrl">
<a-input placeholder="请输入网站地址" v-model:value="form.websiteUrl" :disabled="!edit" />
</a-form-item>
</a-col>
<a-col :span="10">
<a-form-item label="订单默认超时时间(分钟)" class="w-400px" name="orderTimeout">
<a-input-number
:disabled="!edit"
placeholder="请输入订单默认超时时间(分钟)"
:precision="0"
:min="5"
v-model:value="form.orderTimeout"
/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :offset="2" :span="10">
<a-form-item label="签名方式" class="w-400px" name="signType">
<a-radio-group v-model:value="form.signType" button-style="solid" :disabled="!edit">
<a-radio-button value="MD5">MD5</a-radio-button>
<a-radio-button value="HMAC_SHA256">SHA256</a-radio-button>
</a-radio-group>
</a-form-item>
</a-col>
<a-col :span="10">
<a-form-item label="签名秘钥" class="w-400px" name="signSecret">
<a-input placeholder="请输入签名秘钥" v-model:value="form.signSecret" :disabled="!edit" />
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :offset="2" :span="10">
<a-form-item class="w-400px" name="notifyUrl">
<template #label>
<basic-title helpMessage="此处为客户系统接收通知的地址,如果接口中未配置,系统将会将消息发送到该地址上">
异步支付通知地址
</basic-title>
</template>
<a-input placeholder="请输入异步支付通知地址" v-model:value="form.notifyUrl" :disabled="!edit" />
</a-form-item>
</a-col>
<a-col :span="10">
<a-form-item class="w-400px" name="returnUrl">
<template #label>
<basic-title helpMessage="此处为执行成功后跳转的客户系统接收通知的地址,如果接口中未配置,将会跳转到该地址上">
同步支付通知地址
</basic-title>
</template>
<a-input placeholder="请输入同步支付通知地址" v-model:value="form.returnUrl" :disabled="!edit" />
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :push="8">
<a-button v-if="edit" @click="initData">取消</a-button>
<a-button v-if="edit" style="margin-left: 50px" type="primary" @click="updateConfig">更新</a-button>
<a-button v-if="!edit" @click="edit = true">编辑信息</a-button>
</a-col>
</a-row>
</a-form>
</a-spin>
</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted, reactive } from 'vue'
import { getConfig, update, PayPlatformConfig } from './PayPlatformConfig.api'
import { $ref } from 'vue/macros'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { useMessage } from '/@/hooks/web/useMessage'
import BasicTitle from '/@/components/Basic/src/BasicTitle.vue'
const { createConfirm, createMessage } = useMessage()
let form = $ref<PayPlatformConfig>({})
let loading = $ref(false)
const formRef = $ref<FormInstance>()
let edit = $ref(false)
const rules = reactive({
websiteUrl: [{ required: true, message: '请输入网站地址', trigger: 'blur' }],
signType: [{ required: true, message: '请选择签名类型', trigger: 'blur' }],
signSecret: [{ required: true, message: '请输入签名密钥', trigger: 'blur' }],
orderTimeout: [{ required: true, message: '请输入订单默认超时时间(分钟)', trigger: 'blur' }],
} as Record<string, Rule[]>)
onMounted(() => initData())
/**
* 初始化数据
*/
function initData() {
edit = false
loading = true
getConfig().then(({ data }) => {
form = data
loading = false
})
}
/**
* 保存或更新配置
*/
async function updateConfig() {
await formRef?.validate()
createConfirm({
iconType: 'warning',
title: '警告',
content: '是否支付配置相关信息',
onOk: async () => {
loading = true
await update(form)
edit = false
createMessage.success('更新成功')
initData()
},
})
}
</script>
<style lang="less" scoped></style>