<template>
  <view class="layout-coupon-container">
    <image :src="require('./images/background.png')" class="layout-coupon-image"></image>
    <!--  优惠券内容部分  -->
    <view class="absolute layout-coupon-content row aCenter">
      <view class="center price-group row">
        <text><text>¥</text><text class="price-int">{{price}}</text></text>
      </view>
      <view class="flex-1 center">
        <view class="line-1 layout-coupon-message">{{item.title}}</view>
        <view class="coupon-button center" @click="$emit('receive')">立即领取</view>
      </view>
    </view>
  </view>
</template>

<script>
import props from './props';
export default {
  name: "layout-coupon",
  computed:{
    price(){
      if (this.item.value) {

        let price = parseFloat(this.item.value);

        let intPrice = Math.floor(this.item.value);

        if (price === intPrice) {
          return  intPrice;
        } else {
          return  price;
        }

      } else {
        return 0;
      }
    },

  },
  props
}
</script>

<style lang="scss" src="./style.scss"></style>