<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 '~/assets/ts/api/appointment';
|
|
@Component
|
export default class ClientContactedList extends Vue {
|
@State('myAppointmentList') myAppointmentList!: ClientInfo[];
|
|
contactedList: ClientInfo[] = [];
|
pageList: ClientInfo[] = [];
|
keyWord: string = '';
|
filterList: ClientInfo[] = [];
|
|
@Watch('myAppointmentList')
|
onMyAppointmentListChange() {
|
this.contactedList = (this.myAppointmentList || [])
|
.filter(item => item.communicateStatus === 'contacted')
|
.sort((a, b) => a.contactTime > b.contactTime ? -1 : 1);
|
this.filterList = this.contactedList;
|
}
|
|
mounted() {
|
this.onMyAppointmentListChange();
|
}
|
|
changePage(pageList: ClientInfo[]) {
|
this.pageList = pageList;
|
}
|
|
search() {
|
this.filterList = this.contactedList.filter(item => {
|
return item.name.match(this.keyWord) || item.requirement.match(this.keyWord)
|
})
|
}
|
}
|
</script>
|