From e912d42c4a9d806c2a498fef458ef8cb4e9ba405 Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期三, 23 二月 2022 15:54:12 +0800
Subject: [PATCH] update#135494: [ 客戶端 ] 加入顧問到我的顧問清單後,未顯示加入日期

---
 PAMapp/components/AddAndReservedBtns.vue |   55 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/PAMapp/components/AddAndReservedBtns.vue b/PAMapp/components/AddAndReservedBtns.vue
index 8a7b4e1..b42bee8 100644
--- a/PAMapp/components/AddAndReservedBtns.vue
+++ b/PAMapp/components/AddAndReservedBtns.vue
@@ -1,10 +1,10 @@
 <template>
     <el-row type="flex" justify="center" :class="cusClass">
         <el-button @click="addConsultant(agentInfo)" :disabled="isAdded">
-            <span> {{isAdded ? '撌脣�憿批��' : '+ 憿批��'}}</span>
+            <span> {{ isAdded ? '撌脣�憿批��' : '+ 憿批��' }}</span>
         </el-button>
         <el-button
-            @click="reserveCommunication"
+            @click="navigateToReservationForm"
             type="primary"
         >�脰����</el-button>
     </el-row>
@@ -12,28 +12,53 @@
 
 <script lang="ts">
 import { Vue, Component, Prop, Emit, Action, State, namespace } from 'nuxt-property-decorator';
-import { Consultants } from '~/assets/ts/models/consultant.model';
+import { Consultant } from '~/shared/models/consultant.model';
 
-const localStorage = namespace('localStorage');
+const roleStorage = namespace('localStorage');
+
 @Component
 export default class AddAndReservedBtns extends Vue {
-    @Action addToMyConsultantList!: (consultantToAdd: Consultants) => Promise<boolean>
-    @State('myConsultantList') myConsultantList!: Consultants[];
-    @Prop() agentInfo!: Consultants;
-    @Prop() cusClass!: string;
+
+    @Action
+    addToMyConsultantList!: (consultantToAdd: Consultant) => Promise<boolean>
+
+    @State('myConsultantList')
+    myConsultantList!: Consultant[];
+
+    @Prop()
+    agentInfo!: Consultant;
+
+    @Prop()
+    cusClass!: string;
+
+    @roleStorage.Getter
+    isUserLogin!: boolean;
+
     isVisiblePopUp = false;
-    addConsultant(item: Consultants) {
+
+    //////////////////////////////////////////////////////////////////////
+
+    @Emit('openPopUp')
+    openPopUp(popUpTxt: string = '����憿批��'): string {
+        return popUpTxt;
+    }
+
+    //////////////////////////////////////////////////////////////////////
+
+    addConsultant(item: Consultant): void {
+        if (!this.isUserLogin) {
+          item = {
+            ...item,
+            updateTime: new Date().toString()
+          };
+        }
         this.addToMyConsultantList(item).then(addOk => {
             addOk && this.openPopUp();
         });
     }
 
-    reserveCommunication() {
+    navigateToReservationForm(): void {
         this.$router.push(`/questionnaire/${this.agentInfo.agentNo}`);
-    }
-
-    @Emit('openPopUp') openPopUp(popUpTxt: string = '����憿批��') {
-        return popUpTxt
     }
 
     get isAdded() {
@@ -41,4 +66,4 @@
                 ? true : false
     }
 }
-</script>
\ No newline at end of file
+</script>

--
Gitblit v1.8.0