From b4d6944076f1df6eedaae35c4c2a7072fe988e8a Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期二, 30 四月 2024 15:34:02 +0800
Subject: [PATCH] update: package-lock.json

---
 PAMapp/pages/myConsultantList.vue |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/PAMapp/pages/myConsultantList.vue b/PAMapp/pages/myConsultantList.vue
index c712c9a..6914ee7 100644
--- a/PAMapp/pages/myConsultantList.vue
+++ b/PAMapp/pages/myConsultantList.vue
@@ -37,6 +37,9 @@
     @State('myConsultantList')
     myConsultantList!: Consultant[];
 
+    @State('myAppointmentGroupByConsultantList')
+    myAppointmentGroupByConsultantList!: ConsultantWithAppointmentId[];
+
     @Action
     storeConsultantList!: any;
 
@@ -70,18 +73,26 @@
         this.setList();
     }
 
+    @Watch('myAppointmentGroupByConsultantList')
+    omMyAppointmentGroupByConsultantList() {
+      this.setContactedList();
+    }
+
     private setList() {
-    // reset contacted list
-      this.contactedList = [];
 
     // format consultant list
       this.consultantList = (this.myConsultantList || [])
         .filter(item => item.contactStatus !== 'contacted')
         .map((item) => ({ ...item, formatDate: new Date(item.updateTime || item.createTime)}))
         .sort((preItem, nextItem) => +nextItem.formatDate - +preItem.formatDate );
+    }
+
+    private setContactedList() {
+      // reset contacted list
+      this.contactedList = [];
 
       if (authService.isUserLogin()) {
-        this.myConsultantList.filter((consultant) => consultant.appointments!.length)
+        this.myAppointmentGroupByConsultantList.filter((consultant) => consultant.appointments!.length)
           .forEach((consultant) => {
             consultant.appointments!.forEach((appointment) => {
               const consultantWithAppointmentId: ConsultantWithAppointmentId = {
@@ -90,17 +101,17 @@
                 appointmentDate: appointment.appointmentDate,
                 appointmentScore: appointment.satisfactionScore,
                 appointmentStatus: appointment.communicateStatus,
+                appointmentLastModifiedDate: appointment.lastModifiedDate
               };
               this.contactedList.push(consultantWithAppointmentId);
             })
           });
 
         this.contactedList = this.contactedList
-          .filter((appointment) => appointment['appointmentStatus'] === 'contacted')
-          .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentDate)}))
+          .filter((appointment) => appointment['appointmentStatus'] !== 'reserved')
+          .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentLastModifiedDate)}))
           .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime);
       }
-
     }
 
     //////////////////////////////////////////////////////////////////////

--
Gitblit v1.8.0