保誠-保戶業務員媒合平台
Tomas
2022-03-24 83757a31e7b1593d2cce267061722c259c0d5800
update: [客戶端] 我的顧問清單 refactoring (已聯絡清單使用新 api)
修改4個檔案
36 ■■■■ 已變更過的檔案
PAMapp/components/Consultant/ConsultantCard.vue 2 ●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList.vue 18 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/shared/services/my-consultant.service.ts 4 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/store/index.ts 12 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/components/Consultant/ConsultantCard.vue
@@ -1,6 +1,6 @@
<template>
    <div>
        <el-row type="flex" class="rowStyle" :class="{'new': !agentInfo.customerViewTime }">
        <el-row type="flex" class="rowStyle" :class="{'new': !agentInfo.customerViewTime && $route.name !== 'myConsultantList-contactedList' }">
            <el-col class="flex_column pl-5" :xs="5" :sm="3">
                <UiAvatar
                    :size="50"
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);
      }
    }
    //////////////////////////////////////////////////////////////////////
PAMapp/shared/services/my-consultant.service.ts
@@ -16,6 +16,10 @@
    });
  }
  async getAllGroupByConsultant(): Promise<Consultant[]> {
    return http.get<Consultant[]>('/appointment/customer/get_all_group_by_consultant').then((res) => res.data);
  }
  private viewMyConsultantList(): void {
    http.post('/consultant/favorite/view');
  }
PAMapp/store/index.ts
@@ -3,7 +3,7 @@
import myConsultantService from '~/shared/services/my-consultant.service';
import queryConsultantService, { AddFavoriteConsultantItem } from '~/shared/services/query-consultant.service';
import reviewsService from '~/shared/services/reviews.service';
import { Consultant } from '~/shared/models/consultant.model';
import { Consultant, ConsultantWithAppointmentId } from '~/shared/models/consultant.model';
import { getFavoriteFromStorage, setFavoriteToStorage } from '~/shared/storageConsultant';
import { AppointmentLog } from '~/shared/models/appointment.model';
import { AgentOfStrictQuery, StrictQueryParams } from '~/shared/models/strict-query.model';
@@ -14,6 +14,7 @@
    recommendList: Consultant[] = [];
    strictQueryList: AgentOfStrictQuery[] = [];
    myConsultantList: Consultant[] = [];
    myAppointmentGroupByConsultantList: ConsultantWithAppointmentId[] = [];
    reviewLogList: AppointmentLog[] = [];
    unReviewLogList: AppointmentLog[] = [];
@@ -60,6 +61,11 @@
        this.notificationList = data;
    }
    @Mutation
    updateAppointmentGroupByConsultantList(data: ConsultantWithAppointmentId[]) {
      this.myAppointmentGroupByConsultantList = data;
    }
    @Action
    storeRecommendList() {
        queryConsultantService.getRecommendConsultantList().then(data => {
@@ -87,6 +93,10 @@
        myConsultantService.getFavoriteConsultantList().then(data => {
            this.context.commit('updateConsultantList', data);
        })
        myConsultantService.getAllGroupByConsultant().then((data) => {
          this.context.commit('updateAppointmentGroupByConsultantList', data);
        })
    }
    @Action