From ac594e4efb30ba28776d74b0fb08ab34d7c32023 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期四, 30 十二月 2021 15:20:08 +0800
Subject: [PATCH] Merge branch 'Phase2'

---
 PAMapp/components/Consultant/ConsultantCard.vue |   53 +++++++++++++++++++++--------------------------------
 1 files changed, 21 insertions(+), 32 deletions(-)

diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue
index f774135..2c91291 100644
--- a/PAMapp/components/Consultant/ConsultantCard.vue
+++ b/PAMapp/components/Consultant/ConsultantCard.vue
@@ -8,7 +8,7 @@
                     <el-col class="flex_column" :xs="5" :sm="3">
                         <UiAvatar
                             :size="50"
-                            :fileName="avatarFileName"
+                            :agentNo="agentInfo.agentNo"
                             @click.native="showAgentDetail(agentInfo.agentNo)"
                         ></UiAvatar>
                         <!-- TODO:���遛��漲 -->
@@ -44,8 +44,12 @@
                             @click="reserveCommunication"
                             :class="actionBtnStyle"
                         >{{ actionBtnLabel }}</el-button>
+                        <div
+                          v-if="notScoreAppointmentYet"
+                          class="text--primary mt-10 text--center text--underline cursor--pointer"
+                          @click="reviewsBtn = true">蝯虫�遛��漲閰��</div>
                         <div class="updateTime mt-10">
-                            {{ displayTime | formatDate }}
+                            {{ agentInfo.updateTime | formatDate }}
                         </div>
                     </el-col>
                 </el-row>
@@ -129,12 +133,13 @@
 <script lang="ts">
 import { Vue, Component, Prop, Action, namespace } from 'nuxt-property-decorator';
 
-import appointmentService from '~/assets/ts/services/appointment.service';
-import { isMobileDevice } from '~/assets/ts/device';
-import { hideReviews } from '~/assets/ts/const/hide-reviews';
-import { UserReviewsConsultantsParams, userReviewsConsultants } from '~/assets/ts/api/consultant';
-import { Consultant, ConsultantWithAppointmentId } from '~/assets/ts/models/consultant.model';
-import { Appointment } from '~/assets/ts/models/appointment.model';
+import appointmentService from '~/shared/services/appointment.service';
+import reviewsService from '~/shared/services/reviews.service';
+import UtilsService from '~/shared/services/utils.service';
+import { hideReviews } from '~/shared/const/hide-reviews';
+import { Consultant, ConsultantWithAppointmentId } from '~/shared/models/consultant.model';
+import { Appointment } from '~/shared/models/appointment.model';
+import { UserReviewsConsultantsParams } from '~/shared/models/reviews.model';
 
 const localStorage = namespace('localStorage');
 @Component({
@@ -228,27 +233,6 @@
       }
     }
 
-    get displayTime(): string {
-      const isAppointment = !!this.agentInfo['appointmentStatus'];
-      let time: Date | string = '';
-      if (isAppointment) {
-        time = this.agentInfo['appointmentDate'];
-      } else {
-        switch(this.agentInfo.contactStatus) {
-            case 'reserved':
-                time = this.agentInfo.updateTime;
-                break;
-            case 'picked':
-                time = this.agentInfo.updateTime;
-                break;
-        }
-      }
-        if (typeof time !== 'string') {
-          time.toString();
-        }
-        return time as string;
-    }
-
     get avatarFileName() {
         return this.agentInfo.img;
     }
@@ -333,7 +317,7 @@
                 ...res,
                 satisfactionScore:  this.agentInfo['appointmentScore'],
             };
-            this.width = isMobileDevice() ? '80%' : '';
+            this.width = UtilsService.isMobileDevice() ? '80%' : '';
             this.isVisibleDialog = true;
         });
     }
@@ -348,13 +332,18 @@
     }
 
     userReviewsConsultants() {
+      const isAppointment = !!this.agentInfo['appointmentStatus'];
+      const appointmentId = isAppointment
+                          ? this.agentInfo['appointmentId']
+                          : this.latestReservedAppointment.id;
+
         const reviewParams: UserReviewsConsultantsParams = {
-            appointmentId: this.appointmentDetail.id,
+            appointmentId: appointmentId,
             score: this.inputScore,
         }
         this.appointmentDetail.satisfactionScore = this.inputScore;
 
-        userReviewsConsultants(reviewParams).then((res) => {
+        reviewsService.userReviewsConsultants(reviewParams).then((res) => {
             this.reviewsBtn = false;
             this.storeConsultantList();
         });

--
Gitblit v1.8.0