保誠-保戶業務員媒合平台
Mila
2021-12-16 114a0d8e4d0bf9017e8b3e3b19065e2ce5ac9e80
Merge branch 'master' of https://192.168.0.10:8443/r/pcalife/PAM

# Conflicts:
# PAMapp/assets/ts/api/consultant.ts
修改4個檔案
新增1個檔案
177 ■■■■■ 已變更過的檔案
PAMapp/assets/ts/api/consultant.ts 22 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/appointment.model.ts 30 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/models/consultant.model.ts 28 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/services/query-consultant.service.ts 14 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/myConsultantList.vue 83 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/assets/ts/api/consultant.ts
@@ -155,19 +155,19 @@
}
export interface UserReviewsConsultantsParams{
    appointmentId:number,
    score:number,
    appointmentId: number,
    score        : number,
}
export interface editAppointmentParams {
    id: number,
    phone: string,
    email: string,
    contactType: string,
    gender: string,
    age: string,
    job: string,
    requirement: string,
    hopeContactTime: string,
    id              : number,
    phone           : string,
    email           : string,
    contactType     : string,
    gender          : string,
    age             : string,
    job             : string,
    requirement     : string,
    hopeContactTime : string,
    otherRequirement: null
}
PAMapp/assets/ts/models/appointment.model.ts
@@ -8,4 +8,32 @@
    score           : number,
    agentName       : string,
    customerName    : string,
}
}
export interface Appointment {
  id                 : number;
  phone?             : string;
  email?             : string;
  contactType        : string;
  gender             : string;
  age                : string;
  job                : string;
  requirement        : string;
  communicateStatus  : string;
  hopeContactTime    : string;
  otherRequirement?  : string;
  appointmentDate    : string;
  lastModifiedDate   : string;
  agentNo            : string;
  customerId         : number;
  name               : string;
  consultantViewTime?: string;
  consultantReadTime?: string;
  satisfactionScore? : number;
};
export interface AppointmentWithConsultantInfo extends Appointment {
  consultantName      : string;
  consultantAvatar    : string;
  consultantExpertList: string[]
  updateTime          : Date | string;
  contactStatus       : string;
}
PAMapp/assets/ts/models/consultant.model.ts
@@ -1,3 +1,5 @@
import { Appointment } from "./appointment.model";
export interface Consultant {
    agentNo            : string;
    name               : string;
@@ -13,25 +15,9 @@
    appointments?      : Appointment[];
}
export interface Appointment {
    id                 : number;
    phone?             : string;
    email?             : string;
    contactType        : string;
    gender             : string;
    age                : string;
    job                : string;
    requirement        : string;
    communicateStatus  : string;
    hopeContactTime    : string;
    otherRequirement?  : string;
    appointmentDate    : Date;
    lastModifiedDate   : Date;
    agentNo            : string;
    customerId         : number;
    name               : string;
    consultantViewTime?: Date;
    consultantReadTime?: Date;
    satisfactionScore? : number;
};
export interface ConsultantWithAppointmentId extends Consultant {
  appointmentId    : number;
  appointmentDate  : string;
  appointmentScore?: number;
}
PAMapp/assets/ts/services/query-consultant.service.ts
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,14 @@
import { http } from "./httpClient";
import { Consultant } from "../models/consultant.model";
class QueryConsultantService {
    // æŽ¨è–¦ä¿éšªé¡§å•
    async getRecommendConsultantList(): Promise<Consultant[]> {
      return http.get<Consultant[]>('/consultant/recommend').then((res) => res.data);
    }
}
export default new QueryConsultantService();
PAMapp/pages/myConsultantList.vue
@@ -4,14 +4,14 @@
            <div
                class="cus-tab-item"
                :class="{'is-active': activeTabName === 'consultantList'}"
                @click="tabClick('consultantList')"
                @click="clickTab('consultantList')"
            >顧問清單
                <span class="p">({{consultantList.length}})</span>
            </div>
            <div
                class="cus-tab-item"
                :class="{'is-active': activeTabName === 'contactedList'}"
                @click="tabClick('contactedList')"
                @click="clickTab('contactedList')"
            >已聯絡
                <span class="p">({{contactedList.length}})</span>
            </div>
@@ -26,25 +26,30 @@
<script lang='ts'>
import { Vue, Component, Watch, State, Action } from 'nuxt-property-decorator';
import { Consultant } from '~/assets/ts/models/consultant.model';
import { Consultant, ConsultantWithAppointmentId } from '~/assets/ts/models/consultant.model';
@Component
export default class myConsultantList extends Vue {
    activeTabName = 'consultantList';
    agents: Consultant[] = [];
    contactedList: Consultant[] = [];
    consultantList: Consultant[] = [];
    @State('myConsultantList') myConsultantList!: Consultant[];
    @Action storeConsultantList!: any;
    activeTabName = 'consultantList';
    consultantList: Consultant[] = [];
    contactedList: ConsultantWithAppointmentId[] = [];
    @State('myConsultantList')
    myConsultantList!: Consultant[];
    @Action
    storeConsultantList!: any;
    @Watch('myConsultantList')
    onMyConsultantListChange() {
        this.filterContactedList();
        this.setList();
    }
    //////////////////////////////////////////////////////////////////////
    beforeRouteEnter(to: any, from: any, next: any) {
      next(vm => {
      next((vm: any) => {
        if (to.name === 'myConsultantList') {
            vm.$router.push('myConsultantList/consultantList');
          return;
@@ -53,29 +58,55 @@
    }
    mounted() {
        this.storeConsultantList();
      this.storeConsultantList();
        if (this.$route.name) {
         this.activeTabName = this.$route.name.split('-')[1]
        }
      if (this.$route.name) {
        this.activeTabName = this.$route.name.split('-')[1]
      }
    }
    tabClick(path: string) {
    //////////////////////////////////////////////////////////////////////
    clickTab(path: string) {
        this.activeTabName = path;
        this.$router.push('/myConsultantList/' + this.activeTabName)
    }
    //////////////////////////////////////////////////////////////////////
    filterContactedList() {
    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 );
        this.contactedList = (this.myConsultantList || [])
                .filter(item => item.contactStatus === 'contacted')
                .map((item) => ({ ...item, formDate: new Date(item.updateTime)}))
                .sort((preItem, nextItem) => +nextItem.formDate - +preItem.formDate);
          .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) => {
            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);
              })
            }
          });
        this.contactedList = this.contactedList
          .filter((appointment) => appointment['contactStatus'] === 'contacted')
          .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentDate)}))
          .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime);
    }
}
</script>
</script>