From 3477e304dd54aa4bba6185a4345f2e032483a9bd Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期二, 16 十一月 2021 14:57:04 +0800
Subject: [PATCH] update 我的顧問清單/預約清單: 聯絡時段欄位調整

---
 PAMapp/components/Client/ClientCard.vue |   72 +++++++++++++++++++++++++-----------
 1 files changed, 50 insertions(+), 22 deletions(-)

diff --git a/PAMapp/components/Client/ClientCard.vue b/PAMapp/components/Client/ClientCard.vue
index 5594a0e..398ef8e 100644
--- a/PAMapp/components/Client/ClientCard.vue
+++ b/PAMapp/components/Client/ClientCard.vue
@@ -7,18 +7,18 @@
                     src=""
                     class="cursor--pointer"
                 ></el-avatar>
-                <div class="satisfaction">
+                <!-- <div class="satisfaction">
                     <i class="icon-star pam-icon icon--yellow satisfaction"></i>
                     <span>{{'1'}}</span>
-                </div>
+                </div> -->
             </el-col>
             <el-col :xs="14" :sm="15">
                 <div class="smTxt_bold name">{{client.name}}</div>
                 <div class="message">������</div>
                 <div class="professionals">
-                    <template v-if="client.requirements.length > 0">
+                    <template v-if="client.requirement">
                         <span
-                            v-for="(item, index) in client.requirements"
+                            v-for="(item, index) in requirements"
                             :key="index"
                             class="professionalsTxt"
                         >#{{item}}</span>
@@ -46,19 +46,20 @@
         >
             <h5 class="subTitle text--center mb-30"
             >{{isReserved ? '������' : '撌脰蝯∟���'}}</h5>
-            <p class="smTxt text-right">隞予 10:00</p>
+            <p class="smTxt text-right">{{client.appointmentDate | formatDate}}</p>
             <div class="dialogTxt">
                 <p>憪��{client.name}}</p>
-                <p>�閰梧��0912345678</p>
-                <p>Email嚗�</p>
-                <p>�批嚗{client.gender === 'male' ? '���' : '憟單��'}}</p>
+                <p>�閰梧�{client.phone}}</p>
+                <p>Email嚗{client.email}}</p>
+                <p>�批嚗{gender}}</p>
                 <p>撟湧翩嚗{client.age}}</p>
-                <p>�璆哨����璆�</p>
-                <p>��瘙�{client.requirements}}</p>
-                <p>��蝯⊥�挾銝�嚗���,��� 18:00~21:00</p>
-                <div class="mt-30 text--center">
-                    <el-button>{{isReserved ? '璅酉�撌脤��蝯�' : '��遛��漲'}}</el-button>
+                <p>�璆哨�{client.job}}</p>
+                <p>��瘙�{client.requirement.replace(',', '��')}}</p>
+                <p v-for="(item, index) in hopeContactTime" :key="index">��蝯⊥�挾{{index + 1 | formatNumber}}嚗{item}}</p>
+                <div class="mt-30 text--center" v-if="isReserved">
+                    <el-button @click="markAppointment">璅酉�撌脤��蝯�</el-button>
                 </div>
+
             </div>
         </Ui-Dialog>
     </div>
@@ -67,24 +68,47 @@
 <script lang="ts">
 import { Vue, Component, Prop } from 'nuxt-property-decorator';
 import { isMobileDevice } from '~/assets/ts/device';
-import { Clients } from '~/pages/clientReservedList.vue';
+import { ClientInfo, markAsContact } from '~/assets/ts/api/appointment';
 
-@Component
+@Component({
+    filters: {
+        formatNumber(index: number) {
+            if (index) {
+                const upperNumber = ['�', '銝�', '鈭�', '銝�', '���', '鈭�', '�', '銝�', '�', '銋�', '���']
+                return upperNumber[index];
+            }
+        }
+    }
+})
 export default class ClientList extends Vue {
-    @Prop() client!: Clients;
+    @Prop() client!: ClientInfo;
     isVisibleDialog = false;
     width = '';
 
+    get requirements() {
+        return this.client.requirement.split(',');
+    }
+
+    get gender() {
+        if (this.client.gender) {
+            return this.client.gender === 'male' ? '���' : '憟單��';
+        }
+        return ''
+    }
+
+    get hopeContactTime() {
+        const contactList = this.client.hopeContactTime.split("'").map(item => item.slice(0, item.length));
+        return contactList.filter(item => !!item)
+    }
+
     get time() {
-        const hours = this.client.time.getHours();
-        const minutes = this.client.time.getMinutes();
-        return `${hours} : ${minutes}`
+        const formatDate = (this.$options.filters as any).formatDate(this.client.appointmentDate);
+        return formatDate.split(' ')[1]
     }
 
     get date() {
-        const month = this.client.time.getMonth();
-        const date = this.client.time.getDate();
-        return `${month} / ${date}`
+        const formatDate = (this.$options.filters as any).formatDate(this.client.appointmentDate);
+        return formatDate.split(' ')[0]
     }
 
     get isReserved() {
@@ -96,6 +120,10 @@
         this.isVisibleDialog = true;
     }
 
+    markAppointment() {
+        markAsContact(this.client.id).then(res => this.$router.go(0))
+    }
+
 }
 </script>
 

--
Gitblit v1.8.0