shops.vue 2.9 KB
<template>
  <!-- 商品 -->
  <view class="flexW">
    <view class="shopBox" v-for="item in list" :key="item.id" @click="toDetaile(item.id)">
      <view class="shopPhoto">
        <image :src="item.image" mode=""></image>
      </view>
      <view class="btomBox">
        <view class="shopName ellipsis">{{ item.name }}</view>
        <view class="desc ellipsis">{{ item.describe }}</view>
        <view class="shopPrice flexA" v-if="!pointShop">
          <view class="new">¥{{ item.goods_price || item.spprice }}</view>
          <view class="original" v-if="shopHeight == 322 || isTejia">¥{{ item.line_price }}</view>
          <view class="original" v-if="isClass">¥{{ item.spyprice }}</view>
        </view>
        <view class="points" v-else>
          <image src="/static/shopCarIc/pointsIc.png" mode=""></image>
          {{ item.coscore }}
        </view>
        <view v-if="shopWidth == 344 && !isTejia" class="sold">{{ pointShop ? '已兑换:' : '已售:' }}{{ item.sales_actual }}份</view>
        <view v-if="shopHeight == 322 || isTejia" class="sold">库存:{{ item.stock_num }}件</view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref, defineProps, onMounted } from 'vue'
const props = defineProps({
  shopWidth: {
    type: Number,
    default: 322
  },
  shopHeight: {
    type: Number,
    default: 344
  },
  pointShop: {
    type: Boolean,
    default: false
  },
  list: {
    type: Array,
    default: []
  },
  isClass: Boolean,
  isTejia: { type: Boolean, default: false } // 是否是特价
})
const wide = ref(props.shopWidth + 'rpx')
const heig = ref(props.shopHeight + 'rpx')

onMounted(() => {
  // console.log(props.shopWidth,typeof(props.shopHeight),props.pointShop,'宽高')
})
const toDetaile = id => {
  uni.navigateTo({
    url: `/pages/index/shopDetaile?id=${id}`
  })
}
</script>

<style lang="scss">
.shopBox {
  width: v-bind(wide);
  border-radius: 12rpx;
  background: #ffffffff;
  margin-bottom: 14rpx;

  .shopPhoto {
    width: v-bind(wide);
    height: v-bind(heig);

    image {
      width: 100%;
      height: 100%;
      border-radius: 12rpx 12rpx 0 0;
    }
  }

  .btomBox {
    padding: 0 16rpx 16rpx;

    .shopName {
      color: #000000e6;
      font-size: 26rpx;
      line-height: 32rpx;
      margin: 16rpx 0 8rpx;
    }

    .desc {
      color: #00000066;
      font-size: 20rpx;
      margin-bottom: 12rpx;
    }

    .shopPrice {
      margin-bottom: 8rpx;

      .new {
        color: #fc4338ff;
        font-size: 28rpx;
        font-weight: 700;
      }

      .original {
        margin-left: 4rpx;
        color: #00000042;
        font-size: 20rpx;
        text-decoration: line-through;
      }
    }

    .points {
      color: #fc4338ff;
      font-size: 28rpx;
      font-weight: 700;

      image {
        margin-left: 4rpx;
        width: 24rpx;
        height: 24rpx;
      }
    }

    .sold {
      color: #00000066;
      font-size: 22rpx;
      line-height: 28rpx;
    }
  }
}
</style>