保誠-保戶業務員媒合平台
Tomas
2022-02-08 81847996079f71527c1471f272be43b5b4f77490
PAMapp/components/Client/ClientCard.vue
@@ -6,7 +6,7 @@
            class="rowStyle cursor--pointer"
            justify="space-between"
            :class="{'new': newAppointment }"
            @click.native="viewDetail"
            @click.native="viewAppointmentDetail"
        >
        <div class="test">
            <div class="unread" v-if="isReserved">
@@ -14,9 +14,23 @@
            </div>
            <div class="pl-10">
                <div class="smTxt_bold name">{{ client.name }}</div>
                <div class="my-10 xsTxt">預約成功</div>
                <div class="professionals">
                <div class="smTxt_bold name">{{ client.name || 'NO NAME' }}</div>
                <div  v-if="client.communicateStatus === contactStatus.RESERVED" class="my-10 xsTxt">預約成功</div>
                <div
                  class="xsTxt mb-10 mt-10"
                  v-else-if="client.communicateStatus === contactStatus.CONTACTED">
                  約訪紀錄
                </div>
                <div
                  class="xsTxt mb-10 mt-10"
                  v-else>
                  滿意度
                  <span v-if="client.satisfactionScore" class="xsTxt text--primary">
                    <UiReviewScore :score="client.satisfactionScore"></UiReviewScore>
                  </span>
                  <span v-else class="xsTxt text--mid_grey">未填</span>
                </div>
                <div class="professionals mb-10" v-if="client.communicateStatus === contactStatus.RESERVED">
                    <template v-if="client.requirement">
                        <span
                            v-for="(item, index) in requirements"
@@ -40,7 +54,6 @@
                ></el-avatar>
                <div class="satisfaction" v-if="!hideReviews">
                    <template v-if="client.satisfactionScore">
                        TODO:隱藏滿意度
                        <i class="icon-star pam-icon icon--yellow satisfaction"></i>
                        <span>{{client.satisfactionScore}}</span>
                    </template>
@@ -54,20 +67,20 @@
                <div
                  class="invite-msg smTxt_bold"
                  @click.stop="makeInterview"
                  @click.stop="showAddInterviewDialog"
                  v-if="client.communicateStatus === contactStatus.RESERVED">
                  傳送約訪通知
                </div>
                <div
                  class="invite-msg smTxt_bold"
                  @click.stop="closeAppointment"
                  @click.stop="navigateToCloseAppointment"
                  v-else-if="client.communicateStatus === contactStatus.CONTACTED">
                  結案
                </div>
                <div
                  class="invite-msg smTxt_bold"
                  @click.stop="inviteReview"
                  v-else>
                  v-else-if="!client.satisfactionScore">
                  發送滿意度
                </div>
@@ -81,9 +94,9 @@
        </el-row>
        <Ui-Dialog
            :isVisible.sync="isVisibleDialog"
            :isVisible.sync="isShowInformDialog"
            :width="dialogWidth"
            @closeDialog="closeDialog"
            @closeDialog="closeInformDialog"
            class="pam-myDemand-dialog"
        >
            <h5 class="subTitle text--center mb-30"
@@ -142,22 +155,34 @@
            </div>
        </Ui-Dialog>
        <InterviewMsg :isVisible.sync="isMsgDialog"></InterviewMsg>
        <InterviewMsg
          :client="client"
          :isVisible.sync="isShowAddInterviewDialog">
        </InterviewMsg>
        <PopUpFrame :isOpen.sync="isShowInviteReviewDialog">
          <div class="text--middle invite-review">
            <div class="mb-30 mt-10">已發送滿意度</div>
            <div class="text--primary text--middle cursor--pointer text--underline" @click="isShowInviteReviewDialog = false" :size="'250px'">我知道了</div>
          </div>
        </PopUpFrame>
    </div>
