From 5e17ffe4ac5922abec6114d7da4c39f50d6768a6 Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期五, 14 一月 2022 12:45:15 +0800
Subject: [PATCH] update: 顧問-預約單列表調整為三個頁面籤的邏輯調整

---
 PAMapp/pages/myAppointmentList/appointmentList.vue |   16 +++++---
 PAMapp/components/Client/ClientList.vue            |   11 ++++-
 PAMapp/pages/myAppointmentList/closedList.vue      |    6 ++-
 PAMapp/components/Client/ClientCard.vue            |    2 
 PAMapp/pages/myAppointmentList.vue                 |   37 ++++++++++--------
 5 files changed, 43 insertions(+), 29 deletions(-)

diff --git a/PAMapp/components/Client/ClientCard.vue b/PAMapp/components/Client/ClientCard.vue
index 79dc475..5e3516e 100644
--- a/PAMapp/components/Client/ClientCard.vue
+++ b/PAMapp/components/Client/ClientCard.vue
@@ -30,7 +30,7 @@
                     </template>
                 </div>
                 <AppointmentProgress
-                  :currentStep="'contacted'"
+                  :currentStep="client.communicateStatus"
                 ></AppointmentProgress>
             </div>
         </div>
diff --git a/PAMapp/components/Client/ClientList.vue b/PAMapp/components/Client/ClientList.vue
index 2f8285c..820c043 100644
--- a/PAMapp/components/Client/ClientList.vue
+++ b/PAMapp/components/Client/ClientList.vue
@@ -28,9 +28,14 @@
     //////////////////////////////////////////////////////////////////////
 
     get noDataPlaceholder(): string {
-      return this.title === 'reservedList'
-                          ? '����撌脤��恥�'
-                          : '����撌脰蝯∪恥�';
+      let noDataWording = '����撌脩�����';
+      if (this.title === 'contactedList') {
+        noDataWording = '����蝝赤銝剔���';
+      }
+      if (this.title === 'reservedList') {
+        noDataWording = '������蝯∠���';
+      }
+      return noDataWording;
     }
 }
 </script>
diff --git a/PAMapp/pages/myAppointmentList.vue b/PAMapp/pages/myAppointmentList.vue
index 286ea92..0ced7e5 100644
--- a/PAMapp/pages/myAppointmentList.vue
+++ b/PAMapp/pages/myAppointmentList.vue
@@ -12,17 +12,17 @@
                 </div>
                 <div
                     class="cus-tab-item"
-                    :class="{'is-active': activeTabName === 'onProgressList'}"
-                    @click="clickTab('onProgressList')"
+                    :class="{'is-active': activeTabName === 'contactedList'}"
+                    @click="clickTab('contactedList')"
                 >
                   <span class="smTxt">蝝赤銝�({{ appointmentList.length }})</span>
                 </div>
                 <div
                     class="cus-tab-item"
-                    :class="{'is-active': activeTabName === 'contactedList'}"
-                    @click="clickTab('contactedList')"
+                    :class="{'is-active': activeTabName === 'closedList'}"
+                    @click="clickTab('closedList')"
                 >
-                  <span class="smTxt">蝯��({{ contactedList.length }})</span>
+                  <span class="smTxt">蝯��({{ closedList.length }})</span>
                 </div>
             </div>
 
@@ -53,6 +53,7 @@
 import * as _ from 'lodash';
 
 import { Appointment } from '~/shared/models/appointment.model';
+import { ContactStatus } from '~/shared/models/enum/contact-status';
 
 const localStorage = namespace('localStorage');
 
@@ -77,11 +78,12 @@
     @localStorage.Getter
     currentAppointmentIdFromMsg!: string;
 
-    activeTabName         : string       = 'appointmentList';
-    appointmentList       : Appointment[] = [];
-    clients               : Appointment[] = [];
-    contactedList         : Appointment[] = [];
-    showNewAppointmentHint: boolean      = false;
+    activeTabName          : string        = 'appointmentList';
+    appointmentList        : Appointment[] = [];
+    contactedList          : Appointment[] = [];
+    closedList             : Appointment[] = [];
+    contactStatus          = ContactStatus;
+    showNewAppointmentHint: boolean        = false;
 
     //////////////////////////////////////////////////////////////////////
 
@@ -97,23 +99,24 @@
 
     @Watch('myAppointmentList')
     onMyAppointmentListChange(): void {
-        this.contactedList = this.myAppointmentList
-            .filter(item => item.communicateStatus === 'contacted');
-
         this.appointmentList = this.myAppointmentList
-            .filter(item => item.communicateStatus !== 'contacted');
-
+            .filter(item => item.communicateStatus === this.contactStatus.RESERVED);
+        this.contactedList = this.myAppointmentList
+            .filter((item) => item.communicateStatus === this.contactStatus.CONTACTED);
+        this.closedList = this.myAppointmentList
+            .filter(item => item.communicateStatus === this.contactStatus.DONE || item.communicateStatus === this.contactStatus.CLOSE );
         if (this.currentAppointmentIdFromMsg) {
             this.redirectAppointmentStatus();
         }
     }
 
