保誠-保戶業務員媒合平台
Mila
2021-12-22 bdae23a40c461c2c6b6ee614f661eac731c949c8
PAMapp/pages/myConsultantList.vue
@@ -26,7 +26,7 @@
<script lang='ts'>
import { Vue, Component, Watch, State, Action } from 'nuxt-property-decorator';
import { Consultant, ConsultantWithAppointmentId } from '~/assets/ts/models/consultant.model';
import { Consultant, ConsultantWithAppointmentId } from '~/shared/models/consultant.model';
@Component
export default class myConsultantList extends Vue {
@@ -40,11 +40,6 @@
    @Action
    storeConsultantList!: any;
    @Watch('myConsultantList')
    onMyConsultantListChange() {
        this.setList();
    }
    //////////////////////////////////////////////////////////////////////
@@ -67,6 +62,11 @@
    //////////////////////////////////////////////////////////////////////
    @Watch('myConsultantList')
    onMyConsultantListChange() {
        this.setList();
    }
    clickTab(path: string) {
        this.activeTabName = path;
        this.$router.push('/myConsultantList/' + this.activeTabName)
@@ -87,22 +87,20 @@
      // format contacted list
        this.myConsultantList.filter((consultant) => consultant.appointments!.length)
          .forEach((consultant) => {
            const hasAppointment = consultant.appointments?.length;
            if (hasAppointment) {
              consultant.appointments!.forEach((appointment) => {
                const consultantWithAppointmentId: ConsultantWithAppointmentId = {
                  ...consultant,
                  appointmentId: appointment.id,
                  appointmentDate: appointment.appointmentDate,
                  appointmentScore: appointment.satisfactionScore
                };
                this.contactedList.push(consultantWithAppointmentId);
              })
            }
            consultant.appointments!.forEach((appointment) => {
              const consultantWithAppointmentId: ConsultantWithAppointmentId = {
                ...consultant,
                appointmentId: appointment.id,
                appointmentDate: appointment.appointmentDate,
                appointmentScore: appointment.satisfactionScore,
                appointmentStatus: appointment.communicateStatus,
              };
              this.contactedList.push(consultantWithAppointmentId);
            })
          });
        this.contactedList = this.contactedList
          .filter((appointment) => appointment['contactStatus'] === 'contacted')
          .filter((appointment) => appointment['appointmentStatus'] === 'contacted')
          .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentDate)}))
          .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime);
    }