<template>
    <van-list v-model:loading="loading" :finished="finished" finished-text="" @load="getData">
        <div class="pass-info" v-for="(item, index) in list" :key="index">
            <div class="pass-title">
                <div class="title">{{ getLabelName(item.payMethod, payMethodOptions) }}</div>
                <div class="time">{{ item.payAt }}</div>
            </div>
            <div class="pass-box">
                <van-image width="136" height="64" :src="getLevelInfo(item).img" fit="cover" />
                <div class="pass-content">
                    <div class="text1">{{ getLevelInfo(item).label }}</div>
                    <div class="flex1"></div>
                    <div class="text2">编号:78738373788</div>
                    <div class="text2">到期时间:2022-7-20</div>
                </div>
            </div>
        </div>
    </van-list>
</template>

<script>
import list from '../../mixins/list.js';
import room from '../../mixins/room';
export default {
    data() {
        return {
            url: '/userTicket/my',
            payMethodOptions: [
                { label: '微信', value: 'WECHAT' },
                { label: '支付宝', value: 'ALIPAY' },
                { label: '余额', value: 'BALANCE' }
            ]
        };
    },
    mixins: [list, room],
    methods: {
        beforeData() {
            return {
                query: {
                    del: false
                }
            };
        },
        getLevelInfo(info) {
            let _info = [...this.requireTicketOptions].find(item => {
                return info.type === item.value;
            });
            return _info || {};
        }
    }
};
</script>
<style lang="less" scoped>
.van-list {
    padding: 16px;
}
.pass-info {
    background-color: @bg2;
    border-radius: 4px;
    padding: 10px 12px 12px;

    .pass-title {
        .flex();
        justify-content: space-between;
        .title {
            font-size: 12px;
            font-weight: bold;
            color: #ffe3a3;
            line-height: 18px;
        }

        .time {
            font-size: 12px;
            color: #ffffff;
            line-height: 18px;
        }
    }
}
.pass-box {
    padding-top: 22px;
    .flex();
    .pass-content {
        margin-left: 10px;
        .text1 {
            font-size: 14px;
            color: #ffffff;
            line-height: 24px;
        }

        .text2 {
            font-size: 12px;
            color: #6a6d83;
            line-height: 17px;
        }
        .text2 + .text2 {
            margin-top: 2px;
        }
    }
}
.pass-info + .pass-info {
    margin-top: 16px;
}
</style>
