保誠-保戶業務員媒合平台
Tomas
2022-01-13 66a8dd0cfd0122aee97a6f6859407630d6b4d384
PAMapp/shared/services/appointment.service.ts
@@ -1,14 +1,13 @@
import { http } from "./httpClient";
import { AppointmentMemoInfo, ClientInfo } from "~/shared/models/client.model";
import { AppointmentDetail, createdMemoInfo, EditAppointmentParams, updatedMemoInfo } from "~/shared/models/appointment.model";
import { Appointment, AppointmentDetail, AppointmentMemoInfo, createdMemoInfo, EditAppointmentParams, ToCloseAppointment, ToDoneAppointment, updatedMemoInfo } 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();
      }
@@ -16,7 +15,7 @@
    });
  }
  // 顧問登入顯示新預約單筆數後觸發
  // 顧問瀏覽自己所有的預約單紀錄觸發API
  private viewAllAppointment(): void {
    http.post('/consultant/record/allAppointmentsView').then();
  }
@@ -42,12 +41,12 @@
  }
  // 新增註記
  createMemo(memoInfo: createdMemoInfo): Promise<AppointmentMemoInfo> {
  async createMemo(memoInfo: createdMemoInfo): Promise<AppointmentMemoInfo> {
    return http.post('/appointment/memo/create', memoInfo).then(res => res.data);
  }
  // 編輯註記
  updateMemo(memoInfo: updatedMemoInfo): Promise<AppointmentMemoInfo> {
  async updateMemo(memoInfo: updatedMemoInfo): Promise<AppointmentMemoInfo> {
    return http.post('/appointment/memo/update', memoInfo).then(res => res.data);
  }
@@ -55,6 +54,11 @@
  deleteMemo(appointmentMemoId: number) {
    return http.delete(`/appointment/memo/${appointmentMemoId}`)
  }
  // 預約單結案
  async closeAppointment(appointmentInfo: ToDoneAppointment | ToCloseAppointment) {
    return http.post(`/appointment/close`, appointmentInfo).then((res) => res.data);
  }
}
export default new AppointmentService();