From 509d17e9885c46af9331666a43eb8766ec72c295 Mon Sep 17 00:00:00 2001 From: jack <jack.su@pollex.com.tw> Date: 星期二, 19 九月 2023 12:11:57 +0800 Subject: [PATCH] Merge branch '滲透' of ssh://dev.pollex.com.tw:29418/pcalife/PAM into 滲透 --- PAMapp/pages/questionnaire/_agentNo.vue | 98 ++++++++++++++++++++++++++++++++++--------------- 1 files changed, 68 insertions(+), 30 deletions(-) diff --git a/PAMapp/pages/questionnaire/_agentNo.vue b/PAMapp/pages/questionnaire/_agentNo.vue index 213a636..9208efb 100644 --- a/PAMapp/pages/questionnaire/_agentNo.vue +++ b/PAMapp/pages/questionnaire/_agentNo.vue @@ -67,7 +67,7 @@ <div class="ques-container"> <div class="pam-paragraph"> <div class="mdTxt"> - �閬岷������ + �鈭圾����� <span class="hint text--bold"> (�銴) </span> @@ -76,6 +76,12 @@ <MultiSelectBtn class="mt-10" :mutiSelect.sync="myRequest.requirement" :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> @@ -103,7 +109,7 @@ <PopUpFrame :isOpen.sync="showDrawer"> <div class="qaTextTitle mdTxt"> - <strong>�閬岷������</strong> + <strong>�鈭圾�����</strong> </div> <div class="qa-dialog"> <div v-for="(qaText,index) in quesAboutList" :key="index" > @@ -198,6 +204,17 @@ { title:'憟單��', label:Gender.FEMALE, + } + ]; + + consultationMethodOptions = [ + { + title: '蝺��', + label: 'online' + }, + { + title: '蝺��', + label: 'offline' } ]; @@ -300,6 +317,7 @@ selectTimesOptions: [], }], agentNo: '', + consultationMethod: '', }; showDrawer= false; @@ -336,7 +354,6 @@ private setMyRequest(): void { const storageMyRequest = getRequestsFromStorage(); const storageMyRequirement = this.recommendConsultantItem ? JSON.parse(this.recommendConsultantItem).requirements:[]; - const contactTypePromise = accountSettingService.getUserAccountSetting(); if (storageMyRequest) { this.myRequest = { @@ -358,12 +375,15 @@ removeRequestQuestionFromStorage(); } - contactTypePromise.then((contactTypeDetail) => { - this.myRequest = { - ...this.myRequest, - ...contactTypeDetail - } - }) + if (authService.isUserLogin()) { + accountSettingService.getUserAccountSetting().then((contactTypeDetail) => { + this.myRequest = { + ...this.myRequest, + ...contactTypeDetail + } + }) + } + } @@ -400,20 +420,23 @@ 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(',') } - }), - requirement: appointmentInfo.requirement.split(',') + }) + :[{selectWeekOptions : [],selectTimesOptions: []}]; + this.getAppointmentId(appointmentInfo); + + return { + ...appointmentInfo, + hopeContactTime: hopeContactTime, + requirement: appointmentInfo.requirement + ? appointmentInfo.requirement.split(',') + : [] } } else { return null; @@ -429,21 +452,36 @@ //////////////////////////////////////////////////////////////////////////// - sentDemand() { - if (this.isEditBtn) { - this.editAppointmentDemand(); + async sentDemand() { + if (!this.isEditBtn) { + // 雿輻 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.'); + } + } } else { - queryConsultantService.addFavoriteConsultant([this.$route.params.agentNo]).then(res => this.sentAppointmentDemand()); - } - const editSettingInfo: UserSetting = { - name: this.myRequest.name, - phone: this.myRequest.phone, - email: this.myRequest.email, + await this.editAppointmentDemand(); } - 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