| | |
| | | <template> |
| | | <el-row type="flex" justify="center" :class="cusClass"> |
| | | <el-button @click="addConsultant(agentInfo)" :disabled="isAdded"> |
| | | <span> {{isAdded ? '已加入顧問清單' : '+ 顧問清單'}}</span> |
| | | <span> {{ isAdded ? '已加入顧問清單' : '+ 顧問清單' }}</span> |
| | | </el-button> |
| | | <el-button |
| | | @click="reserveCommunication" |
| | | @click="navigateToReservationForm" |
| | | type="primary" |
| | | >進行預約</el-button> |
| | | </el-row> |
| | |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component, Prop, Emit, Action, State, namespace } from 'nuxt-property-decorator'; |
| | | import { Consultant } from '~/assets/ts/models/consultant.model'; |
| | | import { Consultant } from '~/shared/models/consultant.model'; |
| | | |
| | | const localStorage = namespace('localStorage'); |
| | | @Component |
| | | export default class AddAndReservedBtns extends Vue { |
| | | @Action addToMyConsultantList!: (consultantToAdd: Consultant) => Promise<boolean> |
| | | @State('myConsultantList') myConsultantList!: Consultant[]; |
| | | @Prop() agentInfo!: Consultant; |
| | | @Prop() cusClass!: string; |
| | | |
| | | @Action |
| | | addToMyConsultantList!: (consultantToAdd: Consultant) => Promise<boolean> |
| | | |
| | | @State('myConsultantList') |
| | | myConsultantList!: Consultant[]; |
| | | |
| | | @Prop() |
| | | agentInfo!: Consultant; |
| | | |
| | | @Prop() |
| | | cusClass!: string; |
| | | |
| | | isVisiblePopUp = false; |
| | | addConsultant(item: Consultant) { |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |
| | | |
| | | @Emit('openPopUp') |
| | | openPopUp(popUpTxt: string = '成功加入顧問清單'): string { |
| | | return popUpTxt; |
| | | } |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |
| | | |
| | | addConsultant(item: Consultant): void { |
| | | this.addToMyConsultantList(item).then(addOk => { |
| | | addOk && this.openPopUp(); |
| | | }); |
| | | } |
| | | |
| | | reserveCommunication() { |
| | | navigateToReservationForm(): void { |
| | | this.$router.push(`/questionnaire/${this.agentInfo.agentNo}`); |
| | | } |
| | | |
| | | @Emit('openPopUp') openPopUp(popUpTxt: string = '成功加入顧問清單') { |
| | | return popUpTxt |
| | | } |
| | | |
| | | get isAdded() { |
| | |
| | | ? true : false |
| | | } |
| | | } |
| | | </script> |
| | | </script> |