<template>
  <div class="Hl-container-item">
    <div class="Hlc-title-content">
      <div class="Hlc-title">失效</div>
    </div>
    <img lazy-load class="Hlc-item-img" mode="aspectFit" :src="goods.skuImg" />
    <div class="Hlc-item-info">
      <div class="Hlc-item-info-title">
        <span v-if="goods.textTag" class="Hlc-item-info-title-tag">{{ goods.textTag }}</span>
        <span class="Hlc-item-info-title-name"> {{ goods.skuName }}</span>
      </div>
      <div class="Hlc-item-info-bottom">
        <div class="Hlc-item-info-bottom-des">{{ goods.invalidStatusDesc }}</div>
        <cr-button
          v-if="$config.yxm"
          class="similar"
          shape="circle"
          type="default"
          @click="goSimilar"
          >看相似</cr-button
        >
      </div>
    </div>
  </div>
</template>
<script>
// import { saTrackEvent } from "@/utils/sa.js";
import localStorage from '@/service/localStorage.service';
export default {
  name: 'DisabledGoodsCard',
  props: {
    goods: {
      type: Object,
      default: () => {}
    }
  },
  methods: {
    delGood(goods) {
      this.$emit('delGood', goods);
    },
    goSimilar() {
      const { skuId, skuImg, skuName } = this.goods;
      const similarData = {
        des: '当前区域无库存,不能购买',
        skuNo: skuId,
        goodsName: skuName,
        goodsImage: skuImg
      };
      localStorage.set('similarData', similarData);
      this.$router.push({ name: 'Similar' });
    }
  }
};
</script>
<style lang="less" scoped>
.Hl-container-item {
  display: flex;
  // margin: 40px 0;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  padding: 10px 0px;
  .Hlc-title {
    color: #fff;
    background: #979797;
    border-radius: 15px;
    height: 15px;
    width: 32px;
    line-height: 15px;
    text-align: center;
    font-size: 10px;
  }

  .Hlc-item-img {
    max-width: 100px;
    height: 100px;
    border-radius: 6px;
    opacity: 0.5;
    margin-left: 6px;
    // background: #aaa;
  }
  .Hlc-item-info {
    width: 182.5px;
    height: 100px;
    // display: flex;
    // flex-direction: column;
    // justify-content: space-between;
    margin: 0 9px;
    position: relative;
    &-title {
      &-name {
        position: relative;
        opacity: 0.5;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        font-size: 13px;
        line-height: 18px;
        color: #333333;
        .blank {
          width: 5px;
        }
      }
      &-tag {
        font-size: 10px;
        color: #fff;
        background: red;
        border-radius: 3px;
        padding: 0 3px;
        margin-right: 5px;
      }
    }
    &-bottom {
      position: absolute;
      bottom: 0px;
      display: flex;
      align-items: center;
      // justify-content: space-around;
      width: 100%;
      &-des {
        flex: 1;
        line-height: 30px;
        font-size: 13px;
        // line-height: 36px;
        // width: 60%;
        color: #333333;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        padding-right: 5px;
      }
      .similar {
        width: 77px;
        height: 30px;
        line-height: 30px;
        font-size: 14px;
        border: 1px solid #ec1500;
        color: #ec1500;
        box-sizing: border-box;
      }
    }
  }
}
</style>