+    // TODO: 隤踵蝔�Ⅳ [Tomas, 2022/1/14 12:02]
     private redirectAppointmentStatus() {
         const currentAppointmentIndex = this.myAppointmentList
             .findIndex(item => item.id === +this.currentAppointmentIdFromMsg);
         if (currentAppointmentIndex > -1) {
             const communicateStatus = this.myAppointmentList[currentAppointmentIndex].communicateStatus;
-            const pathName = communicateStatus === 'reserved' ? 'appointmentList' : 'contactedList';
+            const pathName = communicateStatus === 'reserved' ? 'appointmentList' : 'closedList';
             this.$router.push(
                 {
                     path: '/myAppointmentList/' + pathName,
@@ -150,7 +153,7 @@
 
     // format to {page}-banner or pam-no-banner tag
     private routeFormatBannerClass(route: string): string {
-        const needBannerTags = ['myAppointmentList-appointmentList', 'myAppointmentList-contactedList'];
+        const needBannerTags = ['myAppointmentList-appointmentList', 'myAppointmentList-closedList'];
         return _.includes(needBannerTags, route) ? route + '-banner' : 'pam-no-banner';
     };
 }
diff --git a/PAMapp/pages/myAppointmentList/appointmentList.vue b/PAMapp/pages/myAppointmentList/appointmentList.vue
index 57e3080..f49be3a 100644
--- a/PAMapp/pages/myAppointmentList/appointmentList.vue
+++ b/PAMapp/pages/myAppointmentList/appointmentList.vue
@@ -27,6 +27,7 @@
 import { Vue, Component, State, Watch, namespace } from 'nuxt-property-decorator';
 
 import { Appointment } from '~/shared/models/appointment.model';
+import { ContactStatus } from '~/shared/models/enum/contact-status';
 
 
 const localStorage = namespace('localStorage');
@@ -44,6 +45,7 @@
     keyWord        : string       = '';
     pageList       : Appointment[] = [];
     currentPage    : number = 1;
+    contactStatus  = ContactStatus;
 
     //////////////////////////////////////////////////////////////////////
 
@@ -55,13 +57,14 @@
 
     @Watch('myAppointmentList')
     onMyAppointmentListChange(): void {
-      const unViewList = this.myAppointmentList
-          .filter((item) => item.communicateStatus !== 'contacted' && !item.consultantViewTime)
-          .map((item) => ({ ...item, sortTime: new Date(item.appointmentDate)}))
-          .sort((preItem, nextItem) => +nextItem.sortTime - +preItem.sortTime);
+      // const unViewList = this.myAppointmentList
+      //     .filter((item) => item.communicateStatus === 'contacted' && !item.consultantViewTime)
+      //     .map((item) => ({ ...item, sortTime: new Date(item.appointmentDate)}))
+      //     .sort((preItem, nextItem) => +nextItem.sortTime - +preItem.sortTime);
+
 
       const tempViewList = this.myAppointmentList
-          .filter(item => item.communicateStatus !== 'contacted' && item.consultantViewTime);
+          .filter(item => item.communicateStatus === this.contactStatus.RESERVED && item.consultantViewTime);
 
       // TODO: 敺������� unreadList ��蝝啁溶�������隢�垢����靘������ createTime嚗�Tomas, 2021/12/16];疇
       const unreadList = tempViewList
@@ -71,7 +74,8 @@
                     .map((item) => ({ ...item, sortTime: new Date(item.consultantReadTime)}))
                     .sort((preItem, nextItem) => +nextItem.sortTime - +preItem.sortTime);
 
-      this.appointmentList = [...unViewList, ...unreadList, ...readList];
+      this.appointmentList = [ ...unreadList, ...readList];
+      // this.appointmentList = [...unViewList, ...unreadList, ...readList];
       this.filterList = this.appointmentList;
 
       this.getCurrentPage();
diff --git a/PAMapp/pages/myAppointmentList/onProgressList.vue b/PAMapp/pages/myAppointmentList/closedList.vue
similarity index 90%
rename from PAMapp/pages/myAppointmentList/onProgressList.vue
rename to PAMapp/pages/myAppointmentList/closedList.vue
index e4de5e7..16cd405 100644
--- a/PAMapp/pages/myAppointmentList/onProgressList.vue
+++ b/PAMapp/pages/myAppointmentList/closedList.vue
@@ -16,7 +16,7 @@
 
         <ClientList
             :clients="pageList"
-            :title="'contactedList'"
+            :title="'closedList'"
         ></ClientList>
 
         <UiPagination
@@ -31,6 +31,7 @@
 import { Vue, Component, Watch, State, namespace } from 'nuxt-property-decorator';
 
 import { Appointment } from '~/shared/models/appointment.model';
+import { ContactStatus } from '~/shared/models/enum/contact-status';
 
 
 const localStorage = namespace('localStorage');
@@ -48,6 +49,7 @@
     keyWord      : string       = '';
     pageList     : Appointment[] = [];
     currentPage  : number = 1;
+    contactStatus= ContactStatus;
 
     //////////////////////////////////////////////////////////////////////
 
@@ -60,7 +62,7 @@
     @Watch('myAppointmentList')
     onMyAppointmentListChange() {
         this.contactedList = (this.myAppointmentList || [])
-            .filter(item => item.communicateStatus === 'contacted')
+            .filter(item => item.communicateStatus === this.contactStatus.DONE || item.communicateStatus === this.contactStatus.CLOSE)
             .map((item) => ({...item, sortTime: new Date(item.contactTime)}))
             .sort((prevItem, nextItem) => +nextItem.sortTime - +prevItem.sortTime);
         this.filterList = this.contactedList;

--
Gitblit v1.8.0