<template>
  <div class="reportCard">
    <slot name="InsUsername" :username="odRpCd"></slot>
    <div class="title">{{ odRpCd.clubName }}</div>
    <div class="item">
      <div>联系人：</div>
      <div>{{ odRpCd.linkMan }}</div>
    </div>
    <div class="item">
      <div>手机号：</div>
      <div>{{ odRpCd.mobile }}</div>
    </div>
    <div class="goods">
      <div class="text">意向商品：</div>
      <div class="goodsInfo" v-if="odRpCd.distributionProduct">
        <div class="img">
          <img class="img" :src="odRpCd.distributionProduct.mainImage" alt="">
        </div>
        <div class="content">
          <div class="goods_title">{{ odRpCd.distributionProduct.name }}</div>
          <div class="name">
            供应商：<span>{{ odRpCd.distributionProduct.shopName }}</span>
          </div>
          <div class="price">￥{{ odRpCd.distributionProduct.price && odRpCd.distributionProduct.price.toFixed(2) }}</div>
        </div>
      </div>
    </div>
    <div class="line"></div>
    <slot name="card-foot" :data="odRpCd"></slot>
    <van-image
      class="image"
      :src="statusImage"
      v-if="isTabImg && statusImage"
    ></van-image>
  </div>
</template>

<script>
export default {
  props: {
    isTabImg: {
      type: Boolean,
      default: false
    },
    odRpCd: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    statusImage () {
      return this.odRpCd.orderStatus * 1 === 1
        ? 'https://static.caimei365.com/app/mini-distribution/order-success.png'
        : ''
    }
  }
}
</script>

<style lang="scss" scoped>
.reportCard {
  padding: 5.3vw 3.2vw;
  background: #fff;
  position: relative;
  .title {
    color: #333333;
    font-size: 4.3vw;
    font-weight: 600;
    margin-bottom: 3.2vw;
  }
  .item {
    font-size: 3.7vw;
    color: #999999;
    display: flex;
    align-items: center;
    margin-bottom: 2.1vw;
    div:nth-child(2) {
      color: #333333;
    }
  }
  .goods {
    .text {
      font-size: 3.7vw;
      color: #999;
      margin-bottom: 2.1vw;
    }
    .goodsInfo {
      background: #f7f7f7;
      display: flex;
      align-items: center;
      padding: 3.5vw;
      border-radius: 1.1vw;
      .img {
        width: 17.1vw;
        height: 17.1vw;
        border-radius: 0.5vw;
        margin-right: 3.2vw;
      }
      .content {
        display: flex;
        justify-content: space-between;
        flex-direction: column;
        height: 17.1vw;
        .goods_title {
          color: #333333;
          font-weight: 600;
          font-size: 3.7vw;
          @include webkit-line-clamp(1)
        }
        .name {
          font-size: 3.2vw;
          color: #999999;
          span {
            color: #333333;
          }
        }
        .price {
          color: #f94b4b;
          font-size: 3.2vw;
        }
      }
    }
  }
  .line {
    margin: 4.5vw 0;
    height: 1px;
    background: #e1e1e1;
  }
  .image {
    top: 4.3vw;
    right: 4.3vw;
    position: absolute;
    width: 21.3vw;
    height: 21.3vw;
  }
}
</style>
