保誠-保戶業務員媒合平台
Mila
2021-12-22 bdae23a40c461c2c6b6ee614f661eac731c949c8
PAMapp/pages/myAppointmentList/contactedList.vue
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,73 @@
<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="'contactedList'"
        ></ClientList>
        <UiPagination
            :totalList="filterList"
            @changePage="changePage"
        ></UiPagination>
    </div>
</template>
<script lang="ts">
import { Vue, Component, Watch, State } from 'nuxt-property-decorator';
import { ClientInfo } from '~/shared/models/client.model';
@Component
export default class ClientContactedList extends Vue {
    @State('myAppointmentList')
    myAppointmentList!: ClientInfo[];
    @Watch('myAppointmentList')
    onMyAppointmentListChange() {
        this.contactedList = (this.myAppointmentList || [])
            .filter(item => item.communicateStatus === 'contacted')
            .map((item) => ({...item, sortTime: new Date(item.contactTime)}))
            .sort((prevItem, nextItem) => +nextItem - +prevItem);
        this.filterList = this.contactedList;
    }
    contactedList: ClientInfo[] = [];
    pageList: ClientInfo[] = [];
    keyWord: string = '';
    filterList: ClientInfo[] = [];
    //////////////////////////////////////////////////////////////////////
    mounted() {
        this.onMyAppointmentListChange();
    }
    //////////////////////////////////////////////////////////////////////
    search(): void {
        this.filterList = this.contactedList.filter(item => {
            return item?.name?.match(this.keyWord) || item?.requirement?.match(this.keyWord)
        })
    }
    changePage(pageList: ClientInfo[]): void {
        this.pageList = pageList;
    }
}
</script>