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

193
pages/index/index.vue

@ -161,7 +161,7 @@
</view>
<view class="daimai-box" style="padding-bottom:180rpx;">
<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'">
<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>
@ -170,7 +170,7 @@
外卖{{waimaiCount}}
</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'">
<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>
@ -179,7 +179,7 @@
快递{{kuaidiCount}}
</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'">
<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>
@ -188,7 +188,7 @@
跑腿{{paotuiCount}}
</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'">
<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>
@ -203,40 +203,40 @@
<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 class="sort-value" v-if="isgetArea">
<view class="sort-value1" v-for="(item,index) in getshopArea" :key="index"
@tap="searchOrder('getarea',item)">{{item.title}}</view>
</view>
</view>
<view class="sort-member" style="position: relative;">
<view @tap="checkAdd">
<view @tap="checkAdd1">
送餐地址 <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 class="sort-value" v-if="isputArea">
<view class="sort-value1" v-for="(item,index) in putshopArea" :key="index"
@tap="searchOrder('putarea',item)">{{item.title}}</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 class="sort-text" v-if="lastScrollTop>583" :style="{'top': (navBarHeight+80) + 'px'}">
<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>
<view class="qusong2">
第一食堂
{{getAreaData.title}}
</view>
</view>
<view class="guize1-qusong">
<view @tap="searchOrder('delputarea',item)" class="guize1-qusong" v-if="putAreaData.id != undefined">
<view class="qusong1">
</view>
<view class="qusong2" style="background: rgba(209, 206, 255, 1);">
第一食堂
{{putAreaData.title}}
</view>
</view>
</view>
@ -453,8 +453,8 @@
areaName:'',
indicatorDots: false,
autoplay: true,
deliveryItem:[]
, interval: 4000,
deliveryItem:[],
interval: 4000,
duration: 1000,
latitude: 39.909, //
longitude: 116.39742, //
@ -482,7 +482,10 @@
hallOnly: true,
status: 0,
pageNum:1,
regionId:JSON.parse(uni.getStorageSync('area')).id,
getAreaId:'',
putAreaId:'',
order:'',
regionId:'',
deliveryType: 1,
waimaiData: [],
workerId: uni.getStorageSync('worker') ? uni.getStorageSync('worker').workerId : '',
@ -494,18 +497,14 @@
lastScrollTop: 0,
worker:null,
isSwitching: true,
getAreaData:{},
putAreaData:{},
yongjin:false,
isArea: false,
shopArea: [{
id: 0,
title: '第一食堂'
}, {
id: 1,
title: '第二食堂'
},{
id: 2,
title: '第三食堂'
}],
isgetArea: false,
isputArea:false,
checkYongjin:false,
getshopArea: [],
putshopArea: []
}
},
components: {
@ -546,39 +545,7 @@
}
},
onLoad() {
let worker = uni.getStorageSync('worker')
if(worker != '' && worker != undefined && worker != null){
this.worker = worker
}
//
this.getUserLocation();
if(uni.getStorageSync('waimaiData')){
let waimailist = uni.getStorageSync('waimaiData')
if(waimailist.length > 0){
for(let a = 0;a<waimailist.length;a++){
let waimai = {
getAreaId:waimailist[a].getAreaId,
putAreaId:waimailist[a].putAreaId
}
this.searchForm.waimaiData.push(waimai)
}
}
}
if(uni.getStorageSync('kuaidiData')){
let waimailist = uni.getStorageSync('kuaidiData')
if(waimailist.length > 0){
for(let a = 0;a<waimailist.length;a++){
let waimai = {
getAreaId:waimailist[a].getAreaId,
putAreaId:waimailist[a].putAreaId
}
this.searchForm.kuaidiData.push(waimai)
}
}
}
// WebSocket
this.getDeliveryLocation();
this.getDelivery();
},
onShow() {
let that = this
@ -587,11 +554,48 @@
that.width = info.screenWidth * 2;
}
});
let worker = uni.getStorageSync('worker')
if(worker != '' && worker != undefined && worker != null){
this.worker = worker
}
//
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')){
let waimailist = uni.getStorageSync('waimaiData')
if(waimailist.length > 0){
for(let a = 0;a<waimailist.length;a++){
let waimai = {
getAreaId:waimailist[a].getAreaId,
putAreaId:waimailist[a].putAreaId
}
this.searchForm.waimaiData.push(waimai)
}
}
}
if(uni.getStorageSync('kuaidiData')){
let waimailist = uni.getStorageSync('kuaidiData')
if(waimailist.length > 0){
for(let a = 0;a<waimailist.length;a++){
let waimai = {
getAreaId:waimailist[a].getAreaId,
putAreaId:waimailist[a].putAreaId
}
this.searchForm.kuaidiData.push(waimai)
}
}
}
}
// sticky offsetstatusBarHeight + 40px
const info = uni.getSystemInfoSync();
@ -718,6 +722,9 @@
},
onClickArea(item){
uni.setStorageSync('area',JSON.stringify(item))
this.searchForm.regionId = item.id
this.getDelivery();
this.getShopArea();
let that = this
that.tui.request("/worker/admin/add", "POST", {userId:uni.getStorageSync('id'),isChangeArea:0,region:item.id}, false, true).then((res) => {
if (res.code == 200) {
@ -742,15 +749,54 @@
}
})
},
searchShop(type, value) {
if (type == 'area') {
getShopArea(){
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
} else if (type == 'baozhang') {
this.baozhang = !this.baozhang
} else if (type == 'yongjin') {
this.yongjin = !this.yongjin
} else if (type == 'putarea') {
if(this.searchForm.putAreaId == value.id){
this.searchForm.putAreaId = ''
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 = ''
}
}else if(type == 'delgetarea'){
this.getAreaData = {}
}else if(type == 'delputarea'){
this.putAreaData = {}
}
this.getShopList();
this.getDelivery();
},
//
getUserLocation() {
@ -776,7 +822,7 @@
}
});
},
checkTab(type){
checkTab1(type){
this.checked = type
if(type == 'waimai'){
this.searchForm.deliveryType = 1
@ -869,7 +915,10 @@
})
},
checkAdd() {
this.isArea = !this.isArea
this.isgetArea = !this.isgetArea
},
checkAdd1() {
this.isputArea = !this.isputArea
},
//tab
changeIndex(index) {

Loading…
Cancel
Save