保誠-保戶業務員媒合平台
HelenHuang
2021-12-06 9cb6d5f92ad7aeda45ad1fe6482dcfc63d17be2b
PAMapp/pages/myAppointmentList/appointmentList.vue
@@ -5,6 +5,7 @@
            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>
@@ -22,18 +23,34 @@
</template>
<script lang="ts">
import { Vue, Component, Prop } from 'nuxt-property-decorator';
import { Vue, Component, State, Watch } from 'nuxt-property-decorator';
import { ClientInfo } from '~/assets/ts/api/appointment';
@Component
export default class ClientReservedList extends Vue {
    @Prop({default: []}) appointmentList!: ClientInfo[];
    @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.consultantViewTime > b.consultantViewTime ? 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.filterList = JSON.parse(JSON.stringify(this.appointmentList))
        this.onMyAppointmentListChange();
    }
    changePage(pageList: ClientInfo[]) {