首页完善

This commit is contained in:
魏啾
2024-05-10 09:40:06 +08:00
parent 678c8fa053
commit 09661b8b0b
13 changed files with 707 additions and 297 deletions

View File

@@ -73,7 +73,7 @@
},
watch: {
timersetnteritem(newVal, oldVal) {
console.log(newVal, oldVal)
// console.log(newVal, oldVal)
if (newVal == 1) {
clearTimeout(this.timersetInterval);
this.timersetInterval = null;
@@ -99,7 +99,7 @@
endMove(e) {
// this.itemStyless = []
var newList = JSON.parse(JSON.stringify(this.itemStyle))
console.log(newList)
// console.log(newList)
// if ((e.changedTouches[0].pageX - this.slideNote.x) < 0) {
// 向左滑动
var last = [newList.pop()]

View File

@@ -0,0 +1,116 @@
<template>
<view class="fourcontent flex-between">
<view class="fourcontent_item flex-start" v-for="(item,index) in menu" :key="index"
@click="viewHistorycategoryss(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text>{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333"
size="16"></u-icon>
</view>
</view>
</template>
<script>
export default {
data() {
return {};
},
props: {
menu: {
type: Array,
default () {
return []
}
},
title: {
type: String,
default: '每日特价'
},
viewHistoryindex: {
type: String,
default: ''
},
},
methods: {
viewHistorycategoryss(item, index) {
console.log(item, index)
uni.$emit('viewHistory', {
item:item,
index:index
});
},
clickdistrict(item) {
switch (item.jumpType) {
case 'absolute':
uni.pro.navigateTo('webview/webview', {
url: item.absUrl
});
break;
case 'relative':
uni.pro.navigateTo(item.absUrl, item);
break;
case 'scan':
if (!uni.utils.pluschooseImage()) {
return false
}
// #ifdef H5
if (this.wxSdk) {
wx.scanQRCode({
needResult: 1, // 默认为0扫描结果由微信处理1则直接返回扫描结果
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
success: res => {
// 当needResult 为 1 时,扫码返回的结果
console.log(res.resultStr, res)
}
});
} else {
uni.showModal({
title: '注意',
content: '微信sdk初始化失败请重新加载',
success: res => {
window.location.reload();
}
});
}
// #endif
// #ifdef APP || MP-WEIXIN
uni.scanCode({
success: res => {
console.log(res.result, res)
}
});
// #endif
break;
}
}
}
};
</script>
<style scoped lang="scss">
.fourcontent {
padding: 32rpx 28rpx 32rpx 28rpx;
overflow-x: auto;
flex-wrap: nowrap;
.fourcontent_item {
flex-wrap: nowrap;
margin-left: 22rpx;
padding: 4rpx 14rpx;
background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
text {
width: max-content;
}
}
.fourcontent_itemactev {
background: #fee06a;
}
.fourcontent_item:nth-child(1) {
margin-left: 0;
}
}
</style>

View File

@@ -102,7 +102,9 @@
},
methods:{
clickproduct(item){
uni.pro.navigateTo('product/index',item)
uni.pro.navigateTo('product/index',{
id:item.id
})
},
jrtoday(e){
if(e == 0){

View File

@@ -1,17 +1,17 @@
<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="after"></view>
<view class="onecontentabsolute">
</view>
</view>
<view class="towcontent">
<view :class="isFixedTop?'towcontentlistxitemboxfixed':''" :style="{'top':customheighttop + 'px'}">
<!-- <view :class="isFixedTop?'towcontentlistxitemboxfixed':''" :style="{'top':customheighttop + 'px'}">
<view class="towcontentlistxitem flex-start">
<view class="towcontentlistxitembox flex-colum"
:class="towcontentclickindex == index?'towcontentlistxitemboxopacity':''"
@@ -22,35 +22,28 @@
</image>
</view>
</view>
<view class="towcontentlistxitembt flex-start">
<view class="towcontentlistxitembtitem" :class="index==1?'towcontentlistxitembtitemaktev':''"
v-for="(item,index) in 3" :key="index">
2小时销量飙升榜
</view>
</view>
</view>
</view> -->
<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" v-for="(item,index) in list" :key="index" @click="clickproduct(item)">
<view class="fivecontent_item_nav flex-start">
<image 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_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"
<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" :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>
@@ -63,41 +56,46 @@
<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">
马上抢
</view>
<view class="indexboxitemlefttheretext flex-start">
<view class="indexboxitemlefttheretextone">
<text>¥</text>
<text>{{item.salePrice}}</text>
<view class="fivecontent_item_boxitemlefthere_one flex-start">
<text class="flex_startone">到手</text>
<text class="flex_starttow">¥{{item.salePrice}}</text>
</view>
<view class="indexboxitemlefttheretexttow">
¥{{item.discount}}
<view class="fivecontent_item_boxitemlefthere_tow">
{{item.discount || ''}}
</view>
<view class="fivecontent_item_boxitemlefthere_there">
¥{{item.originPrice}}
</view>
</view>
<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>
</view>
</view>
</view>
</view>
</view>
</view>
@@ -105,7 +103,7 @@
<!-- </scroll-view> -->
</view>
</view>
</view>
</template>
@@ -125,16 +123,9 @@
customheighttop: '', //top高度
isFixedTop: false,
Topdistance: 3000, //吸顶初始距离
listbox: [{
name: '全部'
},
{
name: '美食正餐'
},
{
name: '饮品小吃'
}
],
list: [],
toplist: {},
listbox: [],
form: {
address: '', //地址
type: '', //品类
@@ -158,17 +149,92 @@
this.isFixedTop = false
}
},
onLoad() {
onLoad(e) {
this.type = e.value
this.distiricttopCommon()
setTimeout(() => {
this.GetTop()
}, 1000)
},
onShow() {
this.init_fn()
},
computed: {
HeighT() { //手机类型的尺寸
return this.$store.getters.is_BarHeight
},
},
methods: {
clickproduct(item){
uni.pro.navigateTo('product/index',{
id:item.id
})
},
init_fn() {
this.list = []
this.form = {
address: uni.cache.get('getLocationstorage').address, //地址
lng: uni.cache.get('getLocationstorage').lng,
lat: uni.cache.get('getLocationstorage').lat,
type:this.type, //品类
orderBy:0, //0.今日上新 1.离我最近 2.销量优先 3.价格优先 4.热榜推荐
other: '', //附近1KM 1选中 0不选中
page: 1, //页数
size: 10, //页容量
dateType: 1,
status: 'loadmore'
}
this.onLoadlist()
},
async distiricttopCommon(e) {
let res = await this.api.distiricttopCommon({
type: this.type, //团购卷品类Id/subShop-预约到店
orderBy: ''
})
if (res.code == 0) {
this.toplist = res.data.carousel[0]
this.listbox = res.data.menu
}
},
async onLoadlist() {
try {
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
}
})
if (res.data.pages < this.form.page) {
this.form.status = 'nomore'
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) {}
},
//G滚动底部
loadMore(e) {
console.log(e)
@@ -218,15 +284,17 @@
width: 100%;
height: 492rpx;
position: relative;
.onecontentimage {
position: absolute;
width: 100%;
height: 100%;
top: 0;
}
.after {
position: absolute;
bottom:32rpx;
bottom: 32rpx;
right: 0;
width: 40rpx;
height: 40rpx;
@@ -234,6 +302,7 @@
text-align: center;
background-image: radial-gradient(160rpx at 0px 0px, rgba(0, 0, 0, 0) 40rpx, #fff 40rpx);
}
.onecontentabsolute {
position: absolute;
width: 100%;
@@ -475,74 +544,90 @@
}
.indexboxitemleftthere {
position: relative;
margin-top: 30rpx;
padding-left: 16rpx;
width: 100%;
height: 88rpx;
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/qinggou.png) no-repeat;
background-size: 100% 100%;
.indexboxitemleftthereabsolute {
position: absolute;
top: 14rpx;
right: 12rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 24rpx;
color: #FFFFFF;
}
.indexboxitemlefttheretext {
.indexboxitemlefttheretextone {
text {
font-family: SourceHanSansCN-Bold, SourceHanSansCN-Bold;
font-weight: normal;
color: #FF5053;
}
text:nth-child(2) {
font-weight: bold;
font-size: 34rpx;
}
text:nth-child(1) {
font-size: 24rpx;
}
}
.indexboxitemlefttheretexttow {
margin-left: 12rpx;
font-size: 20rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN-Regular;
font-weight: normal;
color: #999999;
text-decoration: line-through;
}
}
.indexboxitemleftthere_countdown {
width: 100%;
padding-right: 7rpx;
.indexboxitemleftthere_countdowntext {
position: relative;
margin-top: 30rpx;
padding-left: 16rpx;
width: 100%;
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/qinggou.png) no-repeat;
background-size: 100% 100%;
.indexboxitemleftthereabsolute {
position: absolute;
top: 14rpx;
right: 12rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 24rpx;
color: #FFFFFF;
}
.indexboxitemlefttheretext {
// width: 100%;
margin-top: 12rpx;
align-items: flex-end;
.fivecontent_item_boxitemlefthere_one {
align-items: flex-end;
.flex_startone {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.indexboxitemleftthere_countdowntexts {
font-family: Roboto, Roboto;
font-weight: 400;
color: #333333;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-weight: 500;
font-size: 16rpx;
color: #FFFFFF;
color: #FF7127;
}
.flex_starttow {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 24rpx;
color: #FF7127;
}
}
.fivecontent_item_boxitemlefthere_tow {
margin-left: 4rpx;
padding: 2rpx 10rpx;
border-radius: 4rpx 4rpx 4rpx 4rpx;
border: 2rpx solid #FF7127;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 16rpx;
color: #FF7127;
}
.fivecontent_item_boxitemlefthere_there {
margin-left: 6rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 16rpx;
color: #999999;
text-decoration-line: line-through;
}
}
.indexboxitemleftthere_countdown {
width: 100%;
padding-right: 7rpx;
margin-top: 2rpx;
.indexboxitemleftthere_countdowntext {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
padding-bottom: 8rpx;
}
.indexboxitemleftthere_countdowntexts {
font-family: Roboto, Roboto;
font-weight: 400;
color: #333333;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 16rpx;
color: #FFFFFF;
}
}
}
}
}
}

View File

@@ -38,7 +38,7 @@
<view class="fivecontent_item_boxitemleft flex-colum-start">
<view class="fivecontent_item_boxitemleftone">
<view class="fivecontent_item_boxitemleftone_t"><text
class="fivecontent_item_boxitemleftone_o">热销TOP.{{index + 1}}</text>热销热销热销热销热销热销热销热销热销热销热销热销热销已抢{{item.realSalesNumber}}
class="fivecontent_item_boxitemleftone_o">热销TOP.{{index + 1}}</text>{{item.productName}}
</view>
</view>
<view class="fivecontent_item_boxitemlefttow flex-between">
@@ -232,7 +232,9 @@
}
},
clickproduct(item) {
uni.pro.navigateTo('product/index', item)
uni.pro.navigateTo('product/index', {
id:item.id
})
},
async onLoadlist() {
try {

View File

@@ -294,23 +294,23 @@
uni.getLocation({
type: 'wgs84',
success: (res) => {
console.log(res, '获取距离')
// console.log(res, '获取距离')
// this.lng = res.longitude
// this.lat = res.latitude
// this.positionindex()
// // 测试
let datastorage = {
address: '西安市', //地址
lng: res.longitude,
lat: res.latitude,
}
uni.cache.set('getLocationstorage', datastorage);
},
fail: (err) => {
// this.positionindex()
console.log(err, '获取错误')
}
});
// 测试
let datastorage = {
address: '西安市', //地址
lng: '108.949158',
lat: '34.301731',
}
uni.cache.set('getLocationstorage', datastorage);
setTimeout(() => {
this.GetTop()
}, 1000)
@@ -335,7 +335,9 @@
uni.pro.navigateTo('index/uindexlist')
},
fivecontentclick(item) {
uni.pro.navigateTo('product/index', item)
uni.pro.navigateTo('product/index',{
id:item.id
})
},
updateCity(data) {
thiss.list[data].end_times = 0;
@@ -357,7 +359,6 @@
})
},
changeParentValue(newValue) {
console.log(newValue)
this.itemStyle = newValue
},
getStyle(e) {
@@ -786,7 +787,7 @@
.fivecontent_item_boxitemleft {
margin-left: 24rpx;
flex: auto;
flex: 1;
.fivecontent_item_boxitemleftone {
width: 100%;
@@ -799,6 +800,10 @@
}
view {
width: 300rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space:nowrap; //溢出不换行white-space:nowrap; //溢出不换行
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;

View File

@@ -73,14 +73,14 @@
<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>
</view>
</view>
</view>
@@ -108,9 +108,9 @@
list: [],
toplist: {},
form: {
address: '西安市', //地址
lng: '108.949158',
lat: '34.301731',
address: uni.cache.get('getLocationstorage').address, //地址
lng: uni.cache.get('getLocationstorage').lng,
lat: uni.cache.get('getLocationstorage').lat,
type: '', //品类
orderBy: 0, //1.理我最近 2.销量优先 3.价格优先
other: '', //附近1KM 1选中 0不选中
@@ -128,7 +128,7 @@
}
},
onLoad(e) {
this.distiricttopCommon()
this.distiricttopCommon()
},
onShow() {
this.onLoadlist()
@@ -144,15 +144,17 @@
this.toplist = res.data.carousel[0]
}
},
clickproduct(item){
uni.pro.navigateTo('product/index',item)
clickproduct(item) {
uni.pro.navigateTo('product/index',{
id:item.id
})
},
async onLoadlist() {
try {
this.form = {
address: '西安市', //地址
lng: '108.949158',
lat: '34.301731',
address: uni.cache.get('getLocationstorage').address, //地址
lng: uni.cache.get('getLocationstorage').lng,
lat: uni.cache.get('getLocationstorage').lat,
type: '', //团购卷品类Id
distanceInKm: '', //默认10 以经纬度为中心 多大范围以内 单位km
orderBy: 0, //0.今日上新 1.离我最近 2.销量优先/热榜推荐 3.价格优先
@@ -365,8 +367,8 @@
color: #333333;
}
}
.flexstartboxfttow {
.fivecontent_item_boxitemlefttow {
margin-left: 16rpx;
@@ -375,7 +377,7 @@
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;
@@ -383,13 +385,13 @@
font-size: 16rpx;
color: #F9A511;
}
.fivecontent_item_boxitemlefttowimage {
width: 10.82rpx;
height: 14.06rpx;
}
}
.fivecontent_item_boxitemlefttow:nth-child(1) {
margin-left: 0;
background: #FFD6D7;
@@ -410,7 +412,7 @@
width: 100%;
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/qinggou.png) no-repeat;
background-size: 100% 100%;
.indexboxitemleftthereabsolute {
position: absolute;
top: 14rpx;
@@ -420,22 +422,22 @@
font-size: 24rpx;
color: #FFFFFF;
}
.indexboxitemlefttheretext {
// width: 100%;
margin-top: 12rpx;
align-items: flex-end;
.fivecontent_item_boxitemlefthere_one {
align-items: flex-end;
.flex_startone {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 16rpx;
color: #FF7127;
}
.flex_starttow {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
@@ -443,7 +445,7 @@
color: #FF7127;
}
}
.fivecontent_item_boxitemlefthere_tow {
margin-left: 4rpx;
padding: 2rpx 10rpx;
@@ -454,7 +456,7 @@
font-size: 16rpx;
color: #FF7127;
}
.fivecontent_item_boxitemlefthere_there {
margin-left: 6rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
@@ -464,11 +466,12 @@
text-decoration-line: line-through;
}
}
.indexboxitemleftthere_countdown {
width: 100%;
padding-right: 7rpx;
margin-top: 2rpx;
.indexboxitemleftthere_countdowntext {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
@@ -476,7 +479,7 @@
color: #999999;
padding-bottom: 8rpx;
}
.indexboxitemleftthere_countdowntexts {
font-family: Roboto, Roboto;
font-weight: 400;