保誠-保戶業務員媒合平台
Tomas
2021-12-16 30c810800159df369d75fc59637a15977c14ed7a
fixed: [顧問-預約單列表] 加入 viewTime 機制
修改3個檔案
31 ■■■■ 已變更過的檔案
PAMapp/assets/ts/services/appointment.service.ts 12 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myAppointmentList.vue 7 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myAppointmentList/appointmentList.vue 12 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/services/appointment.service.ts
@@ -6,7 +6,17 @@
  // 取得所有預約清單
  async getMyAppointmentList(): Promise<ClientInfo[]> {
    return http.get('/consultant/getMyAppointment').then(res => res.data);
    return http.get('/consultant/getMyAppointment').then((res) => {
      const hasNewAppointment = res.data.find((appointment: ClientInfo) => !appointment.consultantViewTime);
      if (hasNewAppointment) {
        this.viewAllAppointment();
      }
      return res.data;
    });
  }
  private viewAllAppointment(): void {
    http.post('/consultant/record/allAppointmentsView').then();
  }
  // 標記為已聯絡
PAMapp/pages/myAppointmentList.vue
@@ -20,6 +20,7 @@
            </div>
            <NuxtChild></NuxtChild>
        </div>
        <!-- DIALOG -->
@@ -67,6 +68,11 @@
    @State('myNewAppointmentSum')
    newAppointmentSum!: number;
    @Watch('newAppointmentSum')
    newAppointmentSumChange(): void {
      this.showNewAppointmentHint = this.newAppointmentSum > 0;
    }
    activeTabName = 'appointmentList';
    appointmentList: ClientInfo[] = [];
    contactedList: ClientInfo[] = [];
@@ -83,7 +89,6 @@
    mounted() {
      this.setActivatedTab();
      this.storeMyAppointmentList();
      this.showNewAppointmentHint = this.newAppointmentSum > 0;
    }
    //////////////////////////////////////////////////////////////////////
PAMapp/pages/myAppointmentList/appointmentList.vue
@@ -48,17 +48,17 @@
    @Watch('myAppointmentList')
    onMyAppointmentListChange(): void {
      const unreadList = this.myAppointmentList
          .filter((item) => item.communicateStatus !== 'contacted' && !item.consultantReadTime)
      const unViewList = this.myAppointmentList
          .filter((item) => item.communicateStatus !== 'contacted' && !item.consultantViewTime)
          .map((item) => ({ ...item, sortTime: new Date(item.appointmentDate)}))
          .sort((preItem, nextItem) => +nextItem.sortTime - +preItem.sortTime);
      const readList = this.myAppointmentList
          .filter(item => item.communicateStatus !== 'contacted' && item.consultantReadTime)
          .map((item) => ({ ...item, sortTime: new Date(item.consultantReadTime)}))
      const viewList = this.myAppointmentList
          .filter(item => item.communicateStatus !== 'contacted' && item.consultantViewTime)
          .map((item) => ({ ...item, sortTime: new Date(item.consultantViewTime)}))
          .sort((preItem, nextItem) => +nextItem.sortTime - +preItem.sortTime);
      this.appointmentList = unreadList.concat(readList);
      this.appointmentList = [...unViewList, ...viewList];
      this.filterList = this.appointmentList;
    }