| | |
| | | <template> |
| | | <div> |
| | | <div class="edit-agent-info-page"> |
| | | <el-row |
| | | type="flex" |
| | | justify="center"> |
| | | <UiAvatar |
| | | :size="150" |
| | | :agentNo="agentInfo.agentNo"> |
| | | </UiAvatar> |
| | | <EditConsultantAvatar |
| | | :agentNo="agentInfo.agentNo" |
| | | :photoBase64.sync="editInfoValue.photoBase64"/> |
| | | </el-row> |
| | | <el-row |
| | | type="flex" |
| | | class="pt-10" |
| | | justify="center" |
| | | align="middle" v-if="!hideReviews"> |
| | | <!-- TODO:隱藏滿意度 --> |
| | | <i class="pam-icon icon--primary icon-star"></i> |
| | | <h3 class="mdTxt">{{ agentInfo.avgScore }}</h3> |
| | | </el-row> |
| | | |
| | | <el-row |
| | | type="flex" |
| | | class="pt-10" |
| | | class="pam-paragraph" |
| | | justify="center"> |
| | | <el-input class="mdTxt" v-model="editInfoValue.name"></el-input> |
| | | </el-row> |
| | | |
| | | <el-row |
| | | type="flex" |
| | | class="pam-paragraph"> |
| | | <el-col :span="24" class="pam-field"> |
| | | <div class="pam-field__label pam-progress__label"> |
| | | <div> |
| | | <div class="pam-field__title mb-10"> |
| | | <i class="pam-icon icon-phone" |
| | | ></i>手機號碼 |
| | | <span class="hint text--bold" v-show="!phoneValid">手機號碼格式有誤</span> |
| | | <span class="hint text--bold" v-show="editInfoValue.phoneNumber.length === 0">手機號碼為必填</span> |
| | | </div> |
| | | </div> |
| | | <el-input |
| | | v-model="editInfoValue.phoneNumber" |
| | | :class="{'is-invalid': !phoneValid}" |
| | | maxlength="10" |
| | | minlength="10"></el-input> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | |
| | | <el-row |
| | | type="flex" |
| | |
| | | type="flex" |
| | | class="pam-paragraph"> |
| | | <UiField icon="company" label="服務地區"> |
| | | <el-input v-model="editInfoValue.serveArea"></el-input> |
| | | <MultiSelectBtn class="mt-30" |
| | | :mutiSelect.sync="editInfoValue.serveArea" |
| | | :nameOfSelectAll="'全台'" |
| | | :options="serveAreaOptions" |
| | | > |
| | | </MultiSelectBtn> |
| | | </UiField> |
| | | </el-row> |
| | | |
| | |
| | | <MultiSelectBtn class="mt-30" |
| | | :mutiSelect.sync="editInfoValue.communicationStyle" |
| | | :options="agentCommunicationStyleList" |
| | | @change="selectCommunicationStyles" |
| | | :maxLength="2" |
| | | > |
| | | </MultiSelectBtn> |
| | | </div> |
| | |
| | | <script lang="ts"> |
| | | import { Context } from '@nuxt/types'; |
| | | import { namespace } from 'nuxt-property-decorator'; |
| | | import { Vue, Component } from 'vue-property-decorator'; |
| | | import { Vue, Component, Prop } from 'vue-property-decorator'; |
| | | import * as _ from "lodash"; |
| | | |
| | | import myConsultantService from '~/shared/services/my-consultant.service'; |
| | |
| | | import { hideReviews } from '~/shared/const/hide-reviews'; |
| | | import { AgentInfoSetting } from '~/shared/models/account.model'; |
| | | import { Role } from '~/shared/models/enum/Role'; |
| | | import { agentExpertList } from '~/shared/const/agent-expert-list'; |
| | | import { agentCommunicationStyleList } from '~/shared/const/agent-communication-style-list'; |
| | | import { taiwanCities } from '~/shared/const/taiwan-cities'; |
| | | |
| | | const localStorage = namespace('localStorage'); |
| | | const localStorageTest = namespace('localStorage'); |
| | | |
| | | @Component |
| | | export default class AgentInfoComponent extends Vue { |
| | | |
| | | @localStorage.State('current_role') |
| | | @localStorageTest.State('current_role') |
| | | currentRole!:string | null; |
| | | |
| | | _agentInfoSetting!: AgentInfoSetting; |
| | |
| | | hideReviews : boolean = hideReviews ; |
| | | isAlertFieldInfo: boolean = false; |
| | | isInfoUpdate : boolean = false; |
| | | serveAreaOptions: any[] = taiwanCities.map((city) => ({ title: city, label: city })); |
| | | |
| | | editInfoValue = { |
| | | agentNo : '', |
| | | name : '', |
| | | expertise : [] as string[], |
| | | title : '', |
| | | serveArea : '', |
| | | serveArea : [] as string[], |
| | | companyAddress : '', |
| | | seniorityYear : 1, |
| | | seniorityMonth : 0, |
| | |
| | | awards : '', |
| | | communicationStyle: [] as string[], |
| | | photoBase64 : '', |
| | | phoneNumber : '' |
| | | }; |
| | | |
| | | |
| | | communicationStyleList: string[] = agentCommunicationStyleList; |
| | | role = Role; |
| | | |
| | | agentExpertList = [ |
| | | { |
| | | title:'健康與保障', |
| | |
| | | mounted(){ |
| | | this.setAgentInfo(this.agentInfo); |
| | | } |
| | | |
| | | ///////////////////////////////////////////////////////////////////////////// |
| | | |
| | | private setAgentInfo(agentInfo: AgentInfo): void { |
| | | const [agentYear, _yearUnit , agentMonth, _monthUnit] = agentInfo.seniority.split(" "); |
| | | this._agentInfoSetting = { |
| | |
| | | expertise : agentInfo.expertise || [], |
| | | title : agentInfo.title || '', |
| | | role : agentInfo.role||'', |
| | | serveArea : agentInfo.serveArea || '', |
| | | serveArea : agentInfo?.serveArea.split('、'), |
| | | gender : agentInfo.gender||'', |
| | | phoneNumber : agentInfo.phoneNumber||'', |
| | | companyAddress : agentInfo.companyAddress || '', |
| | |
| | | } |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |
| | | |
| | | editAgentInfoSetting(): void { |
| | | const editSettingInfo: any = { |
| | | ...this.editInfoValue, |
| | | communicationStyle: this.editInfoValue.communicationStyle.join('、'), |
| | | serveArea: this.editInfoValue.serveArea.join('、'), |
| | | } |
| | | accountSettingService.editAgentInfoSetting(editSettingInfo).then((res: AgentInfoSetting) => { |
| | | console.log(editSettingInfo) |
| | | this.isInfoUpdate = true; |
| | | }); |
| | | this.isInfoUpdate = true; |
| | | } |
| | | |
| | | backToInfo() { |
| | | this.isInfoUpdate = false |
| | | this.$router.push(`/agentInfo/${this.agentInfo.agentNo}`); |
| | | } |
| | | } |
| | | |
| | | selectCommunicationStyles(): void { |
| | | if (this.editInfoValue.communicationStyle.length > 2) { |
| | | this.editInfoValue.communicationStyle.shift(); |
| | | } |
| | | } |
| | | |
| | | alertFieldInfo(field: string): void { |
| | | this.isAlertFieldInfo = true; |
| | | switch(field) { |
| | |
| | | } |
| | | } |
| | | //////////////////////////////////////////////////////////// |
| | | get phoneValid(): boolean { |
| | | const rule = /^09[0-9]{8}$/; |
| | | return this.editInfoValue.phoneNumber |
| | | ? rule.test(this.editInfoValue.phoneNumber) && _.isEqual(this.editInfoValue.phoneNumber.length,10) |
| | | : true; |
| | | } |
| | | |
| | | get isSubmitBtnDisabled(): boolean { |
| | | const isFormValid = this.editInfoValue.name |
| | | && this.editInfoValue.title |
| | |
| | | && this.editInfoValue.serveArea |
| | | && this.editInfoValue.concept |
| | | && this.editInfoValue.experiences |
| | | && this.editInfoValue.awards |
| | | && this.editInfoValue.phoneNumber.length |
| | | && this.editInfoValue.seniorityYear |
| | | && this.editInfoValue.expertise.length |
| | | && this.editInfoValue.communicationStyle.length; |
| | |
| | | |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | <style lang="scss" > |
| | | .edit-agent-info-page{ |
| | | .el-textarea__inner{ |
| | | font-size: 15px; |
| | | } |
| | | } |
| | | .pam-icon { |
| | | font-size : 15px; |
| | | padding-right: 8px; |
| | |
| | | .el-input--suffix .el-input__inner { |
| | | padding-right: 20px; |
| | | } |
| | | |
| | | .el-textarea__inner{ |
| | | font-size: 18px; |
| | | } |
| | | </style> |