import { AxiosResponse } from 'axios';
|
import { AppointmentDetail } from '../models/AppointmentDetail';
|
import { ConsultantLoginInfo } from '../models/ConsultantLoginInfo';
|
import _ from 'lodash';
|
import { UserSetting } from '../models/account.model';
|
import { Consultant } from '~/assets/ts/models/consultant.model';
|
import { http } from '../services/httpClient';
|
import { FastQueryParams } from '../models/quickFilter.model';
|
|
|
// 推薦保險顧問
|
export function recommend() {
|
return http.get<Consultant[]>('/consultant/recommend')
|
.then(res => res.data);
|
}
|
|
// 快速篩選
|
export function fastQuery(data: FastQueryParams) {
|
return http.post<Consultant[]>('/consultant/fastQuery', data).then(res => res.data);
|
}
|
|
// 嚴選配對
|
export function strictQuery(data:StrictQueryParams):Promise<AxiosResponse<AgentOfStrictQuery[]>>{
|
return http.post('/consultant/strictQuery', data)
|
}
|
|
// 加入顧問
|
export function addFavoriteConsultant(agentNoList: string[]) {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return http.post('/consultant/favorite', {agentNoList}, {headers})
|
}
|
|
// 預約前詢問
|
export function appointmentDemand(data: AppointmentParams) {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return http.post('/appointment/customer/create', data, {headers})
|
}
|
|
//顧問詳細資訊
|
export function getConsultantDetail(agentNo:string){
|
return http.get('/consultant/detail', {params:{agentNo:agentNo}})
|
}
|
|
// 移除顧問
|
export function deleteConsultant(agentId: string) {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return http.delete('/consultant/favorite/'+agentId, {headers})
|
}
|
|
// 取得預約單細節
|
export function getAppointmentDetail(apointmentId: number):Promise<AxiosResponse<AppointmentDetail>> {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return http.get('/appointment/getDetail/'+apointmentId, {headers})
|
}
|
|
//取得使用者帳號資訊
|
export function getUserAccountSetting() : Promise<UserSetting> {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return http.get<UserSetting>('/customer/info', {headers}).then(res => res.data);
|
}
|
|
//更新使用者帳號資訊
|
export function updateAccountSetting(params: any) : any {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return http.put('/customer/info', params ,{headers}).then(res => res.data);
|
}
|
|
//客戶進行滿意度評分
|
|
export function userReviewsConsultants(data: UserReviewsConsultantsParams) {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return http.post('/satisfaction/create', data ,{headers});
|
}
|
|
// 取消預約
|
export function cancelAppointment(appointment: number) {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return http.delete('/appointment/'+appointment ,{headers});
|
}
|
|
// 編輯預約
|
export function editAppointment(editAppointmentParams: editAppointmentParams) {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return http.put('/appointment', editAppointmentParams, {headers});
|
}
|
|
export interface AppointmentRequests {
|
phone : string,
|
email : string,
|
contactType : string,
|
gender : string,
|
age : string,
|
job : string,
|
requirement : string[],
|
hopeContactTime: ContactTime[],
|
agentNo : string,
|
}
|
export interface ContactTime {
|
selectWeekOptions : string[],
|
selectTimesOptions: string[]
|
}
|
export interface AppointmentParams {
|
phone : string,
|
email : string,
|
contactType : string,
|
gender : string,
|
age : string,
|
job : string,
|
requirement : string,
|
hopeContactTime: string,
|
agentNo : string
|
}
|
export interface StrictQueryParams{
|
gender : string;
|
avgScore : number;
|
status : string; //phase 1 disable
|
area : string;
|
requirements : string[];
|
otherRequirement: string;
|
seniority : string;
|
popularTags : string[];
|
otherPopularTags: string;
|
}
|
export interface AgentOfStrictQuery {
|
agentNo : string;
|
name : string;
|
img : string;
|
expertise : string[];
|
avgScore : number;
|
contactStatus: null;
|
updateTime : null;
|
seniority : string;
|
new : boolean;
|
}
|
export interface RequestOfLoginSuccess{
|
id_token: string;
|
}
|
|
export interface UserReviewsConsultantsParams{
|
appointmentId:number,
|
score:number,
|
}
|
|
export interface editAppointmentParams {
|
id: number,
|
phone: string,
|
email: string,
|
contactType: string,
|
gender: string,
|
age: string,
|
job: string,
|
requirement: string,
|
hopeContactTime: string,
|
otherRequirement: null
|
}
|