179 lines
4.1 KiB
Vue
179 lines
4.1 KiB
Vue
<template>
|
|
<view>
|
|
<view class="list flex flex-wrap" v-if="list.length">
|
|
<view class="item" v-for="item in list" :key="item" @click="goGoodsConByProductID(item)">
|
|
<view class="img-box">
|
|
<image class="main" :src="item.image" mode="scaleToFill"></image>
|
|
</view>
|
|
<view class="content">
|
|
<view class="title one-t">{{item.title}}</view>
|
|
<view class="price flex ai-center">
|
|
<image class="label-vip" :src="webUrl+'/20221118104357701129.png'" mode="scaleToFill"></image>
|
|
<text>¥{{item.price}}</text>
|
|
</view>
|
|
<view class="over-line flex jc-between ai-center">
|
|
<text>{{item.stopTime.substring(0,10)}}结束</text>
|
|
<view>
|
|
<text>还剩</text>
|
|
<text class="red">{{item.surplus}}天</text>
|
|
</view>
|
|
</view>
|
|
<view class="cart-box flex ai-center jc-between">
|
|
<view class="flex ai-center">
|
|
<image class="icon-fire" :src="webUrl+'/20220214125601027724.png'" mode="scaleToFill"></image>
|
|
<text>{{item.postTime.substring(0,10)}}发货</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="v4-nodata" v-else>
|
|
<image src="@/static/images/img_nodata.png" mode="scaleToFill" />
|
|
<view class="text">暂无数据</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getPreSaleList
|
|
} from "@/api/goods";
|
|
import {
|
|
formatDateTime,
|
|
diffDay
|
|
} from "@/utils/index";
|
|
export default {
|
|
data() {
|
|
return {
|
|
webUrl: this.$VUE_APP_RESOURCES_URL,
|
|
page: 1,
|
|
list: [],
|
|
endReach: false,
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.fetchList(this.page);
|
|
},
|
|
onReachBottom() {
|
|
if (this.endReach) return;
|
|
this.page++;
|
|
this.fetchList(this.page);
|
|
},
|
|
methods: {
|
|
goGoodsConByProductID(item) {
|
|
this.$yrouter.push({
|
|
path: '/pages/shop/GoodsCon/index',
|
|
query: {
|
|
id: item.productId,
|
|
activityId: item.id,
|
|
from: "pre"
|
|
}
|
|
});
|
|
},
|
|
|
|
fetchList(page) {
|
|
getPreSaleList(page, 10).then(({
|
|
data
|
|
}) => {
|
|
if (data.records.length > 0) {
|
|
data.records.map(item => {
|
|
var now = new Date().getTime();
|
|
var nowStr = formatDateTime(now, 'yyyy-MM-dd');
|
|
item.surplus = diffDay(nowStr, item.stopTime.substring(0, 10))
|
|
this.list.push(item)
|
|
});
|
|
} else {
|
|
this.endReach = true;
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.list {
|
|
margin: 24rpx 32rpx 0;
|
|
|
|
.item:nth-child(2n) {
|
|
margin-left: 22rpx;
|
|
}
|
|
|
|
.item {
|
|
width: 332rpx;
|
|
margin-bottom: 24rpx;
|
|
border-radius: 8rpx;
|
|
background: #fff;
|
|
|
|
.img-box {
|
|
position: relative;
|
|
|
|
.main {
|
|
width: 332rpx;
|
|
height: 332rpx;
|
|
border-radius: 8rpx;
|
|
}
|
|
}
|
|
|
|
.content {
|
|
.label-vip {
|
|
width: 40rpx;
|
|
height: 24rpx;
|
|
margin-right: 6rpx;
|
|
}
|
|
|
|
.icon-fire {
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
}
|
|
|
|
.icon-cart {
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
}
|
|
|
|
.title {
|
|
margin: 8rpx 4rpx 0 10rpx;
|
|
font-size: 26rpx;
|
|
font-weight: bold;
|
|
line-height: 36rpx;
|
|
color: #333333;
|
|
}
|
|
|
|
.price {
|
|
padding: 4rpx 10rpx 10rpx;
|
|
font-size: 26rpx;
|
|
font-weight: bold;
|
|
line-height: 38rpx;
|
|
color: #ED0F0F;
|
|
}
|
|
|
|
.over-line {
|
|
margin: 0 12rpx 8rpx;
|
|
color: #999;
|
|
font-size: 22rpx;
|
|
line-height: 32rpx;
|
|
|
|
.red {
|
|
color: #ED0F0F;
|
|
}
|
|
}
|
|
|
|
.cart-box {
|
|
padding: 8rpx 16rpx 14rpx 18rpx;
|
|
border-top: 1rpx solid #EFEFEF;
|
|
|
|
text {
|
|
margin-left: 2rpx;
|
|
font-size: 24rpx;
|
|
font-weight: bold;
|
|
line-height: 36rpx;
|
|
color: #FD685D;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|