保誠-保戶業務員媒合平台
Mila
2021-10-27 19e0e4458a4f7410c6970887c5cc2f89302219a8
TODO#128785 首頁-我的顧問清單 畫面刻版
修改2個檔案
新增2個檔案
302 ■■■■■ 已變更過的檔案
PAMapp/components/Consultant/ConsultantCard.vue 139 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/components/Consultant/ConsultantList.vue 61 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/pages/index.vue 48 ●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/plugins/api/home.ts 54 ●●●●● 修補檔 | 檢視 | 原始 | 究查 | 歷程
PAMapp/components/Consultant/ConsultantCard.vue
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,139 @@
<template>
    <div>
        <el-row type="flex" class="rowStyle">
            <el-col :xs="2" :sm="1" :class="{'state': agentInfo.new}"></el-col>
            <el-col :xs="22" :sm="23">
                <el-row type="flex">
                    <el-col class="flex_column" :xs="5" :sm="3">
                        <img class="avator" :src="agentInfo.img" alt="">
                        <div class="star">{{agentInfo.satisfaction}}</div>
                    </el-col>
                    <el-col class="flex_column" :xs="10" :sm="15">
                        <div class="smTxt_bold name">{{agentInfo.name}}</div>
                        <div class="tagStyle">
                            <span
                                class="tagTxt"
                                v-for="(tag, index) in agentInfo.tags" :key="index">#{{tag}}</span>
                        </div>
                        <div class="delete" @click="removeAgent">移除</div>
                    </el-col>
                    <el-col class="flex_column" :xs="9" :sm="6">
                        <el-button
                            class="smTxt_bold btn"
                            @click="reserveCommunication"
                            :class="{'reservedBtn': agentInfo.reserve}"
                        >{{ agentInfo.reserve ? '已預約' : '進行預約'}}</el-button>
                        <div class="time">今天 10:00 åŠ å…¥</div>
                    </el-col>
                </el-row>
            </el-col>
        </el-row>
    </div>
</template>
<script lang="ts">
import { Vue, Component, Prop, Emit, Watch } from 'nuxt-property-decorator';
import { Agents } from '~/plugins/api/home';
@Component
export default class ConsultantCard extends Vue {
    @Prop() agentInfo!: Agents;
    reserveCommunication() {
        if (!this.agentInfo.reserve) {
            this.$router.push('/communication/myDemand')
        }
    }
    @Emit('removeAgent') removeAgent() {
        console.log('removeAgent')
        return this.agentInfo.id;
    }
}
</script>
<style lang="scss" scoped>
    .rowStyle {
        padding: 10px;
        background-color: #FFFFFF;
        margin-bottom: 10px;
        display: flex;
        justify-content: space-between;
        .state {
            width: 10px;
            height: 10px;
            border-radius: 50px;
            background-color: #F2C75C;
            margin: auto 0;
        }
        .avator {
            width: 50px;
            height: 50px;
            border-radius: 50px ;
        }
        .star {
            font-size: 12px;
            font-weight: bold;
            &:before {
                content: '\2605';
                color: #ED1B2E;
                margin: 5px;
            }
        }
        .tagStyle {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            .tagTxt {
                font-size: 12px;
                font-weight: bold;
                margin-right: 5px;
            }
        }
        .delete {
            color: #ED1B2E;
            font-size: 14px;
            font-weight: bold;
            cursor: pointer;
        }
        .btn {
            color: #ED1B2E;
            border: solid 2px;
            border-radius: 30px;
            padding: 10px 16px;
        }
        .reservedBtn {
            color: #009CBD;
            cursor: auto;
            &:hover {
                color: #009CBD;
                border-color: #009CBD;
                background-color: #ffffff;
            }
        }
        .time {
            font-size: 12px;
            font-weight: bold;
            color: #707070;
            text-align: right;
        }
    }
    .flex_column {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
</style>
PAMapp/components/Consultant/ConsultantList.vue
¤ñ¹ï·sÀÉ®×
@@ -0,0 +1,61 @@
<template>
    <div>
        <template v-if="agents.length > 0">
            <ConsultantCard
                v-for="(agent, index) in agents"
                :key="index"
                :agentInfo="agent"
                @removeAgent="removeAgent"
            ></ConsultantCard>
        </template>
        <template v-else-if="noLogin">
            <div class="emptyRowStyle">
                <div class="mdTxt login" @click="$router.push('/login')">登入</div>
                <div class="smTxt txt">查看更多已選顧問</div>
            </div>
        </template>
        <template v-else>
            <div class="emptyRowStyle">
                <div class="smTxt txt">您目前無已選顧問</div>
            </div>
        </template>
    </div>
</template>
<script lang="ts">
import { Vue, Component, Prop, Emit } from 'nuxt-property-decorator';
import { Agents } from '~/plugins/api/home';
@Component
export default class ConsultantList extends Vue {
    @Prop() agents!: Agents[];
    noLogin = false;
    @Emit('removeAgent') removeAgent(agentId: number) {
        return agentId;
    }
}
</script>
<style lang="scss" scoped>
    .emptyRowStyle {
        background-color: #FFFFFF;
        width: 100%;
        height: 100px;
        display: flex;
        justify-content: center;
        align-items: center;
        .login {
            color: #ED1B2E;
            cursor: pointer;
        }
        .txt {
            color: #68737A;
            margin-left: 17px;
        }
    }
</style>
PAMapp/pages/index.vue
@@ -11,11 +11,22 @@
                class="reserveConsultantBtn"
                @click="routerPush('/quickFilter')"
            >快速篩選</el-button>
            <h5 class="mdTxt mb-20">我的顧問清單</h5>
            <el-button @click="routerPush('/contactList/consultantList')">查看更多</el-button>
            <el-button @click="routerPush('/communication/consult')">諮詢</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="agents"></Ui-Swiper>
            <Ui-Swiper :agents="swiperAgents"></Ui-Swiper>
        </div>
    </div>
@@ -31,6 +42,7 @@
})
export default class MainComponent extends Vue {
    agents: Agents[] = [];
    swiperAgents: Agents[] = [];
    async asyncData(context: Context) {
        let agents: Agents[] = [];
@@ -39,13 +51,23 @@
            agents = result;
        })
        const swiperAgents = JSON.parse(JSON.stringify(agents));
        return {
            agents
            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)
    }
}
@@ -84,5 +106,21 @@
        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>
