From dd0fdd6c956782b5cbc0700c15d239200d8f0120 Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期二, 05 九月 2023 14:02:02 +0800
Subject: [PATCH] Fixed: PAM_0901_P6

---
 PAMapp/pages/questionnaire/_agentNo.vue |   61 ++++++++++++++++++++++++------
 1 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/PAMapp/pages/questionnaire/_agentNo.vue b/PAMapp/pages/questionnaire/_agentNo.vue
index 4e55158..7e7c52e 100644
--- a/PAMapp/pages/questionnaire/_agentNo.vue
+++ b/PAMapp/pages/questionnaire/_agentNo.vue
@@ -78,6 +78,12 @@
           :options="requirementOptions" />
       </div>
       <div class="pam-paragraph">
+        <div class="mdTxt">隢株岷�撘�</div>
+        <SingleSelectBtn class="mt-10"
+           :singleSelected.sync="myRequest.consultationMethod"
+           :options="consultationMethodOptions" />
+      </div>
+      <div class="pam-paragraph">
         <div class="mdTxt">����批</div>
         <SingleSelectBtn class="mt-10"
           :singleSelected.sync="myRequest.gender"
@@ -201,6 +207,17 @@
       }
     ];
 
+    consultationMethodOptions = [
+      {
+        title: '蝺��',
+        label: 'online'
+      },
+      {
+        title: '蝺��',
+        label: 'offline'
+      }
+    ];
+
     requirementOptions=[
       {
         title:'�摨瑁����',
@@ -300,6 +317,7 @@
         selectTimesOptions: [],
       }],
       agentNo: '',
+      consultationMethod: '',
     };
 
     showDrawer= false;
@@ -416,7 +434,9 @@
         return {
             ...appointmentInfo,
             hopeContactTime: hopeContactTime,
-            requirement: appointmentInfo.requirement.split(',')
+            requirement: appointmentInfo.requirement
+                        ? appointmentInfo.requirement.split(',')
+                        : []
           }
       } else {
         return null;
@@ -432,21 +452,36 @@
 
     ////////////////////////////////////////////////////////////////////////////
 
-    sentDemand() {
-      if (this.isEditBtn) {
-        this.editAppointmentDemand();
+    async sentDemand() {
+      if (typeof this.isEditBtn !== 'undefined' && this.isEditBtn) {
+        await this.editAppointmentDemand();
       } else {
-        queryConsultantService.addFavoriteConsultant([{ agentNo: this.$route.params.agentNo, createdTime: new Date().toISOString()}]).then(res => this.sentAppointmentDemand());
-      }
-       const editSettingInfo: UserSetting = {
-          name: this.myRequest.name,
-          phone: this.myRequest.phone,
-          email: this.myRequest.email,
+        // 雿輻 async/await 靘��甇交����蝯��
+        const addFavoriteAgentList = [{ agentNo: this.$route.params.agentNo, createdTime: new Date().toISOString() }];
+        const response = await queryConsultantService.addFavoriteConsultant(addFavoriteAgentList);
+
+        // 蝣箔�甇交����蝯�� null ��� undefined
+        if (!response) {
+          throw new Error('queryConsultantService.addFavoriteConsultant returned null-like value.');
+        } else {
+          if (typeof this.editAppointmentDemand === 'function') {
+            // 蝣箔�� this.editAppointmentDemand �銝���
+            await this.editAppointmentDemand();
+          } else {
+            // ���� this.editAppointmentDemand �摰儔�����
+            throw new Error('this.editAppointmentDemand is not defined or not a function.');
+          }
+        }
       }
 
-      accountSettingService.updateAccountSetting(editSettingInfo).then((_) => {
-          this.storageUserInfo(this.userInfo);
-      });
+      const editSettingInfo: UserSetting = {
+        name: this.myRequest.name,
+        phone: this.myRequest.phone,
+        email: this.myRequest.email,
+      };
+
+      await accountSettingService.updateAccountSetting(editSettingInfo);
+      this.storageUserInfo(this.userInfo);
     }
 
     private editAppointmentDemand() {

--
Gitblit v1.8.0