fix: pay app
							parent
							
								
									f1f00becbe
								
							
						
					
					
						commit
						77aa03b31c
					
				|  | @ -14,12 +14,12 @@ const emit = defineEmits(['success', 'register']) | ||||||
| const { t } = useI18n() | const { t } = useI18n() | ||||||
| const { createMessage } = useMessage() | const { createMessage } = useMessage() | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const type = ref(PayType.ALIPAY) | const appType = ref(PayType.ALIPAY) | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 120, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: type.value === PayType.ALIPAY ? aliPayFormSchema : (type.value === PayType.WECHAT ? weChatFormSchema : mockFormSchema), |   schemas: appType.value === PayType.ALIPAY ? aliPayFormSchema : (appType.value === PayType.WECHAT ? weChatFormSchema : mockFormSchema), | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|   actionColOptions: { span: 23 }, |   actionColOptions: { span: 23 }, | ||||||
| }) | }) | ||||||
|  | @ -28,12 +28,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
|   type.value = data.type |   appType.value = data.type | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getChannel(data.record.id, data.payCode) |     const res = await getChannel(data.record.id, data.payCode) | ||||||
|     const config = JSON.parse(res.config) |     const config = JSON.parse(res.config) | ||||||
|     const payConfig: any = {} |     const payConfig: any = {} | ||||||
|     if (type.value === PayType.ALIPAY) { |     if (appType.value === PayType.ALIPAY) { | ||||||
|       payConfig.appId = config.appId |       payConfig.appId = config.appId | ||||||
|       payConfig.serverUrl = config.serverUrl |       payConfig.serverUrl = config.serverUrl | ||||||
|       payConfig.signType = config.signType |       payConfig.signType = config.signType | ||||||
|  | @ -44,7 +44,7 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|       payConfig.alipayPublicCertContent = config.alipayPublicCertContent |       payConfig.alipayPublicCertContent = config.alipayPublicCertContent | ||||||
|       payConfig.rootCertContent = config.rootCertContent |       payConfig.rootCertContent = config.rootCertContent | ||||||
|     } |     } | ||||||
|     else if (type.value === PayType.WECHAT) { |     else if (appType.value === PayType.WECHAT) { | ||||||
|       payConfig.appId = config.appId |       payConfig.appId = config.appId | ||||||
|       payConfig.apiVersion = config.apiVersion |       payConfig.apiVersion = config.apiVersion | ||||||
|       payConfig.mchId = config.mchId |       payConfig.mchId = config.mchId | ||||||
|  |  | ||||||
|  | @ -63,6 +63,19 @@ async function handleDelete(record: Recordable) { | ||||||
| function openChannel(record: Recordable, payCode: string, type: string, isUpdate: boolean) { | function openChannel(record: Recordable, payCode: string, type: string, isUpdate: boolean) { | ||||||
|   openChannelModal(true, { record, payCode, type, isUpdate }) |   openChannelModal(true, { record, payCode, type, isUpdate }) | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * 根据渠道编码判断渠道列表中是否存在 | ||||||
|  |  * | ||||||
|  |  * @param channels 渠道列表 | ||||||
|  |  * @param channelCode 渠道编码 | ||||||
|  |  */ | ||||||
|  | function isChannelExists(channels, channelCode) { | ||||||
|  |   if (!channels) | ||||||
|  |     return false | ||||||
|  | 
 | ||||||
|  |   return channels.includes(channelCode) | ||||||
|  | } | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| <template> | <template> | ||||||
|  | @ -79,7 +92,7 @@ function openChannel(record: Recordable, payCode: string, type: string, isUpdate | ||||||
|       <template #bodyCell="{ column, record }"> |       <template #bodyCell="{ column, record }"> | ||||||
|         <template v-if="column.key === PayChannelEnum.ALIPAY_APP.code"> |         <template v-if="column.key === PayChannelEnum.ALIPAY_APP.code"> | ||||||
|           <a-button |           <a-button | ||||||
|             v-if="record.channelCodes.indexOf(PayChannelEnum.ALIPAY_APP.code) !== -1" |             v-if="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_APP.code)" | ||||||
|             type="primary" |             type="primary" | ||||||
|             shape="circle" |             shape="circle" | ||||||
|             @click="openChannel(record, PayChannelEnum.ALIPAY_APP.code, PayType.ALIPAY, true)" |             @click="openChannel(record, PayChannelEnum.ALIPAY_APP.code, PayType.ALIPAY, true)" | ||||||
|  | @ -98,7 +111,7 @@ function openChannel(record: Recordable, payCode: string, type: string, isUpdate | ||||||
|         </template> |         </template> | ||||||
|         <template v-if="column.key === PayChannelEnum.ALIPAY_PC.code"> |         <template v-if="column.key === PayChannelEnum.ALIPAY_PC.code"> | ||||||
|           <a-button |           <a-button | ||||||
|             v-if="record.channelCodes.indexOf(PayChannelEnum.ALIPAY_PC.code) !== -1" |             v-if="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_PC.code)" | ||||||
|             type="primary" |             type="primary" | ||||||
|             shape="circle" |             shape="circle" | ||||||
|             @click="openChannel(record, PayChannelEnum.ALIPAY_PC.code, PayType.ALIPAY, true)" |             @click="openChannel(record, PayChannelEnum.ALIPAY_PC.code, PayType.ALIPAY, true)" | ||||||
|  | @ -117,7 +130,7 @@ function openChannel(record: Recordable, payCode: string, type: string, isUpdate | ||||||
|         </template> |         </template> | ||||||
|         <template v-if="column.key === PayChannelEnum.ALIPAY_WAP.code"> |         <template v-if="column.key === PayChannelEnum.ALIPAY_WAP.code"> | ||||||
|           <a-button |           <a-button | ||||||
|             v-if="record.channelCodes.indexOf(PayChannelEnum.ALIPAY_WAP.code) !== -1" |             v-if="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_WAP.code)" | ||||||
|             type="primary" |             type="primary" | ||||||
|             shape="circle" |             shape="circle" | ||||||
|             @click="openChannel(record, PayChannelEnum.ALIPAY_WAP.code, PayType.ALIPAY, true)" |             @click="openChannel(record, PayChannelEnum.ALIPAY_WAP.code, PayType.ALIPAY, true)" | ||||||
|  | @ -136,7 +149,7 @@ function openChannel(record: Recordable, payCode: string, type: string, isUpdate | ||||||
|         </template> |         </template> | ||||||
|         <template v-if="column.key === PayChannelEnum.ALIPAY_QR.code"> |         <template v-if="column.key === PayChannelEnum.ALIPAY_QR.code"> | ||||||
|           <a-button |           <a-button | ||||||
|             v-if="record.channelCodes.indexOf(PayChannelEnum.ALIPAY_QR.code) !== -1" |             v-if="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_QR.code)" | ||||||
|             type="primary" |             type="primary" | ||||||
|             shape="circle" |             shape="circle" | ||||||
|             @click="openChannel(record, PayChannelEnum.ALIPAY_QR.code, PayType.ALIPAY, true)" |             @click="openChannel(record, PayChannelEnum.ALIPAY_QR.code, PayType.ALIPAY, true)" | ||||||
|  | @ -155,7 +168,7 @@ function openChannel(record: Recordable, payCode: string, type: string, isUpdate | ||||||
|         </template> |         </template> | ||||||
|         <template v-if="column.key === PayChannelEnum.ALIPAY_BAR.code"> |         <template v-if="column.key === PayChannelEnum.ALIPAY_BAR.code"> | ||||||
|           <a-button |           <a-button | ||||||
|             v-if="record.channelCodes.indexOf(PayChannelEnum.ALIPAY_BAR.code) !== -1" |             v-if="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_BAR.code)" | ||||||
|             type="primary" |             type="primary" | ||||||
|             shape="circle" |             shape="circle" | ||||||
|             @click="openChannel(record, PayChannelEnum.ALIPAY_BAR.code, PayType.ALIPAY, true)" |             @click="openChannel(record, PayChannelEnum.ALIPAY_BAR.code, PayType.ALIPAY, true)" | ||||||
|  | @ -174,7 +187,7 @@ function openChannel(record: Recordable, payCode: string, type: string, isUpdate | ||||||
|         </template> |         </template> | ||||||
|         <template v-if="column.key === PayChannelEnum.WX_LITE.code"> |         <template v-if="column.key === PayChannelEnum.WX_LITE.code"> | ||||||
|           <a-button |           <a-button | ||||||
|             v-if="record.channelCodes.indexOf(PayChannelEnum.WX_LITE.code) !== -1" |             v-if="isChannelExists(record.channelCodes, PayChannelEnum.WX_LITE.code)" | ||||||
|             type="primary" |             type="primary" | ||||||
|             shape="circle" |             shape="circle" | ||||||
|             @click="openChannel(record, PayChannelEnum.WX_LITE.code, PayType.WECHAT, true)" |             @click="openChannel(record, PayChannelEnum.WX_LITE.code, PayType.WECHAT, true)" | ||||||
|  | @ -193,7 +206,7 @@ function openChannel(record: Recordable, payCode: string, type: string, isUpdate | ||||||
|         </template> |         </template> | ||||||
|         <template v-if="column.key === PayChannelEnum.WX_PUB.code"> |         <template v-if="column.key === PayChannelEnum.WX_PUB.code"> | ||||||
|           <a-button |           <a-button | ||||||
|             v-if="record.channelCodes.indexOf(PayChannelEnum.WX_PUB.code) !== -1" |             v-if="isChannelExists(record.channelCodes, PayChannelEnum.WX_PUB.code)" | ||||||
|             type="primary" |             type="primary" | ||||||
|             shape="circle" |             shape="circle" | ||||||
|             @click="openChannel(record, PayChannelEnum.WX_PUB.code, PayType.WECHAT, true)" |             @click="openChannel(record, PayChannelEnum.WX_PUB.code, PayType.WECHAT, true)" | ||||||
|  | @ -212,7 +225,7 @@ function openChannel(record: Recordable, payCode: string, type: string, isUpdate | ||||||
|         </template> |         </template> | ||||||
|         <template v-if="column.key === PayChannelEnum.WX_APP.code"> |         <template v-if="column.key === PayChannelEnum.WX_APP.code"> | ||||||
|           <a-button |           <a-button | ||||||
|             v-if="record.channelCodes.indexOf(PayChannelEnum.WX_APP.code) !== -1" |             v-if="isChannelExists(record.channelCodes, PayChannelEnum.WX_APP.code)" | ||||||
|             type="primary" |             type="primary" | ||||||
|             shape="circle" |             shape="circle" | ||||||
|             @click="openChannel(record, PayChannelEnum.WX_APP.code, PayType.WECHAT, true)" |             @click="openChannel(record, PayChannelEnum.WX_APP.code, PayType.WECHAT, true)" | ||||||
|  | @ -231,7 +244,7 @@ function openChannel(record: Recordable, payCode: string, type: string, isUpdate | ||||||
|         </template> |         </template> | ||||||
|         <template v-if="column.key === PayChannelEnum.MOCK.code"> |         <template v-if="column.key === PayChannelEnum.MOCK.code"> | ||||||
|           <a-button |           <a-button | ||||||
|             v-if="record.channelCodes.indexOf(PayChannelEnum.MOCK.code) !== -1" |             v-if="isChannelExists(record.channelCodes, PayChannelEnum.MOCK.code)" | ||||||
|             type="primary" |             type="primary" | ||||||
|             shape="circle" |             shape="circle" | ||||||
|             @click="openChannel(record, PayChannelEnum.MOCK.code, PayType.MOCK, true)" |             @click="openChannel(record, PayChannelEnum.MOCK.code, PayType.MOCK, true)" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 xingyu
						xingyu