| | |
| | | import { http } from "./httpClient"; |
| | | |
| | | import { ClientInfo } from "~/shared/models/client.model"; |
| | | import { AppointmentDetail, EditAppointmentParams } from "~/shared/models/appointment.model"; |
| | | import { Appointment, AppointmentMemoInfo, createdMemoInfo, EditAppointmentParams, InterviewRecordInfo, ToCloseAppointment, ToDoneAppointment, ToInformAppointment, updatedMemoInfo, UpdateInterviewRecordInfo } from "~/shared/models/appointment.model"; |
| | | |
| | | class AppointmentService { |
| | | |
| | | // 取得所有預約清單 |
| | | async getMyAppointmentList(): Promise<ClientInfo[]> { |
| | | // 顧問取得所有自己的預約單API |
| | | async getMyAppointmentList(): Promise<Appointment[]> { |
| | | return http.get('/consultant/getMyAppointment').then((res) => { |
| | | const hasNewAppointment = res.data.find((appointment: ClientInfo) => !appointment.consultantViewTime); |
| | | const hasNewAppointment = res.data.find((appointment: Appointment) => !appointment.consultantViewTime); |
| | | if (hasNewAppointment) { |
| | | this.viewAllAppointment(); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | // 顧問登入顯示新預約單筆數後觸發 |
| | | // 顧問瀏覽自己所有的預約單紀錄觸發API |
| | | private viewAllAppointment(): void { |
| | | http.post('/consultant/record/allAppointmentsView').then(); |
| | | } |
| | |
| | | } |
| | | |
| | | // 取得預約單細節 |
| | | async getAppointmentDetail(appointmentId: number):Promise<AppointmentDetail> { |
| | | async getAppointmentDetail(appointmentId: number):Promise<Appointment> { |
| | | return http.get(`/appointment/getDetail/${appointmentId}`).then((res) => res.data); |
| | | } |
| | | |
| | |
| | | return http.put('/appointment', editAppointmentParams); |
| | | } |
| | | |
| | | // 新增註記 |
| | | async createMemo(memoInfo: createdMemoInfo): Promise<AppointmentMemoInfo> { |
| | | return http.post('/appointment/memo/create', memoInfo).then(res => res.data); |
| | | } |
| | | |
| | | // 編輯註記 |
| | | async updateMemo(memoInfo: updatedMemoInfo): Promise<AppointmentMemoInfo> { |
| | | return http.post('/appointment/memo/update', memoInfo).then(res => res.data); |
| | | } |
| | | |
| | | // 刪除註記 |
| | | deleteMemo(appointmentMemoId: number) { |
| | | return http.delete(`/appointment/memo/${appointmentMemoId}`) |
| | | } |
| | | |
| | | // 預約單結案, 更新結案明細 |
| | | async closeAppointment(appointmentInfo: ToDoneAppointment | ToCloseAppointment) { |
| | | return http.post(`/appointment/close`, appointmentInfo).then((res) => res.data); |
| | | } |
| | | |
| | | // 約訪通知 API |
| | | async informAppointment(appointmentInformation: ToInformAppointment) { |
| | | return http.post(`/notice/send`, appointmentInformation).then((res) => res.data); |
| | | } |
| | | |
| | | // 新增約訪記錄 |
| | | async createInterviewRecord(interviewRecordInfo: InterviewRecordInfo) { |
| | | return http.post('/interview_record/create', interviewRecordInfo).then(res => res.data); |
| | | } |
| | | |
| | | // 修改約訪記錄 |
| | | async updateInterviewRecord(updateInterviewRecordInfo: UpdateInterviewRecordInfo) { |
| | | return http.post('/interview_record/update', updateInterviewRecordInfo) |
| | | } |
| | | |
| | | // 刪除約訪記錄 |
| | | async deleteInterviewRecord(interviewRecordId) { |
| | | return http.delete(`/interview_record/${interviewRecordId}`); |
| | | } |
| | | } |
| | | |
| | | export default new AppointmentService(); |