| | |
| | | <span class="mdTxt">我的顧問清單</span> |
| | | <span class="smTxt_bold amount">共 {{consultantList.length}} 筆</span> |
| | | </el-col> |
| | | <el-col :span="8" class="mdTxt readMore" |
| | | <el-col |
| | | :span="8" |
| | | class="mdTxt readMore" |
| | | v-if="consultantList.length > 3" |
| | | @click.native="routerPush('/myConsultantList/consultantList')">查看更多</el-col> |
| | | </el-row> |
| | | <ConsultantList |
| | | :agents="consultantList.slice(0, 3)" |
| | | @removeAgent="removeAgent" |
| | | ></ConsultantList> |
| | | <div class='pam-recommend pb-30 pt-30'> |
| | | <h5 class="mdTxt">推薦保險顧問</h5> |
| | | <img class="absulate img" src="~/assets/images/index_recommend.svg" alt=""> |
| | | </div> |
| | | <ConsultantSwiper :agents="agents"></ConsultantSwiper> |
| | | <ConsultantSwiper :agents="recommendList"></ConsultantSwiper> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component } from 'nuxt-property-decorator'; |
| | | import { Agents } from '~/plugins/api/home'; |
| | | import { Context } from '@nuxt/types/app'; |
| | | import { Vue, Component, State, Action, Watch } from 'nuxt-property-decorator'; |
| | | import { Consultants } from '~/assets/ts/api/consultant'; |
| | | |
| | | @Component({ |
| | | layout: 'home' |
| | | }) |
| | | export default class MainComponent extends Vue { |
| | | agents: Agents[] = []; |
| | | consultantList: Agents[] = []; |
| | | consultantList: Consultants[] = []; |
| | | agents: Consultants[] = []; |
| | | @State('recommendList') recommendList!: Consultants[]; |
| | | @Action storeRecommendList!: any; |
| | | |
| | | async asyncData(context: Context) { |
| | | let agents: Agents[] = []; |
| | | let consultantList: Agents[] = []; |
| | | await context.$service.home.recommendConsultantList().then((result: Agents[]) => { |
| | | agents = result; |
| | | }) |
| | | @State('myConsultantList') myConsultantList!: Consultants[]; |
| | | @Action storeConsultantList!: any; |
| | | |
| | | consultantList = agents.filter(item => item.contactStatus !== 'contacted'); |
| | | @Watch('myConsultantList') |
| | | onMyConsultantListChange() { |
| | | this.consultantList = (this.myConsultantList || []) |
| | | .filter(item => item.contactStatus !== 'contacted') |
| | | .sort((a, b) => a.updateTime > b.updateTime ? -1 : 1) |
| | | } |
| | | |
| | | return { |
| | | agents, |
| | | consultantList |
| | | mounted() { |
| | | if (!this.recommendList?.length) { |
| | | this.storeRecommendList(); |
| | | } |
| | | |
| | | this.storeConsultantList(); |
| | | } |
| | | |
| | | routerPush(path: string) { |
| | | this.$router.push(path); |
| | | } |
| | | |
| | | removeAgent(agentNo: number) { |
| | | const findIndex = this.consultantList.findIndex((item, i) => { |
| | | return item.agentNo === agentNo; |
| | | }) |
| | | this.consultantList.splice(findIndex, 1) |
| | | } |
| | | } |
| | | |
| | | </script> |
| | |
| | | background-image: url('~/assets/images/recommendConsultant/banner_mob.svg'); |
| | | } |
| | | |
| | | @media (min-width: 576px) and (max-width: 768px) { |
| | | .quickFilter.el-button--default { |
| | | background-image: url('~/assets/images/quickFilter/banner_web.svg'); |
| | | } |
| | | |
| | | .recommendConsultant.el-button--default { |
| | | background-image: url('~/assets/images/recommendConsultant/banner_web.svg'); |
| | | } |
| | | } |
| | | |
| | | .rowStyle { |
| | | .amount { |
| | | color: $PRUDENTIAL_GREY; |