保誠-保戶業務員媒合平台
Jack
2021-11-10 4a8e5d76ff89406d26e36df8538efacb24e16add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<template>
    <div>
        <div class="pam-cus-tabs mb-30">
            <div
                class="cus-tab-item"
                :class="{'is-active': activeTabName === 'reservedList'}"
                @click="tabClick('reservedList')"
            >客戶預約
                <span class="p">({{reservedList.length}})</span>
            </div>
            <div
                class="cus-tab-item"
                :class="{'is-active': activeTabName === 'contactedList'}"
                @click="tabClick('contactedList')"
            >已聯絡
                <span class="p">({{contactedList.length}})</span>
            </div>
        </div>
 
        <NuxtChild
            :contactedList="contactedList"
            :reservedList="reservedList"
        ></NuxtChild>
    </div>
</template>
 
<script lang="ts">
import { Context } from '@nuxt/types';
import { Vue, Component } from 'nuxt-property-decorator';
 
@Component
export default class ClientReservedList extends Vue {
    activeTabName = 'reservedList';
    reservedList: Clients[] = [];
    contactedList: Clients[] = [];
    clients: Clients[] = [];
 
    async asyncData(context: Context) {
        let reservedList: Clients[] = [];
        let contactedList: Clients[] = [];
        let clients: Clients[] = [];
 
        await context.$service.home.clientReservedList().then((result: Clients[]) => {
            clients = result;
        })
 
        contactedList = clients.filter(item => item.communicateStatus === 'contacted');
        reservedList = clients.filter(item => item.communicateStatus === 'reserved');
 
        return {
            clients,
            contactedList,
            reservedList
        }
    }
 
    tabClick(path: string) {
        this.activeTabName = path;
        this.$router.push('/clientReservedList/' + this.activeTabName)
    }
}
 
export interface Clients {
    name: string,
    clientId: string,
    phone: string,
    time: Date,
    gender: string,
    age: string,
    job: string,
    requirements: string[],
    communicateStatus: string
}
</script>