From 21d2b51910f1e1e338beed76d53effcfccb1ef7a Mon Sep 17 00:00:00 2001
From: Jack <jack.su@pollex.com.tw>
Date: 星期一, 24 一月 2022 16:47:57 +0800
Subject: [PATCH] Merge branch 'Phase3' of ssh://dev.pollex.com.tw:29418/pcalife/PAM into Phase3

---
 PAMapp/components/Client/ClientCard.vue |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/PAMapp/components/Client/ClientCard.vue b/PAMapp/components/Client/ClientCard.vue
index 294eb5f..0ff9748 100644
--- a/PAMapp/components/Client/ClientCard.vue
+++ b/PAMapp/components/Client/ClientCard.vue
@@ -213,6 +213,9 @@
     @appointmentStore.Action
     getAppointmentDetail!: (appointmentId: number) => Promise<Appointment>;
 
+    @appointmentStore.Action
+    updateAppointmentDetail!: (id: number) => Appointment;
+
     @appointmentStore.Getter
     appointmentProgress!: ContactStatus;
 
@@ -258,7 +261,10 @@
 
     viewAppointmentDetail(): void {
       this.getAppointmentDetail(this.client.id).then((_) => {
-        this.readAppointment();
+        const unread = !this.client.consultantReadTime;
+        if (unread) {
+          this.readAppointment();
+        }
         this.$router.push(`/appointment/${this.client.id}`);
       });
     }
@@ -277,7 +283,6 @@
         reviewsService.sendSatisfactionToClient(this.client.id).then(res => {
             this.isShowInviteReviewDialog = true ;
         })
-
     }
 
     openDetail() {
@@ -302,14 +307,12 @@
     }
 
     private readAppointment(): void {
-        const unread = !this.client.consultantReadTime;
-        if (unread) {
-            appointmentService.recordRead(this.client.id).then((_) => {
-                const updatedClient = {...this.client};
-                updatedClient.consultantReadTime = new Date().toString();
-                this.updateMyAppointmentList(updatedClient);
-            });
-        };
+      appointmentService.recordRead(this.client.id).then((_) => {
+          const updatedClient = {...this.client};
+          updatedClient.consultantReadTime = new Date().toString();
+          this.updateMyAppointmentList(updatedClient);
+          this.updateAppointmentDetail(this.client.id);
+      });
     }
 
     private clearAppointmentIdFromMsg() {

--
Gitblit v1.8.0