¤ñ¹ï·sÀÉ®× |
| | |
| | | <template> |
| | | <div> |
| | | <el-input |
| | | type="text" |
| | | placeholder="è«è¼¸å
¥ééµå" |
| | | class="mb-30 pam-clientReserved-input" |
| | | v-model="keyWord" |
| | | @keyup.enter.native="search" |
| | | > |
| | | <i slot="suffix" class="icon-search search cursor--pointer" @click="search"></i> |
| | | </el-input> |
| | | |
| | | <ClientList |
| | | :clients="pageList" |
| | | :title="'reservedList'" |
| | | ></ClientList> |
| | | |
| | | <UiPagination |
| | | :totalList="filterList" |
| | | @changePage="changePage" |
| | | ></UiPagination> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component, State, Watch } from 'nuxt-property-decorator'; |
| | | |
| | | import { ClientInfo } from '~/shared/models/client.model'; |
| | | |
| | | @Component |
| | | export default class ClientReservedList extends Vue { |
| | | |
| | | @State('myAppointmentList') |
| | | myAppointmentList!: ClientInfo[]; |
| | | |
| | | appointmentList: ClientInfo[] = []; |
| | | pageList: ClientInfo[] = []; |
| | | keyWord: string = ''; |
| | | filterList: ClientInfo[] = []; |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |
| | | |
| | | mounted() { |
| | | this.onMyAppointmentListChange(); |
| | | } |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |
| | | |
| | | @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 tempViewList = this.myAppointmentList |
| | | .filter(item => item.communicateStatus !== 'contacted' && item.consultantViewTime); |
| | | |
| | | // TODO: å¾çºå¦ééå° unreadList åæ´ç´°ç·»çæåºï¼åéè«å¾ç«¯æä¾å¤æ·ä¾æï¼ä¾å¦ï¼ createTimeï¼ã[Tomas, 2021/12/16];Ã¥ |
| | | const unreadList = tempViewList.filter((item) => !item.consultantReadTime); |
| | | const readList = tempViewList |
| | | .filter((item) => item.consultantReadTime) |
| | | .map((item) => ({ ...item, sortTime: new Date(item.consultantReadTime)})) |
| | | .sort((preItem, nextItem) => +nextItem - +preItem); |
| | | |
| | | this.appointmentList = [...unViewList, ...unreadList, ...readList]; |
| | | this.filterList = this.appointmentList; |
| | | } |
| | | |
| | | search(): void { |
| | | this.filterList = this.appointmentList.filter(item => { |
| | | return item.name.match(this.keyWord) || item.requirement.match(this.keyWord) |
| | | }) |
| | | } |
| | | |
| | | changePage(pageList: ClientInfo[]): void { |
| | | this.pageList = pageList; |
| | | } |
| | | |
| | | } |
| | | </script> |