zhengyiming
3 天以前 89f387786da0e4383cf06ee162526db54971f9cf
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
<template>
  <ProDialog title="企业充值明细" v-model="visible" destroy-on-close draggable>
    <ProDialogTableWrapper :height="400">
      <ProTableV2 v-bind="proTableProps" :columns="columns" :operationBtns="operationBtns">
        <template #operationBtn-checkBtn="{ data, row }">
          <PreviewBtnV2
            class="pro-table-operation-btn"
            :url="convertApi2FormUrlBySeparator(row.url ?? '')"
            preview-btn-text="查看凭证"
          />
        </template>
      </ProTableV2>
    </ProDialogTableWrapper>
    <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,
  ProTableV2,
  ProDialogTableWrapper,
  defineColumns,
  defineOperationBtns,
  PreviewBtnV2,
} from '@bole-core/components';
import { convertApi2FormUrlBySeparator } from '@/utils';
import { useRewardStatisticsDetail } from '../hooks';
import { EnumParkRewardStatisticsDetailScene } from '@/constants';
 
defineOptions({
  name: 'EnterpriseRechargeDetailDialog',
});
 
type Form = {
  enterpriseId?: string;
  month?: string;
  scene?: EnumParkRewardStatisticsDetailScene;
};
 
const visible = defineModel({ type: Boolean });
const form = defineModel<Form>('form');
 
const emit = defineEmits<{
  (e: 'update:modelValue', value: boolean): void;
  (e: 'onCancel'): void;
}>();
 
const columns = defineColumns([
  {
    id: '1',
    enCode: 'creationTime',
    name: '企业充值日期',
  },
  {
    id: '2',
    enCode: 'auditTime',
    name: '审核通过日期',
  },
  {
    id: '3',
    enCode: 'amount',
    name: '充值金额',
  },
]);
 
const operationBtns = defineOperationBtns([
  {
    data: {
      enCode: 'checkBtn',
      name: '查看凭证',
    },
    extraProps: {
      hide: (row: API.GetRewardStatisticsDetailDto) => !row.url,
    },
  },
]);
 
watch(
  () => visible.value,
  (val) => {
    if (val) {
      getRewardStatisticsDetail();
    }
  },
  {
    immediate: true,
  }
);
 
const { getRewardStatisticsDetail, proTableProps } = useRewardStatisticsDetail({
  enterpriseId: toRef(form.value, 'enterpriseId'),
  month: toRef(form.value, 'month'),
  scene: toRef(form.value, 'scene'),
});
</script>
 
<style lang="scss" scoped>
@use '@/style/common.scss' as *;
</style>