保誠-保戶業務員媒合平台
jack
2023-07-21 785a57e89f99ec350f029f9a85a450839324babf
PAMapp/pages/index.vue
@@ -2,6 +2,7 @@
  <div>
    <Ui-Carousel></Ui-Carousel>
    <div class="page-container">
      <div>
        <h5 class="mdTxt">預約保險顧問</h5>
        <div class="mt-10 pam-reserveBtn--block">
@@ -15,6 +16,7 @@
          </el-button>
        </div>
      </div>
      <div class="pam-paragraph">
        <el-row class="rowStyle">
          <el-col :span="16">
@@ -29,6 +31,8 @@
        <ConsultantList class="mt-10"
          :agents="consultantList.slice(0, 3)"></ConsultantList>
      </div>
      <div class='pam-paragraph'>
        <div class="pam-recommend">
          <h5 class="mdTxt">推薦保險顧問</h5>
@@ -45,41 +49,46 @@
        :width="appointmentDialogWidth"
        class="pam-myDemand-dialog pam-dialog-reserved"
      >
        <div v-if="appointmentDetail">
            <h5 class="subTitle text--center mb-30">預約成功</h5>
            <p class="smTxt">{{appointmentDetail.appointmentDate | formatDate}}</p>
            <div class="reserved-info">
                <p>姓名:{{appointmentDetail.name}}</p>
                <p>電話:{{appointmentDetail.phone}}</p>
                <p>Email:{{appointmentDetail.email}}</p>
                <p>性別:{{gender}}</p>
                <p>年齡:{{appointmentDetail.age | toAgeLabel }}</p>
                <p>職業:{{appointmentDetail.job}}</p>
                <p>需求:{{appointmentDetail.requirement.split(',').join('、')}}</p>
                <p
                    v-for="(item, index) in hopeContactTime"
                    :key="index"
                >連絡時段{{index + 1 | formatNumber}}:{{ item | formatHopeContactTime }}</p>
                <div v-if="appointmentDetail.satisfactionScore">
                    <div class="mdTxt mt-10 mb-10">滿意度</div>
                    <el-rate
                    :value="appointmentDetail.satisfactionScore"
                    class="pam-myDemand-dialog__rate"
                    disabled>
                    </el-rate>
                </div>
            </div>
          <div v-if="appointmentDetail">
              <h5 class="subTitle text--center mb-30">預約成功</h5>
              <p class="smTxt">{{appointmentDetail.appointmentDate | formatDate}}</p>
              <div class="reserved-info">
                  <p>姓名:{{appointmentDetail.name}}</p>
                  <p>電話:{{appointmentDetail.phone}}</p>
                  <p>Email:{{appointmentDetail.email}}</p>
                  <p>性別:{{gender}}</p>
                  <p>年齡:{{appointmentDetail.age | toAgeLabel }}</p>
                  <p>職業:{{appointmentDetail.job}}</p>
                  <p>需求:{{ appointmentDetail.requirement ? appointmentDetail.requirement.split(',').join('、') : '--'}}</p>
                  <p
                      v-for="(item, index) in hopeContactTime"
                      :key="index"
                  >連絡時段{{index + 1 | formatNumber}}:{{ item | formatHopeContactTime }}</p>
                  <div v-if="appointmentDetail.satisfactionScore">
                      <div class="mdTxt mt-10 mb-10">滿意度</div>
                      <el-rate
                      :value="appointmentDetail.satisfactionScore"
                      class="pam-myDemand-dialog__rate"
                      disabled>
                      </el-rate>
                  </div>
              </div>
            <div v-if="notScoreAppointmentYet" class="reserved-btn">
                <el-button type="primary"
                    @click.native="isShowReviewDialog = true">給予滿意度評分</el-button>
            </div>
        </div>
              <div v-if="notScoreAppointmentYet" class="reserved-btn">
                  <el-button type="primary"
                      @click.native="reviewsBtn = true">給予滿意度評分</el-button>
              </div>
              <div v-if="appointmentDetail.communicateStatus === 'reserved'" class="text--center mt-10">
                  <el-button @click="isCancelPopup = true">取消預約</el-button>
                  <el-button @click="edit" type="primary">編輯</el-button>
              </div>
          </div>
      </Ui-Dialog>
      <PopUpFrame
        :isOpen.sync="isShowReAppointmentDialog"
        @closePopUp="removeUrlQueryParameter('notContactAppointmentIdFromMsg')"
        @closePopUp="removeUrlQueryParameter('notContactAppointmentId')"
      >
          <div class="pam-dialog-review">
              <div class="mt-30 text--middle" v-if="agentInfo">
