From b4d6944076f1df6eedaae35c4c2a7072fe988e8a Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期二, 30 四月 2024 15:34:02 +0800
Subject: [PATCH] update: package-lock.json

---
 PAMapp/pages/questionnaire/_agentNo.vue |  109 +++++++++++++++++++++++++++++-------------------------
 1 files changed, 59 insertions(+), 50 deletions(-)

diff --git a/PAMapp/pages/questionnaire/_agentNo.vue b/PAMapp/pages/questionnaire/_agentNo.vue
index 0c0c815..a2552b9 100644
--- a/PAMapp/pages/questionnaire/_agentNo.vue
+++ b/PAMapp/pages/questionnaire/_agentNo.vue
@@ -80,8 +80,8 @@
       <div class="pam-paragraph">
         <div class="mdTxt">隢株岷�撘�</div>
         <SingleSelectBtn class="mt-10"
-           :singleSelected.sync="myRequest.consultantMode"
-           :options="consultantModeOptions" />
+           :singleSelected.sync="myRequest.consultationMethod"
+           :options="consultationMethodOptions" />
       </div>
       <div class="pam-paragraph">
         <div class="mdTxt">����批</div>
@@ -160,7 +160,6 @@
 <script lang="ts">
 import { Vue, Component, State, Action, Watch, namespace } from 'nuxt-property-decorator';
 import { getRequestsFromStorage, removeRequestQuestionFromStorage, setRequestsToStorage } from '~/shared/storageRequests';
-import _ from 'lodash';
 
 import accountSettingService from '~/shared/services/account-setting.service';
 import appointmentService from '~/shared/services/appointment.service';
@@ -207,14 +206,14 @@
       }
     ];
 
-    consultantModeOptions = [
+    consultationMethodOptions = [
       {
         title: '蝺��',
-        label: 'ONLINE'
+        label: 'online'
       },
       {
         title: '蝺��',
-        label: 'OFFLINE'
+        label: 'offline'
       }
     ];
 
@@ -277,37 +276,37 @@
     ];
 
     quesAboutList = [
-                  {
-                      title:'�摨瑁����',
-                      content:'����澈擃憿批末嚗�靽�兢蝳�嚗��������嚗��飩������摮拙��粥銝��頝荔�犖����迤閬����'
-                  },
-                  {
-                      title:'摮戊��',
-                      content:'摮拙���������葦銋摮貊��撠靘�蒂�雿嚗飛���������������瓷嚗��楝銝���韏瑕飛��'
-                  },
-                  {
-                      title:'鞈閬��',
-                      content:'��迤��瓷撖��雓寡�����嚗鈭箇�����蝳西瓷��◢�����Ⅱ靽�蝛拙��嚗�摰嗆��靘�末��皞���'
-                  },
-                  {
-                      title:'璅暑��隡�',
-                      content:'�銝�頛拙����隡��摮���翰瘣鳴�停敺�����������隡瓷����撌勗�帘摰�嚗蝎曉蔗���僑鈭箇�������'
-                  },
-                  {
-                      title:'靽�瑼�/閬��',
-                      content:'��瑼Z�撌梁������蝚血����靘�◢�蝘餉��瘙��'
-                  },
-                  {
-                      title:'����',
-                      content:'���������憸券�����鈭怒�����嚗���摰帘摰漲嚗��隞亙��澈��ˊ�靽���嚗�'
-                  }
+      {
+          title:'�摨瑁����',
+          content:'����澈擃憿批末嚗�靽�兢蝳�嚗��������嚗��飩������摮拙��粥銝��頝荔�犖����迤閬����'
+      },
+      {
+          title:'摮戊��',
+          content:'摮拙���������葦銋摮貊��撠靘�蒂�雿嚗飛���������������瓷嚗��楝銝���韏瑕飛��'
+      },
+      {
+          title:'鞈閬��',
+          content:'��迤��瓷撖��雓寡�����嚗鈭箇�����蝳西瓷��◢�����Ⅱ靽�蝛拙��嚗�摰嗆��靘�末��皞���'
+      },
+      {
+          title:'璅暑��隡�',
+          content:'�銝�頛拙����隡��摮���翰瘣鳴�停敺�����������隡瓷����撌勗�帘摰�嚗蝎曉蔗���僑鈭箇�������'
+      },
+      {
+          title:'靽�瑼�/閬��',
+          content:'��瑼Z�撌梁������蝚血����靘�◢�蝘餉��瘙��'
+      },
+      {
+          title:'����',
+          content:'���������憸券�����鈭怒�����嚗���摰帘摰漲嚗��隞亙��澈��ˊ�靽���嚗�'
+      }
     ];
 
     myRequest: AppointmentRequests = {
       name           : '',
       phone          : '',
       email          : '',
-      contactType    : _.isEqual(this.userInfo?.contactType,ContactType.SMS) ? ContactType.PHONE: ContactType.EMAIL,
+      contactType    : this.userInfo?.contactType === ContactType.SMS ? ContactType.PHONE: ContactType.EMAIL,
       gender         : '',
       age            : '',
       job            : '',
@@ -317,7 +316,7 @@
         selectTimesOptions: [],
       }],
       agentNo: '',
-      consultantMode: '',
+      consultationMethod: '',
     };
 
     showDrawer= false;
@@ -452,27 +451,38 @@
 
     ////////////////////////////////////////////////////////////////////////////
 
-    sentDemand() {
+
+    async sentDemand() {
       if (this.isEditBtn) {
-        this.editAppointmentDemand();
+        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 !== null) {
+          await this.sentAppointmentDemand();
+        } else {
+          throw new Error('queryConsultantService.addFavoriteConsultant returned null-like value.');
+        }
       }
 
-      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() {
       const info = {
           ...this.myRequest,
-          requirement: _.map(this.myRequest.requirement,o=>o).toString(),
+          requirement: this.myRequest.requirement.map(o => o).toString(),
           hopeContactTime: this.myRequest.phone && this.phoneValid ? this.getHopeContactTime() :'',
           id: this.appointmentId,
           otherRequirement: null
@@ -487,7 +497,7 @@
     private sentAppointmentDemand() {
         const data: AppointmentParams = {
           ...this.myRequest,
-          requirement: _.map(this.myRequest.requirement,o=>o).toString(),
+          requirement: this.myRequest.requirement.map(o => o).toString(),
           hopeContactTime: this.myRequest.phone && this.phoneValid ? this.getHopeContactTime() :'',
           agentNo: this.$route.params.agentNo
         };
@@ -528,7 +538,7 @@
     get phoneValid(): boolean {
       const rule = /^09[0-9]{8}$/;
       return this.myRequest.phone
-            ? rule.test(this.myRequest.phone) && _.isEqual(this.myRequest.phone.length,10)
+            ? rule.test(this.myRequest.phone) && this.myRequest.phone.length === 10
             : true;
     }
 
@@ -543,9 +553,9 @@
     }
 
     get isDisabledSubmitBtn(): boolean {
-           return _.includes(this.myRequest.contactType,ContactType.PHONE)
-      ? !this.isHopeContactTimeDone() || !this.emailValid
-      : !this.phoneValid;
+      return this.myRequest.contactType.includes(ContactType.PHONE)
+        ? !this.isHopeContactTimeDone() || !this.emailValid
+        : !this.phoneValid;
     }
 
     private isHopeContactTimeDone():boolean{
@@ -730,4 +740,3 @@
 
 
 </style>
-

--
Gitblit v1.8.0