保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 9bdb95c9e34cef640534e5e5a1e2225a80442000
PAMapp/pages/myConsultantList.vue
@@ -37,6 +37,9 @@
    @State('myConsultantList')
    myConsultantList!: Consultant[];
    @State('myAppointmentGroupByConsultantList')
    myAppointmentGroupByConsultantList!: ConsultantWithAppointmentId[];
    @Action
    storeConsultantList!: any;
@@ -70,18 +73,26 @@
        this.setList();
    }
    @Watch('myAppointmentGroupByConsultantList')
    omMyAppointmentGroupByConsultantList() {
      this.setContactedList();
    }
    private setList() {
    // reset contacted list
      this.contactedList = [];
    // format consultant list
      this.consultantList = (this.myConsultantList || [])
        .filter(item => item.contactStatus !== 'contacted')
        .map((item) => ({ ...item, formatDate: new Date(item.updateTime || item.createTime)}))
        .sort((preItem, nextItem) => +nextItem.formatDate - +preItem.formatDate );
    }
    private setContactedList() {
      // reset contacted list
      this.contactedList = [];
      if (authService.isUserLogin()) {
        this.myConsultantList.filter((consultant) => consultant.appointments!.length)
        this.myAppointmentGroupByConsultantList.filter((consultant) => consultant.appointments!.length)
          .forEach((consultant) => {
            consultant.appointments!.forEach((appointment) => {
              const consultantWithAppointmentId: ConsultantWithAppointmentId = {
@@ -101,7 +112,6 @@
          .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentLastModifiedDate)}))
          .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime);
      }
    }
    //////////////////////////////////////////////////////////////////////