| | |
| | | <el-button type="primary" |
| | | :disabled="isDisabledSubmitBtn" |
| | | @click.native="sentDemand"> |
| | | 送出 |
| | | {{isEditBtn ? '更新' : '送出'}} |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | |
| | | </el-button> |
| | | </div> |
| | | </PopUpFrame> |
| | | |
| | | <PopUpFrame :isOpen.sync="isEditPopup"> |
| | | <div class="text--middle mt-30 sendReserve-txt">是否繼續編輯預約單?</div> |
| | | <div class="text--center mdTxt"> |
| | | <el-button @click="$router.go(-1)">返回</el-button> |
| | | <el-button @click="isEditPopup = false" type="primary">編輯</el-button> |
| | | </div> |
| | | </PopUpFrame> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component } from 'nuxt-property-decorator'; |
| | | import { addFavoriteConsultant, appointmentDemand, AppointmentParams, AppointmentRequests ,RegisterInfo } from '~/assets/ts/api/consultant'; |
| | | import { getRequestsFromStorage, setRequestsToStorage, getRequestQuestionFromStorage, removeRequestQuestionFromStorage } from '~/assets/ts/storageRequests'; |
| | | import { Gender } from '~/assets/ts/models/enum/Gender'; |
| | | import { ContactType } from '~/assets/ts/models/enum/ContactType'; |
| | | import _ from 'lodash'; |
| | | import { isLogin } from '~/assets/ts/auth'; |
| | | import { Vue, Component, State, Action, Watch } from 'nuxt-property-decorator'; |
| | | import { addFavoriteConsultant, appointmentDemand, AppointmentParams, AppointmentRequests ,editAppointment,RegisterInfo } from '~/assets/ts/api/consultant'; |
| | | import { getRequestQuestionFromStorage, getRequestsFromStorage, removeRequestQuestionFromStorage, setRequestsToStorage } from '~/assets/ts/storageRequests'; |
| | | import _ from 'lodash'; |
| | | import { isLogin } from '~/assets/ts/auth'; |
| | | import { Consultant } from '~/assets/ts/models/consultant.model'; |
| | | import { ContactType } from '~/assets/ts/models/enum/ContactType'; |
| | | import { Gender } from '~/assets/ts/models/enum/Gender'; |
| | | |
| | | @Component |
| | | export default class Questionnaire extends Vue { |
| | | @State('myConsultantList') myConsultantList!: Consultant[]; |
| | | @Action storeConsultantList!: () => Promise<number>; |
| | | |
| | | genderOptions=[ |
| | | { |
| | | title:'男性', |
| | |
| | | |
| | | showDrawer= false; |
| | | sendReserve = false; |
| | | isEditPopup = false; |
| | | isEditBtn = false; |
| | | |
| | | appointmentId = 0; |
| | | |
| | | beforeRouteEnter(to: any, from: any, next: any) { |
| | | next(vm => { |
| | |
| | | vm.$router.push('/login'); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | async fetch() { |
| | | if (isLogin()) { |
| | | await this.storeConsultantList(); |
| | | }; |
| | | } |
| | | |
| | | mounted(): void { |
| | |
| | | } |
| | | |
| | | sentDemand() { |
| | | addFavoriteConsultant([this.$route.params.agentNo]).then(res => this.sentAppointmentDemand()); |
| | | if (this.isEditBtn) { |
| | | this.sentEditAppointmentDemand(); |
| | | } else { |
| | | addFavoriteConsultant([this.$route.params.agentNo]).then(res => this.sentAppointmentDemand()); |
| | | } |
| | | |
| | | } |
| | | |
| | | private sentAppointmentDemand() { |
| | |
| | | }); |
| | | } |
| | | |
| | | private sentEditAppointmentDemand() { |
| | | const info = { |
| | | ...this.myRequest, |
| | | requirement: _.map(this.myRequest.requirement,o=>o).toString(), |
| | | hopeContactTime: this.myRequest.phone && this.phoneValid ? this.getHopeContactTime() :'', |
| | | id: this.appointmentId, |
| | | otherRequirement: null |
| | | } |
| | | editAppointment(info).then(res => { |
| | | this.sendReserve = true; |
| | | this.myRequest.hopeContactTime = []; |
| | | setRequestsToStorage(this.myRequest); |
| | | }); |
| | | } |
| | | |
| | | getHopeContactTime() { |
| | | const selectedHopeContactTime = this.myRequest.hopeContactTime.filter((i) => i.selectWeekOptions?.length && i.selectTimesOptions?.length); |
| | | return selectedHopeContactTime.map(i => { |
| | |
| | | this.$router.push('/') |
| | | } |
| | | |
| | | private getLatestReserved(agentNo) { |
| | | const agentInfo = this.myConsultantList.filter(item => item.agentNo === agentNo); |
| | | |
| | | const appointmentInfo = agentInfo.length > 0 && agentInfo[0].appointments |
| | | ? agentInfo[0].appointments! |
| | | .filter((appointment) => appointment.communicateStatus !== 'contacted') |
| | | .sort((preAppointment, nextAppointment) => { |
| | | return +nextAppointment.appointmentDate - +preAppointment.appointmentDate |
| | | })[0] |
| | | : null; |
| | | |
| | | return this.getReservedData(appointmentInfo); |
| | | } |
| | | |
| | | private getReservedData(appointmentInfo) { |
| | | if (appointmentInfo) { |
| | | const hopeContactTime = appointmentInfo!.hopeContactTime.split("'") |
| | | .filter(item => item && item !== ','); |
| | | this.appointmentId = appointmentInfo.id; |
| | | return { |
| | | age: appointmentInfo.age, |
| | | agentNo: appointmentInfo.agentNo, |
| | | contactType: appointmentInfo.contactType, |
| | | email: appointmentInfo.email || '', |
| | | gender: appointmentInfo.gender, |
| | | hopeContactTime: hopeContactTime.map(item => { |
| | | const info = item.split('、'); |
| | | return { |
| | | selectWeekOptions: info[0].split(','), |
| | | selectTimesOptions: info[1].split(',') |
| | | } |
| | | }), |
| | | job: appointmentInfo.job, |
| | | phone: appointmentInfo.phone || '', |
| | | requirement: appointmentInfo.requirement.split(',') |
| | | } |
| | | } else { |
| | | return { |
| | | age: '', |
| | | agentNo: '', |
| | | contactType: '', |
| | | email: '', |
| | | gender: '', |
| | | hopeContactTime: [], |
| | | job: '', |
| | | phone: '', |
| | | requirement: [] |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Watch('myConsultantList') onMyConsultantListChange() { |
| | | if (this.isLogin && this.myConsultantList.length > 0) { |
| | | const editAppointment = this.getLatestReserved(this.$route.params.agentNo); |
| | | |
| | | if (editAppointment.agentNo) { |
| | | this.myRequest = JSON.parse(JSON.stringify(editAppointment)); |
| | | if (!this.$route.query || this.$route.query.edit !== 'true') { |
| | | this.isEditPopup = true; |
| | | } |
| | | this.isEditBtn = true; |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .sendReserve-txt{ |
| | | display: flex; |
| | | justify-content: center; |
| | | margin-top: 10px; |
| | | margin-bottom: 26px; |
| | | display: flex; |
| | | justify-content: center; |
| | | margin-top: 10px; |
| | | margin-bottom: 26px; |
| | | } |
| | | |
| | | //drawer最底下文字樣式 |
| | | .qa-dialog-footer{ |
| | | display: flex; |
| | | justify-content: center; |
| | | margin-bottom: 81px; |
| | | color: #ED1B2E; |
| | | cursor: pointer; |
| | | display: flex; |
| | | justify-content: center; |
| | | margin-bottom: 81px; |
| | | color: #ED1B2E; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | //送出按鈕樣式與排版 |
| | | .ques-footer{ |
| | | justify-content: center; |
| | | margin: 30px 0; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | .el-button { |
| | | justify-content: center; |
| | | margin: 30px 0; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | .el-button { |
| | | width: 120px; |
| | | height:50px; |
| | | background-color: #ED1B2E; |
| | |
| | | |
| | | //詳細問題drawer中間內容空間大小設置 |
| | | .qa-dialog{ |
| | | overflow-y:auto; |
| | | height: 500px; |
| | | margin-top: 20px; |
| | | overflow-y:auto; |
| | | height: 500px; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | //詳細問題drawer主要標題 |
| | | .qaTextTitle{ |
| | | margin-top:30px; |
| | | display: flex; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .el-button+.el-button{ |
| | | margin-left: 0; |
| | | margin-top:30px; |
| | | display: flex; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .datepicker{ |
| | | display: flex; |
| | | flex-direction: column; |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .required { |
| | | position: relative; |
| | | &::before { |
| | | content: '*'; |
| | | position: absolute; |
| | | color: #FF0000; |
| | | transform: translate(-12px, 0); |
| | | } |
| | | position: relative; |
| | | &::before { |
| | | content: '*'; |
| | | position: absolute; |
| | | color: #FF0000; |
| | | transform: translate(-12px, 0); |
| | | } |
| | | } |
| | | |
| | | .ques-page--reset.pam-page-container { |
| | | margin: 0px auto; |
| | | margin: 0px auto; |
| | | } |
| | | |
| | | .ques-header { |
| | | position: relative; |
| | | position: relative; |
| | | } |
| | | |
| | | .ques-header__mob-banner { |
| | |
| | | background-position: center; |
| | | } |
| | | |
| | | .ques-header__info { |
| | | position: relative; |
| | | padding:30px 20px; |
| | | margin: 0px 20px; |
| | | background-color: #B3E7E3; |
| | | border-radius: 10px; |
| | | } |
| | | |
| | | .ques-header__input-block { |
| | | display: flex; |
| | | align-items: center; |
| | | @extend .text--middle,.mt-10 ; |
| | | .ques-header__input{ |
| | | &.is-invalid{ |
| | | border: 2px solid $PRIMARY_RED !important; |
| | | } |
| | | flex: 1; |
| | | height: 50px; |
| | | .ques-header__info { |
| | | position: relative; |
| | | padding:30px 20px; |
| | | margin: 0px 20px; |
| | | background-color: #B3E7E3; |
| | | border-radius: 10px; |
| | | border: 1px #CCCCCC solid; |
| | | background-color: $PRIMARY_WHITE; |
| | | padding: 15px 10px; |
| | | box-sizing: border-box; |
| | | -webkit-box-sizing: border-box; |
| | | -moz-box-sizing: border-box; |
| | | } |
| | | } |
| | | |
| | | .ques-container { |
| | | position: relative; |
| | | margin: 0px 20px; |
| | | } |
| | | .ques-header__input-block { |
| | | display: flex; |
| | | align-items: center; |
| | | @extend .text--middle,.mt-10 ; |
| | | .ques-header__input{ |
| | | &.is-invalid{ |
| | | border: 2px solid $PRIMARY_RED !important; |
| | | } |
| | | flex: 1; |
| | | height: 50px; |
| | | border-radius: 10px; |
| | | border: 1px #CCCCCC solid; |
| | | background-color: $PRIMARY_WHITE; |
| | | padding: 15px 10px; |
| | | box-sizing: border-box; |
| | | -webkit-box-sizing: border-box; |
| | | -moz-box-sizing: border-box; |
| | | } |
| | | } |
| | | |
| | | .ques-container { |
| | | position: relative; |
| | | margin: 0px 20px; |
| | | } |
| | | |
| | | |
| | | @include desktop{ |
| | | @include desktop{ |
| | | .ques-header{ |
| | | display: flex; |
| | | justify-content: flex-end; |