| | |
| | | import { Vue, Component, State, Watch, namespace } from 'nuxt-property-decorator'; |
| | | |
| | | import { Appointment } from '~/shared/models/appointment.model'; |
| | | import { ContactStatus } from '~/shared/models/enum/contact-status'; |
| | | |
| | | |
| | | const localStorage = namespace('localStorage'); |
| | |
| | | keyWord : string = ''; |
| | | pageList : Appointment[] = []; |
| | | currentPage : number = 1; |
| | | contactStatus = ContactStatus; |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |
| | | |
| | |
| | | |
| | | @Watch('myAppointmentList') |
| | | onMyAppointmentListChange(): void { |
| | | const unViewList = this.myAppointmentList |
| | | .filter((item) => item.communicateStatus !== 'contacted' && !item.consultantViewTime) |
| | | .map((item) => ({ ...item, sortTime: new Date(item.appointmentDate)})) |
| | | .sort((preItem, nextItem) => +nextItem.sortTime - +preItem.sortTime); |
| | | // const unViewList = this.myAppointmentList |
| | | // .filter((item) => item.communicateStatus === 'contacted' && !item.consultantViewTime) |
| | | // .map((item) => ({ ...item, sortTime: new Date(item.appointmentDate)})) |
| | | // .sort((preItem, nextItem) => +nextItem.sortTime - +preItem.sortTime); |
| | | |
| | | |
| | | const tempViewList = this.myAppointmentList |
| | | .filter(item => item.communicateStatus !== 'contacted' && item.consultantViewTime); |
| | | .filter(item => item.communicateStatus === this.contactStatus.RESERVED && item.consultantViewTime); |
| | | |
| | | // TODO: 後續如需針對 unreadList 做更細緻的排序,則需請後端提供判斷依據(例如: createTime)。[Tomas, 2021/12/16];å |
| | | const unreadList = tempViewList |
| | |
| | | .map((item) => ({ ...item, sortTime: new Date(item.consultantReadTime)})) |
| | | .sort((preItem, nextItem) => +nextItem.sortTime - +preItem.sortTime); |
| | | |
| | | this.appointmentList = [...unViewList, ...unreadList, ...readList]; |
| | | this.appointmentList = [ ...unreadList, ...readList]; |
| | | // this.appointmentList = [...unViewList, ...unreadList, ...readList]; |
| | | this.filterList = this.appointmentList; |
| | | |
| | | this.getCurrentPage(); |