<template>
  <div class="collection-item flex-default" @click="goGoods(itemData.goodsId, itemData.type,itemData.salesType)">
    <div
      class="flex-default"
      style="padding: 20rpx 0; align-items: center; flex-shrink: 0"
      @click.stop="checkedItem(itemData)"
    >
      <div
        class="item-radio flex-default"
        v-show="editList"
        :class="{ active: itemData.checked }"
      />
    </div>

    <div class="item-img">
      <img :src="itemData.thumb" style="width: 100%; height: 100%" />
    </div>
    <div class="item-describe">
      <div class="desc">
        {{ itemData.name }}
      </div>
      <div class="price">
        <m-price :amt="itemData.defaultPrice" />
      </div>
      <div class="footer flex-default">
        <div />
        <!-- 			<div class="primary">
					看相似
				</div> -->
        <!-- <div class="buycart flex-default" v-show="!editList">
          <m-icon icon="icon-shopping-cart" :size="24" className="icon" />
        </div> -->
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    itemData: Object,
    editList: Boolean,
  },
  data() {
    return {};
  },
  methods: {
    checkedItem(data) {
      this.$emit("checkedItem", data);
    },
  },
};
</script>

<style lang="less">
.collection-item {
  padding: 0 16px;
  width: 100%;
  align-items: center;
  overflow: hidden;
  .item-radio {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 10px;
    border: 1px solid #aeaeae;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    &.active {
      border-color: #2C66F5;
      &::before {
        content: "";
        display: block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color:#2C66F5;
      }
    }
  }
  .item-img {
    width: 110px;
    height: 110px;
    flex-shrink: 0;
    background-color: #eaeaea;
  }
  .item-describe {
    flex-shrink: 1;
    margin-left: 10px;
    height: 130px;
    border-bottom: 1px solid #f8f8f8;
    padding: 10px 0;
    width: 100%;
    .desc {
      font-size: 14px;
      color: #140603;
      display: -webkit-box;
      height: 36px;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      overflow: hidden;
      /* autoprefixer: off */
      -webkit-box-orient: vertical; // 参考 https://github.com/postcss/autoprefixer/issues/776
      /* autoprefixer: on */
      line-height: 18px;
      margin: 4px 0 6px;
    }
    .price {
      color: #FA9F37;
      line-height: 24px;
      ::v-deep.m-price-con {
        .rmb {
          font-size: 10px !important;
        }
        .integer {
          font-size: 20px !important;
          font-weight: bold;
        }
        .float {
          font-size: 14px !important;
          font-weight: bold;
        }
      }
    }
    .footer {
      margin-top: 10px;
      justify-content: space-between;
      align-items: center;
      width: 100%;
      .primary {
        min-width: 50px;
        height: 22px;
        border: 1px solid #979797;
        line-height: 20px;
        color: #1f110f;
        border-radius: 11px;
        text-align: center;
        font-size: 10px;
        padding: 0 7px;
      }
      .m-icon {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background-color: #eaeaea;
      }
      .buycart {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background-color: #eaeaea;
        justify-content: center;
        align-items: center;
      }
    }
  }
}
</style>
