From c5a873f70239f30158c6ab67b3e55de71413de9a Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期三, 10 十一月 2021 18:05:47 +0800
Subject: [PATCH] Merge branch 'master' of https://192.168.0.10:8443/r/pcalife/PAM

---
 PAMapp/pages/quickFilter/index.vue |  113 +++++++++++++++++++++++---------------------------------
 1 files changed, 46 insertions(+), 67 deletions(-)

diff --git a/PAMapp/pages/quickFilter/index.vue b/PAMapp/pages/quickFilter/index.vue
index 9f56a03..dd7dd5a 100644
--- a/PAMapp/pages/quickFilter/index.vue
+++ b/PAMapp/pages/quickFilter/index.vue
@@ -5,7 +5,7 @@
                 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>
@@ -15,19 +15,19 @@
                 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>
@@ -35,14 +35,14 @@
 
             <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>
 
         <div class="mb-10 mt-30">
             <span class="mdTxt">敹恍�祟���</span>
-            <span class="smTxt_bold text--prudential_grey ml-10">� 0 蝑�</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="">
@@ -60,7 +60,7 @@
 
         <Ui-Drawer
             :isVisible.sync="questionDrawer"
-            :size="questionOption.name === 'style' ? '50%' : '30%'"
+            :size="questionOption.name === 'communicationStyles' ? '50%' : '30%'"
             @closeDrawer="closePopUp"
         >
             <QuickFilterSelector
@@ -85,9 +85,8 @@
 </template>
 
 <script lang="ts">
-import { Context } from '@nuxt/types';
 import { Vue, Component } from 'nuxt-property-decorator';
-import { Consultants } from '~/assets/ts/api/consultant';
+import { FastQueryParams } from '~/assets/ts/api/consultant';
 import { isMobileDevice } from '~/assets/ts/device';
 import QuickFilterDrawer from '~/components/QuickFilter/QuickFilterSelector.vue';
 import { fastQuery } from '~/assets/ts/api/consultant';
@@ -98,69 +97,52 @@
     consultantList = [];
     questionDrawer = false;
     questionOption = {};
-    selectedItem: selectedItem = {
+    selectedItem: FastQueryParams = {
         gender: '',
-        satisfaction: 0,
-        style: [],
-        onlineState: ''
+        avgScore: 0,
+        communicationStyles: [],
+        status: ''
     };
     questionList: QuestionOption[] = [
         {
             name: 'gender',
             title: '憿批��批',
             detail: [
-                {
-                    value: '���',
-                    className: 'btn_man'
-                }, {
-                    value: '憟單��',
-                    className: 'btn_woman'
-                }],
+                { 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: [
-                {
-                    value: '雓寞��祕',
-                    className: 'btn_owl'
-                },{
-                    value: '��翰銝餃��',
-                    className: 'btn_tiger'
-                },{
-                    value: '���',
-                    className: 'btn_koala'
-                }, {
-                    value: '�隢◢頞�',
-                    className: 'btn_peacock'
-                }],
+                { 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: Consultants[] = [];
-
-        // await context.$service.home.recommendConsultantList().then((result: Consultants[]) => {
-        //     consultantList = result;
-        // })
-
-        return {
-            consultantList,
-        }
+    get isEmpty() {
+        return !this.selectedItem.gender
+            && !this.selectedItem.avgScore
+            && this.selectedItem.communicationStyles.length === 0
+            && !this.selectedItem.status
     }
 
     openPopUp(question: QuestionOption) {
@@ -174,27 +156,31 @@
             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: 'male',
-            communicationStyle: '雓寞��祕',
-            avgScore: 5,
-            status: 'online'
+            gender: this.selectedItem.gender,
+            communicationStyles: this.selectedItem.communicationStyles,
+            avgScore: this.selectedItem.avgScore,
+            status: this.selectedItem.status
         }
 
-        fastQuery(data).then((res) => console.log(res))
+        fastQuery(data).then((res) => this.consultantList = res.data)
     }
 
 }
@@ -208,16 +194,10 @@
 
 interface Detail {
     value: string;
+    name?: string;
     className: string;
 }
 
-export interface selectedItem {
-    name?: string;
-    gender: string;
-    satisfaction: number;
-    style: string[];
-    onlineState: string;
-}
 </script>
 
 <style lang="scss" scoped>
@@ -278,7 +258,6 @@
             top: -50px;
             right: 10px;
         }
-
     }
 
 </style>
\ No newline at end of file

--
Gitblit v1.8.0