update: TOOD#130022 我的顧問清單: 串接移除顧問 API
| | |
| | | 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 |
| | | } |
| | | |
| | | //顧問詳細資訊 |
| | |
| | | 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, |
| | |
| | | } |
| | | |
| | | markAppointment() { |
| | | markAsContact(this.client.id).then(res => console.log(res)) |
| | | markAsContact(this.client.id).then(res => this.$router.go(0)) |
| | | } |
| | | |
| | | } |
| | |
| | | </div> |
| | | <div |
| | | class="delete" |
| | | v-if="agentInfo.contactStatus !== 'reserved' |
| | | || agentInfo.contactStatus !== 'contacted'" |
| | | v-if="agentInfo.contactStatus === 'picked' |
| | | || !agentInfo.contactStatus" |
| | | @click="removeAgent" |
| | | >移除</div> |
| | | </el-col> |
| | |
| | | <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'; |
| | | |
| | |
| | | } |
| | | |
| | | 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)) |
| | | } |
| | | } |
| | | |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | 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)) |
| | | } |
| | | } |
| | | |