<template>
  <div class="card-item-con">
    <div class="card-time">
      {{ itemData.cardTime }}
    </div>
    <list-item
      v-for="(item, index) in itemData.children"
      :key="index + Math.random()"
      :editList="editList"
      :itemData="item"
      @checkedItem="checkedItem"
    />
  </div>
</template>

<script>
import ListItem from "./list-item.vue";
export default {
  props: {
    itemData: Object,
    editList: Boolean,
  },
  components: { ListItem },
  computed: {
    options() {
      if (!this.editList) {
        return [
          {
            text: "删除",
            style: {
              backgroundColor: "#dd524d",
            },
          },
        ];
      } else {
        return [];
      }
    },
  },
  methods: {
    checkedItem(data) {
      this.$emit("checkedItem", data);
    },
    bindClick(e, obj) {
      this.$emit("delFootprint", [obj.goodsId]);
    },
  },
};
</script>

<style lang="less">
.card-item-con {
  background-color: #ffffff;
  border-radius: 10px;
  margin-bottom: 10px;
  padding: 16px 16px 10px;
  .card-time {
    font-size: 16px;
    line-height: 22px;
    margin-bottom: 2px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
  }
}
</style>
