From 7ef236374431bf2a9ed74dc23e5909c6ef22932d Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期二, 04 一月 2022 18:03:30 +0800
Subject: [PATCH] fixed TODO#133629 標註為已連絡時使用API回傳的資料

---
 PAMapp/components/Client/ClientCard.vue         |   21 +++++++++++----------
 PAMapp/pages/myAppointmentList.vue              |    2 +-
 PAMapp/shared/services/my-consultant.service.ts |    8 +++-----
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/PAMapp/components/Client/ClientCard.vue b/PAMapp/components/Client/ClientCard.vue
index 3ddcfcf..25c5423 100644
--- a/PAMapp/components/Client/ClientCard.vue
+++ b/PAMapp/components/Client/ClientCard.vue
@@ -92,7 +92,7 @@
                     <div class="mdTxt">�摰寞�膩</div>
                     <div
                         class="smTxt text--bold text--primary cursor--pointer text--underline edit"
-                        @click='isEdit = !isEdit'
+                        @click='editMemo'
                     >蝺刻摩</div>
                 </div>
 
@@ -257,12 +257,7 @@
 
     markAppointment() {
         myConsultantService.markAsContact(this.client.id).then(data => {
-            // TODO: 閬敺����� updated client 鞈�� - Ben 2021/11/16
-            const updatedClient = {...this.client};
-            updatedClient.communicateStatus = 'contacted';
-            updatedClient.contactTime = new Date().toString();
-
-            this.updateMyAppointment(updatedClient);
+            this.updateMyAppointment(data);
             this.isVisibleDialog = false;
         })
     }
@@ -307,22 +302,28 @@
 
     private createMemo(params) {
         appointmentService.createMemo(params).then(memoRes => {
-            this.updateStoreMemo(memoRes);
+            this.storeMemo(memoRes);
         });
     }
 
     private updateMemo(params) {
         appointmentService.updateMemo(params).then(memoRes => {
-            this.updateStoreMemo(memoRes);
+            this.storeMemo(memoRes);
         });
     }
 
-    private updateStoreMemo(memoRes) {
+    private storeMemo(memoRes) {
         this.memoInfo = memoRes;
         this.memo = this.memoInfo.content;
+        this.client.appointmentMemoList[0] = this.memoInfo;
         this.isEdit = false;
     }
 
+    editMemo() {
+        this.isEdit = !this.isEdit;
+        this.memo = this.memoInfo.content;
+    }
+
     cancelEditMemo() {
         this.isEdit = false;
         this.memo = this.memoInfo.content;
diff --git a/PAMapp/pages/myAppointmentList.vue b/PAMapp/pages/myAppointmentList.vue
index a5b24cb..ea6c11b 100644
--- a/PAMapp/pages/myAppointmentList.vue
+++ b/PAMapp/pages/myAppointmentList.vue
@@ -121,7 +121,7 @@
       this.showNewAppointmentHint = this.newAppointmentSum > 0;
     }
 
-    @Watch('$route')
+    @Watch('$route', {immediate: true})
     onRouteChange() {
         const routeFullName = this.$route.name;
         if (routeFullName) {
diff --git a/PAMapp/shared/services/my-consultant.service.ts b/PAMapp/shared/services/my-consultant.service.ts
index c48821a..906f44d 100644
--- a/PAMapp/shared/services/my-consultant.service.ts
+++ b/PAMapp/shared/services/my-consultant.service.ts
@@ -2,6 +2,7 @@
 import { AgentInfo } from '~/shared/models/agent-info.model';
 import { Consultant } from "../models/consultant.model";
 import _ from "lodash";
+import { ClientInfo } from "../models/client.model";
 class MyConsultantService {
 
   async getFavoriteConsultantList(): Promise<Consultant[]> {
@@ -29,11 +30,8 @@
   }
 
   // 璅�撌脰蝯�
-  markAsContact(appointmentId: number): Promise<void> {
-    // TODO: 頝�垢蝣箄���ㄐ��� API 銝�府���� void, ���府���敺���� - Ben 2021/11/16
-    // return http.post('/appointment/markAsContacted/'+appointmentId, undefined, {headers})
-    //         .then(res => res.data)
-    return http.post(`/appointment/markAsContacted/${appointmentId}`);
+  markAsContact(appointmentId: number): Promise<ClientInfo> {
+    return http.post(`/appointment/markAsContacted/${appointmentId}`).then(res => res.data);
   }
 
   // ���“�����

--
Gitblit v1.8.0