<template>
  <view
    class="Mall4j item"
    @tap="toProdDetail(prodItem.spuId)"
  >
    <view class="img">
      <img-show
        :src="prodItem.mainImgUrl"
        img-mode="aspectFit"
      />
    </view>
    <view class="text-box">
      <view class="name">
        {{ prodItem.spuName }}
      </view>
      <view class="sku">
        已兑换{{ prodItem.saleNum }}件
      </view>
      <view class="price-box">
        <view class="price">
          <view class="integral-icon">
            <image src="@/package-activities/static/images/integral-icon.png" />
          </view>
          <view class="symbol">
            {{ prodItem.scoreFee }}积分
          </view>
          <view
            v-if="prodItem.priceFee"
            class="add"
          >
            +
          </view>
          <view
            v-if="prodItem.priceFee"
            class="symbol"
          >
            {{ wxs.parsePrice(prodItem.priceFee)[0] }}.{{ wxs.parsePrice(prodItem.priceFee)[1] }}元
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
const wxs = number()

defineProps({
  prodItem: {
    type: Object,
    default: () => {}
  }
})

/**
* 跳转到商品详情页
*/
const toProdDetail = (spuId) => {
  uni.navigateTo({
    url: `/package-activities/pages/score-prod-detail/score-prod-detail?spuId=${spuId}`
  })
}

</script>
