<template>
  <div id="card-1">
    <el-row>
      <el-col :span="24" class="main">
        <detail-1 v-if="num == '1'" @toDeliver="toDeliver" :statusList="statusList" :shop="shop"></detail-1>
        <detail-2 v-else-if="num == '2'" :deliverList="list" @toBack="toBack"></detail-2>
      </el-col>
    </el-row>
  </div>
</template>

<script>
const _ = require('lodash');
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'card-1',
  props: { statusList: { type: Array }, shop: { type: Object } },
  components: { detail1: () => import('./parts/detail-1.vue'), detail2: () => import('./parts/detail-2.vue') },
  data: function () {
    return {
      num: '1',
      list: [],
    };
  },
  async created() {},
  methods: {
    // 生成发货清单
    toDeliver({ data }) {
      if (data.length == '0') {
        this.$message('请选择订单');
      } else {
        this.$set(this, 'list', data);
        this.$set(this, 'num', '2');
      }
    },
    toBack() {
      this.$set(this, 'num', '1');
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.one {
  margin: 0 0 10px 0;
}
</style>
