detail-list.vue
2.19 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>
<LayoutApp :title="title">
<DateFilter class="date-filter-wrapper" v-show="showFilter" @on-change="dateHandler"></DateFilter>
<DetailList ref="list" @on-date-pick="dateHandler"></DetailList>
</LayoutApp>
</template>
<script>
import LayoutApp from '../components/layout/layout-app';
import DetailList from './detailList/detail-list';
import DateFilter from './detailList/components/date-filter';
import {Loading} from 'cube-ui';
import {createNamespacedHelpers} from 'vuex';
const {mapState, mapMutations, mapActions} = createNamespacedHelpers('invite/invite');
export default {
name: 'DetailListPage',
components: {
LayoutApp,
DetailList,
DateFilter,
Loading
},
data() {
return {
title: '全部佣金'
};
},
async mounted() {
this.setDate({value: [
new Date().getFullYear(),
new Date().getMonth() + 1
]});
this.setTab({value: 0});
const result = await this.fetchOrderDetailList();
this.$refs.list.forceUpdate(result);
},
computed: {
...mapState(['showFilter', 'date', 'recordDetailList'])
},
methods: {
...mapMutations({
setDate: 'SET_DATE',
setTab: 'SET_TAB'
}),
...mapActions(['fetchOrderDetailList']),
dateHandler() {
this.showTimePicker();
},
showTimePicker() {
if (!this.timePicker) {
this.timePicker = this.$createDatePicker({
title: '',
min: [2019, 4],
max: new Date(),
value: this.date,
startColumn: 'year',
columnCount: 2,
onSelect: this.selectHandle,
onCancel: this.cancelHandle
});
}
this.timePicker.show();
},
async selectHandle(date, selectedVal) {
this.setDate({value: [...selectedVal]});
this.$refs.list.forceUpdate();
const result = await this.fetchOrderDetailList();
this.$refs.list.forceUpdate(result);
},
cancelHandle() {
}
},
};
</script>
<style lang="scss" scoped>
/deep/ .layout-context {
background-color: #fefefe !important;
}
.date-filter-wrapper {
position: absolute;
width: 100%;
top: -2px;
background: #f5f5f5;
padding-left: 40px;
z-index: 2;
}
</style>