| | |
| | | <span v-show="!phoneValid">手機號碼格式有誤</span> |
| | | </div> |
| | | </div> |
| | | <div class="mt-30" v-if="phoneValid"> |
| | | <div class="mt-30" v-if="myRequest.phone && phoneValid"> |
| | | <div class="datepicker"> |
| | | <span class="mdTxt">手機連絡的方便時間</span> |
| | | <PhoneContactTimePicker |
| | |
| | | selectWeekOptions: [], |
| | | selectTimesOptions: [], |
| | | }], |
| | | agentNo: this.$route.params.agentNo, |
| | | agentNo: '', |
| | | }; |
| | | |
| | | showDrawer= false; |
| | |
| | | mounted() { |
| | | const storageMyRequest = getRequestsFromStorage(); |
| | | if (storageMyRequest) { |
| | | this.myRequest = storageMyRequest; |
| | | this.myRequest = { |
| | | ...storageMyRequest, |
| | | hopeContactTime: storageMyRequest.hopeContactTime?.length |
| | | ? storageMyRequest.hopeContactTime |
| | | : [{ |
| | | selectWeekOptions: [], |
| | | selectTimesOptions: [], |
| | | }], |
| | | }; |
| | | } |
| | | } |
| | | |
| | | get phoneValid(): boolean { |
| | | const rule = /^09[0-9]{8}$/; |
| | | return this.myRequest.phone ? rule.test(this.myRequest.phone) && _.isEqual(this.myRequest.phone.length,10) : true; |
| | | return this.myRequest.phone |
| | | ? rule.test(this.myRequest.phone) && _.isEqual(this.myRequest.phone.length,10) |
| | | : true; |
| | | } |
| | | |
| | | get userInfo(): RegisterInfo { |
| | |
| | | } |
| | | |
| | | private isHopeContactTimeDone():boolean{ |
| | | return this.myRequest.hopeContactTime[0].selectWeekOptions.length >0 && this.myRequest.hopeContactTime[0].selectTimesOptions.length >0; |
| | | return this.myRequest.hopeContactTime[0]?.selectWeekOptions.length >0 && this.myRequest.hopeContactTime[0]?.selectTimesOptions.length >0; |
| | | } |
| | | |
| | | sentDemand() { |
| | | addFavoriteConsultant([this.myRequest.agentNo]).then(res => this.sentAppointmentDemand()); |
| | | addFavoriteConsultant([this.$route.params.agentNo]).then(res => this.sentAppointmentDemand()); |
| | | } |
| | | |
| | | private sentAppointmentDemand() { |
| | | const data: AppointmentParams = { |
| | | ...this.myRequest, |
| | | requirement: _.map(this.myRequest.requirement,o=>o).toString(), |
| | | hopeContactTime:this.phoneValid ? this.getHopeContactTime() :'', |
| | | hopeContactTime: this.myRequest.phone && this.phoneValid ? this.getHopeContactTime() :'', |
| | | agentNo: this.$route.params.agentNo |
| | | }; |
| | | |
| | | appointmentDemand(data).then(res => { |
| | | this.sendReserve = true; |
| | | this.myRequest.hopeContactTime = []; |
| | | setRequestsToStorage(this.myRequest); |
| | | }); |
| | | } |