From 2e2107d8ec18bfd90936d9562e9685040d052eed Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期三, 26 一月 2022 09:22:06 +0800
Subject: [PATCH] add#134745: 登入後,如果有過久無回應的顧問,進入此流程(belong to TODO#134717: [客戶] 取消預約再改選其他顧問(前端))

---
 PAMapp/pages/index.vue |  114 ++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 73 insertions(+), 41 deletions(-)

diff --git a/PAMapp/pages/index.vue b/PAMapp/pages/index.vue
index e424a82..71f343c 100644
--- a/PAMapp/pages/index.vue
+++ b/PAMapp/pages/index.vue
@@ -45,41 +45,46 @@
         :width="appointmentDialogWidth"
         class="pam-myDemand-dialog pam-dialog-reserved"
       >
-        <div v-if="appointmentDetail">
-            <h5 class="subTitle text--center mb-30">������</h5>
-            <p class="smTxt">{{appointmentDetail.appointmentDate | formatDate}}</p>
-            <div class="reserved-info">
-                <p>憪��{appointmentDetail.name}}</p>
-                <p>�閰梧�{appointmentDetail.phone}}</p>
-                <p>Email嚗{appointmentDetail.email}}</p>
-                <p>�批嚗{gender}}</p>
-                <p>撟湧翩嚗{appointmentDetail.age | toAgeLabel }}</p>
-                <p>�璆哨�{appointmentDetail.job}}</p>
-                <p>��瘙�{appointmentDetail.requirement.split(',').join('��')}}</p>
-                <p
-                    v-for="(item, index) in hopeContactTime"
-                    :key="index"
-                >��蝯⊥�挾{{index + 1 | formatNumber}}嚗{ item | formatHopeContactTime }}</p>
-                <div v-if="appointmentDetail.satisfactionScore">
-                    <div class="mdTxt mt-10 mb-10">皛踵�漲</div>
-                    <el-rate
-                    :value="appointmentDetail.satisfactionScore"
-                    class="pam-myDemand-dialog__rate"
-                    disabled>
-                    </el-rate>
-                </div>
-            </div>
+          <div v-if="appointmentDetail">
+              <h5 class="subTitle text--center mb-30">������</h5>
+              <p class="smTxt">{{appointmentDetail.appointmentDate | formatDate}}</p>
+              <div class="reserved-info">
+                  <p>憪��{appointmentDetail.name}}</p>
+                  <p>�閰梧�{appointmentDetail.phone}}</p>
+                  <p>Email嚗{appointmentDetail.email}}</p>
+                  <p>�批嚗{gender}}</p>
+                  <p>撟湧翩嚗{appointmentDetail.age | toAgeLabel }}</p>
+                  <p>�璆哨�{appointmentDetail.job}}</p>
+                  <p>��瘙�{appointmentDetail.requirement.split(',').join('��')}}</p>
+                  <p
+                      v-for="(item, index) in hopeContactTime"
+                      :key="index"
+                  >��蝯⊥�挾{{index + 1 | formatNumber}}嚗{ item | formatHopeContactTime }}</p>
+                  <div v-if="appointmentDetail.satisfactionScore">
+                      <div class="mdTxt mt-10 mb-10">皛踵�漲</div>
+                      <el-rate
+                      :value="appointmentDetail.satisfactionScore"
+                      class="pam-myDemand-dialog__rate"
+                      disabled>
+                      </el-rate>
+                  </div>
+              </div>
 
-            <div v-if="notScoreAppointmentYet" class="reserved-btn">
-                <el-button type="primary"
-                    @click.native="isShowReviewDialog = true">蝯虫�遛��漲閰��</el-button>
-            </div>
-        </div>
+              <div v-if="notScoreAppointmentYet" class="reserved-btn">
+                  <el-button type="primary"
+                      @click.native="reviewsBtn = true">蝯虫�遛��漲閰��</el-button>
+              </div>
+
+              <div v-if="appointmentDetail.communicateStatus === 'reserved' && !isAppointment" class="text--center mt-10">
+                  <el-button @click="isCancelPopup = true">������</el-button>
+                  <el-button @click="edit" type="primary">蝺刻摩</el-button>
+              </div>
+          </div>
       </Ui-Dialog>
 
       <PopUpFrame
         :isOpen.sync="isShowReAppointmentDialog"
-        @closePopUp="removeUrlQueryParameter('notContactAppointmentIdFromMsg')"
+        @closePopUp="removeUrlQueryParameter('notContactAppointmentId')"
       >
           <div class="pam-dialog-review">
               <div class="mt-30 text--middle" v-if="agentInfo">
