From f7590abfcbb4db299a54aeeeb422d53560e61288 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期二, 03 五月 2022 16:44:34 +0800
Subject: [PATCH] Fixed#138373 修正 [客戶_編輯預約單]客戶已以Email方式註冊並完成預約單後,再次編輯預約單補充手機資訊。此時手機方便聯絡時間無法編輯的狀況

---
 PAMapp/pages/questionnaire/_agentNo.vue |   43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/PAMapp/pages/questionnaire/_agentNo.vue b/PAMapp/pages/questionnaire/_agentNo.vue
index 2631fea..76fa04d 100644
--- a/PAMapp/pages/questionnaire/_agentNo.vue
+++ b/PAMapp/pages/questionnaire/_agentNo.vue
@@ -166,8 +166,9 @@
 import { Gender } from '~/shared/models/enum/Gender';
 import { RegisterInfo } from '~/shared/models/registerInfo';
 import { AppointmentParams, AppointmentRequests } from '~/shared/models/appointment.model';
-import { UserReviewPlatformParams } from '~/shared/models/reviews.model';
 import { UserSetting } from '~/shared/models/account.model';
+import { SatisfactionType } from '~/shared/models/enum/satisfaction-type';
+import { UserReviewParams } from '~/shared/models/reviews.model';
 
   const roleStorage = namespace('localStorage');
   @Component
@@ -335,7 +336,6 @@
     private setMyRequest(): void {
       const storageMyRequest = getRequestsFromStorage();
       const storageMyRequirement = this.recommendConsultantItem ? JSON.parse(this.recommendConsultantItem).requirements:[];
-      const contactTypePromise = accountSettingService.getUserAccountSetting();
 
       if (storageMyRequest) {
         this.myRequest = {
@@ -357,12 +357,15 @@
         removeRequestQuestionFromStorage();
       }
 
-      contactTypePromise.then((contactTypeDetail) => {
-            this.myRequest = {
-              ...this.myRequest,
-              ...contactTypeDetail
-            }
-      })
+      if (authService.isUserLogin()) {
+        accountSettingService.getUserAccountSetting().then((contactTypeDetail) => {
+              this.myRequest = {
+                ...this.myRequest,
+                ...contactTypeDetail
+              }
+        })
+      }
+
 
     }
 
@@ -399,19 +402,20 @@
 
     private getReservedData(appointmentInfo) {
       if (appointmentInfo) {
-        const hopeContactTime = appointmentInfo!.hopeContactTime.split("'")
-              .filter(item => item && item !== ',');
-        this.getAppointmentId(appointmentInfo);
-
-        return {
-            ...appointmentInfo,
-            hopeContactTime: hopeContactTime.map(item => {
+        const hopeContactTime = appointmentInfo!.hopeContactTime 
+          ?  appointmentInfo!.hopeContactTime.split("'").filter(item => item && item !== ',').map(item => {
                 const info = item.split('��');
                 return {
                     selectWeekOptions: info[0].split(','),
                     selectTimesOptions: info[1].split(',')
                 }
-            }),
+            })
+          :[{selectWeekOptions : [],selectTimesOptions: []}];
+        this.getAppointmentId(appointmentInfo);
+
+        return {
+            ...appointmentInfo,
+            hopeContactTime: hopeContactTime,
             requirement: appointmentInfo.requirement.split(',')
           }
       } else {
@@ -432,7 +436,7 @@
       if (this.isEditBtn) {
         this.editAppointmentDemand();
       } else {
-        queryConsultantService.addFavoriteConsultant([this.$route.params.agentNo]).then(res => this.sentAppointmentDemand());
+        queryConsultantService.addFavoriteConsultant([{ agentNo: this.$route.params.agentNo, createdTime: new Date().toISOString()}]).then(res => this.sentAppointmentDemand());
       }
        const editSettingInfo: UserSetting = {
           name: this.myRequest.name,
@@ -484,9 +488,10 @@
     }
 
     reviewPlatform(): void {
-      const reviewPlatformParams: UserReviewPlatformParams = {
+      const reviewPlatformParams: UserReviewParams = {
         appointmentId: this.appointmentId,
-        score: this.score
+        score: this.score,
+        type: SatisfactionType.SYSTEM
       };
       reviewsService.reviewPlatform(reviewPlatformParams).then((_) => {
         this.closeReservePopUp();

--
Gitblit v1.8.0