From db5614ba62f5855e5d7f7ed980c8630afc779343 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期一, 06 十二月 2021 10:59:04 +0800
Subject: [PATCH] update: TODO#131490 [預約清單]: 1. 顧問登入後通知新加入預約單有幾筆, 2. 增加新預約單與未讀樣式

---
 PAMapp/pages/myAppointmentList.vue |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/PAMapp/pages/myAppointmentList.vue b/PAMapp/pages/myAppointmentList.vue
index 3e99491..85a57da 100644
--- a/PAMapp/pages/myAppointmentList.vue
+++ b/PAMapp/pages/myAppointmentList.vue
@@ -21,12 +21,26 @@
 
             <NuxtChild></NuxtChild>
         </div>
+
+        <PopUpFrame
+             :isOpen.sync="showNewAppointmentNumber"
+        >
+            <div class="text--center mdTxt">
+                <p class="mb-50">雿�� <span class="text--primary">{{newAppointmentNumber}}</span> �������</p>
+                <div class="text--center">
+                    <el-button
+                        type="primary"
+                        @click="showNewAppointmentNumber = false"
+                    >������</el-button>
+                </div>
+            </div>
+        </PopUpFrame>
     </div>
 </template>
 
 <script lang="ts">
 import { Vue, Component, State, Action, Watch } from 'nuxt-property-decorator';
-import { ClientInfo } from '~/assets/ts/api/appointment';
+import { allAppointmentsView, ClientInfo } from '~/assets/ts/api/appointment';
 import * as _ from 'lodash';
 
 @Component({
@@ -37,12 +51,20 @@
     appointmentList: ClientInfo[] = [];
     contactedList: ClientInfo[] = [];
     clients: ClientInfo[] = [];
+    newAppointmentNumber: number = 0;
+    showNewAppointmentNumber = false;
 
     @State('myAppointmentList') myAppointmentList!: ClientInfo[];
-    @Action storeMyAppointmentList!: any;
+    @Action storeMyAppointmentList!: () => Promise<number>;
 
     mounted() {
-     this.storeMyAppointmentList();
+     this.storeMyAppointmentList().then(newDataLength => {
+         this.newAppointmentNumber = newDataLength;
+         if (this.newAppointmentNumber > 0) {
+             this.showNewAppointmentNumber = true;
+             allAppointmentsView().then(res => res);
+         }
+    });
 
      if (this.$route.name) {
          this.activeTabName = this.$route.name.split('-')[1]
@@ -52,11 +74,10 @@
     @Watch('myAppointmentList')
     onMyAppointmentListChange() {
         this.contactedList = this.myAppointmentList
-            .filter(item => item.communicateStatus === 'contacted')
-            .sort((a, b) => a.appointmentDate > b.appointmentDate ? -1 : 1);
+            .filter(item => item.communicateStatus === 'contacted');
+
         this.appointmentList = this.myAppointmentList
-            .filter(item => item.communicateStatus !== 'contacted')
-            .sort((a, b) => a.appointmentDate > b.appointmentDate ? -1 : 1);;
+            .filter(item => item.communicateStatus !== 'contacted');
     }
 
     tabClick(path: string) {

--
Gitblit v1.8.0