@@ -137,16 +142,17 @@
 
 <script lang="ts">
   import { Vue, Component, State, Action, Watch, namespace } from 'nuxt-property-decorator';
-  import { Appointment, AppointmentClosedInfo } from '~/shared/models/appointment.model';
-  import { Consultant } from '~/shared/models/consultant.model';
-  import { ContactStatus } from '~/shared/models/enum/contact-status';
-  import { UserReviewsConsultantsParams } from '~/shared/models/reviews.model';
-  import { StrictQueryParams } from '~/shared/models/strict-query.model';
+
   import appointmentService from '~/shared/services/appointment.service';
   import reviewsService from '~/shared/services/reviews.service';
   import UtilsService from '~/shared/services/utils.service';
   import myConsultantService from '~/shared/services/my-consultant.service';
-import { AgentInfo } from '~/shared/models/agent-info.model';
+  import { Appointment, AppointmentClosedInfo } from '~/shared/models/appointment.model';
+  import { Consultant } from '~/shared/models/consultant.model';
+  import { UserReviewsConsultantsParams } from '~/shared/models/reviews.model';
+  import { StrictQueryParams } from '~/shared/models/strict-query.model';
+  import { AgentInfo } from '~/shared/models/agent-info.model';
+  import { ContactStatus } from '~/shared/models/enum/contact-status';
 
   const localStorage = namespace('localStorage');
   const roleStorage = namespace('localStorage');
@@ -164,6 +170,9 @@
 
     @roleStorage.Getter
     isAdminLogin!: boolean;
+
+    @roleStorage.Getter
+    isUserLogin!: boolean;
 
     @Action
     storeRecommendList!: any;
@@ -257,6 +266,16 @@
         this.storeConsultantList();
         this.storageClearQuickFilter();
         this.storageClearRecommendConsultant();
+
+        if (this.isUserLogin) {
+          appointmentService.getNotContactAppointment().then((appointment) => {
+            if (appointment) {
+              this.$router.push({ query: { notContactAppointmentId: appointment.id + ''}});
+              this.autoOpenAppointmentBy('askReAppointment', appointment.id);
+            }
+          });
+        }
+
       }
 
     }
@@ -331,13 +350,18 @@
       this.$router.push(path);
     }
 
+    edit() {
+        this.isShowAppointmentDialog = false;
+        this.$router.push({path: `/questionnaire/${this.agentInfo.agentNo}`, query: {'edit': 'true'}});
+    }
+
     reAppointment(): void {
       appointmentService.cancelAppointment(this.appointmentDetail.id).then(() => {
         const requirements = this.appointmentDetail.requirement.split(',');
         this.storeConsultantList();
         this.storageStrickQueryItem({ requirements: requirements });
         this.storageClearNotContactAppointmentIdFromMsg();
-        this.removeUrlQueryParameter('notContactAppointmentIdFromMsg');
+        this.removeUrlQueryParameter('notContactAppointmentId');
         this.$router.push('/recommendConsultant');
       });
     }
@@ -346,8 +370,10 @@
       appointmentService.cancelAppointment(this.appointmentDetail.id).then(() => {
         this.storeConsultantList();
         this.storageClearNotContactAppointmentIdFromMsg();
-        this.removeUrlQueryParameter('notContactAppointmentIdFromMsg');
-        this.$router.push('');
+        this.removeUrlQueryParameter('notContactAppointmentId');
+        this.isShowReAppointmentDialog = false;
+        this.isShowAppointmentDialog = false;
+        this.$router.push('/');
       });
     }
 
@@ -375,18 +401,20 @@
           })
         }
         this.$router.push(newRouteQuery);
+        this.storageClearSatisfactionIdFromMsg();
+        this.storageClearNotContactAppointmentIdFromMsg();
     }
 
     ///////////////////////////////////////////////////////////////////////////////
 
-    get gender() {
+    get gender(): string {
         if (this.appointmentDetail.gender) {
             return this.appointmentDetail.gender === 'male' ? '���' : '憟單��';
         }
         return ''
     }
 
-    get hopeContactTime() {
+    get hopeContactTime(): string[] {
         const contactList = this.appointmentDetail.hopeContactTime
             .split("'").map((item: any) => item.slice(0, item.length));
         return contactList.filter((item: any) => !!item && item !== ",")
@@ -399,6 +427,10 @@
       return false;
     }
 
+    get isAppointment(): boolean {
+      return !!this.agentInfo['appointmentStatus'];
+    }
+
   }
 
 </script>

--
Gitblit v1.8.0