保誠-保戶業務員媒合平台
Mila
2022-01-20 65bceeecd461806e360970d7035f23bacbcc58b7
Merge branch 'Phase3' of https://192.168.0.10:8443/r/pcalife/PAM into Phase3
修改3個檔案
72 ■■■■ 已變更過的檔案
PAMapp/pages/myAppointmentList/contactedList.vue 49 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/shared/models/appointment.model.ts 15 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/shared/services/reviews.service.ts 8 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myAppointmentList/contactedList.vue
@@ -14,12 +14,17 @@
            ></i>
        </el-input>
        <div class="sort-indicator mb-10 text--primary text--underline cursor--pointer" @click="changeSortType">
          {{ this.sortType === 'DESC' ? '新->舊' : '舊->新' }}
        </div>
        <ClientList
            :clients="pageList"
            :title="'contactedList'"
        ></ClientList>
        <UiPagination
            v-if="togglePagination"
            :totalList="filterList"
            :currentPage="currentPage"
            @changePage="changePage"
@@ -28,7 +33,7 @@
</template>
<script lang="ts">
import { Vue, Component, Watch, State, namespace } from 'nuxt-property-decorator';
import { Vue, Component, Watch, namespace } from 'nuxt-property-decorator';
import { Appointment } from '~/shared/models/appointment.model';
@@ -45,11 +50,13 @@
    @localStorage.Getter
    currentAppointmentIdFromMsg!: string;
    contactedList: Appointment[] = [];
    filterList   : Appointment[] = [];
    keyWord      : string       = '';
    pageList     : Appointment[] = [];
    currentPage  : number = 1;
    contactedList   : Appointment[]  = [];
    currentPage      : number        = 1;
    filterList       : Appointment[] = [];
    keyWord          : string        = '';
    pageList         : Appointment[] = [];
    sortType        : 'ASC' | 'DESC' = 'DESC';
    togglePagination: boolean        = true;
    //////////////////////////////////////////////////////////////////////
@@ -61,16 +68,32 @@
    @Watch('myAppointmentList')
    onMyAppointmentListChange() {
      this.setContactedList();
    }
    @Watch('sortType')
    onSortTypeChange() {
      this.togglePagination = false;
      setTimeout(() => {
      this.togglePagination = true;
        this.currentPage = 1;
        this.setContactedList();
      }, 0)
    }
    private setContactedList(): void {
        this.contactedList = (this.myAppointmentList || [])
            .filter(item => item.communicateStatus === 'contacted')
            .map((item) => ({...item, sortTime: new Date(item.contactTime)}))
            .sort((prevItem, nextItem) => +nextItem.sortTime - +prevItem.sortTime);
            .map((item) => ({...item, sortTime: new Date(item.lastModifiedDate)}))
            .sort((prevItem, nextItem) => {
              return this.sortType === 'DESC' ? +nextItem.sortTime - +prevItem.sortTime : +prevItem.sortTime - +nextItem.sortTime
            });
        this.filterList = this.contactedList;
        this.getCurrentPage();
    }
    private getCurrentPage() {
    private getCurrentPage(): void {
        const currentIndex = this.filterList.findIndex(item => item.id === +this.currentAppointmentIdFromMsg);
        const pageSize = 5;
        if (currentIndex > -1) {
@@ -90,5 +113,13 @@
        this.pageList = pageList;
    }
    changeSortType(): void {
      if (this.sortType === 'DESC') {
        this.sortType = 'ASC';
      } else {
        this.sortType = 'DESC';
      }
    }
}
</script>
PAMapp/shared/models/appointment.model.ts
@@ -1,15 +1,16 @@
import { ContactStatus } from "./enum/contact-status";
export interface AppointmentLog {
    id              : number;
    createdDate     : string;
    lastModifiedDate: string;
    customerId      : number;
    agentNo         : string;
    status          : 'UNFILLED' | 'FILLED';
    score           : number;
    agentName       : string;
    agentNo         : string;
    appointmentId   : number;
    createdDate     : string;
    customerId      : number;
    customerName    : string;
    id              : number;
    lastModifiedDate: string;
    score           : number;
    status          : 'UNFILLED' | 'FILLED';
}
export interface Appointment {
PAMapp/shared/services/reviews.service.ts
@@ -7,12 +7,18 @@
  //客戶進行滿意度評分
  userReviewsConsultants(data: UserReviewsConsultantsParams) {
    return http.post('/satisfaction/create', data );
    return http.post('/satisfaction/score', data );
  }
  //取得所有評分紀錄
  async getMyReviewLog(): Promise<AppointmentLog[]> {
    return http.get('/satisfaction/getMySatisfaction').then(res => res.data);
  }
  // 顧問主動發送滿意度通知
  sendSatisfactionToClient(appointmentId: number): void {
    http.post('/consultant/sendSatisfactionToClient/').then((res) => res);
  }
}
export default new ReviewsService();