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/shared/services/reviews.service.ts | 10 ++++++++-- PAMapp/pages/satisfactionList.vue | 49 +++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 10 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 { diff --git a/PAMapp/shared/services/reviews.service.ts b/PAMapp/shared/services/reviews.service.ts index 44c51d9..4bd81df 100644 --- a/PAMapp/shared/services/reviews.service.ts +++ b/PAMapp/shared/services/reviews.service.ts @@ -5,11 +5,17 @@ class ReviewsService { - //摰X�脰�遛��漲閰�� + //摰X�脰�遛��漲閰��(�蝑�) userReviewsConsultants(data: UserReviewsConsultantsParams) { - return http.post('/satisfaction/score', data ); + return http.post('/satisfaction/score', data); } + // 摰X�脰�遛��漲(憭��) + allUserReviewsConsultants(data: UserReviewsConsultantsParams[]) { + return http.post('/satisfaction/score/all', data); + } + + //������������ async getMyReviewLog(): Promise<AppointmentLog[]> { return http.get('/satisfaction/getMySatisfaction').then(res => res.data); -- Gitblit v1.8.0