From 8956474e0072133a8650e4a23bcd6b2a3235688a Mon Sep 17 00:00:00 2001 From: Mila <Mila@pollex.com.tw> Date: 星期一, 15 十一月 2021 18:21:05 +0800 Subject: [PATCH] update: TOOD#130022 我的顧問清單: 串接移除顧問 API --- PAMapp/components/Consultant/ConsultantCard.vue | 4 ++-- PAMapp/pages/index.vue | 13 ++++++++----- PAMapp/components/Client/ClientCard.vue | 2 +- PAMapp/assets/ts/api/consultant.ts | 11 +++++++---- PAMapp/pages/myConsultantList.vue | 8 +++++--- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/PAMapp/assets/ts/api/consultant.ts b/PAMapp/assets/ts/api/consultant.ts index d37c3b8..981967e 100644 --- a/PAMapp/assets/ts/api/consultant.ts +++ b/PAMapp/assets/ts/api/consultant.ts @@ -42,11 +42,7 @@ const headers = { Authorization: 'Bearer ' + localStorage.getItem('id_token') } -<<<<<<< HEAD return service.post('/appointment/customer/create', data, {headers}) -======= - return service.post('/appointment/customer/create', data ,{headers}) ->>>>>>> b7de9faedf2a3e21c77c4ab3fc645ef01ac549cf } //憿批�底蝝啗��� @@ -54,6 +50,13 @@ 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 interface Consultants { agentNo: string, name: string, diff --git a/PAMapp/components/Client/ClientCard.vue b/PAMapp/components/Client/ClientCard.vue index df1fceb..038ec5a 100644 --- a/PAMapp/components/Client/ClientCard.vue +++ b/PAMapp/components/Client/ClientCard.vue @@ -114,7 +114,7 @@ } markAppointment() { - markAsContact(this.client.id).then(res => console.log(res)) + markAsContact(this.client.id).then(res => this.$router.go(0)) } } diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue index 383c739..de25687 100644 --- a/PAMapp/components/Consultant/ConsultantCard.vue +++ b/PAMapp/components/Consultant/ConsultantCard.vue @@ -26,8 +26,8 @@ </div> <div class="delete" - v-if="agentInfo.contactStatus !== 'reserved' - || agentInfo.contactStatus !== 'contacted'" + v-if="agentInfo.contactStatus === 'picked' + || !agentInfo.contactStatus" @click="removeAgent" >蝘駁</div> </el-col> diff --git a/PAMapp/pages/index.vue b/PAMapp/pages/index.vue index 7a5053b..9640b69 100644 --- a/PAMapp/pages/index.vue +++ b/PAMapp/pages/index.vue @@ -45,7 +45,7 @@ <script lang="ts"> import { Vue, Component, State, Action } from 'nuxt-property-decorator'; import { getFavoriteFromStorage, setFavoriteToStorage } from '~/assets/ts/storageConsultant'; -import { addFavoriteConsultant, Consultants } from '~/assets/ts/api/consultant'; +import { addFavoriteConsultant, Consultants, deleteConsultant } from '~/assets/ts/api/consultant'; import { login, getFavoriteConsultant } from '~/assets/ts/api/consultant'; import { isLogin } from '~/assets/ts/auth'; @@ -84,12 +84,15 @@ } removeAgent(agentNo: string) { - const findIndex = this.consultantList.findIndex((item, i) => { - return item.agentNo === agentNo; - }) - this.consultantList.splice(findIndex, 1); + if (!isLogin()) { + const findIndex = this.consultantList.findIndex((item, i) => { + return item.agentNo === agentNo; + }) + this.consultantList.splice(findIndex, 1); setFavoriteToStorage(this.consultantList) + } else { + deleteConsultant(agentNo).then(res => this.$router.go(0)) } } diff --git a/PAMapp/pages/myConsultantList.vue b/PAMapp/pages/myConsultantList.vue index 81b6e3a..b2f2bb9 100644 --- a/PAMapp/pages/myConsultantList.vue +++ b/PAMapp/pages/myConsultantList.vue @@ -30,7 +30,7 @@ import { Vue, Component, Watch } from 'vue-property-decorator'; import { Route } from 'vue-router/types/router.d' import { getFavoriteFromStorage, setFavoriteToStorage } from '~/assets/ts/storageConsultant'; -import { Consultants, getFavoriteConsultant } from '~/assets/ts/api/consultant'; +import { Consultants, deleteConsultant, getFavoriteConsultant } from '~/assets/ts/api/consultant'; import { isLogin } from '~/assets/ts/auth'; @Component @@ -67,10 +67,12 @@ } removeAgent(agentNo: string) { - const fintIndex = this.consultantList.findIndex(item => item.agentNo === agentNo); - this.consultantList.splice(fintIndex, 1); if (!isLogin()) { + const fintIndex = this.consultantList.findIndex(item => item.agentNo === agentNo); + this.consultantList.splice(fintIndex, 1); setFavoriteToStorage(this.consultantList); + } else { + deleteConsultant(agentNo).then(res => this.$router.go(0)) } } -- Gitblit v1.8.0