wupengfei
1 天以前 d32cd83674f9b0db0154e6228807e658539f8cd0
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<template>
  <ProDialog title="明细" v-model="visible" destroy-on-close draggable>
    <PortraitTable v-bind="portraitTableProps" label-width="140px" :col-number="2"></PortraitTable>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="emit('onCancel')" type="primary">确定</el-button>
      </span>
    </template>
  </ProDialog>
</template>
 
<script setup lang="ts">
import { ProDialog, toThousand } from '@bole-core/components';
import { usePortraitTable } from '@/hooks';
import * as userServices from '@/services/api/user';
import { useQuery } from '@tanstack/vue-query';
import { EnumWalletTransactionStatusText } from '@/constants';
 
defineOptions({
  name: 'FinanceDetailDialog',
});
 
type Form = {
  id?: string;
};
 
const visible = defineModel({ type: Boolean });
const form = defineModel<Form>('form');
 
const emit = defineEmits<{
  (e: 'update:modelValue', value: boolean): void;
  (e: 'onCancel'): void;
}>();
 
const { data: detail, refetch } = useQuery({
  queryKey: ['userResumeServices/getUserResume', form.value.id],
  queryFn: async () => {
    return await userServices.getPersonalUserTransaction({ id: form.value.id });
  },
  placeholderData: () => ({} as API.GetPersonalUserTransactionQueryResult),
  enabled: computed(() => !!form.value.id),
});
 
watch(
  () => form.value.id,
  (val) => {
    if (val) {
      refetch();
    }
  }
);
 
const { portraitTableProps } = usePortraitTable({
  data: detail,
  columns: [
    {
      label: '付款人账户',
      key: 'payerAccount',
    },
    {
      label: '收款人账户',
      key: 'receiveAccount',
    },
    {
      label: '付款人名称',
      key: 'payerName',
    },
    {
      label: '收款人名称',
      key: 'receiveName',
    },
    {
      label: '付款人开户行',
      key: 'payerBank',
    },
    {
      label: '收款人开户行',
      key: 'receiveBank',
    },
    {
      label: '币种',
      key: 'currency',
    },
    {
      label: '交易金额',
      key: 'actualAmount',
      type: 'money',
    },
    {
      label: '用途',
      key: 'purpose',
    },
    {
      label: '摘要',
      key: 'failReason',
    },
    {
      label: '交易时间',
      key: 'transDate',
      type: 'date',
      format: 'YYYY-MM-DD HH:mm:ss',
    },
    {
      label: '交易状态',
      key: 'transactionStatus',
      type: 'enum',
      valueEnum: EnumWalletTransactionStatusText,
    },
  ],
});
</script>
 
<style lang="scss" scoped>
@use '@/style/common.scss' as *;
</style>