保誠-保戶業務員媒合平台
Mila
2022-01-21 1592d266eb7cea3a096c17d4ae3c0d01c679da7b
PAMapp/components/Client/ClientCard.vue
@@ -170,7 +170,7 @@
</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';
@@ -179,8 +179,11 @@
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) {
@@ -201,11 +204,17 @@
    }
})
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.Getter
    appointmentProgress!: ContactStatus;
    @localStorage.Mutation
    storageClearAppointmentIdFromMsg!: () => void;
@@ -248,7 +257,10 @@
    //////////////////////////////////////////////////////////////////////
    viewAppointmentDetail(): void {
      this.$router.push(`/appointment/${this.client.id}`);
      this.getAppointmentDetail(this.client.id).then((_) => {
        this.readAppointment();
        this.$router.push(`/appointment/${this.client.id}`);
      });
    }
    showAddInterviewDialog(): void {
@@ -259,12 +271,11 @@
      this.$router.push(`/appointment/${this.client.id}/close`);
    }
    makeAppointment(): void {
      alert('MAKE AN APPOINTMENT!');
    }
    inviteReview(): void {
      this.isShowInviteReviewDialog = true ;
        reviewsService.sendSatisfactionToClient(this.client.id).then(res => {
            this.isShowInviteReviewDialog = true ;
        })
    }
    openDetail() {
@@ -277,22 +288,26 @@
    markAppointment() {
        myConsultantService.markAsContact(this.client.id).then(data => {
            this.updateMyAppointment(data);
            this.updateMyAppointmentList(data);
            this.isShowInformDialog = false;
        })
    }
    closeInformDialog(): void {
      const unread = !this.client.consultantReadTime;
        this.readAppointment();
        this.isEdit = false;
        this.clearAppointmentIdFromMsg();
    }
    private readAppointment(): 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);
                this.updateMyAppointmentList(updatedClient);
            });
        };
        this.isEdit = false;
        this.clearAppointmentIdFromMsg();
    }
    private clearAppointmentIdFromMsg() {
@@ -349,7 +364,7 @@
        this.memo = this.memoInfo.content;
    }
      get newAppointment(): boolean {
    get newAppointment(): boolean {
      return !this.client.consultantViewTime
            && this.client.communicateStatus === 'reserved';
    }