保誠-保戶業務員媒合平台
wayne
2022-01-26 6fa4bba623713c396432ba8b863846883d6a1906
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<template>
  <div>
    <div class="pam-satisfaction-banner"></div>
    <div class="pam-container">
      <div class="satisfaction-title">
        <span class="mdTxt">滿意度調查</span>
        <span class="ml-10 text--prudential_grey smTxt_bold">共 {{mapUnReviewLogList.length}} 筆</span>
      </div>
      <template v-if="mapUnReviewLogList.length">
        <div class="satisfaction-card" v-for="(item, index) in mapUnReviewLogList" :key="index">
          <div class="satisfaction-card-content">
            <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.satisfaction"
            class="pam-satisfaction-rate mt-10 fix-chrome-click--issue"
            @change="isBtnDisabled = false"
          ></el-rate>
        </div>
        <div class="text--center mt-30" v-if="mapUnReviewLogList.length">
          <el-button type="primary" :disabled="isBtnDisabled" @click="sent">送出</el-button>
        </div>
      </template>
      <template v-else>
         <div class="satisfaction-card">
          <div class="satisfaction-card-content">
            目前暫無需要您填寫的滿意度調查
          </div>
         </div>
      </template>
    </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'
})
export default class MySatisfactionList extends Vue {
 
  @State
  unReviewLogList!: AppointmentLog[];
 
  @Action
  storeMyAppointmentReviewLog!: () => void;
 
  mapUnReviewLogList: AppointmentReviewLog[] = [];
  showConfirmPopup = false;
  isBtnDisabled = true;
 
  ///////////////////////////////////////////////////////
 
  @Watch('unReviewLogList')
  onUnReviewLogListChange() {
      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>
 
<style lang="scss" scoped>
.pam-satisfaction-banner {
    width              : 100%;
    height             : 120px;
    background-size    : cover;
    background-repeat  : no-repeat;
    background-position: center;
    position           : relative;
    background-image   : url('~/assets/images/satisfaction/banner_mob.svg');
}
 
@media (min-width: 768px) {
    .pam-satisfaction-banner {
        height          : 150px;
        background-image: url('~/assets/images/satisfaction/banner_web.svg');
    }
}
 
.pam-container {
    margin: 30px 20px;
}
 
@include desktop {
    .pam-container {
        width : 700px;
        margin: 30px auto;
    }
}
.satisfaction-card {
  margin-top       : 20px;
  .satisfaction-card-content {
    display        : flex;
    flex-direction : row;
    justify-content: space-between;
    .satisfaction-card-text {
      width        : 75%;
      line-height  : 28px;
      align-self: center;
      font-size: 20px;
      padding-left: 10px;
    }
 
    @include desktop {
        justify-content: flex-start;
        .satisfaction-card-text {
          width        : auto;
          padding-left: 30px;
        }
      }
  }
 
}
</style>