import { service } from '~/assets/ts/api/share';
|
import { AxiosResponse } from 'axios';
|
import { AppointmentDetail } from '../models/AppointmentDetail';
|
|
// 顧客登入(TODO: OTP認證開發前 暫時使用)
|
export function login(user: any) {
|
return service.post('/authenticate', user)
|
}
|
|
// 推薦保險顧問
|
export function recommend() {
|
return service.get<Consultants[]>('/consultant/recommend')
|
.then(res => res.data);
|
}
|
|
// 我的顧問清單
|
export function getFavoriteConsultant() {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return service.get<Consultants[]>('/consultant/favorite', {headers})
|
.then(res => res.data);
|
}
|
|
// 快速篩選
|
export function fastQuery(data: FastQueryParams) {
|
return service.post('/consultant/fastQuery', data)
|
}
|
|
// 嚴選配對
|
export function strictQuery(data:StrictQueryParams):Promise<AxiosResponse<AgentOfStrictQuery[]>>{
|
return service.post('/consultant/strictQuery', data)
|
}
|
|
// 加入顧問
|
export function addFavoriteConsultant(agentNoList: string[]) {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return service.post('/consultant/favorite', {agentNoList}, {headers})
|
}
|
|
// 預約前詢問
|
export function appointmentDemand(data: AppointmentParams) {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return service.post('/appointment/customer/create', data, {headers})
|
}
|
|
//顧問詳細資訊
|
export function getConsultantDetail(agentNo:string){
|
return service.get('/consultant/detail', {params:{agentNo:agentNo}})
|
}
|
|
// 移除顧問
|
export function deleteConsultant(agentId: string) {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return service.delete('/consultant/favorite/'+agentId, {headers})
|
}
|
|
// 忘記密碼網址
|
export function getForgotPasswordLink():Promise<string>{
|
return new Promise((resolve, reject)=>{
|
resolve('https://www.google.com/');
|
})
|
}
|
|
// 取得驗證碼圖片
|
export function getVerificationCodeImg():Promise<string>{
|
return new Promise((resolve, reject)=>{
|
resolve('');
|
})
|
}
|
|
// 顧問登入
|
export function logInToConsultant(consultantDto:ConsultantLoginInfo):Promise<boolean>{
|
console.log('consultantDto',consultantDto);
|
return new Promise((resolve, reject)=>{
|
setTimeout(()=>{
|
resolve(true);
|
},1000)
|
})
|
}
|
|
// 取得預約單細節
|
export function getAppointmentDetail(apointmentId: number):Promise<AxiosResponse<AppointmentDetail>> {
|
const headers = {
|
Authorization: 'Bearer ' + localStorage.getItem('id_token')
|
}
|
return service.get('/appointment/getDetail/'+apointmentId, {headers})
|
}
|
export interface ConsultantLoginInfo{
|
account:string,
|
password:string,
|
verificationCode:string,
|
}
|
export interface Consultants {
|
agentNo: string,
|
name: string,
|
img: string,
|
new: boolean,
|
avgScore: number,
|
expertise: string[],
|
updateTime: Date,
|
seniority: string,
|
contactStatus?: string;
|
latestAppointmentId: number;
|
role: string;
|
image?: string;
|
expertises?: string;
|
}
|
|
export interface FastQueryParams {
|
gender: string,
|
communicationStyles: string[],
|
avgScore: number,
|
status: string
|
}
|
|
export interface AppointmentParams {
|
phone: string,
|
email: string,
|
contactType: string,
|
gender: string,
|
age: string,
|
job: string,
|
requirement: string,
|
hopeContactTime: string,
|
otherRequirement: 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;
|
}
|