From f0b8fa2b1330ea00faf694817cdf0289673b8c56 Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期三, 14 九月 2022 16:27:35 +0800
Subject: [PATCH] Merge branch 'master' of ssh://192.168.0.10:29418/pcalife/PAM

---
 PAMapp/components/AddAndReservedBtns.vue |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/PAMapp/components/AddAndReservedBtns.vue b/PAMapp/components/AddAndReservedBtns.vue
index f2f3177..f2d5c2e 100644
--- a/PAMapp/components/AddAndReservedBtns.vue
+++ b/PAMapp/components/AddAndReservedBtns.vue
@@ -4,15 +4,18 @@
             <span> {{ isAdded ? '撌脣�憿批��' : '+ 憿批��' }}</span>
         </el-button>
         <el-button
+            :disabled="isDisableReserve"
             @click="navigateToReservationForm"
             type="primary"
-        >�脰����</el-button>
+        >{{ isDisableReserve ? '撌脰蝯�' : '�脰����'}}</el-button>
     </el-row>
 </template>
 
 <script lang="ts">
 import { Vue, Component, Prop, Emit, Action, State, namespace } from 'nuxt-property-decorator';
 import { Consultant } from '~/shared/models/consultant.model';
+
+const roleStorage = namespace('localStorage');
 
 @Component
 export default class AddAndReservedBtns extends Vue {
@@ -29,6 +32,9 @@
     @Prop()
     cusClass!: string;
 
+    @roleStorage.Getter
+    isUserLogin!: boolean;
+
     isVisiblePopUp = false;
 
     //////////////////////////////////////////////////////////////////////
@@ -41,6 +47,12 @@
     //////////////////////////////////////////////////////////////////////
 
     addConsultant(item: Consultant): void {
+        if (!this.isUserLogin) {
+          item = {
+            ...item,
+            updateTime: new Date().toISOString()
+          };
+        }
         this.addToMyConsultantList(item).then(addOk => {
             addOk && this.openPopUp();
         });
@@ -54,5 +66,12 @@
         return this.myConsultantList.find(item => item.agentNo === this.agentInfo.agentNo)
                 ? true : false
     }
+
+    get isDisableReserve(): boolean {
+      return this.myConsultantList.some((agent) => {
+        return agent.agentNo === this.agentInfo.agentNo
+            && agent.contactStatus === 'contacted';
+        });
+    }
 }
 </script>

--
Gitblit v1.8.0