保誠-保戶業務員媒合平台
Tomas
2021-12-27 614f4074a7dfca7a5c887c54a10c649595e51358
page refactor: my-consultant-list
修改3個檔案
90 ■■■■■ 已變更過的檔案
PAMapp/pages/myConsultantList.vue 74 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList/consultantList.vue 8 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList/contactedList.vue 8 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList.vue
@@ -21,6 +21,7 @@
            :contactedList="contactedList"
            :consultantList="consultantList"
        ></NuxtChild>
    </div>
</template>
@@ -31,15 +32,15 @@
@Component
export default class myConsultantList extends Vue {
    activeTabName = 'consultantList';
    consultantList: Consultant[] = [];
    contactedList: ConsultantWithAppointmentId[] = [];
    @State('myConsultantList')
    myConsultantList!: Consultant[];
    @Action
    storeConsultantList!: any;
    activeTabName : string                        = 'consultantList';
    consultantList: Consultant[]                  = [];
    contactedList : ConsultantWithAppointmentId[] = [];
    //////////////////////////////////////////////////////////////////////
@@ -67,43 +68,44 @@
        this.setList();
    }
    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 );
    // format contacted list
      this.myConsultantList.filter((consultant) => consultant.appointments!.length)
        .forEach((consultant) => {
          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['appointmentStatus'] === 'contacted')
        .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentDate)}))
        .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime);
    }
    //////////////////////////////////////////////////////////////////////
    clickTab(path: string) {
        this.activeTabName = path;
        this.$router.push('/myConsultantList/' + this.activeTabName)
    }
    //////////////////////////////////////////////////////////////////////
    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 );
      // format contacted list
        this.myConsultantList.filter((consultant) => consultant.appointments!.length)
          .forEach((consultant) => {
            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['appointmentStatus'] === 'contacted')
          .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentDate)}))
          .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime);
    }
}
</script>
PAMapp/pages/myConsultantList/consultantList.vue
@@ -16,12 +16,16 @@
import { Vue, Component, Prop } from 'nuxt-property-decorator';
import { Consultant } from '~/shared/models/consultant.model';
@Component
export default class ConsultantPage extends Vue {
    @Prop() consultantList!: Consultant[];
    @Prop()
    consultantList!: Consultant[];
    pageList: Consultant[] = [];
    //////////////////////////////////////////////////////////////////////
    changePage(pageList: Consultant[]) {
        this.pageList = pageList;
    }
PAMapp/pages/myConsultantList/contactedList.vue
@@ -16,12 +16,16 @@
import { Vue, Component, Prop } from 'nuxt-property-decorator' ;
import { Consultant } from '~/shared/models/consultant.model';
@Component
export default class ContactedList extends Vue {
    @Prop() contactedList!: Consultant[];
    @Prop()
    contactedList!: Consultant[];
    pageList: Consultant[] = [];
    //////////////////////////////////////////////////////////////////////
    changePage(pageList: Consultant[]) {
        this.pageList = pageList;
    }