update#135494: [ 客戶端 ] 加入顧問到我的顧問清單後,未顯示加入日期
| | |
| | | import { Vue, Component, Prop, Emit, Action, State, namespace } from 'nuxt-property-decorator'; |
| | | import { Consultant } from '~/shared/models/consultant.model'; |
| | | |
| | | const roleStorage = namespace('localStorage'); |
| | | |
| | | @Component |
| | | export default class AddAndReservedBtns extends Vue { |
| | | |
| | |
| | | @Prop() |
| | | cusClass!: string; |
| | | |
| | | @roleStorage.Getter |
| | | isUserLogin!: boolean; |
| | | |
| | | isVisiblePopUp = false; |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |
| | |
| | | ////////////////////////////////////////////////////////////////////// |
| | | |
| | | addConsultant(item: Consultant): void { |
| | | if (!this.isUserLogin) { |
| | | item = { |
| | | ...item, |
| | | updateTime: new Date().toString() |
| | | }; |
| | | } |
| | | this.addToMyConsultantList(item).then(addOk => { |
| | | addOk && this.openPopUp(); |
| | | }); |
| | |
| | | if (this.isEditBtn) { |
| | | this.editAppointmentDemand(); |
| | | } else { |
| | | queryConsultantService.addFavoriteConsultant([this.$route.params.agentNo]).then(res => this.sentAppointmentDemand()); |
| | | queryConsultantService.addFavoriteConsultant([{ agentNo: this.$route.params.agentNo, createdTime: new Date().toString()}]).then(res => this.sentAppointmentDemand()); |
| | | } |
| | | const editSettingInfo: UserSetting = { |
| | | name: this.myRequest.name, |
| | |
| | | } |
| | | |
| | | // 加入顧問 |
| | | async addFavoriteConsultant(agentNoList: string[]) { |
| | | return http.post('/consultant/favorite', { agentNoList }); |
| | | async addFavoriteConsultant(addFavoriteConsultantList: AddFavoriteConsultantItem[]) { |
| | | const payload = { |
| | | consultantList: addFavoriteConsultantList |
| | | }; |
| | | return http.post('/consultant/favorite', payload); |
| | | } |
| | | |
| | | // 預約前詢問 |
| | |
| | | } |
| | | |
| | | export default new QueryConsultantService(); |
| | | |
| | | export interface AddFavoriteConsultantItem { |
| | | agentNo : string; |
| | | createdTime: string; |
| | | } |
| | |
| | | import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators' |
| | | |
| | | import myConsultantService from '~/shared/services/my-consultant.service'; |
| | | import queryConsultantService from '~/shared/services/query-consultant.service'; |
| | | import queryConsultantService, { AddFavoriteConsultantItem } from '~/shared/services/query-consultant.service'; |
| | | import reviewsService from '~/shared/services/reviews.service'; |
| | | import { Consultant } from '~/shared/models/consultant.model'; |
| | | import { getFavoriteFromStorage, setFavoriteToStorage } from '~/shared/storageConsultant'; |
| | |
| | | |
| | | |
| | | if (localData?.length) { |
| | | const agentNoList = localData.map(i => i.agentNo) |
| | | await queryConsultantService.addFavoriteConsultant(agentNoList).then(res => { |
| | | const addFavoriteAgentList: AddFavoriteConsultantItem[] = localData.map(i => ({ agentNo: i.agentNo, createdTime: i.updateTime})); |
| | | await queryConsultantService.addFavoriteConsultant(addFavoriteAgentList).then(res => { |
| | | localStorage.removeItem('favoriteConsultant') |
| | | }) |
| | | } |
| | |
| | | if (!found) { |
| | | const newData = [consultantToAdd].concat(this.myConsultantList); |
| | | if (this.isUserLogin) { |
| | | await queryConsultantService.addFavoriteConsultant([consultantToAdd.agentNo]) |
| | | await queryConsultantService.addFavoriteConsultant([{ agentNo: consultantToAdd.agentNo, createdTime: consultantToAdd.updateTime }]) |
| | | } else { |
| | | setFavoriteToStorage(newData); |
| | | } |