From 1841c2480076b9d64071c032d42a2215bb3fbebb Mon Sep 17 00:00:00 2001 From: Mila <Mila@pollex.com.tw> Date: 星期一, 24 一月 2022 11:21:40 +0800 Subject: [PATCH] update: TODO#134652 多筆滿意度評分 API 串接 --- PAMapp/pages/satisfactionList.vue | 94 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 73 insertions(+), 21 deletions(-) diff --git a/PAMapp/pages/satisfactionList.vue b/PAMapp/pages/satisfactionList.vue index e54717c..8d52771 100644 --- a/PAMapp/pages/satisfactionList.vue +++ b/PAMapp/pages/satisfactionList.vue @@ -4,46 +4,98 @@ <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 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> -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'; +import { UserReviewsConsultantsParams } from '~/shared/models/reviews.model'; +import reviewsService from '~/shared/services/reviews.service'; @Component({ layout: 'home' }) export default class MySatisfactionList extends Vue { - satisfactionList = [ - { - agentName: '�蝢��', - score: 0 - }, - { - agentName: '�蝢��', - score: 0 - } - ] - get isBtnDisabled() { - return this.satisfactionList.findIndex(item => item.score > 0) === -1; + @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 + } + }) + } } + + /////////////////////////////////////////////////////// + + 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 { + satisfaction: number; } </script> @@ -99,4 +151,4 @@ } } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0