From 3e8c86ebf61df1ac5c9dfd96c7a829a2cd9ec4a2 Mon Sep 17 00:00:00 2001 From: Mila <Mila@pollex.com.tw> Date: 星期一, 15 十一月 2021 17:55:59 +0800 Subject: [PATCH] TODO#130023 客戶預約清單: 串接標註已聯絡 api --- PAMapp/components/Consultant/ConsultantCard.vue | 51 ++++++++++++++++++++++++++++----------------------- 1 files changed, 28 insertions(+), 23 deletions(-) diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue index 88b44c4..383c739 100644 --- a/PAMapp/components/Consultant/ConsultantCard.vue +++ b/PAMapp/components/Consultant/ConsultantCard.vue @@ -5,15 +5,14 @@ <el-col :xs="22" :sm="23"> <el-row type="flex"> <el-col class="flex_column" :xs="5" :sm="3"> - <el-avatar + <UiAvatar :size="50" - :src="agentInfo.img" - class="cursor--pointer" - @click.native="$router.push('/agentInfo')" - ></el-avatar> + :fileName="agentInfo.img" + @click.native="showAgentDetail(agentInfo.agentNo)" + ></UiAvatar> <div class="satisfaction"> <i class="icon-star pam-icon icon--yellow satisfaction"></i> - <span>{{agentInfo.satisfaction}}</span> + <span>{{agentInfo.avgScore }}</span> </div> </el-col> <el-col :xs="10" :sm="15"> @@ -21,13 +20,14 @@ <div class="professionals"> <span class="professionalsTxt" - v-for="(professional, index) in agentInfo.professionals" + v-for="(expertise, index) in agentInfo.expertise" :key="index" - >#{{professional}}</span> + >#{{expertise}}</span> </div> <div class="delete" - v-if="agentInfo.contactStatus === 'picked'" + v-if="agentInfo.contactStatus !== 'reserved' + || agentInfo.contactStatus !== 'contacted'" @click="removeAgent" >蝘駁</div> </el-col> @@ -37,13 +37,16 @@ @click="reserveCommunication" :class="agentInfo.contactStatus + 'Btn'" >{{ contactTxt }}</el-button> - <div class="updateTime">{{updateTime}}</div> + <div class="updateTime" v-if="updateTime">{{updateTime | formatDate}}</div> </el-col> </el-row> </el-col> </el-row> - <Ui-Dialog :isVisible.sync="isVisibleDialog"> + <Ui-Dialog + :isVisible.sync="isVisibleDialog" + :width="width" + > <h5 class="subTitle text--center mb-30">������</h5> <p class="smTxt">隞予 10:00</p> <div class="dialogInfo"> @@ -62,12 +65,15 @@ <script lang="ts"> import { Vue, Component, Prop, Emit } from 'nuxt-property-decorator'; -import { Agents } from '~/plugins/api/home'; +import { Consultants } from '~/assets/ts/api/consultant'; +import { isLogin } from '~/assets/ts/auth'; +import { isMobileDevice } from '~/assets/ts/device'; @Component export default class ConsultantCard extends Vue { - @Prop() agentInfo!: Agents; + @Prop() agentInfo!: Consultants; isVisibleDialog = false; + width: string = ''; get contactTxt() { if (this.agentInfo.contactStatus === 'contacted') { @@ -80,19 +86,14 @@ } get updateTime() { - const newDate = new Date(this.agentInfo.updateTime); - let year = newDate.getFullYear(); - let month = newDate.getMonth() + 1; - let date = newDate.getDate(); - let hours = newDate.getHours(); - let minutes = newDate.getMinutes(); - return `${year}/${month}/${date} ${hours} : ${minutes}` + return isLogin() ? this.agentInfo.updateTime : ''; } - reserveCommunication() { - if (this.agentInfo.contactStatus === 'picked') { - this.$router.push('/communication/myDemand') + const contactStatus = this.agentInfo.contactStatus; + if (contactStatus !== 'reserved' && contactStatus !== 'contacted') { + isLogin() ? this.$router.push(`/questionnaire/${this.agentInfo.agentNo}`) : this.$router.push('/login'); } else { + this.width = isMobileDevice() ? '80%' : ''; this.isVisibleDialog = true; } } @@ -100,6 +101,10 @@ @Emit('removeAgent') removeAgent() { return this.agentInfo.agentNo; } + + showAgentDetail(agentNo: string): void { + this.$router.push(`/agentInfo/${agentNo}`); + } } </script> -- Gitblit v1.8.0