wangfukang 3 weeks ago
parent
commit
bc72395725
  1. 159
      pages/index/index.vue

159
pages/index/index.vue

@ -161,7 +161,7 @@
</view> </view>
<view class="daimai-box" style="padding-bottom:180rpx;"> <view class="daimai-box" style="padding-bottom:180rpx;">
<view class="daimai-tab" id="menuList" :style="{'top': navBarHeight + 'px','background':lastScrollTop>583?'#fff':''}"> <view class="daimai-tab" id="menuList" :style="{'top': navBarHeight + 'px','background':lastScrollTop>583?'#fff':''}">
<view @tap="checkTab('waimai')"> <view @tap="checkTab1('waimai')">
<view class="like-title" style="position: relative;width: 240rpx;" v-if="checked == 'waimai'"> <view class="like-title" style="position: relative;width: 240rpx;" v-if="checked == 'waimai'">
<img src="/static/images/img/daimaifantitle.png" alt="" style="width: 220rpx;" /> <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;">{{waimaiCount}}</text> <text style="position: absolute;top: 0;right: 0;font-size: 36rpx;font-weight: 700;">{{waimaiCount}}</text>
@ -170,7 +170,7 @@
外卖{{waimaiCount}} 外卖{{waimaiCount}}
</view> </view>
</view> </view>
<view @tap="checkTab('kuaidi')" style="margin-left: 15px;"> <view @tap="checkTab1('kuaidi')" style="margin-left: 15px;">
<view class="like-title" style="position: relative;width:320rpx;" v-if="checked == 'kuaidi'"> <view class="like-title" style="position: relative;width:320rpx;" v-if="checked == 'kuaidi'">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/99162216d23a44a8ba81c7cb5249f3b8.png" alt="" style="width: 270rpx;"> <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;">{{kuaidiCount}}</text> <text style="position: absolute;top: 0;right: 0;font-size: 36rpx;font-weight: 700;">{{kuaidiCount}}</text>
@ -179,7 +179,7 @@
快递{{kuaidiCount}} 快递{{kuaidiCount}}
</view> </view>
</view> </view>
<view @tap="checkTab('paotui')" style="margin-left: 15px;"> <view @tap="checkTab1('paotui')" style="margin-left: 15px;">
<view class="like-title" style="position: relative;width:320rpx;" v-if="checked == 'paotui'"> <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;"> <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;">{{paotuiCount}}</text> <text style="position: absolute;top: 0;right: 0;font-size: 36rpx;font-weight: 700;">{{paotuiCount}}</text>
@ -188,7 +188,7 @@
跑腿{{paotuiCount}} 跑腿{{paotuiCount}}
</view> </view>
</view> </view>
<view @tap="checkTab('zhipai')" style="margin-left: 15px;" v-if="worker != null"> <view @tap="checkTab1('zhipai')" style="margin-left: 15px;" v-if="worker != null">
<view class="like-title" style="position: relative;width:320rpx;" v-if="checked == 'zhipai'"> <view class="like-title" style="position: relative;width:320rpx;" v-if="checked == 'zhipai'">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/99162216d23a44a8ba81c7cb5249f3b8.png" alt="" style="width: 270rpx;"> <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;">{{zhipaiCount}}</text> <text style="position: absolute;top: 0;right: 0;font-size: 36rpx;font-weight: 700;">{{zhipaiCount}}</text>
@ -203,40 +203,40 @@
<view @tap="checkAdd"> <view @tap="checkAdd">
取餐地址 <text style="font-size: 20rpx;"></text> 取餐地址 <text style="font-size: 20rpx;"></text>
</view> </view>
<view class="sort-value" v-if="isArea"> <view class="sort-value" v-if="isgetArea">
<view class="sort-value1" v-for="(item,index) in shopArea" :key="index" <view class="sort-value1" v-for="(item,index) in getshopArea" :key="index"
@tap="searchShop('area',item.id)">{{item.title}}</view> @tap="searchOrder('getarea',item)">{{item.title}}</view>
</view> </view>
</view> </view>
<view class="sort-member" style="position: relative;"> <view class="sort-member" style="position: relative;">
<view @tap="checkAdd"> <view @tap="checkAdd1">
送餐地址 <text style="font-size: 20rpx;"></text> 送餐地址 <text style="font-size: 20rpx;"></text>
</view> </view>
<view class="sort-value" v-if="isArea"> <view class="sort-value" v-if="isputArea">
<view class="sort-value1" v-for="(item,index) in shopArea" :key="index" <view class="sort-value1" v-for="(item,index) in putshopArea" :key="index"
@tap="searchShop('area',item.id)">{{item.title}}</view> @tap="searchOrder('putarea',item)">{{item.title}}</view>
</view> </view>
</view> </view>
<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 @tap="searchOrder('yongjin')" class="sort-member" style="border-radius: 60rpx" :style="{'background':checkYongjin==true?'rgba(138, 255, 67, 0.16)':'#eee','border':checkYongjin==true?'1px solid rgba(138, 255, 67, 1)':'0'}">
佣金 佣金
</view> </view>
</view> </view>
<view class="sort-text" v-if="lastScrollTop>583" :style="{'top': (navBarHeight+80) + 'px'}"> <view class="sort-text" v-if="lastScrollTop>583" :style="{'top': (navBarHeight+80) + 'px'}">
<view style="display: flex; width: 100%;"> <view style="display: flex; width: 100%;">
<view class="guize1-qusong"> <view @tap="searchOrder('delgetarea',item)" class="guize1-qusong" v-if="getAreaData.id != undefined">
<view class="qusong1"> <view class="qusong1">
</view> </view>
<view class="qusong2"> <view class="qusong2">
第一食堂 {{getAreaData.title}}
</view> </view>
</view> </view>
<view class="guize1-qusong"> <view @tap="searchOrder('delputarea',item)" class="guize1-qusong" v-if="putAreaData.id != undefined">
<view class="qusong1"> <view class="qusong1">
</view> </view>
<view class="qusong2" style="background: rgba(209, 206, 255, 1);"> <view class="qusong2" style="background: rgba(209, 206, 255, 1);">
第一食堂 {{putAreaData.title}}
</view> </view>
</view> </view>
</view> </view>
@ -453,8 +453,8 @@
areaName:'', areaName:'',
indicatorDots: false, indicatorDots: false,
autoplay: true, autoplay: true,
deliveryItem:[] deliveryItem:[],
, interval: 4000, interval: 4000,
duration: 1000, duration: 1000,
latitude: 39.909, // latitude: 39.909, //
longitude: 116.39742, // longitude: 116.39742, //
@ -482,7 +482,10 @@
hallOnly: true, hallOnly: true,
status: 0, status: 0,
pageNum:1, pageNum:1,
regionId:JSON.parse(uni.getStorageSync('area')).id, getAreaId:'',
putAreaId:'',
order:'',
regionId:'',
deliveryType: 1, deliveryType: 1,
waimaiData: [], waimaiData: [],
workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : '', workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : '',
@ -494,18 +497,14 @@
lastScrollTop: 0, lastScrollTop: 0,
worker:null, worker:null,
isSwitching: true, isSwitching: true,
getAreaData:{},
putAreaData:{},
yongjin:false, yongjin:false,
isArea: false, isgetArea: false,
shopArea: [{ isputArea:false,
id: 0, checkYongjin:false,
title: '第一食堂' getshopArea: [],
}, { putshopArea: []
id: 1,
title: '第二食堂'
},{
id: 2,
title: '第三食堂'
}],
} }
}, },
components: { components: {
@ -546,12 +545,33 @@
} }
}, },
onLoad() { onLoad() {
},
onShow() {
let that = this
uni.getSystemInfo({
success: function(info) {
that.width = info.screenWidth * 2;
}
});
let worker = uni.getStorageSync('worker') let worker = uni.getStorageSync('worker')
if(worker != '' && worker != undefined && worker != null){ if(worker != '' && worker != undefined && worker != null){
this.worker = worker this.worker = worker
} }
// //
this.getUserLocation(); this.getUserLocation();
// WebSocket
this.getDeliveryLocation();
if(!uni.getStorageSync('area')){
this.checkArea()
}else{
if(uni.getStorageSync('area')){
this.searchForm.regionId = JSON.parse(uni.getStorageSync('area')).id;
}
this.getDelivery();
this.getShopArea();
let area = JSON.parse(uni.getStorageSync('area'))
this.areaName = area.title
if(uni.getStorageSync('waimaiData')){ if(uni.getStorageSync('waimaiData')){
let waimailist = uni.getStorageSync('waimaiData') let waimailist = uni.getStorageSync('waimaiData')
if(waimailist.length > 0){ if(waimailist.length > 0){
@ -576,22 +596,6 @@
} }
} }
} }
// WebSocket
this.getDeliveryLocation();
this.getDelivery();
},
onShow() {
let that = this
uni.getSystemInfo({
success: function(info) {
that.width = info.screenWidth * 2;
}
});
if(!uni.getStorageSync('area')){
this.checkArea()
}else{
let area = JSON.parse(uni.getStorageSync('area'))
this.areaName = area.title
} }
// sticky offsetstatusBarHeight + 40px // sticky offsetstatusBarHeight + 40px
const info = uni.getSystemInfoSync(); const info = uni.getSystemInfoSync();
@ -718,6 +722,9 @@
}, },
onClickArea(item){ onClickArea(item){
uni.setStorageSync('area',JSON.stringify(item)) uni.setStorageSync('area',JSON.stringify(item))
this.searchForm.regionId = item.id
this.getDelivery();
this.getShopArea();
let that = this let that = this
that.tui.request("/worker/admin/add", "POST", {userId:uni.getStorageSync('id'),isChangeArea:0,region:item.id}, false, true).then((res) => { that.tui.request("/worker/admin/add", "POST", {userId:uni.getStorageSync('id'),isChangeArea:0,region:item.id}, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -742,15 +749,54 @@
} }
}) })
}, },
searchShop(type, value) { getShopArea(){
if (type == 'area') { let that = this
console.log(that.searchForm.regionId)
that.tui.request("/app/shopArea/getByParentId/"+ that.searchForm.regionId, "GET", {}, false, true).then((res) => {
if (res.code == 200) {
if(res.result != null){
that.getshopArea = res.result
that.putshopArea = res.result
}
} else {
that.tui.toast(res.message)
return
}
}).catch((res) => {})
},
searchOrder(type, value) {
if (type == 'getarea') {
if(this.searchForm.getAreaId == value.id){
this.searchForm.getAreaId = ''
this.getAreaData = {}
}else{
this.searchForm.getAreaId = value.id
this.getAreaData = value
}
this.isgetArea = !this.isgetArea
// this.searchForm.shopArea = value // this.searchForm.shopArea = value
} else if (type == 'baozhang') { } else if (type == 'putarea') {
this.baozhang = !this.baozhang if(this.searchForm.putAreaId == value.id){
} else if (type == 'yongjin') { this.searchForm.putAreaId = ''
this.yongjin = !this.yongjin this.putAreaData = {}
}else{
this.searchForm.putAreaId = value.id
this.putAreaData = value
}
this.isputArea = !this.isputArea
}else if (type == 'yongjin') {
this.checkYongjin = !this.checkYongjin
if(this.checkYongjin){
this.searchForm.order = 'deliveryFee'
}else{
this.searchForm.order = ''
} }
this.getShopList(); }else if(type == 'delgetarea'){
this.getAreaData = {}
}else if(type == 'delputarea'){
this.putAreaData = {}
}
this.getDelivery();
}, },
// //
getUserLocation() { getUserLocation() {
@ -776,7 +822,7 @@
} }
}); });
}, },
checkTab(type){ checkTab1(type){
this.checked = type this.checked = type
if(type == 'waimai'){ if(type == 'waimai'){
this.searchForm.deliveryType = 1 this.searchForm.deliveryType = 1
@ -869,7 +915,10 @@
}) })
}, },
checkAdd() { checkAdd() {
this.isArea = !this.isArea this.isgetArea = !this.isgetArea
},
checkAdd1() {
this.isputArea = !this.isputArea
}, },
//tab //tab
changeIndex(index) { changeIndex(index) {

Loading…
Cancel
Save