123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <template>
- <view class="content">
- <view class="hotgoods">
- <view class="hotgoods-item" v-for="item in firstList" :key="item.id" @click="navToDetailPage(item)">
- <view class="image-wrapper">
- <image class="image" :src="item.image" mode="scaleToFill"></image>
- </view>
- <view class="hotgoods-box">
- <view class="title clamp2">{{ item.store_name }}</view>
- <!-- <view class="titlee">{{ item.store_name }}</view> -->
- </view>
- <view class="hot-price">
- <view class="price">
- <text class="font-size-sm">¥</text>
- {{ item.price * 1 }}
- </view>
- <view class="yuanPrice">原价{{ item.price }}</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- loadIndexs,
- } from '@/api/index.js';
- export default {
- data() {
- return {
- firstList: []
- }
- },
- onLoad() {
- },
- onShow() {
- this.loadData()
- },
- onReachBottom() {
- },
- onReady() {
- },
- methods: {
- async loadData() {
- loadIndexs({})
- .then(({
- data
- }) => {
- let goods = data.info;
- data.info.firstList.forEach(e => {
- e.isVip = e.store_type ? "3" : "0"
- })
- this.firstList = data.info.firstList //首页商品
- })
- .catch(e => {
- });
- },
- //详情页
- navToDetailPage(item) {
- let id = item.id;
- uni.navigateTo({
- url: '/pages/product/product?id=' + id + '&isVip=' + 0
- });
- },
- }
- }
- </script>
- <style lang="scss">
- .hotgoods {
- margin-top: 38rpx;
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- padding: 0 0 30rpx;
- .hotgoods-item {
- width: 44%;
- background: #FFFFFF;
- margin: 20rpx;
- box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
- border-radius: 10px;
- .image-wrapper {
- width: 100%;
- height: 330rpx;
- border-radius: 3px;
- overflow: hidden;
- position: relative;
- .image-bg {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- width: 100%;
- height: 100%;
- opacity: 1;
- border-radius: 12rpx 12rpx 0 0;
- z-index: 2;
- }
- .image {
- width: 100%;
- height: 100%;
- opacity: 1;
- border-radius: 12rpx 12rpx 0 0;
- }
- }
- .title {
- margin-top: 20rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- .hotgoods-box {
- height: 75rpx;
- }
- .titlee {
- margin-left: 15rpx;
- font-size: 26rpx;
- font-weight: 500;
- color: #666666;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .hot-price {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- padding: 14rpx 0 30rpx;
- .hotPrice-box {
- width: 70rpx;
- height: 28rpx;
- background: linear-gradient(90deg, #c79a4c, #f9df7f);
- border-radius: 5rpx;
- text-align: center;
- line-height: 28rpx;
- font-size: 20rpx;
- font-weight: 400;
- color: #ffffff;
- }
- .price {
- margin-left: 10rpx;
- font-size: 36rpx;
- color: #ff0000;
- font-weight: 500;
- }
- .yuanPrice {
- margin-left: 10rpx;
- font-size: 20rpx;
- font-family: PingFang SC;
- font-weight: 500;
- text-decoration: line-through;
- color: #999999;
- }
- .cart-icon {
- image {
- width: 44rpx;
- height: 44rpx;
- }
- }
- }
- }
- }
- </style>
|