import { Vue, Component, State, Watch } from 'nuxt-property-decorator';
|
import { ClientInfo } from '~/assets/ts/api/appointment';
|
|
@Component
|
export default class ClientReservedList extends Vue {
|
@State('myAppointmentList') myAppointmentList!: ClientInfo[];
|
|
appointmentList: ClientInfo[] = [];
|
pageList: ClientInfo[] = [];
|
keyWord: string = '';
|
filterList: ClientInfo[] = [];
|
|
@Watch('myAppointmentList')
|
onMyAppointmentListChange() {
|
const unreadList = this.myAppointmentList
|
.filter(item => item.communicateStatus !== 'contacted' && !item.consultantReadTime)
|
.sort((a, b) => a.appointmentDate > b.appointmentDate ? -1 : 1);
|
|
const readList = this.myAppointmentList
|
.filter(item => item.communicateStatus !== 'contacted' && item.consultantReadTime)
|
.sort((a, b) => a.consultantReadTime > b.consultantReadTime ? -1 : 1)
|
|
this.appointmentList = unreadList.concat(readList);
|
this.filterList = this.appointmentList;
|
}
|
|
mounted() {
|
this.onMyAppointmentListChange();
|
}
|
|
changePage(pageList: ClientInfo[]) {
|
this.pageList = pageList;
|
}
|
|
search() {
|
this.filterList = this.appointmentList.filter(item => {
|
return item.name.match(this.keyWord) || item.requirement.match(this.keyWord)
|
})
|
}
|
|
}
|