gaoluyang
2026-06-24 712aa51536236d43e87273e4ce45ac5691dffad8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<script setup lang="ts">
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { PayWalletApi } from '#/api/pay/wallet/balance';
import type { WalletTransactionApi } from '#/api/pay/wallet/transaction';
 
import { Page, useVbenModal } from '..\..\..\..\..\packages\effects\common-ui\src';
 
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getTransactionPage } from '#/api/pay/wallet/transaction';
 
import { useTransactionGridColumns } from '../data';
 
const [Grid, gridApi] = useVbenVxeGrid({
  gridOptions: {
    columns: useTransactionGridColumns(),
    height: 'auto',
    keepSource: true,
    proxyConfig: {
      ajax: {
        query: async ({ page }) => {
          return await getTransactionPage({
            pageNo: page.currentPage,
            pageSize: page.pageSize,
            walletId: modalApi.getData<PayWalletApi.Wallet>().id,
          });
        },
      },
    },
    rowConfig: {
      keyField: 'id',
      isHover: true,
    },
    toolbarConfig: {
      enabled: false,
    },
  } as VxeTableGridOptions<WalletTransactionApi.Transaction>,
});
 
const [Modal, modalApi] = useVbenModal({
  async onOpenChange(isOpen: boolean) {
    if (!isOpen) {
      return;
    }
    // 加载数据
    modalApi.lock();
    try {
      await gridApi.query();
    } finally {
      modalApi.unlock();
    }
  },
});
</script>
<template>
  <Modal
    title="钱包交易记录"
    class="w-1/2"
    :show-cancel-button="false"
    :show-confirm-button="false"
  >
    <Page auto-content-height>
      <Grid />
    </Page>
  </Modal>
</template>