From c047a3336ff1efc7d21edee6f0c8811264eebae7 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期六, 22 一月 2022 15:25:32 +0800
Subject: [PATCH] update: TODO#134222/134105 通知小鈴鐺/取得待評分的滿意度清單, 串接api

---
 PAMapp/pages/satisfactionList.vue |   51 +++++++++++++++++++++++++++++++++++----------------
 1 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/PAMapp/pages/satisfactionList.vue b/PAMapp/pages/satisfactionList.vue
index e54717c..e1f0870 100644
--- a/PAMapp/pages/satisfactionList.vue
+++ b/PAMapp/pages/satisfactionList.vue
@@ -4,17 +4,17 @@
     <div class="pam-container">
       <div class="satisfaction-title">
         <span class="mdTxt">皛踵�漲隤踵</span>
-        <span class="ml-10 text--prudential_grey smTxt_bold">� {{satisfactionList.length}} 蝑�</span>
+        <span class="ml-10 text--prudential_grey smTxt_bold">� {{mapUnReviewLogList.length}} 蝑�</span>
       </div>
-      <div class="satisfaction-card" v-for="(item, index) in satisfactionList" :key="index">
+      <div class="satisfaction-card" v-for="(item, index) in mapUnReviewLogList" :key="index">
         <div class="satisfaction-card-content">
-          <UiAvatar :size="80" :agentNo="''"></UiAvatar>
+          <UiAvatar :size="80" :agentNo="item.agentNo"></UiAvatar>
           <div class="satisfaction-card-text">撠憿批��
               <span class="text--primary text--bold">{{item.agentName}}</span>
               ��擃���蝯虫�嗾憿��嚗�
           </div>
         </div>
-        <el-rate v-model="item.score" class="pam-satisfaction-rate mt-10"></el-rate>
+        <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>
@@ -23,28 +23,47 @@
   </div>
 </template>
 
-<script>
-import { Vue, Component } from 'nuxt-property-decorator';
+<script lang="ts">
+import { Vue, Component, Action, State, Watch } from 'nuxt-property-decorator';
+import { AppointmentLog } from '~/shared/models/appointment.model';
 
 @Component({
   layout: 'home'
 })
 export default class MySatisfactionList extends Vue {
-  satisfactionList = [
-    {
-      agentName: '�蝢��',
-      score: 0
-    },
-    {
-      agentName: '�蝢��',
-      score: 0
+
+  @State
+  unReviewLogList!: AppointmentLog[];
+
+  mapUnReviewLogList: AppointmentReviewLog[] = [];
+
+  ///////////////////////////////////////////////////////
+
+  @Watch('unReviewLogList')
+  onUnReviewLogListChange() {
+    if (this.unReviewLogList.length) {
+      this.mapUnReviewLogList = this.unReviewLogList.map(item => {
+        return {
+          ...item,
+          satisfaction: 0
+        }
+      })
     }
-  ]
+  }
+
+  ///////////////////////////////////////////////////////
 
   get isBtnDisabled() {
-    return this.satisfactionList.findIndex(item => item.score > 0) === -1;
+    if (this.mapUnReviewLogList.length) {
+      return this.mapUnReviewLogList.findIndex(item => item.satisfaction > 0) === -1;
+    }
+    return false;
   }
 }
+
+interface AppointmentReviewLog extends AppointmentLog {
+  satisfaction: number;
+}
 </script>
 
 <style lang="scss" scoped>

--
Gitblit v1.8.0