<template>
    <div class="container">
        <div class="box">
            <div class="box1" @click="navigateTo('/pages/orderdetails')">
                <div class="tit">
                    <img
                        src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-03-15-53-18gjxoMYNY.png"
                        alt=""
                    />
                    <div class="tit1">益禾堂(一食堂)</div>
                </div>
                <div class="address">
                    <img
                        class="avatar"
                        src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-08-10-17-31-24egsujwUw.jpg"
                    />
                    <div>
                        <div class="text1">订单将在 <span>4:22</span> 后自动取消</div>
                        <div class="text1 text2">请尽快完成支付</div>
                    </div>
                    <img
                        class="inter2"
                        src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-15-14-15-50oEVgXoZN.png"
                        alt=""
                    />
                </div>
                <div class="btn">
                    <div class="order">取消订单</div>
                    <div class="pay">立即支付</div>
                </div>
                <div class="border"></div>

                <div class="ImgBox">
                    <div v-for="(item, index) in takeoutList" :key="index">
                        <div>
                            <img :src="item.imges" alt="" />
                            <p>{{ item.name }}</p>
                        </div>
                    </div>
                    <div class="list">
                        <p>共{{ list.lists.length }}件</p>
                        <img
                            class="img"
                            src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-03-15-55-47ydOMSMGa.png"
                            alt=""
                        />
                    </div>
                </div>
                <div class="time">
                    <p>下单时间: {{ list.createdAt }}</p>
                    <div class="text">
                        <div class="text1">合计：</div>
                        <div class="text2">¥{{ list.total }}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            list: {
                transactionId: '2019052035464',
                createdAt: '2021-05-20 07:52:36',
                remark: '加急',
                packPrice: '2',
                distributionPrice: '2',
                total: '37',
                lists: [
                    {
                        price: '11',
                        name: '寿司',
                        num: '1',
                        imges:
                            'https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-08-13-15-54-36URxMKUXs.jpg'
                    },
                    {
                        price: '22',
                        name: '寿司,八宝粥',
                        num: '2',
                        imges:
                            'https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-08-13-15-54-36URxMKUXs.jpg'
                    }
                ]
            }
        };
    },
    computed: {
        takeoutList() {
            return [...this.takeout].filter((item, index) => {
                return index < 3;
            });
        }
    },
    created() {
        this.takeout = this.list.lists;
    }
};
</script>
<style lang="less" scoped>
.container {
    padding: 0 12px;
    .box {
        width: 351px;
        background: #ffffff;
        border-radius: 12px;
        padding: 16px 0;
        .box1 {
            margin: 0 12px;
            .tit {
                .flex();
                img {
                    width: 18px;
                    height: 18px;
                }
                .tit1 {
                    font-size: 14px;
                    font-weight: 400;
                    color: #000000;
                    margin-left: 5px;
                    line-height: 24px;
                }
            }
            .address {
                .flex();
                justify-content: space-between;
                margin: 14px 0 17px;
                .avatar {
                    width: 48px;
                    height: 48px;
                    border-radius: 8px !important;
                }
                .text1 {
                    font-size: 14px;
                    font-weight: bold;
                    color: #000;
                    line-height: 20px;
                    margin-left: -72px;
                    &.text2 {
                        color: #c8c9cc;
                        font-weight: 400;
                    }
                    span {
                        color: @prim;
                    }
                }
                .inter {
                    width: 28px;
                    height: 28px;
                    margin-right: -10px;
                }
                .inter2 {
                    width: 12px;
                    height: 24px;
                }
            }
            .btn {
                display: flex;
                margin-left: 152px;
                .order {
                    width: 80px;
                    height: 34px;
                    border-radius: 8px;
                    color: @prim;
                    margin-right: 12px;
                    line-height: 34px;
                    font-size: 14px;
                    text-align: center;
                    border: 1px solid @prim;
                }
                .pay {
                    width: 80px;
                    height: 36px;
                    line-height: 36px;
                    font-size: 14px;
                    text-align: center;
                    color: #ffffff;
                    background: @prim;
                    border-radius: 8px;
                }
            }
            .border {
                height: 1px;
                background: @bg;
                margin: 20px 0 16px;
            }
            .ImgBox {
                .flex();
                margin-bottom: 18px;
                img {
                    width: 80px;
                    height: 80px;
                    border-radius: 8px;
                    margin-right: 12px;
                }
                p {
                    font-size: 14px;
                    font-weight: bold;
                    color: #1c1c1c;
                    line-height: 24px;
                    width: 80px;
                    .ellipsis();
                }
                .list {
                    .flex();
                    p {
                        width: 43px;
                        font-size: 14px;
                        font-weight: 400;
                        color: #c8c9cc;
                        line-height: 24px;
                    }
                    .img {
                        width: 28px;
                        height: 28px;
                        margin-left: -10px;
                    }
                }
            }
            .time {
                .flex();
                justify-content: space-between;
                p {
                    font-size: 14px;
                    font-weight: 400;
                    color: #c8c9cc;
                    line-height: 24px;
                }
                .text {
                    .flex();
                    font-weight: bold;
                    .text1 {
                        font-size: 14px;
                        color: #c8c9cc;
                        line-height: 24px;
                    }
                    .text2 {
                        font-size: 16px;
                        color: #1c1c1c;
                        line-height: 26px;
                    }
                }
            }
        }
    }
}
</style>
