order-detail-item.vue 2.51 KB
<template>
  <router-link
    :to="toLinkParam"
    class="detial-item-wrapper"
    @click.native="onClickHandler"
  >
    <div class="order-item-wrapper">
      <div class="item-img">
        <image-format
          alt=""
          :src="goodsInfo.goodImg"
          :width="180"
          :height="180"
        />
      </div>
      <div class="item-info">
        <div>
          <div class="price-status">
            <span class="price">¥{{ goodsInfo.goodPrice }}</span>
          </div>
          <p class="item-name">
            {{ goodsInfo.productName }}
          </p>
        </div>
        <p class="item-spec">
          <span class='icon-ufo'></span>
          <span>{{ goodsInfo.colorName }},</span>
          <span>{{ goodsInfo.sizeName }}码</span>
        </p>
      </div>
    </div>
  </router-link>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
import refreshMixin from "../../mixin/refresh";

const { mapGetters } = createNamespacedHelpers("order/orderDetail");

export default {
  mixins: [refreshMixin],
  computed: {
    ...mapGetters(["goodsInfo"]),
    toLinkParam() {
      const { productId, storageId } = this.goodsInfo;
      return {
        name: "ProductDetail",
        params: { productId }
      };
    }
  },
  methods: {
    onClickHandler() {
      this.setIsRefresh(true);
    }
  }
};
</script>

<style lang="scss" scoped>
.detial-item-wrapper {
  display: block;
}

.order-item-wrapper {
  display: flex;

  .item-img {
    width: 180px;
    height: 180px;
    justify-content: center;
    display: flex;
    align-items: center;

    & > img {
      max-height: 100%;
      max-width: 100%;
    }
  }

  .item-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .item-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    margin-left: 20px;
    font-size: 24px;
    justify-content: space-between;

    .price-status {
      display: flex;
      justify-content: space-between;
      margin-bottom: 12px;

      .price {
        font-size: 28px;
        color: #d0021b;
        letter-spacing: 0;
        font-weight: bold;
        @include num;
      }

      .status {
        color: #000;
        letter-spacing: 0;
        font-weight: bold;
      }
    }

    .item-name {
      color: #999;
      letter-spacing: 0;
      line-height: 36px;
    }

    .item-spec {
      font-weight: bold;

      & > :last-child {
        padding-left: 10px;
      }
    }
  }
}
</style>