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 | 117 ++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 72 insertions(+), 45 deletions(-) diff --git a/PAMapp/pages/questionnaire/_agentNo.vue b/PAMapp/pages/questionnaire/_agentNo.vue index 553ccee..a2552b9 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" @@ -154,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'; @@ -198,6 +203,17 @@ { title:'憟單��', label:Gender.FEMALE, + } + ]; + + consultationMethodOptions = [ + { + title: '蝺��', + label: 'online' + }, + { + title: '蝺��', + label: 'offline' } ]; @@ -260,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 : '', @@ -300,6 +316,7 @@ selectTimesOptions: [], }], agentNo: '', + consultationMethod: '', }; showDrawer= false; @@ -416,7 +433,7 @@ return { ...appointmentInfo, hopeContactTime: hopeContactTime, - requirement: appointmentInfo.requirement + requirement: appointmentInfo.requirement ? appointmentInfo.requirement.split(',') : [] } @@ -434,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 @@ -469,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 }; @@ -510,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; } @@ -525,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{ @@ -712,4 +740,3 @@ </style> - -- Gitblit v1.8.0