<template>
    <div class="my-selection">
        <div class="title">
            <p>我的选品</p>
            <span @click="close">关闭</span>
        </div>
        <div class="selection-list">
            <div class="selection-item" v-for="item in 10" :key="item">
                <el-checkbox v-model="checked"></el-checkbox>
                <div class="commodity-box">
                    <div class="box-title">团蜂</div>
                    <div class="commodity">
                        <div class="img-box">
                            <img src="https://img13.360buyimg.com/n1/jfs/t1/229873/19/3272/128629/6555d346F8d1ffae1/966548db340e59dd.jpg"
                                alt="">
                        </div>
                        <div class="text-box">
                            <p> 王老吉凉茶 植物饮料 绿盒装 250ml*24盒 整箱水饮 中华老字号 年货礼盒</p>
                            <div class="text">
                                <p>协议价<span>￥41</span></p>
                                <p>利润率<span>9.2%</span></p>
                            </div>
                            <div class="text">
                                <p>指导价<span>￥44.8</span></p>
                                <p>折扣<span>9.2折</span></p>
                            </div>
                        </div>
                    </div>
                    <div class="delete-selection">
                        <i class="el-icon-close"></i>
                    </div>
                </div>
            </div>
        </div>
        <div class="page">
            <div class="all-checkout">
                <el-checkbox :indeterminate="isIndeterminate" v-model="allCheckout"></el-checkbox>
                <p>共23件商品，共选0件</p>
                <span>删除</span>
            </div>
            <div class="pagination-box">
                <el-pagination small layout="prev, pager, next" :total="50">
                </el-pagination>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            checked: true,
            allCheckout:false,
            //  控制全选框选择的是横线还是对钩
            isIndeterminate:true
        }
    },
    methods: {
        //  关闭抽屉框
        close() {
            this.$emit("closeDrawer");
        }
    }
}
</script>

<style lang="scss" scoped>
.my-selection {
    height: 100%;

    .title {
        display: flex;
        justify-content: space-between;
        box-sizing: border-box;
        height: 60px;
        align-items: center;
        padding: 0 30px;
        background-color: #fff;

        p {
            font-size: 20px;
        }

        span {
            padding: 5px 15px;
            border: 1px solid #EF530E;
            color: #EF530E;
            border-radius: 20px;
            cursor: pointer;
        }
    }

    .selection-list {
        box-sizing: border-box;
        padding-left: 20px;
        height: 85%;
        overflow-y: scroll;

        .selection-item {
            display: flex;
            align-items: center;
            gap: 20px;
            margin-top: 30px;

            .commodity-box {
                width: 80%;
                height: 150px;
                box-sizing: border-box;
                padding: 15px 0px 15px 15px;
                background-color: #fff;
                border-radius: 10px;
                position: relative;
                border: 1px solid transparent;
                cursor: pointer;

                &:hover {
                    border-color: #EF530E;
                }

                &:hover .delete-selection {
                    display: flex;
                }

                .commodity {
                    display: flex;
                    align-items: center;
                    margin-top: 5px;

                    .img-box {
                        width: 100px;
                        height: 100px;

                        img {
                            width: 100%;
                            height: 100%;
                            display: block;
                        }
                    }

                    .text-box {
                        margin-left: 20px;
                        display: flex;
                        gap: 15px;
                        flex-direction: column;

                        >p {
                            width: 250px;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            white-space: nowrap;
                            font-size: 18px;
                            font-weight: 600;
                        }

                        .text {
                            display: flex;
                            gap: 10px;
                            justify-content: space-between;
                            align-items: center;
                            box-sizing: border-box;

                            &:first-of-type {
                                p {
                                    span {
                                        color: #EF530E;
                                    }
                                }
                            }

                            &:last-of-type {
                                p {
                                    span {
                                        color: rgb(15, 111, 241);
                                    }
                                }
                            }

                            p {
                                span {
                                    margin-left: 8px;
                                }
                            }
                        }
                    }
                }

                .delete-selection {
                    cursor: pointer;
                    position: absolute;
                    right: 0;
                    top: 0;
                    width: 25px;
                    height: 25px;
                    background-color: #EF530E;
                    font-size: 14px;
                    color: #fff;
                    display: none;
                    align-items: center;
                    justify-content: center;
                    border-radius: 0px 10px 0px 10px;
                }
            }
        }
    }
    .page{
        height: 50px;
        padding: 10px 10px 10px 20px;
        box-sizing: border-box;
        display: flex;
        gap: 20px;
        align-items: center;
        background-color: #fff;
        margin-top: 10px;
        .all-checkout{
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 14px;
            p{
                color: rgb(102, 102, 102);
                font-weight: 600;
            }
            span{
                color: rgb(237, 42, 30);
                font-weight: 600;
                cursor: pointer;
            }
        }
    }
}

::v-deep .el-checkbox__input.is-checked .el-checkbox__inner{
    background-color: #EF530E;
    border-color: #EF530E;
}

::v-deep .el-pager li.active{
    color: #EF530E;
    font-weight: 600;
}

::v-deep .el-checkbox__input.is-indeterminate .el-checkbox__inner {
    background-color: #EF530E;
    border-color: #EF530E;
}
</style>