<template>
    <div class="fruit1">
        <div class="top">
            <div class="smallTop">
                <div class="icon"></div>
                <div class="title">可兑换明细</div>
            </div>
            <div class="smallBottom">
                <div class="card" v-for="(item,index) in list" :key="index">
                    <div class="name">{{ item.fruitsName }}</div>
                    <div class="num">{{ item.weight }}kg</div>
                </div>
            </div>
        </div>
        <div class="content">
            <div class="smallTop">
                <div class="left">
                    <div class="icon"></div>
                    <div class="title">提货点</div>
                </div>
                <div class="right" @click="change" v-if="num == 1">∧</div>
                <div class="right" @click="change" v-if="num == 2">∨</div>
            </div>
            <div class="smallBottom" v-if="num == 1">
                <div class="card" v-for="(item,index) in list1" :key="index">
                    <div class="name">{{ item.supplyName }}</div>
                    <div class="phone">联系电话：{{ item.supplyMobile }}</div>
                    <div class="address">地点：{{ item.address }}</div>
                </div>
            </div>
        </div>
        <div class="bottom" v-if="this.list2.length > 0">
            <div class="smallTop">
                <div class="icon"></div>
                <div class="title">兑换历史</div>
            </div>
            <div class="smallBottom">
                <div class="card" v-for="(item,index) in list2" :key="index">
                    <div class="goods">
                        <div class="img"></div>
                        <div class="name">{{ item.fruitsName }}</div>
                        <div class="num">{{ item.weight }}kg</div>
                    </div>
                    <div class="address">提货点：{{ item.address }}</div>
                    <div class="time">提货时间：{{ item.createTime }}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'fruit1',
    data() {
        return {
            num: 1,
            list: [],
            list1: [],
            list2: [],
        }
    },
    methods: {
        change() {
            if (this.num == 1) {
                this.num = 2
            } else {
                this.num = 1
            }
        }
    },
    created() {
        this.list = this.$route.query.convertibleInfoList;
        this.list1 = this.$route.query.supplyList;
        this.list2 = this.$route.query.exchangeRecordList;
    }
}
</script>

<style lang="stylus" scoped>

.fruit1{
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    .top{
        display: flex;
        flex-direction: column;
        .smallTop{
            display: flex;
            align-items: center;
            background: #fff;
            padding: 30px;
            .icon{
                width: 6px;
                height: 30px;
                background: #EB4E3F;
            }
            .title{
                font-size: 30px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #333333;
                margin-left: 10px;
            }
        }
        .smallBottom{
            display: flex;
            flex-direction: column;
            align-items: center;
            background: #fff;
            padding: 30px;
            margin: 10px 0 20px 0;
            .card{
                width 100%;
                display: flex;
                justify-content: space-between;
                align-items: center;
                font-size: 30px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #999;
                margin: 10px;
            }
        }
    }
    .content{
        display: flex;
        flex-direction: column;
        .smallTop{
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: #fff;
            padding: 30px;
            .left{
                display: flex;
                align-items: center;
                .icon{
                    width: 6px;
                    height: 30px;
                    background: #EB4E3F;
                }
                .title{
                    font-size: 30px;
                    font-family: PingFangSC-Medium, PingFang SC;
                    font-weight: 500;
                    color: #333333;
                    margin-left: 10px;
                }    
            }
            .right{
                font-size: 30px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 800;
                color: #333333;
            }
        }
        .smallBottom{
            display: flex;
            flex-direction: column;
            .card{
                width 100%;
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                background: #fff;
                font-size: 30px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                line-height: 50px;
                color: #999;
                margin-top: 10px;
                padding: 30px;
                .name{
                    color: #333
                }
            }
        }
    }
    .bottom{
        display: flex;;
        flex-direction: column;
        margin-top: 20px;
        .smallTop{
            display: flex;
            align-items: center;
            background: #fff;
            padding: 30px;
            .icon{
                width: 6px;
                height: 30px;
                background: #EB4E3F;
            }
            .title{
                font-size: 30px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #333333;
                margin-left: 10px;
            }
        }
        .smallBottom{
            display: flex;
            flex-direction: column;
            .card{
                background: #fff;
                display: flex;
                flex-direction: column;
                padding: 30px;
                margin-top: 10px;
                font-size: 30px;
                line-height: 50px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: #999;
                .goods{
                    display: flex;
                    align-items: center;
                    color: #333;
                    .img{
                        width 30px;
                        height 30px;
                        background: #EB4E3F
                    }
                    .name{
                        margin: 0 20px;
                    }
                }
            }
        }
    }
}
</style>