<template>
    <div class="page">
        <div class="time-line">
            <ul>
                <li class="item on" v-for="item of dataList" :key="item.id">
                    <div class="head">
                        <span class="status">{{ item.title }}</span>
                        <div class="time">{{ item.createdTime | dateFormat("MM-dd hh:mm")}}</div>
                    </div>
                    <div class="des">{{item.remark}}</div>
                </li>
            </ul>
            <p class="empty-text" v-if="dataList.length ===0 && !dataListLoading">无订单跟踪数据</p>
        </div>
    </div>
</template>

<script>
import MyImage from "../../components/image/index";

export default {
    name: "",
    components: { MyImage },

    // 数据
    data() {
        return {
            orderId: null,
            dataList: [],
            dataListLoading:true
        };
    },

    async onShow() {
        const self = this;
        await self.fn.init();
        self.orderId = self.$mp.query.orderId;
        self.getData();
    },

    // 函数
    methods: {
        getData() {
            this.dataListLoading = true;
            this.api
                .get("/Order/GetTraceList", {
                    id: this.orderId,
                })
                .then((res) => {
        this.dataListLoading = false;
                    this.dataList = res.data;
                });
        },
    },

    // 数据计算
    computed: {},

    // 数据监听
    watch: {},
};
</script>

<style lang="scss" scoped>
.time-line {
    width: 100%;
    background-color: #fff;
    padding: px(30);
    padding-top: px(60);
    .item {
        color: #666;
        padding-left: px(80);
        position: relative;
        padding-bottom: px(40);
        &::after {
            content: "";
            position: absolute;
            top: 0;
            left: px(40);
            z-index: 1;
            width: px(5);
            height: 100%;
            background-color: rgb(249, 196, 166);
        }
        &::before {
            content: "";
            position: absolute;
            left: px(40);
            z-index: 2;
            transform: translate(-49%, 0);
            top: px(20);
            width: px(25);
            height: px(25);
            border-radius: 50%;
            background-color: rgb(249, 196, 166);
        }
        &:first-child {
            &::before {
                top: 0;
                width: px(50);
                height: px(50);
                background: url("/static/icon/select2.png") no-repeat center;
                background-size: 100%;
            }
        }
        &.on {
            .des {
                color: #333;
            }
            .status {
                color: #f7672b;
            }
        }
    }
    .head {
        display: flex;
        align-items: center;
        justify-content: space-between; 
        .status {
            font-size: px(40);
        }
        .date {
            font-size: px(34);
        }
    }
    .des {
        margin-top: px(20);
        font-size: px(36);
    }
}
.empty-text{
    padding: px(50) px(30);
    font-size: px(36);
    color: #888;
    text-align: center;
}
</style>