From d20d1ac8ed1efb5cc9c8453b843609a4b9a4babc Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期一, 24 一月 2022 10:52:31 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/Phase3' into Phase3

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

diff --git a/PAMapp/components/Client/ClientCard.vue b/PAMapp/components/Client/ClientCard.vue
index 294eb5f..e010af8 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,16 @@
 
     viewAppointmentDetail(): void {
       this.getAppointmentDetail(this.client.id).then((_) => {
-        this.readAppointment();
+        // setTimeout(() => {
+        //   const unread = !this.client.consultantReadTime;
+        //   if (unread) {
+        //     this.readAppointment();
+        //   }
+        // }, 0);
+        const unread = !this.client.consultantReadTime;
+        if (unread) {
+          this.readAppointment();
+        }
         this.$router.push(`/appointment/${this.client.id}`);
       });
     }
@@ -277,7 +289,6 @@
         reviewsService.sendSatisfactionToClient(this.client.id).then(res => {
             this.isShowInviteReviewDialog = true ;
         })
-
     }
 
     openDetail() {
@@ -302,14 +313,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