From a2fdff47df15822410ce53e7f6b9bfd5214e5bb9 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 5 Aug 2023 14:15:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=BA=94=E7=94=A8=EF=BC=9A?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E6=94=AF=E4=BB=98=E7=9A=84=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/constants.ts | 9 -- .../components/channel/AlipayChannelForm.vue | 4 +- .../components/channel/MockChannelForm.vue | 122 ++++++++++++++++ .../components/channel/WeixinChannelForm.vue | 4 +- .../pay/app/components/mockChannelForm.vue | 130 ------------------ src/views/pay/app/index.vue | 85 ++++++------ 6 files changed, 168 insertions(+), 186 deletions(-) create mode 100644 src/views/pay/app/components/channel/MockChannelForm.vue delete mode 100644 src/views/pay/app/components/mockChannelForm.vue diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 3a91899a..edde87d5 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -125,15 +125,6 @@ export const PayChannelEnum = { } } -/** - * 支付类型枚举 - */ -export const PayType = { - WECHAT: 'WECHAT', - ALIPAY: 'ALIPAY', - MOCK: 'MOCK' -} - /** * 支付订单状态枚举 */ diff --git a/src/views/pay/app/components/channel/AlipayChannelForm.vue b/src/views/pay/app/components/channel/AlipayChannelForm.vue index 1d7d0973..46dc4312 100644 --- a/src/views/pay/app/components/channel/AlipayChannelForm.vue +++ b/src/views/pay/app/components/channel/AlipayChannelForm.vue @@ -151,8 +151,8 @@ diff --git a/src/views/pay/app/components/channel/MockChannelForm.vue b/src/views/pay/app/components/channel/MockChannelForm.vue new file mode 100644 index 00000000..49cb3abc --- /dev/null +++ b/src/views/pay/app/components/channel/MockChannelForm.vue @@ -0,0 +1,122 @@ + + diff --git a/src/views/pay/app/components/channel/WeixinChannelForm.vue b/src/views/pay/app/components/channel/WeixinChannelForm.vue index 5421e9d4..bafa4bfe 100644 --- a/src/views/pay/app/components/channel/WeixinChannelForm.vue +++ b/src/views/pay/app/components/channel/WeixinChannelForm.vue @@ -158,8 +158,8 @@ diff --git a/src/views/pay/app/components/mockChannelForm.vue b/src/views/pay/app/components/mockChannelForm.vue deleted file mode 100644 index 8de7f29f..00000000 --- a/src/views/pay/app/components/mockChannelForm.vue +++ /dev/null @@ -1,130 +0,0 @@ - - diff --git a/src/views/pay/app/index.vue b/src/views/pay/app/index.vue index 959ce5a1..d3f993e9 100644 --- a/src/views/pay/app/index.vue +++ b/src/views/pay/app/index.vue @@ -88,7 +88,7 @@ @@ -97,7 +97,7 @@ v-else type="danger" circle - @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_APP.code, PayType.ALIPAY)" + @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_APP.code)" > @@ -109,7 +109,7 @@ type="success" circle v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.ALIPAY_PC.code)" - @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_PC.code, PayType.ALIPAY)" + @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_PC.code)" > @@ -117,7 +117,7 @@ v-else type="danger" circle - @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_PC.code, PayType.ALIPAY)" + @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_PC.code)" > @@ -129,7 +129,7 @@ type="success" circle v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.ALIPAY_WAP.code)" - @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_WAP.code, PayType.ALIPAY)" + @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_WAP.code)" > @@ -137,7 +137,7 @@ v-else type="danger" circle - @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_WAP.code, PayType.ALIPAY)" + @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_WAP.code)" > @@ -149,7 +149,7 @@ type="success" circle v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.ALIPAY_QR.code)" - @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_QR.code, PayType.ALIPAY)" + @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_QR.code)" > @@ -157,7 +157,7 @@ v-else type="danger" circle - @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_QR.code, PayType.ALIPAY)" + @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_QR.code)" > @@ -169,7 +169,7 @@ type="success" circle v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.ALIPAY_BAR.code)" - @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_BAR.code, PayType.ALIPAY)" + @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_BAR.code)" > @@ -177,7 +177,7 @@ v-else type="danger" circle - @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_BAR.code, PayType.ALIPAY)" + @click="openChannelForm(scope.row, PayChannelEnum.ALIPAY_BAR.code)" > @@ -191,7 +191,7 @@ type="success" circle v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.WX_LITE.code)" - @click="openChannelForm(scope.row, PayChannelEnum.WX_LITE.code, PayType.WECHAT)" + @click="openChannelForm(scope.row, PayChannelEnum.WX_LITE.code)" > @@ -199,7 +199,7 @@ v-else type="danger" circle - @click="openChannelForm(scope.row, PayChannelEnum.WX_LITE.code, PayType.WECHAT)" + @click="openChannelForm(scope.row, PayChannelEnum.WX_LITE.code)" > @@ -211,7 +211,7 @@ type="success" circle v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.WX_PUB.code)" - @click="openChannelForm(scope.row, PayChannelEnum.WX_PUB.code, PayType.WECHAT)" + @click="openChannelForm(scope.row, PayChannelEnum.WX_PUB.code)" > @@ -219,7 +219,7 @@ v-else type="danger" circle - @click="openChannelForm(scope.row, PayChannelEnum.WX_PUB.code, PayType.WECHAT)" + @click="openChannelForm(scope.row, PayChannelEnum.WX_PUB.code)" > @@ -231,7 +231,7 @@ type="success" circle v-if="isChannelExists(scope.row.channelCodes, PayChannelEnum.WX_APP.code)" - @click="openChannelForm(scope.row, PayChannelEnum.WX_APP.code, PayType.WECHAT)" + @click="openChannelForm(scope.row, PayChannelEnum.WX_APP.code)" > @@ -239,7 +239,7 @@ v-else type="danger" circle - @click="openChannelForm(scope.row, PayChannelEnum.WX_APP.code, PayType.WECHAT)" + @click="openChannelForm(scope.row, PayChannelEnum.WX_APP.code)" > @@ -252,17 +252,19 @@ + > + + + > + + @@ -310,7 +312,7 @@ import AppForm from './components/AppForm.vue' import { PayChannelEnum, PayType } from '@/utils/constants' import AlipayChannelForm from './components/channel/AlipayChannelForm.vue' import WeixinChannelForm from './components/channel/WeixinChannelForm.vue' -import MockChannelForm from './components/mockChannelForm.vue' +import MockChannelForm from './components/channel/MockChannelForm.vue' import { CommonStatusEnum } from '@/utils/constants' defineOptions({ name: 'PayApp' }) @@ -318,10 +320,6 @@ defineOptions({ name: 'PayApp' }) const message = useMessage() // 消息弹窗 const { t } = useI18n() // 国际化 -const alipayFormRef = ref() -const weixinFormRef = ref() -const mockFormRef = ref() - const loading = ref(true) // 列表的加载中 const total = ref(0) // 列表的总页数 const list = ref([]) // 列表的数据 @@ -376,11 +374,6 @@ const handleStatusChange = async (row: any) => { } /** 添加/修改操作 */ -const channelParam = reactive({ - loading: false, - appId: null, // 应用 ID - payCode: null // 渠道编码 -}) const formRef = ref() const openForm = (type: string, id?: number) => { formRef.value.open(type, id) @@ -429,20 +422,26 @@ const isChannelExists = (channels, channelCode) => { /** * 新增支付渠道信息 */ -const openChannelForm = async (row, payCode, type) => { - channelParam.loading = false +const alipayFormRef = ref() +const weixinFormRef = ref() +const mockFormRef = ref() +const channelParam = reactive({ + appId: null, // 应用 ID + payCode: null // 渠道编码 +}) +const openChannelForm = async (row, payCode) => { channelParam.appId = row.id channelParam.payCode = payCode - switch (type) { - case PayType.ALIPAY: - alipayFormRef.value.open(row.id, payCode) - break - case PayType.WECHAT: - weixinFormRef.value.open(row.id, payCode) - break - case PayType.MOCK: - mockFormRef.value.open(row.id, payCode) - break + if (payCode.indexOf('alipay_') === 0) { + alipayFormRef.value.open(row.id, payCode) + return + } + if (payCode.indexOf('wx_') === 0) { + weixinFormRef.value.open(row.id, payCode) + return + } + if (payCode.indexOf('mock') === 0) { + mockFormRef.value.open(row.id, payCode) } }