From 0ecbccb5e5f04cec5dcd264293cd5a3091a6dc1a Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期一, 20 十二月 2021 13:53:23 +0800
Subject: [PATCH] fixed: [客戶] 我的顧問清單-已聯絡的 action btn 判斷錯誤

---
 PAMapp/components/Consultant/ConsultantCard.vue |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue
index 2b0ddc5..e930d83 100644
--- a/PAMapp/components/Consultant/ConsultantCard.vue
+++ b/PAMapp/components/Consultant/ConsultantCard.vue
@@ -82,13 +82,12 @@
                     </div>
                 </div>
 
-                <div v-if="agentInfo.contactStatus === 'contacted'
-                        && !appointmentDetail.satisfactionScore" class="dialogInfo-btn">
+                <div v-if="notScoreAppointmentYet" class="dialogInfo-btn">
                     <el-button type="primary"
                         @click.native="reviewsBtn = true">蝯虫�遛��漲閰��</el-button>
                 </div>
 
-                <div v-if="agentInfo.contactStatus === 'reserved'" class="text--center mt-10">
+                <div v-if="agentInfo.contactStatus === 'reserved' && !isAppointment" class="text--center mt-10">
                     <el-button @click="isCancelPopup = true">������</el-button>
                     <el-button @click="edit" type="primary">蝺刻摩</el-button>
                 </div>
@@ -179,8 +178,13 @@
     isConfirmPopup = false;
 
     get notScoreAppointmentYet(): boolean {
-      if (this.agentInfo.contactStatus !== 'contacted') return false;
+      const isAppointment = !!this.agentInfo['appointmentStatus'];
+      if (!isAppointment) return false;
       return !this.agentInfo['appointmentScore'];
+    }
+
+    get isAppointment(): boolean {
+      return !!this.agentInfo['appointmentStatus'];;
     }
 
     get latestReservedAppointment(): Appointment {
@@ -306,8 +310,9 @@
     //////////////////////////////////////////////////////////////////////
 
     reserveCommunication() {
-        const contactStatus = this.agentInfo.contactStatus;
-        if (!contactStatus || contactStatus === 'picked') {
+      const isAppointment = !!this.agentInfo['appointmentStatus'];
+      const contactStatus = this.agentInfo.contactStatus;
+        if (!isAppointment && (!contactStatus || contactStatus === 'picked')) {
             this.currentRole === Role.USER
                 ? this.$router.push(`/questionnaire/${this.agentInfo.agentNo}`)
                 : this.$router.push('/login');
@@ -316,15 +321,17 @@
         }
     }
 
-    openPopUp() {
-      const appointmentId = this.agentInfo.contactStatus === 'contacted'
+    openPopUp(): void {
+      const isAppointment = !!this.agentInfo['appointmentStatus'];
+      const appointmentId = isAppointment
                           ? this.agentInfo['appointmentId']
                           : this.latestReservedAppointment.id;
 
         getAppointmentDetail(appointmentId!).then(res => {
             this.appointmentDetail = {
                 ...this.appointmentDetail,
-                ...res.data
+                ...res.data,
+                satisfactionScore:  this.agentInfo['appointmentScore'],
             };
             this.width = isMobileDevice() ? '80%' : '';
             this.isVisibleDialog = true;

--
Gitblit v1.8.0