<template>
  <view>
    <view class="item-price">
      <text class="item-current-price">￥<text class="price-integer">{{ integer }}</text>.<text>{{ decimal }}</text></text>
      <text class="item-original-price" v-show="originalPrice!==''">{{ originalPrice }}</text>
    </view>
  </view>
</template>

<script>
export default {
  name: "en-price",
  props: {
    'currentPrice': {
      default: ''
    },
    'originalPrice': {
      default: ''
    }
  },
  data() {
    return {
      integer: 0,
      decimal: 0,
    }
  },
  mounted() {
    if (this.currentPrice !== '') {
      let currentPrice = this.currentPrice * 1
      this.integer = Math.trunc(currentPrice)
      currentPrice = (currentPrice.toFixed(2)) + ''
      this.decimal = currentPrice.substring((currentPrice.length) - 2)
    }
  },
  methods: {}
}
</script>

<style scoped lang="scss">
.item-price {
  .item-current-price {
    color: #ED301D;
    font-size: 24rpx;
    text{
      color: #ED301D;
      font-size: 24rpx;
    }
    .price-integer{
      font-size: 40rpx;
    }
  }

  .item-original-price {
    margin-left: 12rpx;
    color: #999999;
    font-size: 24rpx;
    text-decoration: line-through;
  }
}
</style>