EquityItem.vue 2.04 KB
<template>
  <div
    @click="chooseRed(data.id,data.goodsName)"
    :class="['item',{'disabled':disabled},{'active':configForm.rewardId == data.id}]"
  >
    <div class="radio">
      <img src="@/assets/red-radio.png" />
    </div>
    <div class="icon">
      <img src="@/assets/activity-3.png" />
    </div>
    <div class="title">品牌:{{ data.brandName }}</div>
    <div class="time">商品名称:{{data.goodsName}}</div>
    <div class="status flex">券面额:{{Number(data.denomination  / 100).toFixed(2)}}</div>
  </div>
</template>

<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'

export default {
  name: '',
  props: {
    data: {
      type: Object,
      default: () => { }
    },
    configForm: {
      type: Object,
      default: () => { }
    },
    disabled: Boolean
  },
  data () {
    return {
      dayjs,
    }
  },
  mounted () {
  },
  methods: {
    chooseRed (rewardId, rewardName) {
      const { disabled } = this
      if (disabled) return
      this.$emit('choose', {
        rewardId,
        rewardName
      })
    }
  }
}
</script>

<style scoped lang='scss'>
.item {
  width: 100%;
  height: 75px;
  background: #fff;
  border-radius: 4px;
  box-sizing: border-box;
  cursor: pointer;
  padding: 0 16px;
  font-size: 12px;
  color: #999999;
  line-height: 17px;
  position: relative;
  user-select: none;
  .icon {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 28px;
    height: 28px;
  }
  .radio {
    display: none;
  }
  .title {
    padding-top: 12px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
  &:hover {
    opacity: 0.95;
  }
}
.active {
  .radio {
    display: block;
    position: absolute;
    right: 0;
    top: 0;
    width: 16px;
    height: 16px;
    background-color: #5850ff;
    border-radius: 0 0 0 4px;
    overflow: hidden;
  }
  &::after {
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border: 1px solid #5850ff;
    box-sizing: border-box;
  }
}
.disabled {
  cursor: not-allowed;
}
</style>