首页更新
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<!-- 占位符导航栏 -->
|
||||
<navseat :opacity='opacity' :title='titlename' :titleshow='false'></navseat>
|
||||
<navseat :opacity='opacity' :title='toplist.name' :titleshow='false'></navseat>
|
||||
<view class="onecontent">
|
||||
<image class="onecontentimage" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/today/nav.png" mode=""></image>
|
||||
<image class="onecontentimage" :src="toplist.coverImg" mode=""></image>
|
||||
<view class="onecontentabsolute">
|
||||
<view class="onecontentabsoluteitem flex-between">
|
||||
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/today/l.png" mode=""></image>
|
||||
@@ -15,24 +15,24 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="towcontent">
|
||||
<view class="fivecontent_item" v-for="(item,index) in 20" :key="index">
|
||||
<view class="fivecontent_item" v-for="(item,index) in list" :key="index" @click="clickproduct(item)">
|
||||
<view class="fivecontent_item_nav flex-start">
|
||||
<image class="fivecontent_item_navimage" src="@/static/avatar.png" mode="aspectFill"></image>
|
||||
<image class="fivecontent_item_navimage" :src="item.shopImage" 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
|
||||
龙首.{{item.distances}}km
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-start">
|
||||
<view class="fivecontent_item_nav_lefttopstart 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"
|
||||
:key="index1" :style="{'background':s.backColor,'color':s.backColor}">
|
||||
<image class="fivecontent_item_nav_leftlangimage" v-if="s.shareImg" :src="s.shareImg"
|
||||
mode="aspectFill"></image>
|
||||
<text>{{s}}</text>
|
||||
<text class="fivecontent_item_nav_leftlangtext">{{s.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -45,11 +45,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">
|
||||
@@ -100,10 +103,14 @@
|
||||
return {
|
||||
titlename: '今日上新',
|
||||
opacity: false,
|
||||
list: [],
|
||||
toplist: {},
|
||||
form: {
|
||||
address: '', //地址
|
||||
address: '西安市', //地址
|
||||
lng: '108.949158',
|
||||
lat: '34.301731',
|
||||
type: '', //品类
|
||||
orderBy: '', //1.理我最近 2.销量优先 3.价格优先
|
||||
orderBy: 0, //1.理我最近 2.销量优先 3.价格优先
|
||||
other: '', //附近1KM 1选中 0不选中
|
||||
page: 1, //页数
|
||||
size: 10, //页容量
|
||||
@@ -118,6 +125,82 @@
|
||||
this.opacity = true
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.distiricttopCommon()
|
||||
},
|
||||
onShow() {
|
||||
this.onLoadlist()
|
||||
},
|
||||
methods: {
|
||||
async distiricttopCommon() {
|
||||
let res = await this.api.distiricttopCommon({
|
||||
type: '', //团购卷品类Id/subShop-预约到店
|
||||
orderBy: 0
|
||||
})
|
||||
console.log(res.data)
|
||||
if (res.code == 0) {
|
||||
this.toplist = res.data.carousel[0]
|
||||
}
|
||||
},
|
||||
clickproduct(item){
|
||||
uni.pro.navigateTo('product/index',item)
|
||||
},
|
||||
async onLoadlist() {
|
||||
try {
|
||||
this.form = {
|
||||
address: '西安市', //地址
|
||||
lng: '108.949158',
|
||||
lat: '34.301731',
|
||||
type: '', //团购卷品类Id
|
||||
distanceInKm: '', //默认10 以经纬度为中心 多大范围以内 单位km
|
||||
orderBy: 0, //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>
|
||||
|
||||
@@ -131,8 +214,8 @@
|
||||
width: 100%;
|
||||
height: 492rpx;
|
||||
position: relative;
|
||||
|
||||
.onecontentimage{
|
||||
|
||||
.onecontentimage {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@@ -140,6 +223,7 @@
|
||||
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/today/nav.png) no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.onecontentabsolute {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
@@ -215,33 +299,34 @@
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.flex-start {
|
||||
.fivecontent_item_nav_lefttopstart {
|
||||
margin-top: 8rpx;
|
||||
|
||||
.fivecontent_item_nav_leftlang {
|
||||
margin-top: 8rpx;
|
||||
margin-left: 12rpx;
|
||||
width: max-content;
|
||||
padding: 4rpx 10rpx;
|
||||
background: #FFF9E1;
|
||||
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||
text {
|
||||
|
||||
.fivecontent_item_nav_leftlangtext {
|
||||
margin-left: 6rpx;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 16rpx;
|
||||
color: #F9A511;
|
||||
}
|
||||
image {
|
||||
|
||||
.fivecontent_item_nav_leftlangimage {
|
||||
width: 10.82rpx;
|
||||
height: 14.06rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.fivecontent_item_nav_leftlang:nth-child(2) {
|
||||
margin-left: 12rpx;
|
||||
background: #FEE9DF;
|
||||
.fivecontent_item_nav_leftlang:nth-child(1) {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,26 +363,35 @@
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.fivecontent_item_boxitemlefttow {
|
||||
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;
|
||||
|
||||
|
||||
.flexstartboxfttow {
|
||||
.fivecontent_item_boxitemlefttow {
|
||||
margin-left: 16rpx;
|
||||
margin-top: 8rpx;
|
||||
width: max-content;
|
||||
padding: 4rpx 10rpx;
|
||||
background: #FFF9E1;
|
||||
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user