<template>
  <div
    class="good-item"
    :class="[currentIndex===index ? 'active-item' : '']"
  >
    <div class="good-item-left">
      <Poptip
        trigger="hover"
        title=""
        transfer
      >
        <img
          :src="url"
          alt=""
        />
        <template slot="content">
          <img
            :src="url"
            alt=""
            style="height: 200px;width: 200px;"
          />
        </template>
      </Poptip>

    </div>
    <div class="good-item-middle">
      <div class="row-1">
        <div class="title one-line-flow" :title="data.title">
          {{ data.title }}
        </div>
      </div>
      <div class="row-4">
        <div class="attr-item">
          <span class="label ">系统名：</span>
          <span
            class="value one-line-flow"
            :title="data.systitle"
          >
            {{ data.systitle }}
          </span>
        </div>
      </div>
      <div class="row-2">
        <div class="attr-item">
          <span class="label">款号：</span>
          <span
            class="value one-line-flow"
            :title="data.productcode"
          >
            {{ data.productcode }}
          </span>
        </div>
        <div class="attr-item">
          <span class="label w-72">SKU：</span>
          <span
            class="value one-line-flow"
            :title="data.sku_no"
          >
            {{ data.sku_no }}
          </span>
        </div>
        <div class="attr-item">
          <span class="label">国标码：</span>
          <span
            class="value one-line-flow"
            :title="data.gbcode"
          >
            {{ data.gbcode }}
          </span>
        </div>
      </div>
      <div class="row-3">
        <div class="attr-item">
          <span class="label ">规格：</span>
          <span
            class="value one-line-flow"
            :title="data.normsdetailnames"
          >
            {{ data.normsdetailnames }}
          </span>
        </div>

        <div class="attr-item">
          <span
            class="label w-72"
            v-if="data.good_qrcode"
          >唯一码：</span>
          <span
            class="value one-line-flow"
            :title="data.good_qrcode"
            v-if="data.good_qrcode"
          >
            {{ data.good_qrcode }}
          </span>
        </div>

        <!-- 这个空div占布局用的 -->
        <div class="attr-item">
        </div>
      </div>
    </div>
    <div class="good-item-right">
      <div class="num-wrap">
        <span
          class="current"
          :class="[data.scanInNum===data.qty?'green':'red']"
        >{{ data.scanInNum }}</span>/<span class="total">{{ data.qty }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'OutStoreGoodItem',

  props: {
    data: {
      type: Object
    },
    // 当前扫描的商品索引
    currentIndex: {
      type: Number
    },
    index: {
      type: Number
    }
  },

  computed: {
    url() {
      return this.data.pic_url ? this.data.pic_url : '../../../../static/img/camera.jpg'
    }
  },

  data() {
    return {
    };
  },

  mounted() {

  },

  methods: {

  },
};
</script>

<style lang="less" scoped>
.good-item {
  border-top: 1px solid #dadada;
  border-left: 1px solid #dadada;
  border-right: 1px solid #dadada;
  display: flex;
  justify-content: space-between;
  height: 100px;
  // padding: 16px;
  min-width: 660px;
  &.active-item {
    background-color: #d5e7ff;
  }
  &:last-child {
    border-bottom: 1px solid #dadada;
  }
  &-left {
    display: flex;
    // margin-right: 16px;
    overflow: hidden;
    align-items: center;
    padding: 6px;
    img {
      // width: 90px;
      // height: 90px;
      width:88px;
      height: 88px;
      cursor: pointer;
    }
  }
  &-middle {
    padding: 8px 0;
    flex: 1;
    overflow: hidden;
    .title {
      font-weight: 500;
      font-size: 14px;
      color: #333333;
      line-height: 20px;
      // width: 400px;
    }
    .row-4 {
      color: #666666;
      margin-top: 4px;
      display: flex;
      align-items: center;
    }
    .row-2,
    .row-3 {
      color: #666666;
      margin-top: 8px;
      display: flex;
      align-items: center;
    }

    .attr-item {
      width: 33%;
      flex: 1;
      white-space: nowrap;
      .label {
        display: inline-block;
        vertical-align: middle;
        height: 14px;
      }
      .value {
        vertical-align: middle;
        display: inline-block;
        height: 14px;
        width: calc(100% - 72px);
      }
      .w-72 {
        width: 72px;
        text-align: right;
      }
    }
  }
  &-right {
    padding: 16px 0;
    flex: 0 0 60px;
    display: flex;
    align-items: center;
    padding-right: 28px;
    .num-wrap {
      color: #666666;
      font-size: 24px;
      font-weight: 500;
    }

    .good-type {
      margin-right: 10px;
    }
  }

  .red {
    color: #ff0101;
  }
  .green {
    color: #2baa0c;
  }
}
</style>
