From 21d2b51910f1e1e338beed76d53effcfccb1ef7a Mon Sep 17 00:00:00 2001
From: Jack <jack.su@pollex.com.tw>
Date: 星期一, 24 一月 2022 16:47:57 +0800
Subject: [PATCH] Merge branch 'Phase3' of ssh://dev.pollex.com.tw:29418/pcalife/PAM into Phase3

---
 PAMapp/pages/satisfactionList.vue |   49 +++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/PAMapp/pages/satisfactionList.vue b/PAMapp/pages/satisfactionList.vue
index a6bae69..8d52771 100644
--- a/PAMapp/pages/satisfactionList.vue
+++ b/PAMapp/pages/satisfactionList.vue
@@ -14,18 +14,32 @@
               ��擃���蝯虫�嗾憿��嚗�
           </div>
         </div>
-        <el-rate v-model="item.score" class="pam-satisfaction-rate mt-10 fix-chrome-click--issue"></el-rate>
+        <el-rate
+          v-model="item.satisfaction"
+          class="pam-satisfaction-rate mt-10 fix-chrome-click--issue"
+          @change="isBtnDisabled = false"
+        ></el-rate>
       </div>
-      <div class="text--center mt-30">
-        <el-button type="primary" :disabled="isBtnDisabled">�</el-button>
+      <div class="text--center mt-30" v-if="mapUnReviewLogList.length">
+        <el-button type="primary" :disabled="isBtnDisabled" @click="sent">�</el-button>
       </div>
     </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 { AppointmentLog } from '~/shared/models/appointment.model';
+import { UserReviewsConsultantsParams } from '~/shared/models/reviews.model';
+import reviewsService from '~/shared/services/reviews.service';
 
 @Component({
   layout: 'home'
@@ -35,7 +49,12 @@
   @State
   unReviewLogList!: AppointmentLog[];
 
+  @Action
+  storeMyAppointmentReviewLog!: () => void;
+
   mapUnReviewLogList: AppointmentReviewLog[] = [];
+  showConfirmPopup = false;
+  isBtnDisabled = true;
 
   ///////////////////////////////////////////////////////
 
@@ -53,12 +72,26 @@
 
   ///////////////////////////////////////////////////////
 
-  get isBtnDisabled() {
-    if (this.mapUnReviewLogList.length) {
-      return this.mapUnReviewLogList.findIndex(item => item.satisfaction > 0) === -1;
-    }
-    return false;
+  sent() {
+    const reviewParams: UserReviewsConsultantsParams[] = this.mapUnReviewLogList
+                .filter(item => item.satisfaction > 0)
+                .map(item => {
+                  return {
+                    appointmentId: item.appointmentId,
+                    score: item.satisfaction
+                  }
+                })
+
+        reviewsService.allUserReviewsConsultants(reviewParams).then((res) => {
+            this.showConfirmPopup = true;
+        });
   }
+
+  closePopup() {
+    this.showConfirmPopup = false;
+    this.storeMyAppointmentReviewLog();
+  }
+
 }
 
 interface AppointmentReviewLog extends AppointmentLog {

--
Gitblit v1.8.0