|
|
|
@ -21,7 +21,10 @@ |
|
|
|
|
<view v-for="(item,index) in menuList" :key='index' class="filter_item"> |
|
|
|
|
<view @click="seleFilter(item,index)"> {{ item.value?item.value.split('/')[0]:item.title}} </view> |
|
|
|
|
<view :style="{maxHeight:item.SublistOpen?'200rpx':'0rpx'}" class="conditions"> |
|
|
|
|
<view :style="{color:item.value?item.value.split('/')[0] == items.lable?'#666666':'#bbbbbb':'#bbbbbb'}" @click="filterItemSele(index,indexs)" v-for="(items,indexs) in item.Sublist" :key='indexs' style="margin-bottom: 10rpx; font-size: 25rpx;">{{items.lable}}</view> |
|
|
|
|
<view |
|
|
|
|
:style="{color:item.value?item.value.split('/')[0] == items.lable?'#666666':'#bbbbbb':'#bbbbbb'}" |
|
|
|
|
@click="filterItemSele(index,indexs)" v-for="(items,indexs) in item.Sublist" :key='indexs' |
|
|
|
|
style="margin-bottom: 10rpx; font-size: 25rpx;">{{items.lable}}</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -59,7 +62,7 @@ |
|
|
|
|
isShow: { |
|
|
|
|
conditions: false |
|
|
|
|
}, |
|
|
|
|
header:null, |
|
|
|
|
header: null, |
|
|
|
|
menuList: [{ |
|
|
|
|
title: '距离', |
|
|
|
|
value: '5KM/5', |
|
|
|
@ -74,7 +77,7 @@ |
|
|
|
|
}, { |
|
|
|
|
lable: '30KM', |
|
|
|
|
value: '30' |
|
|
|
|
},{ |
|
|
|
|
}, { |
|
|
|
|
lable: '50KM', |
|
|
|
|
value: '50' |
|
|
|
|
}] |
|
|
|
@ -84,19 +87,18 @@ |
|
|
|
|
value: '全部/2', |
|
|
|
|
field: 'highSpeed', |
|
|
|
|
SublistOpen: false, |
|
|
|
|
Sublist: [ |
|
|
|
|
{ |
|
|
|
|
Sublist: [{ |
|
|
|
|
lable: '全部', |
|
|
|
|
value: '2' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
lable: '高速', |
|
|
|
|
value: '1' |
|
|
|
|
}, { |
|
|
|
|
lable: '非高速', |
|
|
|
|
value: '0' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lable: '高速', |
|
|
|
|
value: '1' |
|
|
|
|
}, { |
|
|
|
|
lable: '非高速', |
|
|
|
|
value: '0' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
@ -107,67 +109,70 @@ |
|
|
|
|
console.log(this.styles); |
|
|
|
|
const query = uni.createSelectorQuery().in(this); |
|
|
|
|
query.select('.header').boundingClientRect(data => { |
|
|
|
|
console.log("得到布局位置信息" + JSON.stringify(data)); |
|
|
|
|
this.header = data |
|
|
|
|
console.log("节点离页面顶部的距离为" + data.top); |
|
|
|
|
console.log("得到布局位置信息" + JSON.stringify(data)); |
|
|
|
|
this.header = data |
|
|
|
|
console.log("节点离页面顶部的距离为" + data.top); |
|
|
|
|
}).exec(); |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
this.getConditionMenu(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getElement(){ |
|
|
|
|
getElement() { |
|
|
|
|
return this.styles.top + this.styles.height + 10 + this.header.height |
|
|
|
|
}, |
|
|
|
|
filterItemSele(index,indexs){ |
|
|
|
|
this.menuList[index].value = `${this.menuList[index].Sublist[indexs].lable}/${this.menuList[index].Sublist[indexs].value}`; |
|
|
|
|
this.menuList[index].SublistOpen=false; |
|
|
|
|
console.log(this.datassFn(),'/-/-/'); |
|
|
|
|
if(index==2){ |
|
|
|
|
this.$emit('mapEventListeners','localScreen',this.datassFn()) |
|
|
|
|
}else{ |
|
|
|
|
this.$emit('mapEventListeners','apiScreen',this.datassFn()) |
|
|
|
|
filterItemSele(index, indexs) { |
|
|
|
|
this.menuList[index].value = |
|
|
|
|
`${this.menuList[index].Sublist[indexs].lable}/${this.menuList[index].Sublist[indexs].value}`; |
|
|
|
|
this.menuList[index].SublistOpen = false; |
|
|
|
|
console.log(this.datassFn(), '/-/-/'); |
|
|
|
|
if (index == 2) { |
|
|
|
|
this.$emit('mapEventListeners', 'localScreen', this.datassFn()) |
|
|
|
|
} else { |
|
|
|
|
this.$emit('mapEventListeners', 'apiScreen', this.datassFn()) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getConditionMenu() { |
|
|
|
|
oilSiteApi.getConditionMenu().then(res => { |
|
|
|
|
if (res.code !== 20000) return |
|
|
|
|
Object.keys(res.data).forEach((item,index)=>{ |
|
|
|
|
Object.keys(res.data).forEach((item, index) => { |
|
|
|
|
let data = { |
|
|
|
|
title: index==0?'全渠道':'油品', |
|
|
|
|
value: index==0?'全渠道/':'0#/0#', |
|
|
|
|
field: index==0?'siteChannel':'oilProductCode', |
|
|
|
|
title: index == 0 ? '全渠道' : '油品', |
|
|
|
|
value: index == 0 ? '全渠道/' : '0#/0#', |
|
|
|
|
field: index == 0 ? 'siteChannel' : 'oilProductCode', |
|
|
|
|
SublistOpen: false, |
|
|
|
|
Sublist: [] |
|
|
|
|
} |
|
|
|
|
res.data[item].forEach(items=>{ |
|
|
|
|
res.data[item].forEach(items => { |
|
|
|
|
data.Sublist.push({ |
|
|
|
|
lable:index==0?items.name:items.id, |
|
|
|
|
value:items.id |
|
|
|
|
lable: index == 0 ? items.name : items.id, |
|
|
|
|
value: items.id |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.menuList.push(data) |
|
|
|
|
}) |
|
|
|
|
this.menuList[2].Sublist.unshift({ |
|
|
|
|
lable:'全渠道', |
|
|
|
|
value:'' |
|
|
|
|
lable: '全渠道', |
|
|
|
|
value: '' |
|
|
|
|
}); |
|
|
|
|
// [this.menuList[1],this.menuList[3]]=[this.menuList[3],this.menuList[1]] |
|
|
|
|
[this.menuList[0],this.menuList[1],this.menuList[2],this.menuList[3]] = [this.menuList[0],this.menuList[3],this.menuList[1],this.menuList[2]]; |
|
|
|
|
[this.menuList[0], this.menuList[1], this.menuList[2], this.menuList[3]] = [this.menuList[0], |
|
|
|
|
this.menuList[3], this.menuList[1], this.menuList[2] |
|
|
|
|
]; |
|
|
|
|
console.log(this.menuList, '***') |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
datassFn(){ |
|
|
|
|
datassFn() { |
|
|
|
|
let data = {} |
|
|
|
|
this.menuList.forEach((item,index)=>{ |
|
|
|
|
data[item.field] = item.value?item.value.split('/')[1]:'' |
|
|
|
|
this.menuList.forEach((item, index) => { |
|
|
|
|
data[item.field] = item.value ? item.value.split('/')[1] : '' |
|
|
|
|
}) |
|
|
|
|
return data |
|
|
|
|
}, |
|
|
|
|
seleFilter(e, w) { |
|
|
|
|
this.menuList.forEach((item,index)=>{ |
|
|
|
|
if(w==index) return |
|
|
|
|
this.menuList.forEach((item, index) => { |
|
|
|
|
if (w == index) return |
|
|
|
|
item.SublistOpen = false |
|
|
|
|
}) |
|
|
|
|
e.SublistOpen = !e.SublistOpen; |
|
|
|
@ -212,7 +217,7 @@ |
|
|
|
|
padding: 24rpx 0; |
|
|
|
|
text-align: center; |
|
|
|
|
position: relative; |
|
|
|
|
/* border-bottom-left-radius: 10px; |
|
|
|
|
/* border-bottom-left-radius: 10px; |
|
|
|
|
border-bottom-right-radius: 10px; */ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|