保誠-保戶業務員媒合平台
Mila
2021-10-27 19e0e4458a4f7410c6970887c5cc2f89302219a8
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<template>
    <div>
        <Ui-Carousel></Ui-Carousel>
        <div class="content">
            <h5 class="mdTxt mb-20">預約保險顧問</h5>
            <el-button
                class="reserveConsultantBtn"
                @click="routerPush('/recommendConsultant')"
            >嚴選配對</el-button>
            <el-button
                class="reserveConsultantBtn"
                @click="routerPush('/quickFilter')"
            >快速篩選</el-button>
            <div class="rowStyle mb-20">
                <div class="flex">
                    <h5 class="mdTxt">我的顧問清單</h5>
                    <span class="smTxt_bold align_center amount">共 {{agents.length}} 筆</span>
                </div>
                <div
                    class="mdTxt readMore"
                    @click="routerPush('/contactList/consultantList')"
                >查看更多</div>
            </div>
            <ConsultantList
                :agents="agents.slice(0, 3)"
                @removeAgent="removeAgent"
            ></ConsultantList>
            <h5 class="mdTxt mb-20 mt-32">推薦保險顧問</h5>
            <Ui-Swiper :agents="swiperAgents"></Ui-Swiper>
        </div>
 
    </div>
</template>
 
<script lang="ts">
import { Vue, Component } from 'nuxt-property-decorator';
import { Agents } from '~/plugins/api/home';
import { Context } from '@nuxt/types/app';
 
@Component({
    layout: 'home'
})
export default class MainComponent extends Vue {
    agents: Agents[] = [];
    swiperAgents: Agents[] = [];
 
    async asyncData(context: Context) {
        let agents: Agents[] = [];
 
        await context.$service.home.recommendConsultantList().then((result: Agents[]) => {
            agents = result;
        })
 
        const swiperAgents = JSON.parse(JSON.stringify(agents));
 
        return {
            agents,
            swiperAgents
        }
    }
 
    routerPush(path: string) {
        this.$router.push(path);
    }
 
    removeAgent(agentId: number) {
        const findIndex = this.agents.findIndex((item, i) => {
            return item.id === agentId;
        })
        this.agents.splice(findIndex, 1)
    }
}
 
</script>
 
<style lang="scss" scoped>
    .content {
        padding: 0 20px;
    }
 
    .mb-20 {
        margin: 0 0 20px 0;
    }
 
    .mt-32 {
        margin-top: 32px;
    }
 
    .reserveConsultantBtn {
        max-width: 340px;
        width: 100%;
        height: 110px;
        border-radius: 10px;
        box-shadow: 0px 0px 6px #22222229;
        margin: 0 auto 17px auto;
        font-size: 32px;
        font-weight: 700;
        color: #222222;
 
        &:nth-child(3) {
            margin-bottom: 42px;
        }
    }
 
    .reserveConsultantBtn+.reserveConsultantBtn {
        margin-left: 0px;
    }
 
    .rowStyle {
        display: flex;
        justify-content: space-between;
        .flex {
            display: flex;
            .amount {
                color: #68737A;
                margin-left: 10px;
                align-self: center;
            }
        }
        .readMore {
            color: #ED1B2E;
            cursor: pointer;
        }
    }
 
</style>