<template>
  <div class="uc_orders_container">
    <order_list :orders="orders" v-if="orders.length > 0"></order_list>
    <van-empty description="暂无数据" v-else />
  </div>
</template>

<script>
import order_list from "@/components/user_center/order_list";

import {orderList} from "@/requests/orders";
import {formatTime} from "@/utils/index";

var $this
export default {
  name: "uc_orders_container",
  components: {
    order_list
  },
  data() {
    return {
      orders: [
      ],
    }
  },
  methods: {
    //获取订单列表
    get_order_list() {
      orderList().then((res) => {
        let $data = res.data
        $this.orders = $data.data
        $this.orders.forEach(($val, $index) => {
          $this.orders[$index]['create_time'] = formatTime($val['create_time'] * 1000)
        })
        console.log($this.orders)
      })
    }
  }
  ,
  mounted() {
    this.get_order_list()
  },
  created() {
    $this = this;
  },
  onLoad() {
  }
}
</script>

<style scoped>
</style>
