From 9bdb95c9e34cef640534e5e5a1e2225a80442000 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:48:15 +0800 Subject: [PATCH] TODO#139894 [ footer -最下方說明與保經代合作 ] 文案修改 --- PAMapp/components/AddAndReservedBtns.vue | 65 ++++++++++++++++++++++++-------- 1 files changed, 49 insertions(+), 16 deletions(-) diff --git a/PAMapp/components/AddAndReservedBtns.vue b/PAMapp/components/AddAndReservedBtns.vue index 5c1afc5..f2d5c2e 100644 --- a/PAMapp/components/AddAndReservedBtns.vue +++ b/PAMapp/components/AddAndReservedBtns.vue @@ -1,44 +1,77 @@ <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" + :disabled="isDisableReserve" + @click="navigateToReservationForm" type="primary" - >�脰����</el-button> + >{{ isDisableReserve ? '撌脰蝯�' : '�脰����'}}</el-button> </el-row> </template> <script lang="ts"> import { Vue, Component, Prop, Emit, Action, State, namespace } from 'nuxt-property-decorator'; -import { Consultants } from '~/assets/ts/api/consultant'; +import { Consultant } from '~/shared/models/consultant.model'; -const localStorage = namespace('localStorage'); +const roleStorage = namespace('localStorage'); + @Component export default class AddAndReservedBtns extends Vue { - @Action addToMyConsultantList!: (consultantToAdd: Consultants) => Promise<boolean> - @State('myConsultantList') myConsultantList!: Consultants[]; - @Prop() agentInfo!: Consultants; - @Prop() cusClass!: string; + + @Action + addToMyConsultantList!: (consultantToAdd: Consultant) => Promise<boolean> + + @State('myConsultantList') + myConsultantList!: Consultant[]; + + @Prop() + agentInfo!: Consultant; + + @Prop() + cusClass!: string; + + @roleStorage.Getter + isUserLogin!: boolean; + isVisiblePopUp = false; - addConsultant(item: Consultants) { + + ////////////////////////////////////////////////////////////////////// + + @Emit('openPopUp') + openPopUp(popUpTxt: string = '����憿批��'): string { + return popUpTxt; + } + + ////////////////////////////////////////////////////////////////////// + + addConsultant(item: Consultant): void { + if (!this.isUserLogin) { + item = { + ...item, + updateTime: new Date().toISOString() + }; + } 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() { return this.myConsultantList.find(item => item.agentNo === this.agentInfo.agentNo) ? true : false } + + get isDisableReserve(): boolean { + return this.myConsultantList.some((agent) => { + return agent.agentNo === this.agentInfo.agentNo + && agent.contactStatus === 'contacted'; + }); + } } -</script> \ No newline at end of file +</script> -- Gitblit v1.8.0