</template>
<script lang="ts">
import { Vue, Component, Prop, Action, namespace, Watch } from 'nuxt-property-decorator';
import { Vue, Component, Prop, namespace, Watch } from 'nuxt-property-decorator';
import appointmentService from '~/shared/services/appointment.service';
import myConsultantService from '~/shared/services/my-consultant.service';
import UtilsService from '~/shared/services/utils.service';
import { hideReviews } from '~/shared/const/hide-reviews';
import myConsultantService from '~/shared/services/my-consultant.service';
import { ElRow } from 'element-ui/types/row';
import { Appointment, AppointmentMemoInfo } from '~/shared/models/appointment.model';
import { ContactStatus } from '~/shared/models/enum/contact-status';
import reviewsService from '~/shared/services/reviews.service';
const localStorage = namespace('localStorage');
const appointmentStore = namespace('appointment.store');
const localStorage     = namespace('localStorage');
@Component({
    filters: {
        formatNumber(index: number) {
@@ -178,30 +203,39 @@
    }
})
export default class ClientList extends Vue {
    @Action
    updateMyAppointment!: (data: Appointment) => void;
    @Prop()
    client!: Appointment;
    @appointmentStore.Action
    updateMyAppointmentList!: (data: Appointment) => void;
    @appointmentStore.Action
    getAppointmentDetail!: (appointmentId: number) => Promise<Appointment>;
    @appointmentStore.Action
    updateAppointmentDetail!: (id: number) => Appointment;
    @appointmentStore.Getter
    appointmentProgress!: ContactStatus;
    @localStorage.Mutation
    storageClearAppointmentIdFromMsg!: () => void;
    isVisibleDialog = false;
    isMsgDialog = false;
    dialogWidth = '';
    hideReviews = hideReviews;
    contactStatus            = ContactStatus;
    contactStatus = ContactStatus;
    // currentAppointmentStatus = this.contactStatus.RESERVED;
    dialogWidth              = '';
    hideReviews              = hideReviews;
    isEdit                   = false;
    isShowAddInterviewDialog = false;
    isShowInformDialog       = false;
    isShowInviteReviewDialog = false;
    memo                     = '';
    isEdit = false;
    memoInfo: AppointmentMemoInfo = {
        appointmentId: 0,
        content: '',
        id: 0
    }
    memo = '';
        content      : '',
        id           : 0
    };
    //////////////////////////////////////////////////////////////////////
@@ -224,75 +258,30 @@
    //////////////////////////////////////////////////////////////////////
    viewDetail(): void {
      this.$router.push(`/appointment/${this.client.id}`);
    }
    makeInterview(): void {
      this.isMsgDialog = true;
    }
    closeAppointment(): void {
      this.$router.push(`/appointment/${this.client.id}/close`);
    }
    makeAppointment(): void {
      alert('MAKE AN APPOINTMENT!');
    }
    get newAppointment(): boolean {
      return !this.client.consultantViewTime
            && this.client.communicateStatus === 'reserved';
    }
    get isReserved() {
      return this.client.communicateStatus === 'reserved';
    }
    get isRead() {
      return !!this.client.consultantReadTime;
    }
    get requirements() {
        return this.client.requirement.split(',');
    }
    get gender() {
        if (this.client.gender) {
            return this.client.gender === 'male' ? '男性' : '女性';
    viewAppointmentDetail(): void {
      this.getAppointmentDetail(this.client.id).then((_) => {
        const unread = !this.client.consultantReadTime;
        if (unread) {
          this.readAppointment();
        }
        return '';
        this.$router.push(`/appointment/${this.client.id}`);
      });
    }
    get hopeContactTime() {
        const contactList = this.client.hopeContactTime.split("'").map(item => item.slice(0, item.length));
        return contactList.filter(item => !!item && item !== ",")
    showAddInterviewDialog(): void {
      this.isShowAddInterviewDialog = true;
    }
    get reservedTxt(): string {
        if (this.isReserved) {
            return this.client.consultantReadTime ? '已讀' : '未讀';
        } else {
            return '已聯絡'
        }
    navigateToCloseAppointment(): void {
      this.getAppointmentDetail(this.client.id).then((_) => {
        this.$router.push(`/appointment/${this.client.id}/close`);
      });
    }
    get displayTime(): string {
        if (this.isReserved) {
            return this.client.appointmentDate;
        } else {
            return this.client.lastModifiedDate;
        }
    }
    get time() {
        const formatDate = (this.$options.filters as any).formatDate(this.displayTime);
        return formatDate.split(' ')[1]
    }
    get date() {
        const formatDate = (this.$options.filters as any).formatDate(this.displayTime);
        return formatDate.split(' ')[0];
    inviteReview(): void {
        reviewsService.sendSatisfactionToClient(this.client.id).then(res => {
            this.isShowInviteReviewDialog = true ;
        })
    }
    openDetail() {
@@ -300,27 +289,29 @@
            (this.$refs.clientCardRef as any).$el.classList.add('currentShowStyle');
        }, 0)
        this.dialogWidth = UtilsService.isMobileDevice() ? '80%' : '';
        this.isVisibleDialog = true;
        this.isShowInformDialog = true;
    }
    markAppointment() {
        myConsultantService.markAsContact(this.client.id).then(data => {
            this.updateMyAppointment(data);
            this.isVisibleDialog = false;
            this.updateMyAppointmentList(data);
            this.isShowInformDialog = false;
        })
    }
    closeDialog(): void {
      const unread = !this.client.consultantReadTime;
        if (unread) {
            appointmentService.recordRead(this.client.id).then((_) => {
                const updatedClient = {...this.client};
                updatedClient.consultantReadTime = new Date().toString();
                this.updateMyAppointment(updatedClient);
            });
        };
    closeInformDialog(): void {
        this.readAppointment();
        this.isEdit = false;
        this.clearAppointmentIdFromMsg();
    }
    private readAppointment(): void {
      appointmentService.recordRead(this.client.id).then((_) => {
          const updatedClient = {...this.client};
          updatedClient.consultantReadTime = new Date().toString();
          this.updateMyAppointmentList(updatedClient);
          this.updateAppointmentDetail(this.client.id);
      });
    }
    private clearAppointmentIdFromMsg() {
@@ -377,54 +368,113 @@
        this.memo = this.memoInfo.content;
    }
    get newAppointment(): boolean {
      return !this.client.consultantViewTime
            && this.client.communicateStatus === 'reserved';
    }
    get isReserved() {
      return this.client.communicateStatus === 'reserved';
    }
    get isRead() {
      return !!this.client.consultantReadTime;
    }
    get requirements() {
        return this.client.requirement.split(',');
    }
    get gender() {
        if (this.client.gender) {
            return this.client.gender === 'male' ? '男性' : '女性';
        }
        return '';
    }
    get hopeContactTime() {
        const contactList = this.client.hopeContactTime.split("'").map(item => item.slice(0, item.length));
        return contactList.filter(item => !!item && item !== ",")
    }
    get reservedTxt(): string {
        if (this.isReserved) {
            return this.client.consultantReadTime ? '已讀' : '未讀';
        } else {
            return '已聯絡'
        }
    }
    get displayTime(): string {
        if (this.isReserved) {
            return this.client.appointmentDate;
        } else {
            return this.client.lastModifiedDate;
        }
    }
    get date() {
        const formatDate = (this.$options.filters as any).formatDate(this.displayTime);
        return formatDate.split(' ')[0];
    }
    get time() {
        const formatDate = (this.$options.filters as any).formatDate(this.displayTime);
        return formatDate.split(' ')[1]
    }
}
</script>
<style lang="scss" scoped>
    .rowStyle {
        padding: 10px 15px 10px 5px;
        background-color: $PRIMARY_WHITE;
        margin-bottom: 10px;
        display: flex;
        justify-content: space-between;
        border-left     : solid 4px transparent;
        display         : flex;
        justify-content : space-between;
        margin-bottom   : 10px;
        padding         : 10px 15px 10px 5px;
        transition: background-color 0.5s;
        &.new {
            border-left: solid 4px $YELLOW;
            border-color: $YELLOW;
        }
        &.currentShowStyle {
            background-color: rgba(236, 195, 178, 0.5);
            transition: background-color 0.5s;
            transition      : background-color 0.5s;
        }
        .unread {
            align-self: center;
            .circle {
                width: 10px;
                height: 10px;
                border-radius: 50%;
                background-color: $PRIMARY_RED;
                margin: auto;
                border-radius   : 50%;
                height          : 10px;
                margin          : auto;
                width           : 10px;
            }
        }
        .satisfaction {
            font-size: 12px;
            font-size  : 12px;
            font-weight: bold;
            margin-top: 5px;
            margin-top : 5px;
            .unfilled {
                color      : $MID_GREY;
                font-weight: lighter;
                color: $MID_GREY;
            }
        }
        .professionals {
            overflow: hidden;
            white-space: nowrap;
            overflow     : hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            .professionalsTxt {
                font-size: 12px;
                font-size   : 12px;
                margin-right: 5px;
            }
            .noProfessionalsTxt {
                color: $PRUDENTIAL_GREY;
                color      : $PRUDENTIAL_GREY;
                font-weight: lighter;
            }
        }
@@ -442,24 +492,23 @@
        }
    }
    .flex-column {
        display: flex;
        flex-direction: column;
        display        : flex;
        flex-direction : column;
        justify-content: space-between;
    }
    .dialogTxt {
        font-size: 20px;
        overflow-y:scroll;
        font-size : 20px;
        max-height: 25vh;
        overflow-y: scroll;
        @include desktop {
            height: 400px;
        }
    }
    .memoTitleStyle {
        display: flex;
        flex-direction: row;
        display        : flex;
        flex-direction : row;
        justify-content: space-between;
        .edit {
       .edit {
            align-self: flex-end;
        }
    }
@@ -470,7 +519,13 @@
        display: flex;
    }
    .invite-msg{
      width: 96px;
      color: $PRIMARY_RED;
        @extend .text--underline;
      @extend .text--underline;
    }
  .invite-review{
    align-items   : center;
    display       : flex;
    flex-direction: column;
  }
</style>