From 27d109b5792305d849f578627f98e1cb55a330f4 Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期五, 11 三月 2022 15:12:54 +0800
Subject: [PATCH] Merge branch 'Phase3' into pollex-dev

---
 PAMapp/pages/satisfactionList.vue |  102 +++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 83 insertions(+), 19 deletions(-)

diff --git a/PAMapp/pages/satisfactionList.vue b/PAMapp/pages/satisfactionList.vue
index e1f0870..dbf2330 100644
--- a/PAMapp/pages/satisfactionList.vue
+++ b/PAMapp/pages/satisfactionList.vue
@@ -6,26 +6,59 @@
         <span class="mdTxt">皛踵�漲隤踵</span>
         <span class="ml-10 text--prudential_grey smTxt_bold">� {{mapUnReviewLogList.length}} 蝑�</span>
       </div>
-      <div class="satisfaction-card" v-for="(item, index) in mapUnReviewLogList" :key="index">
-        <div class="satisfaction-card-content">
-          <UiAvatar :size="80" :agentNo="item.agentNo"></UiAvatar>
-          <div class="satisfaction-card-text">撠憿批��
-              <span class="text--primary text--bold">{{item.agentName}}</span>
-              ��擃���蝯虫�嗾憿��嚗�
+      <template v-if="mapUnReviewLogList.length">
+        <div class="satisfaction-card" v-for="(item, index) in mapUnReviewLogList" :key="index">
+          <div class="satisfaction-card-content"  v-if="item.agentName">
+            <UiAvatar :size="80" :agentNo="item.agentNo"></UiAvatar>
+            <div class="satisfaction-card-text">撠憿批��
+                <span class="text--primary text--bold">{{item.agentName}}</span>
+                ��擃���蝯虫�嗾憿��嚗�
+            </div>
           </div>
+           <div class="satisfaction-card-content"  v-else>
+            <div class="pam-satisfaction-avatar">
+              <span class="pam-satisfaction-avatar-txt">撟喳</span>
+              </div>
+            <div class="satisfaction-card-text" >撠
+                <span class="text--primary text--bold">������</span>
+                撟喳��擃���蝯虫�嗾憿��嚗�
+            </div>
+          </div>
+          <el-rate
+            v-model="item.satisfaction"
+            class="pam-satisfaction-rate mt-10 fix-chrome-click--issue"
+            @change="isBtnDisabled = false"
+          ></el-rate>
         </div>
-        <el-rate v-model="item.satisfaction" class="pam-satisfaction-rate mt-10"></el-rate>
-      </div>
-      <div class="text--center mt-30">
-        <el-button type="primary" :disabled="isBtnDisabled">�</el-button>
-      </div>
+        <div class="text--center mt-30" v-if="mapUnReviewLogList.length">
+          <el-button type="primary" :disabled="isBtnDisabled" @click="sent">�</el-button>
+        </div>
+      </template>
+      <template v-else>
+         <div class="satisfaction-card">
+          <div class="satisfaction-card-content">
+            ������閬憛怠神��遛��漲隤踵
+          </div>
+         </div>
+      </template>
     </div>
+
+    <PopUpFrame :isOpen.sync="showConfirmPopup"
+        @closePopUp="closePopup">
+        <div class="text--center mdTxt">�����</div>
+        <div class="text--center mt-30">
+            <el-button @click="closePopup" type="primary">蝣箏��</el-button>
+        </div>
+      </PopUpFrame>
   </div>
 </template>
 
 <script lang="ts">
 import { Vue, Component, Action, State, Watch } from 'nuxt-property-decorator';
+
+import reviewsService from '~/shared/services/reviews.service';
 import { AppointmentLog } from '~/shared/models/appointment.model';
+import { UserReviewParams } from '~/shared/models/reviews.model';
 
 @Component({
   layout: 'home'
@@ -35,30 +68,48 @@
   @State
   unReviewLogList!: AppointmentLog[];
 
+  @Action
+  storeMyAppointmentReviewLog!: () => void;
+
   mapUnReviewLogList: AppointmentReviewLog[] = [];
+  showConfirmPopup = false;
+  isBtnDisabled = true;
 
   ///////////////////////////////////////////////////////
 
   @Watch('unReviewLogList')
   onUnReviewLogListChange() {
-    if (this.unReviewLogList.length) {
       this.mapUnReviewLogList = this.unReviewLogList.map(item => {
         return {
           ...item,
           satisfaction: 0
         }
       })
-    }
   }
 
   ///////////////////////////////////////////////////////
 
-  get isBtnDisabled() {
-    if (this.mapUnReviewLogList.length) {
-      return this.mapUnReviewLogList.findIndex(item => item.satisfaction > 0) === -1;
-    }
-    return false;
+  sent() {
+    const reviewParams: UserReviewParams[] = this.mapUnReviewLogList
+                .filter(item => item.satisfaction > 0)
+                .map(item => {
+                  return {
+                    appointmentId: item.appointmentId,
+                    score: item.satisfaction,
+                    type: item.type
+                  }
+                })
+
+        reviewsService.allUserReviewsConsultants(reviewParams).then((res) => {
+            this.showConfirmPopup = true;
+        });
   }
+
+  closePopup() {
+    this.showConfirmPopup = false;
+    this.storeMyAppointmentReviewLog();
+  }
+
 }
 
 interface AppointmentReviewLog extends AppointmentLog {
@@ -107,6 +158,19 @@
       font-size: 20px;
       padding-left: 10px;
     }
+    .pam-satisfaction-avatar{
+      height: 80px;
+      width: 80px;
+      border-radius: 50%;
+      background-color:#F09491;
+      justify-content: center;
+      align-items: center;
+      display: flex;
+      .pam-satisfaction-avatar-txt{
+        font-size: 18px;
+        color: #fff;
+      }
+    }
 
     @include desktop {
         justify-content: flex-start;
@@ -118,4 +182,4 @@
   }
 
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0