350 lines
8.7 KiB
Vue
350 lines
8.7 KiB
Vue
<template>
|
||
<view class="page-seckill">
|
||
<view class="next-box" v-if="nextList.length>0">
|
||
<view class="info flex ai-center"><text>下场秒杀时间:</text><text class="red">{{seckillTime[seckillTimeIndex+1].time}}</text></view>
|
||
<view class="img-box flex">
|
||
<image :src="item.image" mode="scaleToFill" v-for="item in nextList" :key="item"></image>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="header acea-row">
|
||
<view>
|
||
<view class="title">限时秒杀</view>
|
||
<view class="sub-title">尖货限时抢</view>
|
||
</view>
|
||
<view class="count-box">
|
||
<count-down :isDay="false" isSecond :dayText="false" :hourText="':'" :minuteText="':'" :secondText="false"
|
||
:datatime="seckillTime[seckillTimeIndex].stop"></count-down>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="list flex flex-wrap">
|
||
<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>
|
||
<!-- <image class="label" :src="webUrl+'/20220525103739004011.png'" mode="scaleToFill"></image> -->
|
||
</view>
|
||
<view class="content">
|
||
<view class="title more-t">{{item.productName}}</view>
|
||
<view class="price flex ai-center">
|
||
<!-- <image class="label-vip" :src="webUrl+'/20221118104357701129.png'" mode="scaleToFill"></image> -->
|
||
<text>¥{{item.price}}</text>
|
||
<text class="del">¥{{item.otPrice}}</text>
|
||
</view>
|
||
<view class="cart-box flex ai-center jc-between">
|
||
<view class="flex ai-center">
|
||
<image class="icon-fire" :src="webUrl+'/20220214125642215597.png'" mode="scaleToFill"></image>
|
||
<text>{{item.sales}}人已购买</text>
|
||
</view>
|
||
<image class="icon-cart" :src="webUrl+'/20220214125543267695.png'" mode="scaleToFill"></image>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="header acea-row" v-if="nextList.length>0">
|
||
<view>
|
||
<view class="title">下场预告商品</view>
|
||
<view class="sub-title">下一场{{seckillTime[seckillTimeIndex+1].time}}开始</view>
|
||
</view>
|
||
<view class="count-box">
|
||
<count-down :isDay="false" isSecond :dayText="false" :hourText="':'" :minuteText="':'" :secondText="false"
|
||
:datatime="seckillTime[seckillTimeIndex+1].start"></count-down>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="list flex flex-wrap" v-if="nextList.length>0">
|
||
<view class="item" v-for="item in nextList" :key="item" @click="goGoodsConByProductID(item)">
|
||
<view class="img-box">
|
||
<image class="main" :src="item.image" mode="scaleToFill"></image>
|
||
<!-- <image class="label" :src="webUrl+'/20220219171325371623.png'" mode="scaleToFill"></image> -->
|
||
</view>
|
||
<view class="content">
|
||
<view class="title more-t">{{item.productName}}</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="cart-box flex ai-center jc-between">
|
||
<view class="flex ai-center">
|
||
<image class="icon-fire" :src="webUrl+'/20220214125642215597.png'" mode="scaleToFill"></image>
|
||
<text>{{item.sales}}人已购买</text>
|
||
</view>
|
||
<image class="icon-cart" :src="webUrl+'/20220214125543267695.png'" mode="scaleToFill"></image>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
getYxStoreSeckillIndex,
|
||
getYxStoreSeckillPageList
|
||
} from "@/api/goods";
|
||
import CountDown from "@/components/CountDown.vue";
|
||
export default {
|
||
components: {
|
||
CountDown
|
||
},
|
||
data() {
|
||
return {
|
||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||
seckillTime: [],
|
||
seckillTimeIndex: 0,
|
||
page: 1,
|
||
list: [],
|
||
endReach: false,
|
||
timeId: null,
|
||
nextList: []
|
||
}
|
||
},
|
||
onLoad() {
|
||
this.fetchSession();
|
||
},
|
||
onReachBottom() {
|
||
if (this.endReach) return;
|
||
this.page++;
|
||
this.fetchList(this.page);
|
||
},
|
||
methods: {
|
||
fetchSession() {
|
||
getYxStoreSeckillIndex().then(({
|
||
data
|
||
}) => {
|
||
this.seckillTime = data.seckillTime;
|
||
this.seckillTimeIndex = data.seckillTimeIndex;
|
||
|
||
this.timeId = this.seckillTime[this.seckillTimeIndex].id
|
||
this.fetchList(this.page);
|
||
|
||
if (this.seckillTime.length > this.seckillTimeIndex) {
|
||
console.log("test",this.seckillTime[this.seckillTimeIndex + 1].id)
|
||
getYxStoreSeckillPageList(1, 10, this.seckillTime[this.seckillTimeIndex + 1].id).then(({
|
||
data
|
||
}) => {
|
||
this.nextList = data
|
||
})
|
||
}
|
||
});
|
||
},
|
||
|
||
fetchList(page) {
|
||
getYxStoreSeckillPageList(page, 10, this.timeId).then(({
|
||
data
|
||
}) => {
|
||
if (data.length > 0) {
|
||
data.map(item => this.list.push(item));
|
||
} else {
|
||
this.endReach = true;
|
||
}
|
||
});
|
||
},
|
||
|
||
goGoodsConByProductID(item) {
|
||
this.$yrouter.push({
|
||
path: '/pages/shop/GoodsCon/index',
|
||
query: {
|
||
id: item.productId,
|
||
activityId:item.id,
|
||
from:"kill"
|
||
}
|
||
});
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="less">
|
||
.page-seckill {
|
||
min-height: 100vh;
|
||
padding-top: 24rpx;
|
||
background: #FFEDE0;
|
||
}
|
||
|
||
.next-box {
|
||
height: 200rpx;
|
||
box-sizing: border-box;
|
||
margin: 0 32rpx;
|
||
padding: 10rpx 0 18rpx;
|
||
background: #fff;
|
||
opacity: 1;
|
||
border-radius: 12rpx;
|
||
|
||
.info {
|
||
padding: 0 18rpx;
|
||
|
||
text {
|
||
font-size: 24rpx;
|
||
font-weight: bold;
|
||
line-height: 34rpx;
|
||
color: #333333;
|
||
}
|
||
|
||
.red {
|
||
font-size: 32rpx;
|
||
font-weight: bold;
|
||
line-height: 48rpx;
|
||
color: #FD685D;
|
||
}
|
||
}
|
||
|
||
.img-box {
|
||
width: 100%;
|
||
margin-top: 24rpx;
|
||
overflow-x: auto;
|
||
|
||
image {
|
||
flex-shrink: 0;
|
||
width: 100rpx;
|
||
height: 100rpx;
|
||
margin-left: 24rpx;
|
||
border-radius: 12rpx;
|
||
}
|
||
|
||
image:first-child {
|
||
margin-left: 18rpx;
|
||
}
|
||
}
|
||
|
||
.img-box::-webkit-scrollbar {
|
||
width: 0 !important
|
||
}
|
||
}
|
||
|
||
.header {
|
||
margin: 40rpx 32rpx 20rpx;
|
||
|
||
.title {
|
||
margin-right: 28rpx;
|
||
color: #333;
|
||
line-height: 48rpx;
|
||
font-size: 32rpx;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.sub-title {
|
||
line-height: 32rpx;
|
||
font-size: 22rpx;
|
||
color: #A1A1A1;
|
||
}
|
||
|
||
.count-box {
|
||
margin-top: 6rpx;
|
||
font-size: 24rpx;
|
||
|
||
/deep/ .time {
|
||
.styleAll {
|
||
display: inline-block;
|
||
height: 40rpx;
|
||
line-height: 40rpx;
|
||
padding: 0 4rpx;
|
||
background: #ED0F0F;
|
||
color: #fff;
|
||
font-size: 24rpx;
|
||
}
|
||
|
||
.timeTxt {
|
||
margin: 0 4rpx;
|
||
color: #8D8D8D;
|
||
}
|
||
}
|
||
}
|
||
|
||
.more {
|
||
margin-top: 8rpx;
|
||
color: #7C7C7C;
|
||
font-size: 24rpx;
|
||
}
|
||
}
|
||
|
||
.list {
|
||
margin: 0 32rpx;
|
||
|
||
.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;
|
||
}
|
||
|
||
.label {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 94rpx;
|
||
height: 42rpx;
|
||
}
|
||
}
|
||
|
||
.content {
|
||
.label-vip {
|
||
width: 40rpx;
|
||
height: 24rpx;
|
||
margin-right: 6rpx;
|
||
}
|
||
|
||
.icon-fire {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
}
|
||
|
||
.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;
|
||
|
||
.del {
|
||
margin-left: 16rpx;
|
||
text-decoration: line-through;
|
||
font-size: 20rpx;
|
||
line-height: 30rpx;
|
||
font-weight: normal;
|
||
color: #A5A5A5;
|
||
}
|
||
}
|
||
|
||
.cart-box {
|
||
padding: 10rpx 12rpx 12rpx;
|
||
border-top: 1rpx solid #EFEFEF;
|
||
|
||
text {
|
||
font-size: 22rpx;
|
||
line-height: 32rpx;
|
||
color: #333333;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style>
|