From 7c2808237b145f18eeb2c6e06c206451352d614e Mon Sep 17 00:00:00 2001 From: Mila <Mila@pollex.com.tw> Date: 星期二, 21 十二月 2021 12:27:37 +0800 Subject: [PATCH] Merge branch 'master' of https://192.168.0.10:8443/r/pcalife/PAM --- PAMapp/components/Consultant/ConsultantCard.vue | 87 ++++++++++++++++++++++--------------------- 1 files changed, 45 insertions(+), 42 deletions(-) diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue index e930d83..8531755 100644 --- a/PAMapp/components/Consultant/ConsultantCard.vue +++ b/PAMapp/components/Consultant/ConsultantCard.vue @@ -127,15 +127,17 @@ </template> <script lang="ts"> -import { Vue, Component, Prop, Action, namespace } from 'nuxt-property-decorator'; -import { getAppointmentDetail, UserReviewsConsultantsParams, userReviewsConsultants, cancelAppointment } from '~/assets/ts/api/consultant'; +import { Vue, Component, Prop, Action, namespace, State } from 'nuxt-property-decorator'; + +import appointmentService from '~/assets/ts/services/appointment.service'; +import { isMobileDevice } from '~/assets/ts/device'; +import { hideReviews } from '~/assets/ts/const/hide-reviews'; +import { UserReviewsConsultantsParams, userReviewsConsultants } from '~/assets/ts/api/consultant'; import { Consultant, ConsultantWithAppointmentId } from '~/assets/ts/models/consultant.model'; import { Appointment } from '~/assets/ts/models/appointment.model'; -import { isMobileDevice } from '~/assets/ts/device'; -import { Role } from '~/assets/ts/models/enum/Role'; -import { hideReviews } from '~/assets/ts/const/hide-reviews'; +import { Role } from '~/assets/ts/models/enum/role'; -const roleStorage = namespace('localStorage'); +const localStorage = namespace('localStorage'); @Component({ filters: { formatNumber(index: number) { @@ -157,16 +159,11 @@ }) export default class ConsultantCard extends Vue { - @Action - removeFromMyConsultantList!: (agentNo: string) => Promise<boolean>; - - @Action - storeConsultantList!: any; - @Prop() agentInfo!: Consultant | ConsultantWithAppointmentId; - @roleStorage.Getter currentRole!:string; + @localStorage.State('current_role') + currentRole!: string; isVisibleDialog = false; reviewsBtn = false; @@ -176,6 +173,30 @@ isCancelPopup = false; hideReviews = hideReviews; isConfirmPopup = false; + + + appointmentDetail: any = { + age : '', + agentNo : '', + appointmentDate : '', + communicateStatus : '', + consultantReadTime: null, + consultantViewTime: null, + contactTime : '', + contactType : '', + customerId : 0, + email : '', + gender : '', + hopeContactTime : "", + id : 0, + job : "", + lastModifiedDate : '', + name : '', + otherRequirement : null, + phone : "", + requirement : '', + satisfactionScore : 0, + }; get notScoreAppointmentYet(): boolean { const isAppointment = !!this.agentInfo['appointmentStatus']; @@ -229,29 +250,6 @@ return time as string; } - appointmentDetail: any = { - age : '', - agentNo : '', - appointmentDate : '', - communicateStatus : '', - consultantReadTime: null, - consultantViewTime: null, - contactTime : '', - contactType : '', - customerId : 0, - email : '', - gender : '', - hopeContactTime : "", - id : 0, - job : "", - lastModifiedDate : '', - name : '', - otherRequirement : null, - phone : "", - requirement : '', - satisfactionScore : 0, - }; - get avatarFileName() { return this.agentInfo.img; } @@ -303,11 +301,17 @@ get hopeContactTime() { const contactList = this.appointmentDetail.hopeContactTime - .split("'").map(item => item.slice(0, item.length)); - return contactList.filter(item => !!item && item !== ",") + .split("'").map((item: any) => item.slice(0, item.length)); + return contactList.filter((item: any) => !!item && item !== ",") } ////////////////////////////////////////////////////////////////////// + + @Action + removeFromMyConsultantList!: (agentNo: string) => Promise<boolean>; + + @Action + storeConsultantList!: () => void; reserveCommunication() { const isAppointment = !!this.agentInfo['appointmentStatus']; @@ -327,10 +331,9 @@ ? this.agentInfo['appointmentId'] : this.latestReservedAppointment.id; - getAppointmentDetail(appointmentId!).then(res => { + appointmentService.getAppointmentDetail(appointmentId!).then(res => { this.appointmentDetail = { - ...this.appointmentDetail, - ...res.data, + ...res, satisfactionScore: this.agentInfo['appointmentScore'], }; this.width = isMobileDevice() ? '80%' : ''; @@ -361,7 +364,7 @@ } cancel() { - cancelAppointment(this.latestReservedAppointment.id).then(res => { + appointmentService.cancelAppointment(this.latestReservedAppointment.id).then(res => { this.storeConsultantList(); this.isVisibleDialog = false; this.isCancelPopup = false; -- Gitblit v1.8.0