From 82e2a62e7c90cc191f9e2ebc569fe3a3663b68b0 Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期五, 03 十二月 2021 11:19:00 +0800
Subject: [PATCH] Merge branch '預約單更新與刪除'

---
 PAMapp/components/Consultant/ConsultantCard.vue |   42 ++++++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue
index 8ff803e..de521db 100644
--- a/PAMapp/components/Consultant/ConsultantCard.vue
+++ b/PAMapp/components/Consultant/ConsultantCard.vue
@@ -46,6 +46,7 @@
         <Ui-Dialog
             :isVisible.sync="isVisibleDialog"
             :width="width"
+            class="pam-myDemand-dialog"
         >
             <div v-if="appointmentDetail">
                 <h5 class="subTitle text--center mb-30">������</h5>
@@ -55,13 +56,13 @@
                     <p>�閰梧�{appointmentDetail.phone}}</p>
                     <p>Email嚗{appointmentDetail.email}}</p>
                     <p>�批嚗{gender}}</p>
-                    <p>撟湧翩嚗{appointmentDetail.age}}</p>
+                    <p>撟湧翩嚗{appointmentDetail.age | toAgeLabel }}</p>
                     <p>�璆哨�{appointmentDetail.job}}</p>
-                    <p>��瘙�{appointmentDetail.requirement.replace(',', '��')}}</p>
+                    <p>��瘙�{appointmentDetail.requirement.split(',').join('��')}}</p>
                     <p
                         v-for="(item, index) in hopeContactTime"
                         :key="index"
-                    >��蝯⊥�挾{{index + 1 | formatNumber}}嚗{item}}</p>
+                    >��蝯⊥�挾{{index + 1 | formatNumber}}嚗{ item | formatHopeContactTime }}</p>
                 </div>
             </div>
         </Ui-Dialog>
@@ -69,8 +70,9 @@
 </template>
 
 <script lang="ts">
-import { Vue, Component, Prop, Emit } from 'nuxt-property-decorator';
-import { AppointmentDetail, Consultants, getAppointmentDetail } from '~/assets/ts/api/consultant';
+import { Vue, Component, Prop, Emit, Action } from 'nuxt-property-decorator';
+import { Consultants, getAppointmentDetail } from '~/assets/ts/api/consultant';
+import { AppointmentDetail } from '~/assets/ts/models/AppointmentDetail';
 import { isLogin } from '~/assets/ts/auth';
 import { isMobileDevice } from '~/assets/ts/device';
 
@@ -81,10 +83,21 @@
                 const upperNumber = ['�', '銝�', '鈭�', '銝�', '���', '鈭�', '�', '銝�', '�', '銋�', '���']
                 return upperNumber[index];
             }
+        },
+        formatHopeContactTime(item: string): string {
+          if (item) {
+            const [hopeDay, hopeTime] = item.split('��');
+            const day = hopeDay.split(',').length > 6 ? '銝����' : hopeDay;
+            const time = hopeTime.split(',').length > 3 ? '銝����' : hopeTime;
+            return `${day}��${time}`;
+          }
+          return '';
         }
     }
 })
 export default class ConsultantCard extends Vue {
+    @Action removeFromMyConsultantList!: (agentNo: string) => Promise<boolean>;
+
     @Prop() agentInfo!: Consultants;
     isVisibleDialog = false;
     width: string = '';
@@ -136,14 +149,12 @@
     get hopeContactTime() {
         const contactList = this.appointmentDetail.hopeContactTime
             .split("'").map(item => item.slice(0, item.length));
-        return contactList.filter(item => !!item)
+        return contactList.filter(item => !!item && item !== ",")
     }
     reserveCommunication() {
         const contactStatus = this.agentInfo.contactStatus;
         if (!contactStatus || contactStatus === 'picked') {
-            isLogin()
-                ? this.$router.push(`/questionnaire/${this.agentInfo.agentNo}`)
-                : this.$router.push('/login');
+            this.$router.push(`/questionnaire/${this.agentInfo.agentNo}`)
         } else {
             this.openPopUp();
         }
@@ -157,8 +168,10 @@
         });
     }
 
-    @Emit('removeAgent') removeAgent() {
-        return this.agentInfo.agentNo;
+    removeAgent() {
+        this.removeFromMyConsultantList(this.agentInfo.agentNo).then((removeOk) => {
+            console.log('removeOk?', removeOk);
+        });
     }
 
     showAgentDetail(agentNo: string): void {
@@ -248,6 +261,11 @@
 
     .dialogInfo {
         font-size: 20px;
+        overflow-y:scroll;
+        max-height: 50vh;
+        @include desktop {
+            height: 400px;
+        }
     }
 
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0