@@ -136,19 +145,21 @@
</template>
<script lang="ts">
  import { Vue, Component, State, Action, Watch, namespace } from 'nuxt-property-decorator';
  import { Appointment, AppointmentClosedInfo } from '~/shared/models/appointment.model';
  import { Consultant } from '~/shared/models/consultant.model';
  import { ContactStatus } from '~/shared/models/enum/contact-status';
  import { UserReviewsConsultantsParams } from '~/shared/models/reviews.model';
  import { StrictQueryParams } from '~/shared/models/strict-query.model';
  import appointmentService from '~/shared/services/appointment.service';
  import reviewsService from '~/shared/services/reviews.service';
  import UtilsService from '~/shared/services/utils.service';
  import myConsultantService from '~/shared/services/my-consultant.service';
import { AgentInfo } from '~/shared/models/agent-info.model';
import {Action, Component, Mutation, namespace, State, Vue, Watch} from 'nuxt-property-decorator';
  const localStorage = namespace('localStorage');
import appointmentService from '~/shared/services/appointment.service';
import utilService, {AccessFroms} from '~/shared/services/utils.service';
import reviewsService from '~/shared/services/reviews.service';
import myConsultantService from '~/shared/services/my-consultant.service';
import {Appointment, AppointmentClosedInfo} from '~/shared/models/appointment.model';
import {Consultant} from '~/shared/models/consultant.model';
import {UserReviewParams} from '~/shared/models/reviews.model';
import {StrictQueryParams} from '~/shared/models/strict-query.model';
import {AgentInfo} from '~/shared/models/agent-info.model';
import {ContactStatus} from '~/shared/models/enum/contact-status';
import {SatisfactionType} from '~/shared/models/enum/satisfaction-type';
const localStorage = namespace('localStorage');
  const roleStorage = namespace('localStorage');
  @Component({
@@ -165,11 +176,17 @@
    @roleStorage.Getter
    isAdminLogin!: boolean;
    @roleStorage.Getter
    isUserLogin!: boolean;
    @Action
    storeRecommendList!: any;
    @Action
    storeConsultantList!: any;
    @Mutation
    setAccessSource!: (accessSource: AccessFroms) => void;
    @localStorage.Mutation
    storageClearQuickFilter!: () => void;
@@ -209,7 +226,7 @@
      appointmentDate   : '',
      appointmentMemoList: [],
      appointmentNoticeLogs: [],
      communicateStatus : this.contactStatus.PICKED,
      communicateStatus: this.contactStatus.PICKED,
      consultantReadTime: '',
      consultantViewTime: '',
      contactTime       : '',
@@ -247,6 +264,11 @@
    //////////////////////////////////////////////////////////////////////
    mounted() {
      if (this.$route.query.from) {
        const fromSource = this.$route.query.from as AccessFroms;
        this.setAccessSource(fromSource);
        utilService.insertAccessFrom(fromSource);
      }
      if (this.isAdminLogin) {
        this.$router.push('/myAppointmentList/appointmentList');
      } else {
@@ -257,6 +279,16 @@
        this.storeConsultantList();
        this.storageClearQuickFilter();
        this.storageClearRecommendConsultant();
        if (this.isUserLogin) {
          appointmentService.getNotContactAppointment().then((appointment) => {
            if (appointment) {
              this.$router.push({ query: { notContactAppointmentId: appointment.id + ''}});
              this.autoOpenAppointmentBy('askReAppointment', appointment.id);
            }
          });
        }
      }
    }
@@ -270,7 +302,6 @@
    @Watch('myConsultantList')
    onMyConsultantListChange() {
      this.consultantList = (this.myConsultantList || [])
        .filter(item => item.contactStatus !== 'contacted')
        .map((item) => ({ ...item, formatDate: new Date(item.updateTime || item.createTime)}))
        .sort((preItem, nextItem) => +nextItem.formatDate - +preItem.formatDate);
@@ -306,7 +337,7 @@
          const appointmentInfo = values[1] as Appointment;
          this.consultantName = agentInfo.name;
          this.appointmentDetail = appointmentInfo;
          this.appointmentDialogWidth = UtilsService.isMobileDevice() ? '80%' : '';
          this.appointmentDialogWidth = utilService.isMobileDevice() ? '80%' : '';
          this.isShowAppointmentDialog = true;
          switch (reason) {
            case 'inviteReviewConsultant':
@@ -332,13 +363,20 @@
      this.$router.push(path);
    }
    edit() {
        this.isShowAppointmentDialog = false;
        this.$router.push({path: `/questionnaire/${this.agentInfo.agentNo}`, query: {'edit': 'true'}});
    }
    reAppointment(): void {
      appointmentService.cancelAppointment(this.appointmentDetail.id).then(() => {
        const requirements = this.appointmentDetail.requirement.split(',');
        const requirements = this.appointmentDetail && this.appointmentDetail.requirement
                            ? this.appointmentDetail.requirement.split(',')
                            : [];
        this.storeConsultantList();
        this.storageStrickQueryItem({ requirements: requirements });
        this.storageClearNotContactAppointmentIdFromMsg();
        this.removeUrlQueryParameter('notContactAppointmentIdFromMsg');
        this.removeUrlQueryParameter('notContactAppointmentId');
        this.$router.push('/recommendConsultant');
      });
    }
@@ -347,15 +385,18 @@
      appointmentService.cancelAppointment(this.appointmentDetail.id).then(() => {
        this.storeConsultantList();
        this.storageClearNotContactAppointmentIdFromMsg();
        this.removeUrlQueryParameter('notContactAppointmentIdFromMsg');
        this.$router.push('');
        this.removeUrlQueryParameter('notContactAppointmentId');
        this.isShowReAppointmentDialog = false;
        this.isShowAppointmentDialog = false;
        this.$router.push('/');
      });
    }
    userReviewsConsultants() {
      const reviewParams: UserReviewsConsultantsParams = {
      const reviewParams: UserReviewParams = {
            appointmentId: this.appointmentDetail.id,
            score: this.inputScore,
            type: SatisfactionType.APPOINTMENT
        }
        this.appointmentDetail.satisfactionScore = this.inputScore;
@@ -376,18 +417,20 @@
          })
        }
        this.$router.push(newRouteQuery);
        this.storageClearSatisfactionIdFromMsg();
        this.storageClearNotContactAppointmentIdFromMsg();
    }
    ///////////////////////////////////////////////////////////////////////////////
    get gender() {
    get gender(): string {
        if (this.appointmentDetail.gender) {
            return this.appointmentDetail.gender === 'male' ? '男性' : '女性';
        }
        return ''
    }
    get hopeContactTime() {
    get hopeContactTime(): string[] {
        const contactList = this.appointmentDetail.hopeContactTime
            .split("'").map((item: any) => item.slice(0, item.length));
        return contactList.filter((item: any) => !!item && item !== ",")
@@ -457,6 +500,7 @@
    align-items: center;
  }
  @media (min-width: 576px) and (max-width: 767px) {
    .quickFilter.el-button--default {
      background-image: url('~/assets/images/quickFilter/banner_web.svg');
@@ -473,6 +517,15 @@
      margin: 0 auto;
    }
      .landing-container {
    border: 2px solid blue;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
    .pam-reserveBtn--block {
      display: flex;
      justify-content: space-between;