index.vue
2.36 KB
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
<template>
<PageWrapper title="基础详情页" contentBackground>
<Description
size="middle"
title="退款申请"
:bordered="false"
:column="3"
:data="refundData"
:schema="refundSchema"
/>
<a-divider />
<Description
size="middle"
title="用户信息"
:bordered="false"
:column="3"
:data="personData"
:schema="personSchema"
/>
<a-divider />
<BasicTable @register="registerRefundTable" />
<a-divider />
<BasicTable @register="registerTimeTable" />
</PageWrapper>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { Description } from '/@/components/Description/index';
import { BasicTable, useTable } from '/@/components/Table';
import { PageWrapper } from '/@/components/Page';
import { Divider } from 'ant-design-vue';
import {
refundSchema,
refundData,
personSchema,
personData,
refundTableSchema,
refundTimeTableSchema,
refundTableData,
refundTimeTableData,
} from './data';
export default defineComponent({
components: { Description, BasicTable, PageWrapper, [Divider.name]: Divider },
setup() {
const [registerRefundTable] = useTable({
title: '退货商品',
dataSource: refundTableData,
columns: refundTableSchema,
pagination: false,
showIndexColumn: false,
scroll: { y: 300 },
showSummary: true,
summaryFunc: handleSummary,
});
const [registerTimeTable] = useTable({
title: '退货进度',
columns: refundTimeTableSchema,
pagination: false,
dataSource: refundTimeTableData,
showIndexColumn: false,
scroll: { y: 300 },
});
function handleSummary(tableData: any[]) {
let totalT5 = 0;
let totalT6 = 0;
tableData.forEach((item) => {
totalT5 += item.t5;
totalT6 += item.t6;
});
return [
{
t1: '总计',
t5: totalT5,
t6: totalT6,
},
];
}
return {
registerRefundTable,
registerTimeTable,
refundSchema,
refundData,
personSchema,
personData,
};
},
});
</script>
<style lang="less" scoped>
.desc-wrap {
padding: 16px;
background-color: @component-background;
}
</style>