fix: pay app
							parent
							
								
									6eeb57eadb
								
							
						
					
					
						commit
						58bef6359f
					
				|  | @ -54,7 +54,6 @@ export function useGridColumns<T = PayAppApi.App>( | ||||||
|     { |     { | ||||||
|       field: 'status', |       field: 'status', | ||||||
|       title: '状态', |       title: '状态', | ||||||
|       minWidth: 100, |  | ||||||
|       align: 'center', |       align: 'center', | ||||||
|       cellRender: { |       cellRender: { | ||||||
|         attrs: { beforeChange: onStatusChange }, |         attrs: { beforeChange: onStatusChange }, | ||||||
|  |  | ||||||
|  | @ -100,7 +100,7 @@ function isChannelExists(channels: string[], channelCode: string) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async function openChannelForm(row: PayAppApi.App, payCode: string) { | async function openChannelForm(row: PayAppApi.App, payCode: string) { | ||||||
|   channelModalApi.setData({ id: row.id || 0, payCode }).open(); |   channelModalApi.setData({ id: row.id, payCode }).open(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const [Grid, gridApi] = useVbenVxeGrid({ | const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|  | @ -139,8 +139,8 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|       <DocAlert title="支付功能开启" url="https://doc.iocoder.cn/pay/build/" /> |       <DocAlert title="支付功能开启" url="https://doc.iocoder.cn/pay/build/" /> | ||||||
|     </template> |     </template> | ||||||
| 
 | 
 | ||||||
|     <AppModal @reload="onRefresh" /> |     <AppModal @success="onRefresh" /> | ||||||
|     <ChannelModal @reload="onRefresh" /> |     <ChannelModal @success="onRefresh" /> | ||||||
| 
 | 
 | ||||||
|     <Grid> |     <Grid> | ||||||
|       <template #toolbar-tools> |       <template #toolbar-tools> | ||||||
|  | @ -185,27 +185,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.ALIPAY_APP.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.ALIPAY_APP.code, |                 PayChannelEnum.ALIPAY_APP.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.ALIPAY_APP.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.ALIPAY_APP.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -220,27 +210,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.ALIPAY_PC.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.ALIPAY_PC.code, |                 PayChannelEnum.ALIPAY_PC.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.ALIPAY_PC.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.ALIPAY_PC.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -255,27 +235,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.ALIPAY_WAP.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.ALIPAY_WAP.code, |                 PayChannelEnum.ALIPAY_WAP.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.ALIPAY_WAP.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.ALIPAY_WAP.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -290,27 +260,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.ALIPAY_QR.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.ALIPAY_QR.code, |                 PayChannelEnum.ALIPAY_QR.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.ALIPAY_QR.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.ALIPAY_QR.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -325,27 +285,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.ALIPAY_BAR.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.ALIPAY_BAR.code, |                 PayChannelEnum.ALIPAY_BAR.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.ALIPAY_BAR.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.ALIPAY_BAR.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -360,27 +310,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.WX_LITE.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.WX_LITE.code, |                 PayChannelEnum.WX_LITE.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.WX_LITE.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.WX_LITE.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -395,27 +335,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.WX_PUB.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.WX_PUB.code, |                 PayChannelEnum.WX_PUB.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.WX_PUB.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.WX_PUB.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -430,27 +360,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.WX_APP.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.WX_APP.code, |                 PayChannelEnum.WX_APP.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.WX_APP.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.WX_APP.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -465,27 +385,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.WX_NATIVE.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.WX_NATIVE.code, |                 PayChannelEnum.WX_NATIVE.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.WX_NATIVE.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.WX_NATIVE.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -500,27 +410,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.WX_WAP.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.WX_WAP.code, |                 PayChannelEnum.WX_WAP.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.WX_WAP.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.WX_WAP.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -535,27 +435,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.WX_BAR.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.WX_BAR.code, |                 PayChannelEnum.WX_BAR.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.WX_BAR.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.WX_BAR.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -570,27 +460,17 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists( | ||||||
|               shape: 'circle', |                 row.channelCodes, | ||||||
|               ifShow: isChannelExists( |                 PayChannelEnum.WALLET.code, | ||||||
|  |               ) | ||||||
|  |                 ? 'lucide:check' | ||||||
|  |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.WALLET.code, |                 PayChannelEnum.WALLET.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.WALLET.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.WALLET.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  | @ -605,27 +485,14 @@ const [Grid, gridApi] = useVbenVxeGrid({ | ||||||
|           :actions="[ |           :actions="[ | ||||||
|             { |             { | ||||||
|               type: 'primary', |               type: 'primary', | ||||||
|               icon: 'lucide:check', |               icon: isChannelExists(row.channelCodes, PayChannelEnum.MOCK.code) | ||||||
|               shape: 'circle', |                 ? 'lucide:check' | ||||||
|               ifShow: isChannelExists( |                 : 'lucide:x', | ||||||
|  |               danger: !isChannelExists( | ||||||
|                 row.channelCodes, |                 row.channelCodes, | ||||||
|                 PayChannelEnum.MOCK.code, |                 PayChannelEnum.MOCK.code, | ||||||
|               ), |               ), | ||||||
|               onClick: openChannelForm.bind( |  | ||||||
|                 null, |  | ||||||
|                 row, |  | ||||||
|                 PayChannelEnum.MOCK.code, |  | ||||||
|               ), |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|               type: 'primary', |  | ||||||
|               danger: true, |  | ||||||
|               icon: 'lucide:x', |  | ||||||
|               shape: 'circle', |               shape: 'circle', | ||||||
|               ifShow: !isChannelExists( |  | ||||||
|                 row.channelCodes, |  | ||||||
|                 PayChannelEnum.MOCK.code, |  | ||||||
|               ), |  | ||||||
|               onClick: openChannelForm.bind( |               onClick: openChannelForm.bind( | ||||||
|                 null, |                 null, | ||||||
|                 row, |                 row, | ||||||
|  |  | ||||||
|  | @ -10,16 +10,17 @@ import { message } from 'ant-design-vue'; | ||||||
| 
 | 
 | ||||||
| import { useVbenForm } from '#/adapter/form'; | import { useVbenForm } from '#/adapter/form'; | ||||||
| import { createChannel, getChannel, updateChannel } from '#/api/pay/channel'; | import { createChannel, getChannel, updateChannel } from '#/api/pay/channel'; | ||||||
|  | import { CommonStatusEnum } from '#/utils'; | ||||||
| 
 | 
 | ||||||
| import { channelSchema } from './data'; | import { channelSchema } from './data'; | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success']); | const emit = defineEmits(['success']); | ||||||
| const formData = ref<PayChannelApi.Channel>(); | const formData = ref<any>(); | ||||||
| const formType = ref<string>(''); | const formType = ref<string>(''); | ||||||
| const title = computed(() => { | const title = computed(() => { | ||||||
|   return formData.value?.id |   return formData.value?.id === 0 | ||||||
|     ? $t('ui.actionTitle.edit', '应用') |     ? $t('ui.actionTitle.create', '应用') | ||||||
|     : $t('ui.actionTitle.create', '应用'); |     : $t('ui.actionTitle.edit', '应用'); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| const [Form, formApi] = useVbenForm({ | const [Form, formApi] = useVbenForm({ | ||||||
|  | @ -43,8 +44,17 @@ const [Modal, modalApi] = useVbenModal({ | ||||||
|     modalApi.lock(); |     modalApi.lock(); | ||||||
|     // 提交表单 |     // 提交表单 | ||||||
|     const data = (await formApi.getValues()) as PayChannelApi.Channel; |     const data = (await formApi.getValues()) as PayChannelApi.Channel; | ||||||
|  |     // 只保留表单中实际存在的字段,且值不为 undefined | ||||||
|  |     const data2 = Object.fromEntries( | ||||||
|  |       Object.entries(data).filter(([key, value]) => { | ||||||
|  |         // 检查字段是否在表单中存在,且值不为 undefined | ||||||
|  |         return key in data && value !== undefined; | ||||||
|  |       }), | ||||||
|  |     ); | ||||||
|  |     const data3 = { ...formData.value, ...data2 }; | ||||||
|  |     data3.config = JSON.stringify(data3.config); | ||||||
|     try { |     try { | ||||||
|       await (formData.value?.id ? updateChannel(data) : createChannel(data)); |       await (data3.id ? updateChannel(data3) : createChannel(data3)); | ||||||
|       // 关闭并提示 |       // 关闭并提示 | ||||||
|       await modalApi.close(); |       await modalApi.close(); | ||||||
|       emit('success'); |       emit('success'); | ||||||
|  | @ -67,18 +77,80 @@ const [Modal, modalApi] = useVbenModal({ | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|     modalApi.lock(); |     modalApi.lock(); | ||||||
|  |     formType.value = payCode; | ||||||
|     if (payCode.includes('alipay_')) { |     if (payCode.includes('alipay_')) { | ||||||
|       formType.value = 'alipay'; |       formData.value = { | ||||||
|  |         appId: id, | ||||||
|  |         code: payCode, | ||||||
|  |         status: CommonStatusEnum.ENABLE, | ||||||
|  |         remark: '', | ||||||
|  |         feeRate: null, | ||||||
|  |         config: { | ||||||
|  |           appId: '', | ||||||
|  |           serverUrl: null, | ||||||
|  |           signType: 'RSA2', | ||||||
|  |           mode: null, | ||||||
|  |           privateKey: '', | ||||||
|  |           alipayPublicKey: '', | ||||||
|  |           appCertContent: '', | ||||||
|  |           alipayPublicCertContent: '', | ||||||
|  |           rootCertContent: '', | ||||||
|  |           encryptType: '', | ||||||
|  |           encryptKey: '', | ||||||
|  |         }, | ||||||
|  |       }; | ||||||
|     } else if (payCode.includes('mock')) { |     } else if (payCode.includes('mock')) { | ||||||
|       formType.value = 'mock'; |       formData.value = { | ||||||
|  |         appId: id, | ||||||
|  |         code: payCode, | ||||||
|  |         status: CommonStatusEnum.ENABLE, | ||||||
|  |         remark: '', | ||||||
|  |         feeRate: 0, | ||||||
|  |         config: { | ||||||
|  |           name: 'mock-conf', | ||||||
|  |         }, | ||||||
|  |       }; | ||||||
|     } else if (payCode.includes('wallet')) { |     } else if (payCode.includes('wallet')) { | ||||||
|       formType.value = 'wallet'; |       formData.value = { | ||||||
|  |         appId: id, | ||||||
|  |         code: payCode, | ||||||
|  |         status: CommonStatusEnum.ENABLE, | ||||||
|  |         remark: '', | ||||||
|  |         feeRate: 0, | ||||||
|  |         config: { | ||||||
|  |           name: 'mock-conf', | ||||||
|  |         }, | ||||||
|  |       }; | ||||||
|     } else if (payCode.includes('wx')) { |     } else if (payCode.includes('wx')) { | ||||||
|       formType.value = 'wx'; |       formData.value = { | ||||||
|  |         appId: id, | ||||||
|  |         code: payCode, | ||||||
|  |         status: CommonStatusEnum.ENABLE, | ||||||
|  |         feeRate: undefined, | ||||||
|  |         remark: '', | ||||||
|  |         config: { | ||||||
|  |           appId: '', | ||||||
|  |           mchId: '', | ||||||
|  |           apiVersion: '', | ||||||
|  |           mchKey: '', | ||||||
|  |           keyContent: '', | ||||||
|  |           privateKeyContent: '', | ||||||
|  |           certSerialNo: '', | ||||||
|  |           apiV3Key: '', | ||||||
|  |           publicKeyContent: '', | ||||||
|  |           publicKeyId: '', | ||||||
|  |         }, | ||||||
|  |       }; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     try { |     try { | ||||||
|       formData.value = await getChannel(id, payCode); |       const res = await getChannel(id, payCode); | ||||||
|  |       formData.value = { | ||||||
|  |         ...res, | ||||||
|  |         config: { | ||||||
|  |           ...JSON.parse(res.config), | ||||||
|  |         }, | ||||||
|  |       }; | ||||||
|       // 设置到 values |       // 设置到 values | ||||||
|       await formApi.setValues(formData.value); |       await formApi.setValues(formData.value); | ||||||
|     } finally { |     } finally { | ||||||
|  |  | ||||||
|  | @ -6,541 +6,486 @@ import { InputUpload } from '#/components/upload'; | ||||||
| import { DICT_TYPE, getDictOptions } from '#/utils/dict'; | import { DICT_TYPE, getDictOptions } from '#/utils/dict'; | ||||||
| 
 | 
 | ||||||
| export function channelSchema(formType: string): VbenFormSchema[] { | export function channelSchema(formType: string): VbenFormSchema[] { | ||||||
|   switch (formType) { |   if (formType.includes('alipay_')) { | ||||||
|     case 'alipay': { |     return [ | ||||||
|       return [ |       { | ||||||
|         { |         label: '应用编号', | ||||||
|           label: '商户编号', |         fieldName: 'appId', | ||||||
|           fieldName: 'id', |         component: 'Input', | ||||||
|           component: 'Input', |         dependencies: { | ||||||
|           dependencies: { |           show: () => false, | ||||||
|             show: () => false, |           triggerFields: [''], | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |         }, | ||||||
|         { |       }, | ||||||
|           label: '应用编号', |       { | ||||||
|           fieldName: 'appId', |         label: '渠道费率', | ||||||
|           component: 'Input', |         fieldName: 'feeRate', | ||||||
|           dependencies: { |         component: 'InputNumber', | ||||||
|             show: () => false, |         rules: 'required', | ||||||
|             triggerFields: [''], |         componentProps: { | ||||||
|           }, |           placeholder: '请输入渠道费率', | ||||||
|  |           addonAfter: '%', | ||||||
|         }, |         }, | ||||||
|         { |         defaultValue: 0, | ||||||
|           label: '渠道编码', |       }, | ||||||
|           fieldName: 'code', |       { | ||||||
|           component: 'Input', |         label: '开放平台 APPID', | ||||||
|           dependencies: { |         fieldName: 'config.appId', | ||||||
|             show: () => false, |         component: 'Input', | ||||||
|             triggerFields: [''], |         rules: 'required', | ||||||
|           }, |         componentProps: { | ||||||
|  |           placeholder: '请输入开放平台 APPID', | ||||||
|         }, |         }, | ||||||
|         { |       }, | ||||||
|           label: '渠道费率', |       { | ||||||
|           fieldName: 'feeRate', |         label: '渠道状态', | ||||||
|           component: 'Input', |         fieldName: 'status', | ||||||
|           rules: 'required', |         component: 'RadioGroup', | ||||||
|           componentProps: { |         rules: 'required', | ||||||
|             placeholder: '请输入渠道费率', |         componentProps: { | ||||||
|           }, |           options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), | ||||||
|         }, |         }, | ||||||
|         { |         defaultValue: 0, | ||||||
|           label: '开放平台 APPID', |       }, | ||||||
|           fieldName: 'config.appId', |       { | ||||||
|           component: 'Input', |         label: '网关地址', | ||||||
|           rules: 'required', |         fieldName: 'config.serverUrl', | ||||||
|           componentProps: { |         component: 'RadioGroup', | ||||||
|             placeholder: '请输入开放平台 APPID', |         rules: 'required', | ||||||
|           }, |         componentProps: { | ||||||
|  |           options: [ | ||||||
|  |             { | ||||||
|  |               value: 'https://openapi.alipay.com/gateway.do', | ||||||
|  |               label: '线上环境', | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |               value: 'https://openapi-sandbox.dl.alipaydev.com/gateway.do', | ||||||
|  |               label: '沙箱环境', | ||||||
|  |             }, | ||||||
|  |           ], | ||||||
|         }, |         }, | ||||||
|         { |       }, | ||||||
|           label: '渠道状态', |       { | ||||||
|           fieldName: 'status', |         label: '算法类型', | ||||||
|           component: 'RadioGroup', |         fieldName: 'config.signType', | ||||||
|           rules: 'required', |         component: 'RadioGroup', | ||||||
|           componentProps: { |         rules: 'required', | ||||||
|             options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), |         componentProps: { | ||||||
|           }, |           options: [ | ||||||
|           defaultValue: 1, |             { | ||||||
|  |               value: 'RSA2', | ||||||
|  |               label: 'RSA2', | ||||||
|  |             }, | ||||||
|  |           ], | ||||||
|         }, |         }, | ||||||
|         { |         defaultValue: 'RSA2', | ||||||
|           label: '网关地址', |       }, | ||||||
|           fieldName: 'config.serverUrl', |       { | ||||||
|           component: 'RadioGroup', |         label: '公钥类型', | ||||||
|           rules: 'required', |         fieldName: 'config.mode', | ||||||
|           componentProps: { |         component: 'RadioGroup', | ||||||
|             options: [ |         rules: 'required', | ||||||
|               { |         componentProps: { | ||||||
|                 value: 'https://openapi.alipay.com/gateway.do', |           options: [ | ||||||
|                 label: '线上环境', |             { | ||||||
|               }, |               value: 1, | ||||||
|               { |               label: '公钥模式', | ||||||
|                 value: 'https://openapi-sandbox.dl.alipaydev.com/gateway.do', |             }, | ||||||
|                 label: '沙箱环境', |             { | ||||||
|               }, |               value: 2, | ||||||
|             ], |               label: '证书模式', | ||||||
|           }, |             }, | ||||||
|  |           ], | ||||||
|         }, |         }, | ||||||
|         { |       }, | ||||||
|           label: '算法类型', |       { | ||||||
|           fieldName: 'config.signType', |         label: '应用私钥', | ||||||
|           component: 'RadioGroup', |         fieldName: 'config.privateKey', | ||||||
|           rules: 'required', |         component: 'Textarea', | ||||||
|           componentProps: { |         rules: 'required', | ||||||
|             options: [ |         componentProps: { | ||||||
|               { |           placeholder: '请输入应用私钥', | ||||||
|                 value: 'RSA2', |           rows: 8, | ||||||
|                 label: 'RSA2', |  | ||||||
|               }, |  | ||||||
|             ], |  | ||||||
|           }, |  | ||||||
|           defaultValue: 'RSA2', |  | ||||||
|         }, |         }, | ||||||
|         { |       }, | ||||||
|           label: '公钥类型', |       { | ||||||
|           fieldName: 'config.mode', |         label: '支付宝公钥', | ||||||
|           component: 'RadioGroup', |         fieldName: 'config.alipayPublicKey', | ||||||
|           rules: 'required', |         component: 'Textarea', | ||||||
|           componentProps: { |         rules: 'required', | ||||||
|             options: [ |         componentProps: { | ||||||
|               { |           placeholder: '请输入支付宝公钥', | ||||||
|                 value: 0, |           rows: 8, | ||||||
|                 label: '公钥模式', |  | ||||||
|               }, |  | ||||||
|               { |  | ||||||
|                 value: 1, |  | ||||||
|                 label: '证书模式', |  | ||||||
|               }, |  | ||||||
|             ], |  | ||||||
|           }, |  | ||||||
|         }, |         }, | ||||||
|         { |         dependencies: { | ||||||
|           label: '应用私钥', |           show(values) { | ||||||
|           fieldName: 'config.privateKey', |             return values?.config?.mode === 1; | ||||||
|           component: 'Textarea', |           }, | ||||||
|           rules: 'required', |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|           componentProps: { |         }, | ||||||
|             placeholder: '请输入应用私钥', |       }, | ||||||
|  |       { | ||||||
|  |         label: '商户公钥应用证书', | ||||||
|  |         fieldName: 'config.appCertContent', | ||||||
|  |         component: h(InputUpload, { | ||||||
|  |           inputType: 'textarea', | ||||||
|  |           textareaProps: { rows: 8, placeholder: '请上传商户公钥应用证书' }, | ||||||
|  |           fileUploadProps: { | ||||||
|  |             accept: ['crt'], | ||||||
|  |           }, | ||||||
|  |         }), | ||||||
|  |         rules: 'required', | ||||||
|  |         dependencies: { | ||||||
|  |           show(values) { | ||||||
|  |             return values?.config?.mode === 2; | ||||||
|  |           }, | ||||||
|  |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '支付宝公钥证书', | ||||||
|  |         fieldName: 'config.alipayPublicCertContent', | ||||||
|  |         component: h(InputUpload, { | ||||||
|  |           inputType: 'textarea', | ||||||
|  |           textareaProps: { rows: 8, placeholder: '请上传支付宝公钥证书' }, | ||||||
|  |           fileUploadProps: { | ||||||
|  |             accept: ['crt'], | ||||||
|  |           }, | ||||||
|  |         }), | ||||||
|  |         rules: 'required', | ||||||
|  |         dependencies: { | ||||||
|  |           show(values) { | ||||||
|  |             return values?.config?.mode === 2; | ||||||
|  |           }, | ||||||
|  |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '根证书', | ||||||
|  |         fieldName: 'config.rootCertContent', | ||||||
|  |         component: h(InputUpload, { | ||||||
|  |           inputType: 'textarea', | ||||||
|  |           textareaProps: { rows: 8, placeholder: '请上传根证书' }, | ||||||
|  |           fileUploadProps: { | ||||||
|  |             accept: ['crt'], | ||||||
|  |           }, | ||||||
|  |         }), | ||||||
|  |         rules: 'required', | ||||||
|  |         dependencies: { | ||||||
|  |           show(values) { | ||||||
|  |             return values?.config?.mode === 2; | ||||||
|  |           }, | ||||||
|  |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '接口内容加密方式', | ||||||
|  |         fieldName: 'config.encryptType', | ||||||
|  |         component: 'RadioGroup', | ||||||
|  |         rules: 'required', | ||||||
|  |         componentProps: { | ||||||
|  |           options: [ | ||||||
|  |             { | ||||||
|  |               value: 'NONE', | ||||||
|  |               label: '无加密', | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |               value: 'AES', | ||||||
|  |               label: 'AES', | ||||||
|  |             }, | ||||||
|  |           ], | ||||||
|  |         }, | ||||||
|  |         defaultValue: 'NONE', | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '接口内容加密密钥', | ||||||
|  |         fieldName: 'config.encryptKey', | ||||||
|  |         component: 'Input', | ||||||
|  |         rules: 'required', | ||||||
|  |         dependencies: { | ||||||
|  |           show(values) { | ||||||
|  |             return values?.config?.encryptType === 'AES'; | ||||||
|  |           }, | ||||||
|  |           triggerFields: ['config.encryptType', 'encryptType', 'config'], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '备注', | ||||||
|  |         fieldName: 'remark', | ||||||
|  |         component: 'Input', | ||||||
|  |         componentProps: { | ||||||
|  |           placeholder: '请输入备注', | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |     ]; | ||||||
|  |   } else if (formType.includes('mock') || formType.includes('wallet')) { | ||||||
|  |     return [ | ||||||
|  |       { | ||||||
|  |         label: '应用编号', | ||||||
|  |         fieldName: 'appId', | ||||||
|  |         component: 'Input', | ||||||
|  |         dependencies: { | ||||||
|  |           show: () => false, | ||||||
|  |           triggerFields: [''], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '渠道状态', | ||||||
|  |         fieldName: 'status', | ||||||
|  |         component: 'RadioGroup', | ||||||
|  |         rules: 'required', | ||||||
|  |         componentProps: { | ||||||
|  |           options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), | ||||||
|  |         }, | ||||||
|  |         defaultValue: 0, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '渠道编码', | ||||||
|  |         fieldName: 'code', | ||||||
|  |         component: 'Input', | ||||||
|  |         dependencies: { | ||||||
|  |           show: () => false, | ||||||
|  |           triggerFields: [''], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '渠道费率', | ||||||
|  |         fieldName: 'feeRate', | ||||||
|  |         component: 'InputNumber', | ||||||
|  |         rules: 'required', | ||||||
|  |         componentProps: { | ||||||
|  |           placeholder: '请输入渠道费率', | ||||||
|  |           addonAfter: '%', | ||||||
|  |         }, | ||||||
|  |         defaultValue: 0, | ||||||
|  |         dependencies: { | ||||||
|  |           show: () => false, | ||||||
|  |           triggerFields: [''], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '备注', | ||||||
|  |         fieldName: 'remark', | ||||||
|  |         component: 'Input', | ||||||
|  |         componentProps: { | ||||||
|  |           placeholder: '请输入备注', | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |     ]; | ||||||
|  |   } else if (formType.includes('wx')) { | ||||||
|  |     return [ | ||||||
|  |       { | ||||||
|  |         label: '应用编号', | ||||||
|  |         fieldName: 'appId', | ||||||
|  |         component: 'Input', | ||||||
|  |         dependencies: { | ||||||
|  |           show: () => false, | ||||||
|  |           triggerFields: [''], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '渠道编码', | ||||||
|  |         fieldName: 'code', | ||||||
|  |         component: 'Input', | ||||||
|  |         dependencies: { | ||||||
|  |           show: () => false, | ||||||
|  |           triggerFields: [''], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '渠道费率', | ||||||
|  |         fieldName: 'feeRate', | ||||||
|  |         component: 'InputNumber', | ||||||
|  |         rules: 'required', | ||||||
|  |         componentProps: { | ||||||
|  |           placeholder: '请输入渠道费率', | ||||||
|  |           addonAfter: '%', | ||||||
|  |         }, | ||||||
|  |         defaultValue: 0, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '微信 APPID', | ||||||
|  |         fieldName: 'config.appId', | ||||||
|  |         help: '前往微信商户平台[https://pay.weixin.qq.com/index.php/extend/merchant_appid/mapay_platform/account_manage]查看 APPID', | ||||||
|  |         component: 'Input', | ||||||
|  |         rules: 'required', | ||||||
|  |         componentProps: { | ||||||
|  |           placeholder: '请输入微信 APPID', | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '商户号', | ||||||
|  |         fieldName: 'config.mchId', | ||||||
|  |         help: '前往微信商户平台[https://pay.weixin.qq.com/index.php/extend/pay_setting]查看商户号', | ||||||
|  |         component: 'Input', | ||||||
|  |         rules: 'required', | ||||||
|  |         componentProps: { | ||||||
|  |           placeholder: '请输入商户号', | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '渠道状态', | ||||||
|  |         fieldName: 'status', | ||||||
|  |         component: 'RadioGroup', | ||||||
|  |         rules: 'required', | ||||||
|  |         componentProps: { | ||||||
|  |           options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), | ||||||
|  |         }, | ||||||
|  |         defaultValue: 0, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: 'API 版本', | ||||||
|  |         fieldName: 'config.apiVersion', | ||||||
|  |         component: 'RadioGroup', | ||||||
|  |         rules: 'required', | ||||||
|  |         componentProps: { | ||||||
|  |           options: [ | ||||||
|  |             { | ||||||
|  |               label: 'v2', | ||||||
|  |               value: 'v2', | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |               label: 'v3', | ||||||
|  |               value: 'v3', | ||||||
|  |             }, | ||||||
|  |           ], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: '商户密钥', | ||||||
|  |         fieldName: 'config.mchKey', | ||||||
|  |         component: 'Input', | ||||||
|  |         rules: 'required', | ||||||
|  |         componentProps: { | ||||||
|  |           placeholder: '请输入商户密钥', | ||||||
|  |         }, | ||||||
|  |         dependencies: { | ||||||
|  |           show(values) { | ||||||
|  |             return values?.config?.apiVersion === 'v2'; | ||||||
|  |           }, | ||||||
|  |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: 'apiclient_cert.p12 证书', | ||||||
|  |         fieldName: 'config.keyContent', | ||||||
|  |         component: h(InputUpload, { | ||||||
|  |           inputType: 'textarea', | ||||||
|  |           textareaProps: { | ||||||
|             rows: 8, |             rows: 8, | ||||||
|  |             placeholder: '请上传 apiclient_cert.p12 证书', | ||||||
|           }, |           }, | ||||||
|           dependencies: { |           fileUploadProps: { | ||||||
|             show(values) { |             accept: ['p12'], | ||||||
|               return values.config.mode !== undefined; |  | ||||||
|             }, |  | ||||||
|             triggerFields: ['config'], |  | ||||||
|           }, |           }, | ||||||
|  |         }), | ||||||
|  |         rules: 'required', | ||||||
|  |         dependencies: { | ||||||
|  |           show(values) { | ||||||
|  |             return values?.config?.apiVersion === 'v2'; | ||||||
|  |           }, | ||||||
|  |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|         }, |         }, | ||||||
|         { |       }, | ||||||
|           label: '支付宝公钥', |       { | ||||||
|           fieldName: 'config.alipayPublicKey', |         label: 'API V3 密钥', | ||||||
|           component: 'Textarea', |         fieldName: 'config.apiV3Key', | ||||||
|           rules: 'required', |         component: 'Input', | ||||||
|           componentProps: { |         rules: 'required', | ||||||
|             placeholder: '请输入支付宝公钥', |         componentProps: { | ||||||
|  |           placeholder: '请输入 API V3 密钥', | ||||||
|  |         }, | ||||||
|  |         dependencies: { | ||||||
|  |           show(values) { | ||||||
|  |             return values?.config?.apiVersion === 'v3'; | ||||||
|  |           }, | ||||||
|  |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|  |         }, | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         label: 'apiclient_key.pem 证书', | ||||||
|  |         fieldName: 'config.privateKeyContent', | ||||||
|  |         component: h(InputUpload, { | ||||||
|  |           inputType: 'textarea', | ||||||
|  |           textareaProps: { | ||||||
|             rows: 8, |             rows: 8, | ||||||
|  |             placeholder: '请上传 apiclient_key.pem 证书', | ||||||
|           }, |           }, | ||||||
|           dependencies: { |           fileUploadProps: { | ||||||
|             show(values) { |             accept: ['pem'], | ||||||
|               return values?.config?.mode === 0; |  | ||||||
|             }, |  | ||||||
|             triggerFields: ['config.mode', 'mode', 'config'], |  | ||||||
|           }, |           }, | ||||||
|  |         }), | ||||||
|  |         rules: 'required', | ||||||
|  |         dependencies: { | ||||||
|  |           show(values) { | ||||||
|  |             return values?.config?.apiVersion === 'v3'; | ||||||
|  |           }, | ||||||
|  |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|         }, |         }, | ||||||
|         { |       }, | ||||||
|           label: '商户公钥应用证书', |       { | ||||||
|           fieldName: 'config.appCertContent', |         label: '证书序列号', | ||||||
|           component: h(InputUpload, { |         fieldName: 'config.certSerialNo', | ||||||
|             inputType: 'textarea', |         component: 'Input', | ||||||
|             textareaProps: { rows: 8, placeholder: '请上传商户公钥应用证书' }, |         help: '前往微信商户平台[https://pay.weixin.qq.com/index.php/core/cert/api_cert#/api-cert-manage]查看证书序列号', | ||||||
|             fileUploadProps: { |         rules: 'required', | ||||||
|               accept: ['crt'], |         componentProps: { | ||||||
|             }, |           placeholder: '请输入证书序列号', | ||||||
|           }), |  | ||||||
|           rules: 'required', |  | ||||||
|           dependencies: { |  | ||||||
|             show(values) { |  | ||||||
|               return values?.config?.mode === 1; |  | ||||||
|             }, |  | ||||||
|             triggerFields: ['config.mode', 'mode', 'config'], |  | ||||||
|           }, |  | ||||||
|         }, |         }, | ||||||
|         { |         dependencies: { | ||||||
|           label: '支付宝公钥证书', |           show(values) { | ||||||
|           fieldName: 'config.alipayPublicCertContent', |             return values?.config?.apiVersion === 'v3'; | ||||||
|           component: h(InputUpload, { |  | ||||||
|             inputType: 'textarea', |  | ||||||
|             textareaProps: { rows: 8, placeholder: '请上传支付宝公钥证书' }, |  | ||||||
|             fileUploadProps: { |  | ||||||
|               accept: ['crt'], |  | ||||||
|             }, |  | ||||||
|           }), |  | ||||||
|           rules: 'required', |  | ||||||
|           dependencies: { |  | ||||||
|             show(values) { |  | ||||||
|               return values?.config?.mode === 1; |  | ||||||
|             }, |  | ||||||
|             triggerFields: ['config.mode', 'mode', 'config'], |  | ||||||
|           }, |           }, | ||||||
|  |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|         }, |         }, | ||||||
|         { |       }, | ||||||
|           label: '根证书', |       { | ||||||
|           fieldName: 'config.rootCertContent', |         label: 'public_key.pem 证书', | ||||||
|           component: h(InputUpload, { |         fieldName: 'config.publicKeyContent', | ||||||
|             inputType: 'textarea', |         component: h(InputUpload, { | ||||||
|             textareaProps: { rows: 8, placeholder: '请上传根证书' }, |           inputType: 'textarea', | ||||||
|             fileUploadProps: { |           textareaProps: { | ||||||
|               accept: ['crt'], |             rows: 8, | ||||||
|             }, |             placeholder: '请上传 public_key.pem 证书', | ||||||
|           }), |  | ||||||
|           rules: 'required', |  | ||||||
|           dependencies: { |  | ||||||
|             show(values) { |  | ||||||
|               return values?.config?.mode === 1; |  | ||||||
|             }, |  | ||||||
|             triggerFields: ['config.mode', 'mode', 'config'], |  | ||||||
|           }, |           }, | ||||||
|  |           fileUploadProps: { | ||||||
|  |             accept: ['pem'], | ||||||
|  |           }, | ||||||
|  |         }), | ||||||
|  |         rules: 'required', | ||||||
|  |         dependencies: { | ||||||
|  |           show(values) { | ||||||
|  |             return values?.config?.apiVersion === 'v3'; | ||||||
|  |           }, | ||||||
|  |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|         }, |         }, | ||||||
|         { |       }, | ||||||
|           label: '接口内容加密方式', |       { | ||||||
|           fieldName: 'config.encryptType', |         label: '公钥 ID', | ||||||
|           component: 'RadioGroup', |         fieldName: 'config.publicKeyId', | ||||||
|           rules: 'required', |         component: 'Input', | ||||||
|           componentProps: { |         help: '微信支付公钥产品简介及使用说明[https://pay.weixin.qq.com/doc/v3/merchant/4012153196]', | ||||||
|             options: [ |         rules: 'required', | ||||||
|               { |         componentProps: { | ||||||
|                 value: 'NONE', |           placeholder: '请输入公钥 ID', | ||||||
|                 label: '无加密', |  | ||||||
|               }, |  | ||||||
|               { |  | ||||||
|                 value: 'AES', |  | ||||||
|                 label: 'AES', |  | ||||||
|               }, |  | ||||||
|             ], |  | ||||||
|           }, |  | ||||||
|           defaultValue: 'NONE', |  | ||||||
|         }, |         }, | ||||||
|         { |         dependencies: { | ||||||
|           label: '备注', |           show(values) { | ||||||
|           fieldName: 'remark', |             return values?.config?.apiVersion === 'v3'; | ||||||
|           component: 'Textarea', |  | ||||||
|           componentProps: { |  | ||||||
|             rows: 3, |  | ||||||
|             placeholder: '请输入备注', |  | ||||||
|           }, |           }, | ||||||
|  |           triggerFields: ['config.mode', 'mode', 'config'], | ||||||
|         }, |         }, | ||||||
|       ]; |       }, | ||||||
|     } |       { | ||||||
|     case 'mock': { |         label: '备注', | ||||||
|       return [ |         fieldName: 'remark', | ||||||
|         { |         component: 'Input', | ||||||
|           label: '商户编号', |         componentProps: { | ||||||
|           fieldName: 'id', |           placeholder: '请输入备注', | ||||||
|           component: 'Input', |  | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |         }, | ||||||
|         { |       }, | ||||||
|           label: '应用编号', |     ]; | ||||||
|           fieldName: 'appId', |   } else { | ||||||
|           component: 'Input', |     return []; | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '渠道状态', |  | ||||||
|           fieldName: 'status', |  | ||||||
|           component: 'RadioGroup', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), |  | ||||||
|           }, |  | ||||||
|           defaultValue: 1, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '渠道编码', |  | ||||||
|           fieldName: 'code', |  | ||||||
|           component: 'Input', |  | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '渠道费率', |  | ||||||
|           fieldName: 'feeRate', |  | ||||||
|           component: 'Input', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             placeholder: '请输入渠道费率', |  | ||||||
|           }, |  | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '备注', |  | ||||||
|           fieldName: 'remark', |  | ||||||
|           component: 'Textarea', |  | ||||||
|           componentProps: { |  | ||||||
|             rows: 3, |  | ||||||
|             placeholder: '请输入备注', |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|       ]; |  | ||||||
|     } |  | ||||||
|     case 'wallet': { |  | ||||||
|       return [ |  | ||||||
|         { |  | ||||||
|           label: '商户编号', |  | ||||||
|           fieldName: 'id', |  | ||||||
|           component: 'Input', |  | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '应用编号', |  | ||||||
|           fieldName: 'appId', |  | ||||||
|           component: 'Input', |  | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '渠道状态', |  | ||||||
|           fieldName: 'status', |  | ||||||
|           component: 'RadioGroup', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), |  | ||||||
|           }, |  | ||||||
|           defaultValue: 1, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '渠道编码', |  | ||||||
|           fieldName: 'code', |  | ||||||
|           component: 'Input', |  | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '渠道费率', |  | ||||||
|           fieldName: 'feeRate', |  | ||||||
|           component: 'Input', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             placeholder: '请输入渠道费率', |  | ||||||
|           }, |  | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '备注', |  | ||||||
|           fieldName: 'remark', |  | ||||||
|           component: 'Textarea', |  | ||||||
|           componentProps: { |  | ||||||
|             rows: 3, |  | ||||||
|             placeholder: '请输入备注', |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|       ]; |  | ||||||
|     } |  | ||||||
|     case 'wx': { |  | ||||||
|       return [ |  | ||||||
|         { |  | ||||||
|           label: '商户编号', |  | ||||||
|           fieldName: 'id', |  | ||||||
|           component: 'Input', |  | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '应用编号', |  | ||||||
|           fieldName: 'appId', |  | ||||||
|           component: 'Input', |  | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '渠道编码', |  | ||||||
|           fieldName: 'code', |  | ||||||
|           component: 'Input', |  | ||||||
|           dependencies: { |  | ||||||
|             show: () => false, |  | ||||||
|             triggerFields: [''], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '渠道费率', |  | ||||||
|           fieldName: 'feeRate', |  | ||||||
|           component: 'Input', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             placeholder: '请输入渠道费率', |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '微信 APPID', |  | ||||||
|           fieldName: 'config.appId', |  | ||||||
|           component: 'Input', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             placeholder: '请输入微信 APPID', |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '商户号', |  | ||||||
|           fieldName: 'config.mchId', |  | ||||||
|           component: 'Input', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             placeholder: '请输入商户号', |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '渠道状态', |  | ||||||
|           fieldName: 'status', |  | ||||||
|           component: 'RadioGroup', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), |  | ||||||
|           }, |  | ||||||
|           defaultValue: 1, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: 'API 版本', |  | ||||||
|           fieldName: 'config.apiVersion', |  | ||||||
|           component: 'RadioGroup', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             options: [ |  | ||||||
|               { |  | ||||||
|                 label: 'v2', |  | ||||||
|                 value: 'v2', |  | ||||||
|               }, |  | ||||||
|               { |  | ||||||
|                 label: 'v3', |  | ||||||
|                 value: 'v3', |  | ||||||
|               }, |  | ||||||
|             ], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '商户密钥', |  | ||||||
|           fieldName: 'config.mchKey', |  | ||||||
|           component: 'Input', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             placeholder: '请输入商户密钥', |  | ||||||
|           }, |  | ||||||
|           dependencies: { |  | ||||||
|             show(values) { |  | ||||||
|               return values?.config?.apiVersion === 'v2'; |  | ||||||
|             }, |  | ||||||
|             triggerFields: ['config.mode', 'mode', 'config'], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: 'apiclient_cert.p12 证书', |  | ||||||
|           fieldName: 'config.keyContent', |  | ||||||
|           component: h(InputUpload, { |  | ||||||
|             inputType: 'textarea', |  | ||||||
|             textareaProps: { |  | ||||||
|               rows: 8, |  | ||||||
|               placeholder: '请上传 apiclient_cert.p12 证书', |  | ||||||
|             }, |  | ||||||
|             fileUploadProps: { |  | ||||||
|               accept: ['p12 '], |  | ||||||
|             }, |  | ||||||
|           }), |  | ||||||
|           rules: 'required', |  | ||||||
|           dependencies: { |  | ||||||
|             show(values) { |  | ||||||
|               return values?.config?.apiVersion === 'v2'; |  | ||||||
|             }, |  | ||||||
|             triggerFields: ['config.mode', 'mode', 'config'], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: 'API V3 密钥', |  | ||||||
|           fieldName: 'config.apiV3Key', |  | ||||||
|           component: 'Input', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             placeholder: '请输入 API V3 密钥', |  | ||||||
|           }, |  | ||||||
|           dependencies: { |  | ||||||
|             show(values) { |  | ||||||
|               return values?.config?.apiVersion === 'v3'; |  | ||||||
|             }, |  | ||||||
|             triggerFields: ['config.mode', 'mode', 'config'], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: 'apiclient_key.pem 证书', |  | ||||||
|           fieldName: 'config.privateKeyContent', |  | ||||||
|           component: h(InputUpload, { |  | ||||||
|             inputType: 'textarea', |  | ||||||
|             textareaProps: { |  | ||||||
|               rows: 8, |  | ||||||
|               placeholder: '请上传 apiclient_key.pem 证书', |  | ||||||
|             }, |  | ||||||
|             fileUploadProps: { |  | ||||||
|               accept: ['pem'], |  | ||||||
|             }, |  | ||||||
|           }), |  | ||||||
|           rules: 'required', |  | ||||||
|           dependencies: { |  | ||||||
|             show(values) { |  | ||||||
|               return values?.config?.apiVersion === 'v3'; |  | ||||||
|             }, |  | ||||||
|             triggerFields: ['config.mode', 'mode', 'config'], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '证书序列号', |  | ||||||
|           fieldName: 'config.certSerialNo', |  | ||||||
|           component: 'Input', |  | ||||||
|           rules: 'required', |  | ||||||
|           componentProps: { |  | ||||||
|             placeholder: '请输入证书序列号', |  | ||||||
|           }, |  | ||||||
|           dependencies: { |  | ||||||
|             show(values) { |  | ||||||
|               return values?.config?.apiVersion === 'v3'; |  | ||||||
|             }, |  | ||||||
|             triggerFields: ['config.mode', 'mode', 'config'], |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           label: '备注', |  | ||||||
|           fieldName: 'remark', |  | ||||||
|           component: 'Textarea', |  | ||||||
|           componentProps: { |  | ||||||
|             rows: 3, |  | ||||||
|             placeholder: '请输入备注', |  | ||||||
|           }, |  | ||||||
|         }, |  | ||||||
|       ]; |  | ||||||
|     } |  | ||||||
|     default: { |  | ||||||
|       return []; |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 xingyu4j
						xingyu4j