保誠-保戶業務員媒合平台
Tomas
2021-12-08 5730601f103ea285d129bf3d89acd649e86c114a
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
import { Vue, Component, Watch, State } from 'nuxt-property-decorator';
import { ClientInfo } from '~/assets/ts/api/appointment';
 
@Component
export default class ClientContactedList extends Vue {
    @State('myAppointmentList') myAppointmentList!: ClientInfo[];
 
    contactedList: ClientInfo[] = [];
    pageList: ClientInfo[] = [];
    keyWord: string = '';
    filterList: ClientInfo[] = [];
 
    @Watch('myAppointmentList')
    onMyAppointmentListChange() {
        this.contactedList = (this.myAppointmentList || [])
            .filter(item => item.communicateStatus === 'contacted')
            .sort((a, b) => a.contactTime > b.contactTime ? -1 : 1);
        this.filterList = this.contactedList;
    }
 
    mounted() {
        this.onMyAppointmentListChange();
    }
 
    changePage(pageList: ClientInfo[]) {
        this.pageList = pageList;
    }
 
    search() {
        this.filterList = this.contactedList.filter(item => {
            return item.name.match(this.keyWord) || item.requirement.match(this.keyWord)
        })
    }
}