保誠-保戶業務員媒合平台
HelenHuang
2022-01-14 9f843e9978cc4bff79e515a6ab929154d904fa46
PAMapp/pages/myAppointmentList.vue
@@ -12,17 +12,17 @@
                </div>
                <div
                    class="cus-tab-item"
                    :class="{'is-active': activeTabName === 'onProgressList'}"
                    @click="clickTab('onProgressList')"
                    :class="{'is-active': activeTabName === 'contactedList'}"
                    @click="clickTab('contactedList')"
                >
                  <span class="smTxt">約訪中({{ appointmentList.length }})</span>
                </div>
                <div
                    class="cus-tab-item"
                    :class="{'is-active': activeTabName === 'contactedList'}"
                    @click="clickTab('contactedList')"
                    :class="{'is-active': activeTabName === 'closedList'}"
                    @click="clickTab('closedList')"
                >
                  <span class="smTxt">結案({{ contactedList.length }})</span>
                  <span class="smTxt">結案({{ closedList.length }})</span>
                </div>
            </div>
@@ -53,6 +53,7 @@
import * as _ from 'lodash';
import { Appointment } from '~/shared/models/appointment.model';
import { ContactStatus } from '~/shared/models/enum/contact-status';
const localStorage = namespace('localStorage');
@@ -77,11 +78,12 @@
    @localStorage.Getter
    currentAppointmentIdFromMsg!: string;
    activeTabName         : string       = 'appointmentList';
    appointmentList       : Appointment[] = [];
    clients               : Appointment[] = [];
    contactedList         : Appointment[] = [];
    showNewAppointmentHint: boolean      = false;
    activeTabName          : string        = 'appointmentList';
    appointmentList        : Appointment[] = [];
    contactedList          : Appointment[] = [];
    closedList             : Appointment[] = [];
    contactStatus          = ContactStatus;
    showNewAppointmentHint: boolean        = false;
    //////////////////////////////////////////////////////////////////////
@@ -97,23 +99,24 @@
    @Watch('myAppointmentList')
    onMyAppointmentListChange(): void {
        this.contactedList = this.myAppointmentList
            .filter(item => item.communicateStatus === 'contacted');
        this.appointmentList = this.myAppointmentList
            .filter(item => item.communicateStatus !== 'contacted');
            .filter(item => item.communicateStatus === this.contactStatus.RESERVED);
        this.contactedList = this.myAppointmentList
            .filter((item) => item.communicateStatus === this.contactStatus.CONTACTED);
        this.closedList = this.myAppointmentList
            .filter(item => item.communicateStatus === this.contactStatus.DONE || item.communicateStatus === this.contactStatus.CLOSE );
        if (this.currentAppointmentIdFromMsg) {
            this.redirectAppointmentStatus();
        }
    }
    // TODO: 調整程式碼 [Tomas, 2022/1/14 12:02]
    private redirectAppointmentStatus() {
        const currentAppointmentIndex = this.myAppointmentList
            .findIndex(item => item.id === +this.currentAppointmentIdFromMsg);
        if (currentAppointmentIndex > -1) {
            const communicateStatus = this.myAppointmentList[currentAppointmentIndex].communicateStatus;
            const pathName = communicateStatus === 'reserved' ? 'appointmentList' : 'contactedList';
            const pathName = communicateStatus === 'reserved' ? 'appointmentList' : 'closedList';
            this.$router.push(
                {
                    path: '/myAppointmentList/' + pathName,
@@ -150,7 +153,7 @@
    // format to {page}-banner or pam-no-banner tag
    private routeFormatBannerClass(route: string): string {
        const needBannerTags = ['myAppointmentList-appointmentList', 'myAppointmentList-contactedList'];
        const needBannerTags = ['myAppointmentList-appointmentList', 'myAppointmentList-closedList'];
        return _.includes(needBannerTags, route) ? route + '-banner' : 'pam-no-banner';
    };
}