From 9bdb95c9e34cef640534e5e5a1e2225a80442000 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:48:15 +0800 Subject: [PATCH] TODO#139894 [ footer -最下方說明與保經代合作 ] 文案修改 --- PAMapp/pages/myAppointmentList/appointmentList.vue | 91 +++++++++++++++++++++++++++++++-------------- 1 files changed, 63 insertions(+), 28 deletions(-) diff --git a/PAMapp/pages/myAppointmentList/appointmentList.vue b/PAMapp/pages/myAppointmentList/appointmentList.vue index 8cee481..e623916 100644 --- a/PAMapp/pages/myAppointmentList/appointmentList.vue +++ b/PAMapp/pages/myAppointmentList/appointmentList.vue @@ -5,9 +5,9 @@ placeholder="隢撓���摮�" class="mb-30 pam-clientReserved-input" v-model="keyWord" - @keyup.enter.native="search" + @input="search" > - <i slot="suffix" class="icon-search search cursor--pointer" @click="search"></i> + <i slot="suffix" class="icon-search search cursor--pointer"></i> </el-input> <ClientList @@ -17,51 +17,86 @@ <UiPagination :totalList="filterList" + :currentPage="currentPage" @changePage="changePage" ></UiPagination> </div> </template> <script lang="ts"> -import { Vue, Component, State, Watch } from 'nuxt-property-decorator'; -import { ClientInfo } from '~/assets/ts/api/appointment'; +import { Vue, Component, 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'); +const appointmentStore = namespace('appointment.store'); @Component export default class ClientReservedList extends Vue { - @State('myAppointmentList') myAppointmentList!: ClientInfo[]; - appointmentList: ClientInfo[] = []; - pageList: ClientInfo[] = []; - keyWord: string = ''; - filterList: ClientInfo[] = []; + @appointmentStore.State('myAppointmentList') + myAppointmentList!: Appointment[]; - @Watch('myAppointmentList') - onMyAppointmentListChange() { - const unreadList = this.myAppointmentList - .filter(item => item.communicateStatus !== 'contacted' && !item.consultantReadTime) - .sort((a, b) => a.appointmentDate > b.appointmentDate ? -1 : 1); + @localStorage.Getter + currentAppointmentIdFromMsg!: string; - const readList = this.myAppointmentList - .filter(item => item.communicateStatus !== 'contacted' && item.consultantReadTime) - .sort((a, b) => a.consultantReadTime > b.consultantReadTime ? -1 : 1) + @appointmentStore.Action + getAppointmentDetail!: () => Promise<Appointment>; - this.appointmentList = unreadList.concat(readList); - this.filterList = this.appointmentList; - } + appointmentList: Appointment[] = []; + currentPage : number = 1; + filterList : Appointment[] = []; + keyWord : string = ''; + pageList : Appointment[] = []; + + contactStatus = ContactStatus; + + ////////////////////////////////////////////////////////////////////// mounted() { this.onMyAppointmentListChange(); } - changePage(pageList: ClientInfo[]) { + ////////////////////////////////////////////////////////////////////// + + @Watch('myAppointmentList') + onMyAppointmentListChange(): void { + this.appointmentList = this.myAppointmentList + .filter(item => item.communicateStatus === this.contactStatus.RESERVED) + .map((item) => ({ ...item, sortTime: new Date(item.lastModifiedDate)})) + .sort((preItem, nextItem) => +nextItem.sortTime - +preItem.sortTime); + + this.filterList = this.appointmentList; + + this.getCurrentPage(); + } + + private getCurrentPage() { + const currentIndex = this.filterList + .findIndex(item => item.id === +this.currentAppointmentIdFromMsg); + const pageSize = 5; + if (currentIndex > -1) { + this.currentPage = Math.ceil((currentIndex + 1) / pageSize); + } + } + + ////////////////////////////////////////////////////////////////////// + + search(): void { + if (this.keyWord) { + this.filterList = this.appointmentList.filter(item => { + return item.name.match(this.keyWord) || item.requirement.match(this.keyWord); + }) + } else { + this.filterList = this.appointmentList; + } + + } + + changePage(pageList: Appointment[]): void { this.pageList = pageList; } - search() { - this.filterList = this.appointmentList.filter(item => { - return item.name.match(this.keyWord) || item.requirement.match(this.keyWord) - }) - } - } -</script> \ No newline at end of file +</script> -- Gitblit v1.8.0