Browse Source

首页

master
tianyi 4 weeks ago
parent
commit
f34f54b830
  1. 644
      pages/index/index.vue

644
pages/index/index.vue

@ -2,9 +2,9 @@
<view class="page1">
<view class="swiper-container">
<view class="swiper-page" v-if="currentIndex == 0">
<!-- <map id="map" style="width: 100%; height: 300px;" :latitude="latitude" :longitude="longitude"
:markers="markers" :polyline="polyline"></map> -->
<view style="position: relative;height: 545rpx;">
<view style="width:100%;height: 50px;position: fixed;top: 0;background: #fff;z-index: 90;" v-if="lastScrollTop>583"></view>
<view style="position: absolute;top: 55px;left: 10px;z-index: 999;">
<view @click="checkArea" v-if="areaName == ''">
点击选择区域
@ -160,20 +160,68 @@
</view>
</view>
<view class="daimai-box" style="padding-bottom:180rpx;">
<view class="daimai-tab">
<view class="like-title" style="position: relative;">
<img src="/static/images/img/daimaifantitle.png" alt="">
<text
style="position: absolute;top: 0;right: 0;font-size: 36rpx;font-weight: 700;">(31)</text>
<view class="daimai-tab" id="menuList" :style="{'top': navBarHeight + 'px','background':lastScrollTop>583?'#fff':''}">
<view @tap="checkTab('daimaifan')">
<view class="like-title" style="position: relative;width: 240rpx;" v-if="checked == 'daimaifan'">
<img src="/static/images/img/daimaifantitle.png" alt="" style="width: 220rpx;" />
<text style="position: absolute;top: 0;right: 0;font-size: 36rpx;font-weight: 700;">31</text>
</view>
<view style="font-size: 30rpx;font-weight: 700;margin-left: 20rpx;color: #777;" v-else>
代买饭 (9)
</view>
</view>
<view @tap="checkTab('paotui')" style="margin-left: 15px;">
<view class="like-title" style="position: relative;width:320rpx;" v-if="checked == 'paotui'">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/99162216d23a44a8ba81c7cb5249f3b8.png" alt="" style="width: 270rpx;">
<text style="position: absolute;top: 0;right: 0;font-size: 36rpx;font-weight: 700;">9</text>
</view>
<view style="font-size: 30rpx;font-weight: 700;margin-left: 20rpx;color: #777;" v-else>
代取快递/跑腿 (9)
</view>
</view>
</view>
<view class="title-sort" v-if="lastScrollTop>583" :style="{'top': (navBarHeight+30) + 'px'}">
<view class="sort-member" style="position: relative;">
<view @tap="checkAdd">
取餐地址 <text style="font-size: 20rpx;"></text>
</view>
<view class="sort-value" v-if="isArea">
<view class="sort-value1" v-for="(item,index) in shopArea" :key="index"
@tap="searchShop('area',item.id)">{{item.title}}</view>
</view>
</view>
<view class="sort-member" style="position: relative;">
<view @tap="checkAdd">
送餐地址 <text style="font-size: 20rpx;"></text>
</view>
<view class="sort-value" v-if="isArea">
<view class="sort-value1" v-for="(item,index) in shopArea" :key="index"
@tap="searchShop('area',item.id)">{{item.title}}</view>
</view>
</view>
<view class="like-title" style="position: relative;width:300rpx;">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/99162216d23a44a8ba81c7cb5249f3b8.png" alt="">
<text
style="position: absolute;top: 0;right: 0;font-size: 36rpx;font-weight: 700;">(9)</text>
<view @tap="searchShop('yongjin')" class="sort-member" style="border-radius: 60rpx" :style="{'background':yongjin==true?'rgba(138, 255, 67, 0.16)':'#eee','border':yongjin==true?'1px solid rgba(138, 255, 67, 1)':'0'}">
佣金
</view>
</view>
<view class="sort-text" v-if="lastScrollTop>583" :style="{'top': (navBarHeight+80) + 'px'}">
<view style="display: flex; width: 100%;">
<view class="guize1-qusong">
<view class="qusong1">
</view>
<view class="qusong2">
第一食堂
</view>
</view>
<view class="guize1-qusong">
<view class="qusong1">
</view>
<view class="qusong2" style="background: rgba(209, 206, 255, 1);">
第一食堂
</view>
</view>
</view>
<!-- <view style="font-size: 30rpx;font-weight: 700;margin-left: 60rpx;color: #777;">
代取快递/跑腿 (9)
</view> -->
</view>
<view class="daimai-list">
<view class="list-1">
@ -185,9 +233,6 @@
#<text>021</text>
</view>
<view class="shangjia">
<!-- <view class="shangjialogo">
<img src="/static/images/img/shangjialogo.png" alt="" />
</view> -->
<text style="font-weight: 700;">王继酸辣粉</text>
<view
style="width: 32rpx;height: 30rpx;font-weight: 700;font-size: 20rpx;color: #fff;text-align: center;background: #00BFFF;border-radius: 10rpx;margin: 20rpx 0 0 10rpx;line-height: 30rpx;">
@ -195,23 +240,6 @@
</view>
</view>
<view class="shangpin">
<!-- <view class="shangpintu">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="shangpinxinxi">
<view class="pinming">
神仙搭配酸辣粉+脆皮肉夹馍套餐
</view>
<view class="guige">
大份不要辣
</view>
<view class="shuliang">
<view style="width: 50%;">x1</view>
<view
style="width: 50%;font-size: 28rpx;text-align: right;color: #000;font-weight: 700;">
19.99</view>
</view>
</view> -->
<view class="qu-song">
<view class="qu-box">
<view class='qu-tu'>
@ -242,37 +270,88 @@
</view>
</view>
</view>
<!-- <view class="qu-song">
<view class="qu-box">
<view class='qu-tu'>
<img src="" alt="" />
<view class="yongjin">
<view style="width: 50%;color: #777;padding-left: 4%;display: flex;">
配送佣金
<view class="chaoda">
超大/超重
</view>
<view class="qu-text">
<view class="qu-left">
第三师堂A02窗口
</view>
<view class="qu-right">
1000m
</view>
</view>
<view style="font-weight: 700;width: 50%;text-align: right;">
5.00
<text style="color: #777;font-size: 22rpx;">包含2平台佣金</text>
</view>
</view>
<view class="beizhu">
备注一共有3个快递哦普通快递没有超重和超大的辛苦了
</view>
<view class="qiangdan-btn">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1b8b815302a34902ac79a76a469e4ee6.png" alt="">
</view>
</view>
<view class="list-1">
<view style="display:flex;">
<view class="daoda-time">
送达时间02-02 18:02
</view>
<view class="paotui-title">
<view class="paotui-text">
取件码:1-2-9830
</view>
<view class="paotui-num">
3
</view>
<view>
<uni-icons type="right" size="12"></uni-icons>
</view>
</view>
<view class="qu-box" style="margin-top:10rpx;">
<view class='qu-tu'>
<img src="" alt="" />
</view>
<view class="order-page">
<view class="shangjia">
<text style="font-weight: 700;">王继酸辣粉</text>
<view
style="width: 32rpx;height: 30rpx;font-weight: 700;font-size: 20rpx;color: #fff;text-align: center;background: #00BFFF;border-radius: 10rpx;margin: 20rpx 0 0 10rpx;line-height: 30rpx;">
</view>
<view class="qu-text">
<view class="qu-left">
11号楼310
</view>
<view class="shangpin">
<view class="qu-song">
<view class="qu-box">
<view class='qu-tu'>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1f77398a73454a6595c12a3c18731599.png" alt="" />
</view>
<view class="qu-text">
<view class="qu-left">
第三师堂A02窗口
</view>
<view class="qu-right">
1000m
</view>
</view>
</view>
<view class="qu-right">
2.1km
<view class="qu-box" style="margin-top:10rpx;">
<view class='qu-tu'>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/d0764fb4138747769538cf1cafa3b017.png" alt="" />
</view>
<view class="qu-text">
<view class="qu-left">
11号楼310
</view>
<view class="qu-right">
2.1km
</view>
</view>
</view>
</view>
</view>
</view> -->
</view>
<view class="yongjin">
<view style="width: 50%;color: #777;padding-left: 4%;">
配送佣金</view>
<view style="width: 50%;color: #777;padding-left: 4%;display: flex;">
配送佣金
<view class="chaoda">
超大/超重
</view>
</view>
<view style="font-weight: 700;width: 50%;text-align: right;">
5.00
<text style="color: #777;font-size: 22rpx;">包含2平台佣金</text>
@ -283,7 +362,7 @@
</view>
</view>
<view class="list-1">
<view class="display:flex;">
<view style="display:flex;">
<view class="daoda-time">
送达时间02-02 18:02
</view>
@ -301,9 +380,6 @@
</view>
<view class="order-page">
<view class="shangjia">
<!-- <view class="shangjialogo">
<img src="/static/images/img/shangjialogo.png" alt="" />
</view> -->
<text style="font-weight: 700;">王继酸辣粉</text>
<view
style="width: 32rpx;height: 30rpx;font-weight: 700;font-size: 20rpx;color: #fff;text-align: center;background: #00BFFF;border-radius: 10rpx;margin: 20rpx 0 0 10rpx;line-height: 30rpx;">
@ -311,23 +387,78 @@
</view>
</view>
<view class="shangpin">
<!-- <view class="shangpintu">
<img src="/static/images/img/shangpintu.png" alt="">
</view>
<view class="shangpinxinxi">
<view class="pinming">
神仙搭配酸辣粉+脆皮肉夹馍套餐
</view>
<view class="guige">
大份不要辣
<view class="qu-song">
<view class="qu-box">
<view class='qu-tu'>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1f77398a73454a6595c12a3c18731599.png" alt="" />
</view>
<view class="qu-text">
<view class="qu-left">
第三师堂A02窗口
</view>
<view class="qu-right">
1000m
</view>
</view>
</view>
<view class="shuliang">
<view style="width: 50%;">x1</view>
<view
style="width: 50%;font-size: 28rpx;text-align: right;color: #000;font-weight: 700;">
19.99</view>
<view class="qu-box" style="margin-top:10rpx;">
<view class='qu-tu'>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/d0764fb4138747769538cf1cafa3b017.png" alt="" />
</view>
<view class="qu-text">
<view class="qu-left">
11号楼310
</view>
<view class="qu-right">
2.1km
</view>
</view>
</view>
</view> -->
</view>
</view>
</view>
<view class="yongjin">
<view style="width: 50%;color: #777;padding-left: 4%;display: flex;">
配送佣金
<view class="chaoda">
超大/超重
</view>
</view>
<view style="font-weight: 700;width: 50%;text-align: right;">
5.00
<text style="color: #777;font-size: 22rpx;">包含2平台佣金</text>
</view>
</view>
<view class="qiangdan-btn">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1b8b815302a34902ac79a76a469e4ee6.png" alt="">
</view>
</view>
<view class="list-1">
<view style="display:flex;">
<view class="daoda-time">
送达时间02-02 18:02
</view>
<view class="paotui-title">
<view class="paotui-text">
取件码:1-2-9830
</view>
<view class="paotui-num">
3
</view>
<view>
<uni-icons type="right" size="12"></uni-icons>
</view>
</view>
</view>
<view class="order-page">
<view class="shangjia">
<text style="font-weight: 700;">王继酸辣粉</text>
<view
style="width: 32rpx;height: 30rpx;font-weight: 700;font-size: 20rpx;color: #fff;text-align: center;background: #00BFFF;border-radius: 10rpx;margin: 20rpx 0 0 10rpx;line-height: 30rpx;">
</view>
</view>
<view class="shangpin">
<view class="qu-song">
<view class="qu-box">
<view class='qu-tu'>
@ -358,37 +489,157 @@
</view>
</view>
</view>
<!-- <view class="qu-song">
<view class="qu-box">
<view class='qu-tu'>
<img src="/static/images/img/quhuo.png" alt="" />
<view class="yongjin">
<view style="width: 50%;color: #777;padding-left: 4%;display: flex;">
配送佣金
<view class="chaoda">
超大/超重
</view>
</view>
<view style="font-weight: 700;width: 50%;text-align: right;">
5.00
<text style="color: #777;font-size: 22rpx;">包含2平台佣金</text>
</view>
</view>
<view class="qiangdan-btn">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1b8b815302a34902ac79a76a469e4ee6.png" alt="">
</view>
</view>
<view class="list-1">
<view style="display:flex;">
<view class="daoda-time">
送达时间02-02 18:02
</view>
<view class="paotui-title">
<view class="paotui-text">
取件码:1-2-9830
</view>
<view class="paotui-num">
3
</view>
<view>
<uni-icons type="right" size="12"></uni-icons>
</view>
</view>
</view>
<view class="order-page">
<view class="shangjia">
<text style="font-weight: 700;">王继酸辣粉</text>
<view
style="width: 32rpx;height: 30rpx;font-weight: 700;font-size: 20rpx;color: #fff;text-align: center;background: #00BFFF;border-radius: 10rpx;margin: 20rpx 0 0 10rpx;line-height: 30rpx;">
</view>
<view class="qu-text">
<view class="qu-left">
第三师堂A02窗口
</view>
<view class="shangpin">
<view class="qu-song">
<view class="qu-box">
<view class='qu-tu'>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1f77398a73454a6595c12a3c18731599.png" alt="" />
</view>
<view class="qu-text">
<view class="qu-left">
第三师堂A02窗口
</view>
<view class="qu-right">
1000m
</view>
</view>
</view>
<view class="qu-right">
1000m
<view class="qu-box" style="margin-top:10rpx;">
<view class='qu-tu'>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/d0764fb4138747769538cf1cafa3b017.png" alt="" />
</view>
<view class="qu-text">
<view class="qu-left">
11号楼310
</view>
<view class="qu-right">
2.1km
</view>
</view>
</view>
</view>
</view>
<view class="qu-box" style="margin-top:10rpx;">
<view class='qu-tu'>
<img src="" alt="" />
</view>
<view class="yongjin">
<view style="width: 50%;color: #777;padding-left: 4%;display: flex;">
配送佣金
<view class="chaoda">
超大/超重
</view>
</view>
<view style="font-weight: 700;width: 50%;text-align: right;">
5.00
<text style="color: #777;font-size: 22rpx;">包含2平台佣金</text>
</view>
</view>
<view class="qiangdan-btn">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1b8b815302a34902ac79a76a469e4ee6.png" alt="">
</view>
</view>
<view class="list-1">
<view style="display:flex;">
<view class="daoda-time">
送达时间02-02 18:02
</view>
<view class="paotui-title">
<view class="paotui-text">
取件码:1-2-9830
</view>
<view class="paotui-num">
3
</view>
<view>
<uni-icons type="right" size="12"></uni-icons>
</view>
</view>
</view>
<view class="order-page">
<view class="shangjia">
<text style="font-weight: 700;">王继酸辣粉</text>
<view
style="width: 32rpx;height: 30rpx;font-weight: 700;font-size: 20rpx;color: #fff;text-align: center;background: #00BFFF;border-radius: 10rpx;margin: 20rpx 0 0 10rpx;line-height: 30rpx;">
</view>
<view class="qu-text">
<view class="qu-left">
11号楼310
</view>
<view class="shangpin">
<view class="qu-song">
<view class="qu-box">
<view class='qu-tu'>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/1f77398a73454a6595c12a3c18731599.png" alt="" />
</view>
<view class="qu-text">
<view class="qu-left">
第三师堂A02窗口
</view>
<view class="qu-right">
1000m
</view>
</view>
</view>
<view class="qu-right">
2.1km
<view class="qu-box" style="margin-top:10rpx;">
<view class='qu-tu'>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/d0764fb4138747769538cf1cafa3b017.png" alt="" />
</view>
<view class="qu-text">
<view class="qu-left">
11号楼310
</view>
<view class="qu-right">
2.1km
</view>
</view>
</view>
</view>
</view>
</view> -->
</view>
<view class="yongjin">
<view style="width: 50%;color: #777;padding-left: 4%;">
配送佣金</view>
<view style="width: 50%;color: #777;padding-left: 4%;display: flex;">
配送佣金
<view class="chaoda">
超大/超重
</view>
</view>
<view style="font-weight: 700;width: 50%;text-align: right;">
5.00
<text style="color: #777;font-size: 22rpx;">包含2平台佣金</text>
@ -419,7 +670,7 @@
<view class="popup-area-title">
<text>请选择所属区域</text>
</view>
<view class="popup-area-container" v-for="(item,index) in areaList" @tap="onClickArea(item)">
<view class="popup-area-container" v-for="(item,index) in areaList" :key="index" @tap="onClickArea(item)">
<text style="display: inline-block">{{item.title}}</text>
</view>
</view>
@ -430,7 +681,7 @@
<view class="popup-area-title">
<text>查看页面</text>
</view>
<view class="popup-area-container" v-for="(item,index) in pages" @tap="aaaaaaa(item)">
<view class="popup-area-container" v-for="(item,index) in pages" :key="index" @tap="aaaaaaa(item)">
<text style="display: inline-block">{{item.name}}</text>
</view>
</view>
@ -559,7 +810,24 @@
isCheck: false
}],
dataList: [],
areaList:[]
areaList:[],
checked:'daimaifan',
navBarHeight: 0,
menuListOffsetTop: 0,
lastScrollTop: 0,
isSwitching: true,
yongjin:false,
isArea: false,
shopArea: [{
id: 0,
title: '第一食堂'
}, {
id: 1,
title: '第二食堂'
},{
id: 2,
title: '第三食堂'
}],
}
},
components: {
@ -568,6 +836,26 @@
postList,
myCenter
},
onPageScroll(e) {
const scrollTop = e.scrollTop;
const isScrollingUp = scrollTop < this.lastScrollTop;
//
// 80px
if (isScrollingUp && scrollTop < 80 && !this.isSwitching) {
const currIdx = this.menuList.findIndex(m => m.checked);
if (currIdx > 0) {
this._switchCategory(currIdx - 1);
}
}
this.lastScrollTop = scrollTop;
},
onReachBottom() {
if (this.searchForm.pageNum < this.total) {
this.searchForm.pageNum++;
this.getProduct(this.searchForm.categoryId);
return;
}
},
onLoad() {
//
this.getUserLocation();
@ -583,13 +871,47 @@
});
if(!uni.getStorageSync('area')){
this.checkArea()
console.log("11111")
}else{
let area = JSON.parse(uni.getStorageSync('area'))
this.areaName = area.title
}
// sticky offsetstatusBarHeight + 40px
const info = uni.getSystemInfoSync();
this.navBarHeight = info.statusBarHeight;
},
onReady() {
//
setTimeout(() => {
const query = uni.createSelectorQuery().in(this);
query.select('#menuList').boundingClientRect(rect => {
if (rect) this.menuListOffsetTop = rect.top + this.lastScrollTop;
}).exec();
}, 500);
},
methods: {
// isSwitching
_switchCategory(index) {
if (this.isSwitching) return;
this.isSwitching = true;
this.checkTab(index);
// 400ms200ms200ms
setTimeout(() => { this.isSwitching = false; }, 400);
},
checkTab(index) {
for (let i = 0; i < this.menuList.length; i++) {
this.menuList[i].checked = (i === index);
}
//
this.searchForm.pageNum = 1;
this.pageNum = 1;
this.total = 1;
this.productItem = [];
// this.getProduct(this.menuList[index].id);
// nav-bar
// menuListOffsetTop - navBarHeight 使sticky
const target = this.menuListOffsetTop - this.navBarHeight;
uni.pageScrollTo({ scrollTop: target > 0 ? target : 0, duration: 200 });
},
//便
aaaaaaa(item){
uni.navigateTo({
@ -642,6 +964,16 @@
}
})
},
searchShop(type, value) {
if (type == 'area') {
// this.searchForm.shopArea = value
} else if (type == 'baozhang') {
this.baozhang = !this.baozhang
} else if (type == 'yongjin') {
this.yongjin = !this.yongjin
}
this.getShopList();
},
//
getUserLocation() {
uni.getLocation({
@ -666,6 +998,10 @@
}
});
},
checkTab(type){
this.checked = type
this.$forceUpdate()
},
// 使WebSocket
getDeliveryLocation() {
// WebSocket
@ -739,6 +1075,9 @@
}
})
},
checkAdd() {
this.isArea = !this.isArea
},
//tab
changeIndex(index) {
let that = this;
@ -746,7 +1085,6 @@
this.currentIndex = index
switch (index) {
case 1:
console.log(that.$refs)
let worker = uni.getStorageSync('worker')
if(worker == '' || worker == undefined || worker == null){
this.tui.toast('您还没有注册兼职')
@ -968,8 +1306,11 @@
display: flex;
height: 60rpx;
line-height: 60rpx;
position: sticky;
top:0;
z-index:90;
}
.like-title {
width: 218rpx;
height: 64rpx;
@ -1067,7 +1408,7 @@
.list-1 {
width: 98%;
height: 500rpx;
max-height: 640rpx;
background: #fff;
border-radius: 20rpx;
margin: 20rpx auto 0;
@ -1234,14 +1575,19 @@
.paotui-title{
display: flex;
flex: 1;
line-height: 44px;
text-align: right;
padding-right: 10px;
}
.paotui-text{
font-size: 14px;
color: red;
font-weight: bold;
flex: 1;
}
.paotui-num{
font-size: 12px;
padding: 0 5px;
}
.popup-area-content {
align-items: center;
@ -1270,4 +1616,98 @@
border-top: 1px solid #eee;
color: #fff;
}
.chaoda{
height: 15px;
line-height: 15px;
margin: 5px 0 0 10px;
padding: 0 5px;
background: rgba(255, 117, 88, 1);
color: #fff;
border-radius: 5px;
font-size: 10px;
}
.beizhu{
width: 95%;
margin: 0 auto;
background: rgba(255, 117, 88, 0.08);
border: 1px solid rgba(255, 117, 88, 0.12);
border-radius: 10px;
height: 60px;
padding: 10px;
color: rgba(255, 57, 57, 1);
}
.title-sort {
height: 100rpx;
display: flex;
position: sticky;
top:0;
z-index:90;
background: #fff;
padding-top:10px;
}
.sort-text{
height: 70rpx;
display: flex;
position: sticky;
top:0;
z-index:90;
background: #fff;
}
.sort-member {
height: 60rpx;
line-height: 60rpx;
text-align: center;
background: #eee;
width: 24%;
margin-left: 4%;
border-radius: 10rpx;
}
.sort-value {
width: 160rpx;
height: auto;
max-height: 300rpx;
overflow: scroll;
background: rgba(0, 0, 0, 0.7);
position: absolute;
top: 80rpx;
right: 0;
border-radius: 20rpx;
color: #fff;
font-size: 22rpx;
}
.sort-value1 {
border-bottom: 1rpx solid #eee;
}
.guize1-qusong {
display: flex;
margin-left: 20px;
}
.qusong1 {
width: 20px;
height: 20px;
background: rgba(0, 35, 28, 1);
color: #fff;
border-radius: 20px;
text-align: center;
line-height: 20px;
font-size: 10px;
z-index: 80;
}
.qusong2 {
height: 20px;
font-size: 12px;
line-height: 19px;
text-align: center;
background: rgba(166, 255, 234, 0.5);
padding: 0 10px;
margin-left: -5px;
font-weight: 700;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
}
</style>
Loading…
Cancel
Save