pull/33/head
xingyu 2023-09-08 16:44:04 +08:00
parent a5f3cfb4f9
commit f55ca845af
2 changed files with 26 additions and 97 deletions

View File

@ -22,16 +22,6 @@ export interface AppPageReqVO extends PageParam {
createTime?: Date[] createTime?: Date[]
} }
export interface AppExportReqVO {
name?: string
status?: number
remark?: string
payNotifyUrl?: string
refundNotifyUrl?: string
merchantName?: string
createTime?: Date[]
}
export interface AppUpdateStatusReqVO { export interface AppUpdateStatusReqVO {
id: number id: number
status: number status: number

View File

@ -9,17 +9,16 @@ import { PayChannelEnum, PayType } from '@/enums/systemEnum'
import { IconEnum } from '@/enums/appEnum' import { IconEnum } from '@/enums/appEnum'
import { Icon } from '@/components/Icon' import { Icon } from '@/components/Icon'
import { BasicTable, TableAction, useTable } from '@/components/Table' import { BasicTable, TableAction, useTable } from '@/components/Table'
import type { AppExportReqVO } from '@/api/pay/app' import { deleteApp, getAppPage } from '@/api/pay/app'
import { deleteApp, exportApp, getAppPage } from '@/api/pay/app'
defineOptions({ name: 'PayApp' }) defineOptions({ name: 'PayApp' })
const { t } = useI18n() const { t } = useI18n()
const { createConfirm, createMessage } = useMessage() const { createMessage } = useMessage()
const [registerModal, { openModal }] = useModal() const [registerModal, { openModal }] = useModal()
const [registerChannelModal, { openModal: openChannelModal }] = useModal() const [registerChannelModal, { openModal: openChannelModal }] = useModal()
const [registerTable, { getForm, reload }] = useTable({ const [registerTable, { reload }] = useTable({
title: '应用列表', title: '应用列表',
api: getAppPage, api: getAppPage,
columns, columns,
@ -42,18 +41,6 @@ function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true }) openModal(true, { record, isUpdate: true })
} }
async function handleExport() {
createConfirm({
title: t('common.exportTitle'),
iconType: 'warning',
content: t('common.exportMessage'),
async onOk() {
await exportApp(getForm().getFieldsValue() as AppExportReqVO)
createMessage.success(t('common.exportSuccessText'))
},
})
}
async function handleDelete(record: Recordable) { async function handleDelete(record: Recordable) {
await deleteApp(record.id) await deleteApp(record.id)
createMessage.success(t('common.delSuccessText')) createMessage.success(t('common.delSuccessText'))
@ -85,25 +72,17 @@ function isChannelExists(channels, channelCode) {
<a-button v-auth="['pay:app:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate"> <a-button v-auth="['pay:app:create']" type="primary" :pre-icon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }} {{ t('action.create') }}
</a-button> </a-button>
<a-button v-auth="['pay:app:export']" :pre-icon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template> </template>
<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="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_APP.code)" v-if="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_APP.code)" type="primary"
type="primary" shape="circle" @click="openChannel(record, PayChannelEnum.ALIPAY_APP.code, PayType.ALIPAY, true)"
shape="circle"
@click="openChannel(record, PayChannelEnum.ALIPAY_APP.code, PayType.ALIPAY, true)"
> >
<Icon icon="ant-design:check-outlined" /> <Icon icon="ant-design:check-outlined" />
</a-button> </a-button>
<a-button <a-button
v-else v-else type="primary" shape="circle" danger
type="primary"
shape="circle"
danger
@click="openChannel(record, PayChannelEnum.ALIPAY_APP.code, PayType.ALIPAY, false)" @click="openChannel(record, PayChannelEnum.ALIPAY_APP.code, PayType.ALIPAY, false)"
> >
<Icon icon="ant-design:close-outlined" /> <Icon icon="ant-design:close-outlined" />
@ -111,18 +90,13 @@ function isChannelExists(channels, channelCode) {
</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="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_PC.code)" v-if="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_PC.code)" type="primary"
type="primary" shape="circle" @click="openChannel(record, PayChannelEnum.ALIPAY_PC.code, PayType.ALIPAY, true)"
shape="circle"
@click="openChannel(record, PayChannelEnum.ALIPAY_PC.code, PayType.ALIPAY, true)"
> >
<Icon icon="ant-design:check-outlined" /> <Icon icon="ant-design:check-outlined" />
</a-button> </a-button>
<a-button <a-button
v-else v-else type="primary" shape="circle" danger
type="primary"
shape="circle"
danger
@click="openChannel(record, PayChannelEnum.ALIPAY_PC.code, PayType.ALIPAY, false)" @click="openChannel(record, PayChannelEnum.ALIPAY_PC.code, PayType.ALIPAY, false)"
> >
<Icon icon="ant-design:close-outlined" /> <Icon icon="ant-design:close-outlined" />
@ -130,18 +104,13 @@ function isChannelExists(channels, channelCode) {
</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="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_WAP.code)" v-if="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_WAP.code)" type="primary"
type="primary" shape="circle" @click="openChannel(record, PayChannelEnum.ALIPAY_WAP.code, PayType.ALIPAY, true)"
shape="circle"
@click="openChannel(record, PayChannelEnum.ALIPAY_WAP.code, PayType.ALIPAY, true)"
> >
<Icon icon="ant-design:check-outlined" /> <Icon icon="ant-design:check-outlined" />
</a-button> </a-button>
<a-button <a-button
v-else v-else type="primary" shape="circle" danger
type="primary"
shape="circle"
danger
@click="openChannel(record, PayChannelEnum.ALIPAY_WAP.code, PayType.ALIPAY, false)" @click="openChannel(record, PayChannelEnum.ALIPAY_WAP.code, PayType.ALIPAY, false)"
> >
<Icon icon="ant-design:close-outlined" /> <Icon icon="ant-design:close-outlined" />
@ -149,18 +118,13 @@ function isChannelExists(channels, channelCode) {
</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="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_QR.code)" v-if="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_QR.code)" type="primary"
type="primary" shape="circle" @click="openChannel(record, PayChannelEnum.ALIPAY_QR.code, PayType.ALIPAY, true)"
shape="circle"
@click="openChannel(record, PayChannelEnum.ALIPAY_QR.code, PayType.ALIPAY, true)"
> >
<Icon icon="ant-design:check-outlined" /> <Icon icon="ant-design:check-outlined" />
</a-button> </a-button>
<a-button <a-button
v-else v-else type="primary" shape="circle" danger
type="primary"
shape="circle"
danger
@click="openChannel(record, PayChannelEnum.ALIPAY_QR.code, PayType.ALIPAY, false)" @click="openChannel(record, PayChannelEnum.ALIPAY_QR.code, PayType.ALIPAY, false)"
> >
<Icon icon="ant-design:close-outlined" /> <Icon icon="ant-design:close-outlined" />
@ -168,18 +132,13 @@ function isChannelExists(channels, channelCode) {
</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="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_BAR.code)" v-if="isChannelExists(record.channelCodes, PayChannelEnum.ALIPAY_BAR.code)" type="primary"
type="primary" shape="circle" @click="openChannel(record, PayChannelEnum.ALIPAY_BAR.code, PayType.ALIPAY, true)"
shape="circle"
@click="openChannel(record, PayChannelEnum.ALIPAY_BAR.code, PayType.ALIPAY, true)"
> >
<Icon icon="ant-design:check-outlined" /> <Icon icon="ant-design:check-outlined" />
</a-button> </a-button>
<a-button <a-button
v-else v-else type="primary" shape="circle" danger
type="primary"
shape="circle"
danger
@click="openChannel(record, PayChannelEnum.ALIPAY_BAR.code, PayType.ALIPAY, false)" @click="openChannel(record, PayChannelEnum.ALIPAY_BAR.code, PayType.ALIPAY, false)"
> >
<Icon icon="ant-design:close-outlined" /> <Icon icon="ant-design:close-outlined" />
@ -187,18 +146,13 @@ function isChannelExists(channels, channelCode) {
</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="isChannelExists(record.channelCodes, PayChannelEnum.WX_LITE.code)" v-if="isChannelExists(record.channelCodes, PayChannelEnum.WX_LITE.code)" type="primary" shape="circle"
type="primary"
shape="circle"
@click="openChannel(record, PayChannelEnum.WX_LITE.code, PayType.WECHAT, true)" @click="openChannel(record, PayChannelEnum.WX_LITE.code, PayType.WECHAT, true)"
> >
<Icon icon="ant-design:check-outlined" /> <Icon icon="ant-design:check-outlined" />
</a-button> </a-button>
<a-button <a-button
v-else v-else type="primary" shape="circle" danger
type="primary"
shape="circle"
danger
@click="openChannel(record, PayChannelEnum.WX_LITE.code, PayType.WECHAT, false)" @click="openChannel(record, PayChannelEnum.WX_LITE.code, PayType.WECHAT, false)"
> >
<Icon icon="ant-design:close-outlined" /> <Icon icon="ant-design:close-outlined" />
@ -206,18 +160,13 @@ function isChannelExists(channels, channelCode) {
</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="isChannelExists(record.channelCodes, PayChannelEnum.WX_PUB.code)" v-if="isChannelExists(record.channelCodes, PayChannelEnum.WX_PUB.code)" type="primary" shape="circle"
type="primary"
shape="circle"
@click="openChannel(record, PayChannelEnum.WX_PUB.code, PayType.WECHAT, true)" @click="openChannel(record, PayChannelEnum.WX_PUB.code, PayType.WECHAT, true)"
> >
<Icon icon="ant-design:check-outlined" /> <Icon icon="ant-design:check-outlined" />
</a-button> </a-button>
<a-button <a-button
v-else v-else type="primary" shape="circle" danger
type="primary"
shape="circle"
danger
@click="openChannel(record, PayChannelEnum.WX_PUB.code, PayType.WECHAT, false)" @click="openChannel(record, PayChannelEnum.WX_PUB.code, PayType.WECHAT, false)"
> >
<Icon icon="ant-design:close-outlined" /> <Icon icon="ant-design:close-outlined" />
@ -225,18 +174,13 @@ function isChannelExists(channels, channelCode) {
</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="isChannelExists(record.channelCodes, PayChannelEnum.WX_APP.code)" v-if="isChannelExists(record.channelCodes, PayChannelEnum.WX_APP.code)" type="primary" shape="circle"
type="primary"
shape="circle"
@click="openChannel(record, PayChannelEnum.WX_APP.code, PayType.WECHAT, true)" @click="openChannel(record, PayChannelEnum.WX_APP.code, PayType.WECHAT, true)"
> >
<Icon icon="ant-design:check-outlined" /> <Icon icon="ant-design:check-outlined" />
</a-button> </a-button>
<a-button <a-button
v-else v-else type="primary" shape="circle" danger
type="primary"
shape="circle"
danger
@click="openChannel(record, PayChannelEnum.WX_APP.code, PayType.WECHAT, false)" @click="openChannel(record, PayChannelEnum.WX_APP.code, PayType.WECHAT, false)"
> >
<Icon icon="ant-design:close-outlined" /> <Icon icon="ant-design:close-outlined" />
@ -244,18 +188,13 @@ function isChannelExists(channels, channelCode) {
</template> </template>
<template v-if="column.key === PayChannelEnum.MOCK.code"> <template v-if="column.key === PayChannelEnum.MOCK.code">
<a-button <a-button
v-if="isChannelExists(record.channelCodes, PayChannelEnum.MOCK.code)" v-if="isChannelExists(record.channelCodes, PayChannelEnum.MOCK.code)" type="primary" shape="circle"
type="primary"
shape="circle"
@click="openChannel(record, PayChannelEnum.MOCK.code, PayType.MOCK, true)" @click="openChannel(record, PayChannelEnum.MOCK.code, PayType.MOCK, true)"
> >
<Icon icon="ant-design:check-outlined" /> <Icon icon="ant-design:check-outlined" />
</a-button> </a-button>
<a-button <a-button
v-else v-else type="primary" shape="circle" danger
type="primary"
shape="circle"
danger
@click="openChannel(record, PayChannelEnum.MOCK.code, PayType.MOCK, false)" @click="openChannel(record, PayChannelEnum.MOCK.code, PayType.MOCK, false)"
> >
<Icon icon="ant-design:close-outlined" /> <Icon icon="ant-design:close-outlined" />