From 98a92f7083e4ca742340b8f01abe46ea8278c490 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 十二月 2021 15:22:10 +0800 Subject: [PATCH] fixed TODO#132182 [我的顧問清單] 新增顧問後,最新一筆的顧問應顯示加入的時間,目前未顯示 --- PAMapp/components/Consultant/ConsultantCard.vue | 54 +++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 37 insertions(+), 17 deletions(-) diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue index 1d59d39..78c7153 100644 --- a/PAMapp/components/Consultant/ConsultantCard.vue +++ b/PAMapp/components/Consultant/ConsultantCard.vue @@ -17,8 +17,8 @@ {{ latestContactedAppointment && latestContactedAppointment.satisfactionScore}} </span> <div class="unfilled text--center " - style="display:flex" - v-if="agentInfo.contactStatus === 'contacted' && + style="display:flex" + v-if="agentInfo.contactStatus === 'contacted' && latestContactedAppointment && !latestContactedAppointment.satisfactionScore">�憛�<br />皛踵�漲</div> <span v-if="agentInfo.contactStatus !== 'contacted'">{{ agentInfo.avgScore }}</span> </div> @@ -45,7 +45,9 @@ @click="reserveCommunication" :class="agentInfo.contactStatus + 'Btn'" >{{ contactTxt }}</el-button> - <div class="updateTime" v-if="updateTime">{{updateTime | formatDate}}</div> + <div class="updateTime"> + {{ displayTime | formatDate }} + </div> </el-col> </el-row> </el-col> @@ -72,14 +74,14 @@ :key="index" >��蝯⊥�挾{{index + 1 | formatNumber}}嚗{ item | formatHopeContactTime }}</p> <div v-if="appointmentDetail.satisfactionScore"> - <div class="mdTxt mt-10 mb-10">皛踵�漲</div> - <el-rate + <div class="mdTxt mt-10 mb-10">皛踵�漲</div> + <el-rate :value="appointmentDetail.satisfactionScore" class="pam-myDemand-dialog__rate" disabled> - </el-rate> + </el-rate> + </div> </div> - </div> <div v-if="agentInfo.contactStatus === 'contacted' && !appointmentDetail.satisfactionScore" class="dialogInfo-btn"> @@ -168,7 +170,28 @@ get latestReservedAppointment(): Appointment { return this.agentInfo.appointments! .filter((appointment) => appointment.communicateStatus !== 'contacted') - .sort((preAppointment, nextAppointment) => +nextAppointment.appointmentDate - +preAppointment.appointmentDate)[0]; + .map((reversedAppointment) => { + return { + ...reversedAppointment, + sortDate: new Date(reversedAppointment.appointmentDate) + } + }) + .sort((preAppointment, nextAppointment) => +nextAppointment.sortDate - +preAppointment.sortDate)[0]; + } + get displayTime(): string { + let time = ''; + switch(this.agentInfo.contactStatus) { + case 'reserved': + time = this.agentInfo.updateTime + break; + case 'contacted': + time = this.agentInfo.updateTime + break; + case 'picked': + time = this.agentInfo.createTime + break; + } + return time; } appointmentDetail: any = { @@ -214,10 +237,6 @@ return '�脰����'; } - get updateTime() { - return isLogin() ? this.agentInfo.updateTime : ''; - } - get hopeContactTime() { const contactList = this.appointmentDetail.hopeContactTime .split("'").map(item => item.slice(0, item.length)); @@ -236,9 +255,11 @@ } openPopUp() { - getAppointmentDetail(this.latestContactedAppointment - ? this.latestContactedAppointment.id - : this.latestReservedAppointment.id).then(res => { + const appointmentId = this.agentInfo.contactStatus === 'contacted' + ? this.latestContactedAppointment?.id + : this.latestReservedAppointment.id; + + getAppointmentDetail(appointmentId!).then(res => { this.appointmentDetail = { ...this.appointmentDetail, ...res.data @@ -310,7 +331,6 @@ .unfilled { font-size: 12px; padding-top: 5px; - padding-bottom: 5px; padding-left: 5px; } @@ -386,4 +406,4 @@ margin-bottom: 50px; } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0