shopInfo.vue 2.1 KB
<template>
  <view class="infoBox">
    <view class="name ellipsisT">
      {{ info.name }}
    </view>
    <view class="flexJ" v-if="info.goodstatus === 1">
      <view class="inventory" style="margin-bottom: 10rpx">购买可获得{{ info.spec[0].score }}积分</view>
      <view class="inventory" style="color: rgb(241, 71, 71)">注: 购买不同规格的商品可获得不同的积分</view>
    </view>
    <view class="priceBox flexJ">
      <view class="price flexA" v-if="info.goodstatus == 3">
        <view class="new">{{ info.spec[0].coscore }}</view>
        <view class="points">积分</view>
      </view>
      <view class="price flexA" v-else>
        <view class="new">¥{{ info.spec[0].goods_price }}</view>
        <text v-if="[2,1].includes(info.goodstatus)">¥{{ info.spec[0].line_price }}</text>
      </view>
      <!-- 1=普通商品,2=特价商品,3=积分商品 -->
      <view class="inventory">{{ info.goodstatus == 1 ? '已售:' : info.goodstatus == 2 ? '库存:' : '已兑:' }}{{ info.goodstatus != 2 ? info.sales_actual : info.spec[0].stock_num }}份</view>
    </view>
  </view>
</template>

<script setup>
import { defineProps, onMounted } from 'vue'
const props = defineProps({
  isPoints: {
    type: Boolean,
    default: false
  },
  info: {
    type: Object,
    default: {}
  }
})
onMounted(() => {
  // console.log('商品信息',props.info)
})
</script>

<style lang="scss">
.infoBox {
  .name {
    height: 80rpx;
    color: #000000e6;
    font-size: 30rpx;
    font-weight: 700;
    line-height: 40rpx;
  }

  .priceBox {
    .price {
      text {
        color: #00000042;
        font-size: 24rpx;
        text-decoration: line-through;
        margin-left: 8rpx;
        margin-top: 16rpx;
      }

      .new {
        color: #fc4338ff;
        font-size: 40rpx;
        font-weight: 700;
      }
      .points {
        color: #fc4338ff;
        font-size: 22rpx;
        margin: 10rpx 0 0 8rpx;
      }
    }

    .inventory {
      color: #00000066;
      font-size: 22rpx;
    }
  }
}
.inventory {
  color: #00000066;
  font-size: 22rpx;
}
</style>