首页更新

This commit is contained in:
魏啾
2024-05-07 17:23:52 +08:00
parent 3b85017f91
commit a9832d38af
12 changed files with 707 additions and 286 deletions

View File

@@ -1,9 +1,9 @@
<template>
<view class="content">
<!-- 占位符导航栏 -->
<navseat class="navbar" :opacity='opacitys' :title='titlename' :titleshow='false'></navseat>
<navseat class="navbar" :opacity='opacitys' :title='toplist.name' :titleshow='false'></navseat>
<view class="onecontent">
<image class="onecontentimage" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/today/bsb.png" mode=" "></image>
<image class="onecontentimage" :src="toplist.coverImg" mode=" "></image>
<view class="onecontentabsolute">
</view>
</view>
@@ -20,9 +20,9 @@
</view>
</view>
<view class="towcontentlistxitembt flex-start">
<view class="towcontentlistxitembtitem" :class="index==1?'towcontentlistxitembtitemaktev':''"
v-for="(item,index) in 3" :key="index">
2小时销量飙升榜
<view class="towcontentlistxitembtitem" :class="index==xitembtitemindex?'towcontentlistxitembtitemaktev':''"
v-for="(item,index) in xitembtitem" :key="index" @click="clickxitembtitemindex(index)">
{{item.name}}
</view>
</view>
@@ -30,28 +30,7 @@
<view v-if="isFixedTop" :style="{'height':windowHeight - seighT + 'px'}"></view>
<view class="towcontentboutton" :style="{'height':seighT + 'px'}">
<!-- <scroll-view :style="{'height':seighT + 'px'}" scroll-y @scrolltolower="loadMore"> -->
<view class="fivecontent_item" v-for="(item,index) in 20" :key="index">
<view class="fivecontent_item_nav flex-start">
<image src="@/static/avatar.png" mode="aspectFill"></image>
<view class="fivecontent_item_nav_left">
<view class="fivecontent_item_nav_lefttop flex-between">
<view>
{{item.shopName}}
</view>
<view>
龙首.{{item.distances}}m
</view>
</view>
<view class="flex-start">
<view class="fivecontent_item_nav_leftlang flex-start"
v-for="(s,index1) in item.shopTag" :key="index1">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/hong_h.png"
mode="aspectFill"></image>
<text>{{s}}</text>
</view>
</view>
</view>
</view>
<view class="fivecontent_item" v-for="(item,index) in list" :key="index" @click="clickproduct(item)">
<view class="fivecontent_item_box">
<view class="fivecontent_item_boxitem flex-between">
<image :src="item.image" mode=""></image>
@@ -60,11 +39,14 @@
<view>{{item.productName}}</view>
<text>已抢{{item.realSalesNumber}}</text>
</view>
<view class="fivecontent_item_boxitemlefttow flex-start"
v-for="(c,index2) in item.proTag" :key="index2">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/hong_h.png"
mode="aspectFill"></image>
<text>{{c}}</text>
<view class="flex-start flexstartboxfttow">
<view class="fivecontent_item_boxitemlefttow flex-start"
v-for="(c,index2) in item.proTag" :key="index2"
:style="{'background':c.backColor,'color':c.backColor}">
<image class="fivecontent_item_boxitemlefttowimage" v-if="c.shareImg"
:src="c.shareImg" mode="aspectFill"></image>
<text class="fivecontent_item_boxitemlefttowtext">{{c.name}}</text>
</view>
</view>
<view class="indexboxitemleftthere flex-colum-start">
<view class="indexboxitemleftthereabsolute">
@@ -83,11 +65,11 @@
<view class="indexboxitemleftthere_countdown flex-between">
<text class="indexboxitemleftthere_countdowntext">共省{{item.save}}</text>
<view class="indexboxitemleftthere_countdowntexts">
<!-- <uni-countdown @timeup="updateCity" :show-day="false"
:day="item.end_times.d" :hour="item.end_times.h"
:minute="item.end_times.m" :second="item.end_times.s"
:indexs='index' color="#FFFFFF" border-color="#00B26A"
splitorColor="#FFFFFF" :font-size="7"></uni-countdown> -->
<!-- <uni-countdown @timeup="updateCity" :show-day="false" :day="item.end_times.d"
:hour="item.end_times.h" :minute="item.end_times.m"
:second="item.end_times.s" :indexs='index' color="#FFFFFF"
border-color="#00B26A" splitorColor="#FFFFFF"
:font-size="7"></uni-countdown> -->
</view>
@@ -97,8 +79,7 @@
</view>
</view>
</view>
<u-loadmore height='40' :status="form.status" iconSize='24' fontSize='24' />
</view><u-loadmore height='40' :status="form.status" iconSize='24' fontSize='24' />
<!-- </scroll-view> -->
</view>
</view>
@@ -123,6 +104,8 @@
customheighttop: '', //top高度
isFixedTop: false,
Topdistance: 3000, //吸顶初始距离
list: [],
toplist: {},
listbox: [{
name: '全部'
},
@@ -133,6 +116,14 @@
name: '饮品小吃'
}
],
xitembtitemindex:0,
xitembtitem: [{
name: '2小时销量飙升榜'
},
{
name: '今日热榜'
}
],
form: {
address: '', //地址
type: '', //品类
@@ -157,6 +148,8 @@
}
},
onLoad() {
this.distiricttopCommon()
this.onLoadlist()
setTimeout(() => {
this.GetTop()
}, 1000)
@@ -167,6 +160,13 @@
},
},
methods: {
//飙升榜
clickxitembtitemindex(index){
this.xitembtitemindex = index
},
towcontentclick(index) {
this.towcontentclickindex = index
},
//G滚动底部
loadMore(e) {
console.log(e)
@@ -199,9 +199,75 @@
}
})
},
towcontentclick(index) {
this.towcontentclickindex = index
}
async distiricttopCommon() {
let res = await this.api.distiricttopCommon({
type: '', //团购卷品类Id/subShop-预约到店
orderBy: 2
})
console.log(res.data)
if (res.code == 0) {
this.toplist = res.data.carousel[0]
this.listbox = res.data.menu
}
},
clickproduct(item) {
uni.pro.navigateTo('product/index', item)
},
async onLoadlist() {
try {
this.form = {
address:uni.cache.get('getLocationstorage').address, //地址
lng: uni.cache.get('getLocationstorage').lng,
lat: uni.cache.get('getLocationstorage').lat,
type: '', //团购卷品类Id
distanceInKm: '', //默认10 以经纬度为中心 多大范围以内 单位km
orderBy: 2, //0.今日上新 1.离我最近 2.销量优先/热榜推荐 3.价格优先
page: 1, //页数
size: 10, //页容量
status: 'loadmore',
}
let res = await this.api.indexlist(this.form)
var dates = new Date().getTime();
res.data.list.forEach((item, index) => {
var leftTime = item.endTime - dates; //计算两日期之间相差的毫秒数
if (leftTime >= 0) {
let d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
let h = Math.floor(leftTime / 1000 / 60 / 60 % 24);
let m = Math.floor(leftTime / 1000 / 60 % 60);
let s = Math.floor(leftTime / 1000 % 60);
item.end_times = {
d: d,
h: h,
m: m,
s: s
}
} else {
item.end_times = 0
}
})
console.log(res.data.list)
if (res.data.pages < this.form.page) {
this.form.status = 'nomore'
// if (res.data.pageNum == 1) {
// this.is_end = true
// }
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data.list];
this.form.status = 'loading';
if (res.data.pageNum == res.data.pages) {
this.form.status = 'nomore';
} else {
this.form.status = 'loading';
}
}, 500)
}
} catch (e) {}
},
}
};
</script>
@@ -216,6 +282,7 @@
width: 100%;
height: 492rpx;
position: relative;
.onecontentimage {
position: absolute;
width: 100%;
@@ -349,62 +416,13 @@
.fivecontent_item {
margin-top: 32rpx;
padding: 24rpx;
padding:32rpx 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
.fivecontent_item_nav {
image {
width: 60rpx;
height: 60rpx;
border-radius: 8rpx;
}
.fivecontent_item_nav_left {
flex: auto;
margin-left: 12rpx;
.fivecontent_item_nav_lefttop {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
.fivecontent_item_nav_leftlang {
margin-top: 8rpx;
width: max-content;
padding: 4rpx 10rpx;
background: #FFF9E1;
border-radius: 4rpx 4rpx 4rpx 4rpx;
text {
margin-left: 6rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 16rpx;
color: #F9A511;
}
image {
width: 10.82rpx;
height: 14.06rpx;
}
}
.fivecontent_item_nav_leftlang:nth-child(2) {
margin-left: 12rpx;
background: #FEE9DF;
}
}
}
.fivecontent_item_box {
margin-top: 20rpx;
border-top: 2rpx solid #E5E5E5;
padding-top: 14rpx;
.fivecontent_item_boxitem {
image {
@@ -435,25 +453,34 @@
}
}
.fivecontent_item_boxitemlefttow {
margin-top: 8rpx;
width: max-content;
padding: 4rpx 10rpx;
background: #FFF9E1;
border-radius: 4rpx 4rpx 4rpx 4rpx;
text {
margin-left: 6rpx;
.flexstartboxfttow {
.fivecontent_item_boxitemlefttow {
margin-left: 16rpx;
margin-top: 8rpx;
width: max-content;
padding: 4rpx 10rpx;
background: #FFF9E1;
border-radius: 4rpx 4rpx 4rpx 4rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 16rpx;
color: #F9A511;
.fivecontent_item_boxitemlefttowtext {
margin-left: 6rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 16rpx;
color: #F9A511;
}
.fivecontent_item_boxitemlefttowimage {
width: 10.82rpx;
height: 14.06rpx;
}
}
image {
width: 10.82rpx;
height: 14.06rpx;
.fivecontent_item_boxitemlefttow:nth-child(1) {
margin-left: 0;
background: #FFD6D7;
border-radius: 4rpx 4rpx 4rpx 4rpx;
}
}