| | |
| | | v-for="(question, index) in questionList" |
| | | :key="index" |
| | | class="subTitle quickBtn" |
| | | :disabled="question.name === 'onlineState'" |
| | | |
| | | :disabled="question.name === 'status'" |
| | | @click="openPopUp(question)" |
| | | >{{question.title}}</el-button> |
| | | </div> |
| | |
| | | v-if="selectedItem.gender" |
| | | @removeTag="removeTag('gender')" |
| | | > |
| | | {{selectedItem.gender}} |
| | | {{selectedItem.gender === 'male' ? '男性' : '女性'}} |
| | | </Ui-Tags> |
| | | <Ui-Tags |
| | | v-if="selectedItem.satisfaction" |
| | | @removeTag="removeTag('satisfaction')" |
| | | v-if="selectedItem.avgScore" |
| | | @removeTag="removeTag('avgScore')" |
| | | > |
| | | {{selectedItem.satisfaction + '星以上滿意度'}} |
| | | {{selectedItem.avgScore + '星以上滿意度'}} |
| | | </Ui-Tags> |
| | | <template v-if="selectedItem.style.length > 0"> |
| | | <template v-if="selectedItem.communicationStyles"> |
| | | <Ui-Tags |
| | | v-for="(item, index) in selectedItem.style" |
| | | v-for="(item, index) in selectedItem.communicationStyles" |
| | | :key="index" |
| | | @removeTag="removeTag('style', index)" |
| | | @removeTag="removeTag('communicationStyles', index)" |
| | | > |
| | | {{item}} |
| | | </Ui-Tags> |
| | |
| | | |
| | | <div class="mb-10" v-if="selectedItem.onlineState"></div> |
| | | <div class="emptyBox text--mid_grey" |
| | | v-if="!selectedItem.gender && !selectedItem.satisfaction && selectedItem.style.length === 0 && !selectedItem.onlineState"> |
| | | v-if="isEmpty"> |
| | | <p class="smTxt">尚無篩選</p> |
| | | </div> |
| | | </div> |
| | | |
| | | <h5 class="mdTxt mb-10 mt-30">快速篩選推薦</h5> |
| | | <template v-if="consultantList.length > 0"> |
| | | <QuickFilterConsultantList></QuickFilterConsultantList> |
| | | </template> |
| | | <div class="mb-10 mt-30"> |
| | | <span class="mdTxt">快速篩選推薦</span> |
| | | <span class="smTxt_bold text--prudential_grey ml-10">共 {{consultantList.length}} 筆</span> |
| | | </div> |
| | | <div class="recommend"> |
| | | <img class="img" src="~/assets/images/quickFilter/recommend.svg" alt=""> |
| | | |
| | | <template v-else> |
| | | <div class="emptyBox bg-white"></div> |
| | | </template> |
| | | <template v-if="consultantList.length > 0"> |
| | | <QuickFilterConsultantList :consultantList="consultantList"></QuickFilterConsultantList> |
| | | </template> |
| | | |
| | | <Ui-Drawer |
| | | :isVisible.sync="questionDrawer" |
| | | :size="questionOption.name === 'style' ? '50%' : '30%'" |
| | | @closeDrawer="closePopUp" |
| | | <template v-else> |
| | | <div class="emptyBox text--mid_grey recommendStyle"> |
| | | <p class="smTxt">尚無推薦資料</p> |
| | | </div> |
| | | </template> |
| | | </div> |
| | | |
| | | <PopUpFrame |
| | | :isOpen.sync="questionPopUp" |
| | | :drawerSize="questionOption.name === 'communicationStyles' ? '50%' : '30%'" |
| | | @update:isOpen="closePopUp" |
| | | > |
| | | <QuickFilterSelector |
| | | ref="quickFilterRef" |
| | | :drawerVisible.sync="questionDrawer" |
| | | :drawerVisible.sync="questionPopUp" |
| | | :questionOption="questionOption" |
| | | :selectedItem="selectedItem" |
| | | ></QuickFilterSelector> |
| | | </Ui-Drawer> |
| | | </PopUpFrame> |
| | | |
| | | <Ui-Dialog :isVisible.sync="dialog" |
| | | @closeDialog="closePopUp" |
| | | > |
| | | <QuickFilterSelector |
| | | ref="quickFilterRef" |
| | | :drawerVisible.sync="questionDrawer" |
| | | :questionOption="questionOption" |
| | | :selectedItem="selectedItem" |
| | | ></QuickFilterSelector> |
| | | </Ui-Dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Context } from '@nuxt/types'; |
| | | import { Vue, Component } from 'nuxt-property-decorator'; |
| | | import { Agents } from '~/plugins/api/home'; |
| | | import { isMobileDevice } from '~/assets/ts/device'; |
| | | import { Consultants, FastQueryParams } from '~/assets/ts/api/consultant'; |
| | | import QuickFilterDrawer from '~/components/QuickFilter/QuickFilterSelector.vue'; |
| | | import { fastQuery } from '~/assets/ts/api/consultant'; |
| | | |
| | | @Component |
| | | export default class QuickFilter extends Vue { |
| | | dialog = false; |
| | | consultantList = []; |
| | | questionDrawer = false; |
| | | questionPopUp = false; |
| | | consultantList: Consultants[] = []; |
| | | questionOption = {}; |
| | | selectedItem: selectedItem = { |
| | | selectedItem: FastQueryParams = { |
| | | gender: '', |
| | | satisfaction: 0, |
| | | style: [], |
| | | onlineState: '' |
| | | avgScore: 0, |
| | | communicationStyles: [], |
| | | status: '' |
| | | }; |
| | | questionList: QuestionOption[] = [ |
| | | { |
| | | name: 'gender', |
| | | title: '顧問性別', |
| | | detail: ['男性', '女性'], |
| | | type: 'radio' |
| | | detail: [ |
| | | { name: '男性', value: 'male', className: 'btn_man'}, |
| | | { name: '女性', value: 'female', className: 'btn_woman'} |
| | | ], |
| | | type: 'radio', |
| | | }, |
| | | { |
| | | name: 'satisfaction', |
| | | name: 'avgScore', |
| | | title: '顧問滿意度', |
| | | detail: [], |
| | | type: '' |
| | | }, |
| | | { |
| | | name: 'style', |
| | | name: 'communicationStyles', |
| | | title: '溝通風格', |
| | | detail: ['謹慎務實', '明快主動', '耐心傾聽', '健談風趣'], |
| | | detail: [ |
| | | { value: '謹慎務實', className: 'btn_owl'}, |
| | | { value: '明快主動', className: 'btn_tiger'}, |
| | | { value: '耐心傾聽', className: 'btn_koala'}, |
| | | { value: '健談風趣', className: 'btn_peacock'} |
| | | ], |
| | | type: 'checkbox' |
| | | }, |
| | | { |
| | | name: 'onlineState', |
| | | name: 'status', |
| | | title: '上線狀態', |
| | | detail: [], |
| | | type: 'radio' |
| | | } |
| | | ]; |
| | | |
| | | async asyncData(context: Context) { |
| | | let consultantList: Agents[] = []; |
| | | |
| | | await context.$service.home.recommendConsultantList().then((result: Agents[]) => { |
| | | consultantList = result; |
| | | }) |
| | | |
| | | return { |
| | | consultantList, |
| | | } |
| | | get isEmpty() { |
| | | return !this.selectedItem.gender |
| | | && !this.selectedItem.avgScore |
| | | && this.selectedItem.communicationStyles.length === 0 |
| | | && !this.selectedItem.status |
| | | } |
| | | |
| | | openPopUp(question: QuestionOption) { |
| | | this.questionOption = question; |
| | | isMobileDevice() ? this.questionDrawer = true : this.dialog = true; |
| | | this.questionPopUp =true; |
| | | } |
| | | |
| | | removeTag(type: string, index: number = 0) { |
| | |
| | | this.selectedItem.gender = '' |
| | | } |
| | | |
| | | if (type === 'satisfaction') { |
| | | this.selectedItem.satisfaction = 0 |
| | | if (type === 'avgScore') { |
| | | this.selectedItem.avgScore = 0 |
| | | } |
| | | |
| | | if (type === 'style') { |
| | | this.selectedItem.style.splice(index, 1) |
| | | if (type === 'communicationStyles') { |
| | | this.selectedItem.communicationStyles.splice(index, 1) |
| | | } |
| | | |
| | | this.isEmpty ? this.consultantList = [] : this.getRecommendList(); |
| | | } |
| | | |
| | | closePopUp() { |
| | | this.selectedItem = JSON.parse(JSON.stringify((this.$refs.quickFilterRef as QuickFilterDrawer).pickedItem)); |
| | | this.getRecommendList(); |
| | | } |
| | | |
| | | getRecommendList() { |
| | | const data = { |
| | | gender: this.selectedItem.gender, |
| | | communicationStyles: this.selectedItem.communicationStyles, |
| | | avgScore: this.selectedItem.avgScore, |
| | | status: this.selectedItem.status |
| | | } |
| | | |
| | | fastQuery(data).then((res) => this.consultantList = res.data) |
| | | } |
| | | |
| | | } |
| | | |
| | | export interface QuestionOption { |
| | | title: string; |
| | | detail: string[]; |
| | | detail: Detail[]; |
| | | type: string; |
| | | name: string; |
| | | } |
| | | |
| | | export interface selectedItem { |
| | | interface Detail { |
| | | value: string; |
| | | name?: string; |
| | | gender: string; |
| | | satisfaction: number; |
| | | style: string[]; |
| | | onlineState: string; |
| | | className: string; |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .emptyBox { |
| | | width: 100%; |
| | | height: 100px; |
| | | |
| | | border: solid 1px $LIGHT_GREY; |
| | | text-align: center; |
| | | border-radius: 10px; |
| | | |
| | | .smTxt { |
| | | line-height: 100px; |
| | | } |
| | | } |
| | | |
| | | .bg-white { |
| | | .recommendStyle { |
| | | box-shadow: 0 0 6px #00000029; |
| | | background-color: $PRIMARY_WHITE; |
| | | } |
| | | |
| | |
| | | height: 56px; |
| | | text-align: center; |
| | | box-shadow: 0 0 6px #22222229; |
| | | border-color: $PRIMARY_WHITE; |
| | | border-radius: 10px; |
| | | color: $PRIMARY_BLACK; |
| | | |
| | | &:hover,&:focus { |
| | | color: $PRIMARY_BLACK; |
| | | border-color: $PRIMARY_WHITE; |
| | | background-color: $PRIMARY_WHITE; |
| | | } |
| | | color: $PRIMARY_WHITE; |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | background-image: url('~/assets/images/quickFilter/btn_bg.svg'); |
| | | |
| | | &:disabled { |
| | | color: $PRIMARY_WHITE; |
| | | border-color: $LIGHT_GREY; |
| | | background-color: $LIGHT_GREY; |
| | | background-image: none; |
| | | } |
| | | } |
| | | .quickBtn+.quickBtn { |
| | | margin-left: 0; |
| | | } |
| | | |
| | | .is-disabled { |
| | | background-color: $LIGHT_GREY; |
| | | color: $PRIMARY_WHITE; |
| | | } |
| | | |
| | | &:hover,&:focus { |
| | | color: $PRIMARY_WHITE; |
| | | border-color: $LIGHT_GREY; |
| | | background-color: $LIGHT_GREY; |
| | | } |
| | | .recommend { |
| | | position: relative; |
| | | |
| | | .img { |
| | | position: absolute; |
| | | top: -50px; |
| | | right: 10px; |
| | | } |
| | | } |
| | | |