保誠-保戶業務員媒合平台
HelenHuang
2021-12-06 20b87b7eab9c600e2445548c4306ea1b8b37b275
PAMapp/store/index.ts
@@ -1,8 +1,10 @@
import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators'
import { ClientInfo, getMyAppointmentList } from '~/assets/ts/api/appointment';
import { ClientInfo, getMyAppointmentList, getMyReviewLog } from '~/assets/ts/api/appointment';
// import * as consultant from '~/assets/ts/api/consultant';
import { Consultants,recommend,AgentOfStrictQuery, getFavoriteConsultant, addFavoriteConsultant, deleteConsultant, strictQuery } from '~/assets/ts/api/consultant';
import { recommend, AgentOfStrictQuery, getFavoriteConsultant, addFavoriteConsultant, deleteConsultant, strictQuery } from '~/assets/ts/api/consultant';
import { Consultants } from '~/assets/ts/models/consultant.model';
import { isLogin } from '~/assets/ts/auth';
import { AppointmentLog } from '~/assets/ts/models/appointment.model';
import { getFavoriteFromStorage, setFavoriteToStorage } from '~/assets/ts/storageConsultant';
@Module
@@ -12,6 +14,8 @@
    myConsultantList: Consultants[] = [];
    myAppointmentList: ClientInfo[] = [];
    myAppointmentReviewLogList: AppointmentLog[] = [];
    @Mutation updateRecommend(data: Consultants[]) {
        this.recommendList = data;
@@ -27,6 +31,10 @@
    @Mutation updateMyAppointmentList(data: ClientInfo[]) {
        this.myAppointmentList = data;
    }
    @Mutation updateMyAppointmentReviewLog(data: AppointmentLog[]) {
        this.myAppointmentReviewLogList = data;
    }
    @Action storeRecommendList() {
@@ -103,6 +111,13 @@
        });
    }
    @Action
    storeMyAppointmentReviewLog() {
        getMyReviewLog().then((data) => {
            this.context.commit('updateMyAppointmentReviewLog', data);
        });
    }
    @Action updateMyAppointment(myAppointment: ClientInfo) {
        const data = this.myAppointmentList.filter(item => item.id !== myAppointment.id);
        data.unshift(myAppointment);