<template>
  <basic-container>
    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
      <el-menu-item index="1">待领取</el-menu-item>
      <el-menu-item index="2">配送中</el-menu-item>
      <el-menu-item index="3">已完成</el-menu-item>
    </el-menu>
    <user-goods-comps v-if="activeIndex==1"></user-goods-comps>
    <goods-record v-else ref="goodsRecordRef" :distributionStatus="distributionStatus"></goods-record>
  </basic-container>
</template>

<script>
  import userGoodsComps from "@/components/usergoods-comps/usergoods-comps.vue"
  import goodsRecord from "@/components/goodsrecord-comps/goodsrecord.vue"
  export default {
    components:{
      userGoodsComps,goodsRecord
    },
    data() {
      return {
        activeIndex: '1',
        //配送状态 0配送中 1 已完成
        distributionStatus:0
      };
    },
    methods: {
      handleSelect(key, keyPath) {
        this.activeIndex=key
        if (key==2) {
          this.distributionStatus=0
        }else if (key==3) {
          this.distributionStatus=1
        }
      }
    }
  };
</script>

<style>
</style>