PAMapp/plugins/api/home.ts
@@ -8,57 +8,73 @@
                id: 0,
                name: '張小美',
                img: 'https://randomuser.me/api/portraits/women/31.jpg',
                loginState: '上線',
                satisfaction: 4.8
                new: false,
                tags: ['財務規劃', '資產轉移'],
                satisfaction: 4.8,
                reserve: false
            },
            {
                id: 1,
                name: '蔣帥哥',
                img: 'https://randomuser.me/api/portraits/men/32.jpg',
                loginState: '上線',
                satisfaction: 4
                new: true,
                tags: [],
                satisfaction: 4,
                reserve: false
            },
            {
                id: 2,
                name: '林美女',
                img: 'https://randomuser.me/api/portraits/women/33.jpg',
                loginState: '離線',
                satisfaction: 5
                new: false,
                tags: ['財務規劃', '資產轉移'],
                satisfaction: 5,
                reserve: true
            },
            {
                id: 3,
                name: '蔡美眉',
                img: 'https://randomuser.me/api/portraits/women/34.jpg',
                loginState: '上線',
                satisfaction: 4.3
                new: true,
                tags: ['財務規劃', '資產轉移'],
                satisfaction: 4.3,
                reserve: false
            },
            {
                id: 4,
                name: '張小美',
                img: 'https://randomuser.me/api/portraits/women/35.jpg',
                loginState: '忙碌',
                satisfaction: 4.8
                state: '忙碌',
                tags: [],
                satisfaction: 4.8,
                reserve: true
            },
            {
                id: 5,
                name: '蔣帥哥',
                img: 'https://randomuser.me/api/portraits/men/36.jpg',
                loginState: '離線',
                satisfaction: 4
                new: true,
                tags: ['財務規劃', '資產轉移'],
                satisfaction: 4,
                reserve: false
            },
            {
                id: 6,
                name: '林美女',
                img: 'https://randomuser.me/api/portraits/women/37.jpg',
                loginState: '忙碌',
                satisfaction: 5
                state: '忙碌',
                tags: [],
                satisfaction: 5,
                reserve: false
            },
            {
                id: 7,
                name: '蔡美眉',
                img: 'https://randomuser.me/api/portraits/women/38.jpg',
                loginState: '上線',
                satisfaction: 4.3
                new: false,
                tags: [],
                satisfaction: 4.3,
                reserve: true
            }
        ]
        return CommonService.prototype.withDebugData(debugData, 'https://randomuser.me/api/')
@@ -69,6 +85,8 @@
    id: number,
    name: string,
    img: string,
    loginState: string,
    satisfaction: number
    new: boolean,
    satisfaction: number,
    tags: string[],
    reserve: boolean
  }