<template>
    <div class="side-list" :style="{transform: isShow ? 'translate(0px)' : 'translate(358px)'}">
        <div class="show-switch" @click="isShow=!isShow">
            <i class="el-icon-caret-left" :style="{color: isShow ? '#409EFF' : '#999'}" />
        </div>

        <div class="list-switch">
            <div class="tab-list">
                <div class="tab" :class="{'tab-active':isSatellite}" @click="showSatelliteLayer">
                    <svg-icon icon-class="satellite" />
                    <p>卫星</p>
                </div>
            </div>
        </div>

        <div class="info-list" v-loading="orderLoading">
            <el-card class="info-card" v-for="(item, i) in orderList" :key="i" @click.native="clickOrder(item.id)">
                <div class="info-item"><span>订单号：</span><span>{{ item.internalNumber }}</span></div>
                <div class="info-item"><span>车牌号：</span><span>{{ item.plateNumber }}</span></div>
                <div class="info-item"><span>用户昵称：</span><span>{{ item.username }}</span></div>
                <div class="info-item"><span>手机号码：</span><span>{{ item.mobile }}</span></div>
                <div class="info-item"><span>状态：</span><span>{{ item.orderStatus | statusFilter }}</span></div>
                <!--<div class="info-item"><span>骑行时长：</span><span>{{ item.useBikeTimeLength }} 分钟</span></div>-->
                <div class="info-item"><span>骑行开始时间：</span><span>{{ item.useBikeStartTime }}</span></div>
                <div class="info-item"><span>骑行结束时间：</span><span>{{ item.useBikeEndTime }}</span></div>
            </el-card>
        </div>
    </div>
</template>

<script>
    export default {
        name: "side-list",
        props: {
            orderList: Array,
            orderLoading: {
                type: Boolean,
                default: false
            }
        },
        data() {
            return {
                isShow: true,
                isSatellite: false,
            }
        },
        filters: {
            statusFilter(state) {
                const stateMap = ['骑行中', '交易完成', '已关闭', '待支付']
                return stateMap[state-1]
            },
        },
        methods: {
            clickOrder(id) {
                this.$emit('showLocus', id)
            },
            showSatelliteLayer() {
                this.isSatellite = !this.isSatellite
                this.$bus.$emit('showSatelliteLayer', this.isSatellite)
            }
        }
    }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
    .side-list {
        height: 100%;
        position: absolute;
        right: 0;
        top: 0;
        transition: all .5s;
        .info-list {
            width: 358px;
            height: 100%;
            overflow-y: auto;
            background-color: rgba(255,255,255,.9);
            font-size: 14px;
            .info-card {
                .rid-status {
                    color: darkorange;
                    position: absolute;
                    right: 10px;
                    top: 60px;
                    font-size: 28px;
                }
                .info-item {
                    display: flex;
                    padding-bottom: 8px;
                    cursor: pointer;
                    /*span:first-child {
                        width: 80px;
                    }
                    span:last-child {
                        flex: 1;
                        word-break: break-all;
                    }*/
                    &:last-child {
                        padding-bottom: 0;
                    }
                }
            }
        }
        .list-switch {
            position: absolute;
            top: 10px;
            left: -70px;
            transition: all .5s;
            cursor: pointer;
            .tab-list {
                background-color: #fff;
                border-radius: 5px;
                margin-bottom: 20px;
                overflow: hidden;
                transition: all .3s;
                .tab {
                    width: 50px;
                    height: 50px;
                    text-align: center;
                    line-height: 30px;
                    color: #000;
                    background-color: #fff;
                    border-top: 1px solid #ccc;
                    &:first-child {
                        border-top: none;
                    }
                    p {
                        font-size: 12px;
                        margin: 0;
                        line-height: 1;
                    }
                }
                .tab-active {
                    background-color: #66b1ff;
                    color: #fff;
                }
            }
        }
        .show-switch {
            width: 15px;
            height: 50px;
            text-align: center;
            line-height: 50px;
            background-color: #fff;
            position: absolute;
            top: 50%;
            left: -15px;
            margin-top: -25px;
        }
    }
</style>
<style>
    .side-list .el-card__body {
        padding: 15px;
    }
</style>
