Files
iot-device-management-frontend/apps/web-antd/src/views/pay/order/index.vue

116 lines
3.0 KiB
Vue
Raw Normal View History

<script lang="ts" setup>
2025-05-26 17:22:09 +08:00
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { PayOrderApi } from '#/api/pay/order';
2025-04-22 22:10:33 +08:00
import { Page, useVbenModal } from '@vben/common-ui';
import { Tag } from 'ant-design-vue';
2025-05-26 17:22:09 +08:00
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getOrderPage } from '#/api/pay/order';
2025-04-22 22:10:33 +08:00
import { DocAlert } from '#/components/doc-alert';
2025-05-26 17:22:09 +08:00
import { useGridColumns, useGridFormSchema } from './data';
import Detail from './modules/detail.vue';
2025-05-26 17:22:09 +08:00
const [DetailModal, detailModalApi] = useVbenModal({
connectedComponent: Detail,
destroyOnClose: true,
});
2025-05-26 17:22:09 +08:00
/** 刷新表格 */
function onRefresh() {
gridApi.query();
}
/** 查看详情 */
function handleDetail(row: PayOrderApi.Order) {
detailModalApi.setData(row).open();
}
const [Grid, gridApi] = useVbenVxeGrid({
formOptions: {
schema: useGridFormSchema(),
2025-05-28 11:36:52 +08:00
collapsed: false,
},
2025-05-26 17:22:09 +08:00
gridOptions: {
2025-05-28 11:36:52 +08:00
cellConfig: {
height: 80,
},
2025-05-26 17:22:09 +08:00
columns: useGridColumns(),
height: 'auto',
keepSource: true,
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
return await getOrderPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
2025-05-26 17:22:09 +08:00
rowConfig: {
keyField: 'id',
2025-05-28 11:36:52 +08:00
isCurrent: true,
isHover: true,
resizable: true,
2025-05-26 17:22:09 +08:00
},
toolbarConfig: {
refresh: { code: 'query' },
search: true,
},
} as VxeTableGridOptions<PayOrderApi.Order>,
});
</script>
<template>
2025-05-26 19:05:31 +08:00
<Page auto-content-height>
2025-05-26 17:22:09 +08:00
<template #doc>
<DocAlert
title="支付宝支付接入"
url="https://doc.iocoder.cn/pay/alipay-pay-demo/"
/>
<DocAlert
title="微信公众号支付接入"
url="https://doc.iocoder.cn/pay/wx-pub-pay-demo/"
/>
<DocAlert
title="微信小程序支付接入"
url="https://doc.iocoder.cn/pay/wx-lite-pay-demo/"
/>
</template>
<DetailModal @success="onRefresh" />
<Grid table-title="支付订单列表">
<template #actions="{ row }">
<TableAction
:actions="[
{
label: $t('common.detail'),
type: 'link',
icon: ACTION_ICON.VIEW,
auth: ['pay:order:query'],
onClick: handleDetail.bind(null, row),
},
]"
/>
</template>
<template #no="{ row }">
2025-05-28 11:36:52 +08:00
<div class="flex flex-col gap-1 text-left">
<p class="text-sm">
<Tag size="small" color="blue"> 商户</Tag> {{ row.merchantOrderId }}
</p>
<p class="text-sm" v-if="row.no">
<Tag size="small" color="orange">支付</Tag> {{ row.no }}
</p>
<p class="text-sm" v-if="row.channelOrderNo">
<Tag size="small" color="green">渠道</Tag>
{{ row.channelOrderNo }}
</p>
</div>
</template>
2025-05-26 17:22:09 +08:00
</Grid>
</Page>
2025-04-22 22:10:33 +08:00
</template>