feat: Channel
parent
ce1236d141
commit
08e041b6ec
|
@ -37,7 +37,28 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
||||||
if (unref(isUpdate)) {
|
if (unref(isUpdate)) {
|
||||||
let res = await getChannel(data.record.payMerchant.id, data.record.id, data.payCode)
|
let res = await getChannel(data.record.payMerchant.id, data.record.id, data.payCode)
|
||||||
const config = JSON.parse(res.config)
|
const config = JSON.parse(res.config)
|
||||||
res = Object.assign(res, config)
|
const payConfig: any = {}
|
||||||
|
if (type.value === PayType.ALIPAY) {
|
||||||
|
payConfig.appId = config.appId
|
||||||
|
payConfig.serverUrl = config.serverUrl
|
||||||
|
payConfig.signType = config.signType
|
||||||
|
payConfig.mode = config.mode
|
||||||
|
payConfig.privateKey = config.privateKey
|
||||||
|
payConfig.alipayPublicKey = config.alipayPublicKey
|
||||||
|
payConfig.appCertContent = config.appCertContent
|
||||||
|
payConfig.alipayPublicCertContent = config.alipayPublicCertContent
|
||||||
|
payConfig.rootCertContent = config.rootCertContent
|
||||||
|
} else {
|
||||||
|
payConfig.appId = config.appId
|
||||||
|
payConfig.apiVersion = config.apiVersion
|
||||||
|
payConfig.mchId = config.mchId
|
||||||
|
payConfig.mchKey = config.mchKey
|
||||||
|
payConfig.privateKeyContent = config.privateKeyContent
|
||||||
|
payConfig.privateCertContent = config.privateCertContent
|
||||||
|
payConfig.apiV3Key = config.apiV3Key
|
||||||
|
}
|
||||||
|
res.payConfig = payConfig
|
||||||
|
delete res['config']
|
||||||
setFieldsValue({ ...res })
|
setFieldsValue({ ...res })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -46,7 +67,7 @@ async function handleSubmit() {
|
||||||
try {
|
try {
|
||||||
const values = await validate()
|
const values = await validate()
|
||||||
setModalProps({ confirmLoading: true })
|
setModalProps({ confirmLoading: true })
|
||||||
values.config = Object.assign({}, values)
|
values.config = JSON.stringify(values.payConfig)
|
||||||
if (unref(isUpdate)) {
|
if (unref(isUpdate)) {
|
||||||
await updateChannel(values)
|
await updateChannel(values)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -221,7 +221,7 @@ export const aliPayFormSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '开放平台APPID',
|
label: '开放平台APPID',
|
||||||
field: 'appId',
|
field: 'payConfig.appId',
|
||||||
required: true,
|
required: true,
|
||||||
component: 'Input'
|
component: 'Input'
|
||||||
},
|
},
|
||||||
|
@ -236,7 +236,7 @@ export const aliPayFormSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '网关地址',
|
label: '网关地址',
|
||||||
field: 'serverUrl',
|
field: 'payConfig.serverUrl',
|
||||||
required: true,
|
required: true,
|
||||||
component: 'RadioGroup',
|
component: 'RadioGroup',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
@ -245,7 +245,7 @@ export const aliPayFormSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '算法类型',
|
label: '算法类型',
|
||||||
field: 'signType',
|
field: 'payConfig.signType',
|
||||||
required: true,
|
required: true,
|
||||||
component: 'RadioGroup',
|
component: 'RadioGroup',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
@ -254,8 +254,9 @@ export const aliPayFormSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '公钥类型',
|
label: '公钥类型',
|
||||||
field: 'mode',
|
field: 'payConfig.mode',
|
||||||
required: true,
|
required: true,
|
||||||
|
defaultValue: null,
|
||||||
component: 'RadioGroup',
|
component: 'RadioGroup',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: getDictOptions(DICT_TYPE.PAY_CHANNEL_ALIPAY_MODE)
|
options: getDictOptions(DICT_TYPE.PAY_CHANNEL_ALIPAY_MODE)
|
||||||
|
@ -263,37 +264,37 @@ export const aliPayFormSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '商户私钥',
|
label: '商户私钥',
|
||||||
field: 'privateKey',
|
field: 'payConfig.privateKey',
|
||||||
required: true,
|
required: true,
|
||||||
ifShow: ({ values }) => !!(values.mode === 1),
|
ifShow: ({ values }) => !!(values['payConfig.mode'] === 1),
|
||||||
component: 'Input'
|
component: 'Input'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '支付宝公钥字符串',
|
label: '支付宝公钥字符串',
|
||||||
field: 'alipayPublicKey',
|
field: 'payConfig.alipayPublicKey',
|
||||||
required: true,
|
required: true,
|
||||||
ifShow: ({ values }) => !!(values.mode === 1),
|
ifShow: ({ values }) => !!(values['payConfig.mode'] === 1),
|
||||||
component: 'InputTextArea'
|
component: 'InputTextArea'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '商户公钥应用证书',
|
label: '商户公钥应用证书',
|
||||||
field: 'appCertContent',
|
field: 'payConfig.appCertContent',
|
||||||
required: true,
|
required: true,
|
||||||
ifShow: ({ values }) => !!(values.mode === 2),
|
ifShow: ({ values }) => !!(values['payConfig.mode'] === 2),
|
||||||
component: 'InputTextArea'
|
component: 'InputTextArea'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '支付宝公钥证书',
|
label: '支付宝公钥证书',
|
||||||
field: 'alipayPublicCertContent',
|
field: 'payConfig.alipayPublicCertContent',
|
||||||
required: true,
|
required: true,
|
||||||
ifShow: ({ values }) => !!(values.mode === 2),
|
ifShow: ({ values }) => !!(values['payConfig.mode'] === 2),
|
||||||
component: 'InputTextArea'
|
component: 'InputTextArea'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '根证书',
|
label: '根证书',
|
||||||
field: 'rootCertContent',
|
field: 'payConfig.rootCertContent',
|
||||||
required: true,
|
required: true,
|
||||||
ifShow: ({ values }) => !!(values.mode === 2),
|
ifShow: ({ values }) => !!(values['payConfig.mode'] === 2),
|
||||||
component: 'InputTextArea'
|
component: 'InputTextArea'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -319,13 +320,13 @@ export const weChatFormSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '公众号APPID',
|
label: '公众号APPID',
|
||||||
field: 'appId',
|
field: 'payConfig.appId',
|
||||||
required: true,
|
required: true,
|
||||||
component: 'Input'
|
component: 'Input'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '商户号',
|
label: '商户号',
|
||||||
field: 'mchId',
|
field: 'payConfig.mchId',
|
||||||
required: true,
|
required: true,
|
||||||
component: 'Input'
|
component: 'Input'
|
||||||
},
|
},
|
||||||
|
@ -340,7 +341,7 @@ export const weChatFormSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'API 版本',
|
label: 'API 版本',
|
||||||
field: 'apiVersion',
|
field: 'payConfig.apiVersion',
|
||||||
required: true,
|
required: true,
|
||||||
component: 'RadioGroup',
|
component: 'RadioGroup',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
@ -349,27 +350,27 @@ export const weChatFormSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '商户密钥',
|
label: '商户密钥',
|
||||||
field: 'mchKey',
|
field: 'payConfig.mchKey',
|
||||||
required: true,
|
required: true,
|
||||||
ifShow: ({ values }) => !!(values.apiVersion === 'v2'),
|
ifShow: ({ values }) => !!(values['payConfig.apiVersion'] === 'v2'),
|
||||||
component: 'Input'
|
component: 'Input'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'API V3密钥',
|
label: 'API V3密钥',
|
||||||
field: 'apiV3Key',
|
field: 'payConfig.apiV3Key',
|
||||||
required: true,
|
required: true,
|
||||||
ifShow: ({ values }) => !!(values.apiVersion === 'v3'),
|
ifShow: ({ values }) => !!(values['payConfig.apiVersion'] === 'v3'),
|
||||||
component: 'Input'
|
component: 'Input'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'apiclient_key.perm证书',
|
label: 'apiclient_key.perm证书',
|
||||||
field: 'privateKeyContent',
|
field: 'payConfig.privateKeyContent',
|
||||||
required: true,
|
required: true,
|
||||||
component: 'InputTextArea'
|
component: 'InputTextArea'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'apiclient_cert.perm证书',
|
label: 'apiclient_cert.perm证书',
|
||||||
field: 'privateCertContent',
|
field: 'payConfig.privateCertContent',
|
||||||
required: true,
|
required: true,
|
||||||
component: 'InputTextArea'
|
component: 'InputTextArea'
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue