111
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

349 lines
7.7 KiB

2 years ago
<template>
<view :style="{top:(styles.top + styles.height + 10 )+'px'}" class="header">
<view class="sele_car">
<view @click="backFn()" class="flex ac">
<uni-icons type="back" size="30"></uni-icons>
<!-- <uni-icond type="back" size="30"></uni-icond> -->
</view>
<view class=" flex sele_car_right">
1 year ago
<view @click="chooseLocation('start')" class=" Padding flex ac flexone height79">
2 years ago
<view class="yuan" />
<view class="flexone margin size">{{Route.start.title}}</view>
</view>
1 year ago
1 year ago
<view v-for="item,index in midwayPointList" :key="index" @click="chooseLocation('midwayPoint',index)"
class=" Padding addressInput flex ac flexone height79">
1 year ago
<view style="background-color: #32CD32;" class="yuan" />
<view class="flexone margin size">{{item.title || '请输入途经点'}}</view>
1 year ago
<image @click.stop="removeLocation(index)" class="remove" src="../../../static/img/remove.png">
</image>
1 year ago
</view>
<view @click="chooseLocation('end')" class=" Padding addressInput flex ac flexone height79">
2 years ago
<view style="background-color: #FF6700;" class="yuan" />
<view class="flexone margin size colorb">{{Route.end.title||'请输入终点'}}</view>
1 year ago
<image v-if="midwayPointList.length <= 1" @click.stop="additionLocation"
:style="{'top':midwayPointList.length?'50%':'0'}" class="addition"
src="../../../static/img/addition.png"></image>
2 years ago
</view>
</view>
</view>
<view v-if="isShow.conditions" class="filter">
<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">
1 year ago
<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>
2 years ago
</view>
</view>
</view>
</view>
</template>
<script>
import oilSiteApi from '@/api/oil-site.js'
export default {
props: {
Route: {
type: Object,
default: () => {
return {}
}
},
polyline: {
type: Array,
default: () => []
}
},
watch: {
polyline: function(n, o) {
if (n.length !== 0) {
this.isShow.conditions = true
} else {
this.isShow.conditions = false
}
}
},
data() {
return {
styles: {},
isShow: {
conditions: false
},
1 year ago
midwayPointList: [],
1 year ago
header: null,
2 years ago
menuList: [{
title: '距离',
value: '5KM/5',
field: 'juLi',
SublistOpen: false,
Sublist: [{
lable: '5KM',
value: '5'
}, {
lable: '20KM',
value: '20'
}, {
lable: '30KM',
value: '30'
1 year ago
}, {
2 years ago
lable: '50KM',
value: '50'
}]
},
{
title: '全类型',
value: '全部/2',
field: 'highSpeed',
SublistOpen: false,
1 year ago
Sublist: [{
2 years ago
lable: '全部',
value: '2'
},
{
1 year ago
lable: '高速',
value: '1'
}, {
lable: '非高速',
value: '0'
}
2 years ago
]
}
]
}
},
mounted() {
this.styles = uni.getMenuButtonBoundingClientRect();
const query = uni.createSelectorQuery().in(this);
query.select('.header').boundingClientRect(data => {
1 year ago
console.log("得到布局位置信息" + JSON.stringify(data));
this.header = data
console.log("节点离页面顶部的距离为" + data.top);
2 years ago
}).exec();
},
created() {
this.getConditionMenu();
},
methods: {
1 year ago
removeLocation(index) {
this.midwayPointList.splice(index, 1)
this.$parent.passiveRedraw(this.midwayPointList)
1 year ago
1 year ago
},
additionLocation() {
this.midwayPointList.push({
longitude: '',
latitude: '',
title: ''
})
},
1 year ago
getElement() {
2 years ago
return this.styles.top + this.styles.height + 10 + this.header.height
},
1 year ago
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())
2 years ago
}
},
getConditionMenu() {
oilSiteApi.getConditionMenu().then(res => {
if (res.code !== 20000) return
1 year ago
Object.keys(res.data).forEach((item, index) => {
2 years ago
let data = {
1 year ago
title: index == 0 ? '全渠道' : '油品',
value: index == 0 ? '全渠道/' : '0#/0#',
field: index == 0 ? 'siteChannel' : 'oilProductCode',
2 years ago
SublistOpen: false,
Sublist: []
}
1 year ago
res.data[item].forEach(items => {
2 years ago
data.Sublist.push({
1 year ago
lable: index == 0 ? items.name : items.id,
value: items.id
2 years ago
})
})
1 year ago
if (item === 'productCodes') {
this.menuList.push(data)
}
2 years ago
})
this.menuList[2].Sublist.unshift({
1 year ago
lable: '全渠道',
value: ''
2 years ago
});
1 year ago
[this.menuList[0], this.menuList[1], this.menuList[2], ] = [this.menuList[0],
this.menuList[2], this.menuList[1]
1 year ago
];
2 years ago
})
},
1 year ago
datassFn() {
2 years ago
let data = {}
1 year ago
this.menuList.forEach((item, index) => {
data[item.field] = item.value ? item.value.split('/')[1] : ''
2 years ago
})
return data
},
seleFilter(e, w) {
1 year ago
this.menuList.forEach((item, index) => {
if (w == index) return
2 years ago
item.SublistOpen = false
})
e.SublistOpen = !e.SublistOpen;
this.$emit('closeFooterScroll')
},
1 year ago
chooseLocation(e, index) {
2 years ago
uni.navigateTo({
url: './chooseLocation?type=' +
1 year ago
`${e}/${this.Route.start.latitude},${this.Route.start.longitude}/${index}/${JSON.stringify(this.midwayPointList)}`
2 years ago
})
},
backFn() {
uni.navigateBack()
}
}
}
</script>
<style scoped>
.conditions {
position: absolute;
background-color: #FFFFFF;
width: 100%;
max-height: 200rpx;
top: 68rpx;
display: flex;
flex-direction: column;
gap: 15rpx;
/* padding: 21rpx 0; */
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
overflow: auto;
transition: max-height 0.3s, opacity 0.3s;
opacity: 1;
}
.filter_item {
flex: 1;
background-color: #FFFFFF;
border-radius: 10px;
margin-top: 30rpx;
padding: 24rpx 0;
text-align: center;
position: relative;
1 year ago
/* border-bottom-left-radius: 10px;
2 years ago
border-bottom-right-radius: 10px; */
}
.filter {
font-size: 28rpx;
width: 100%;
display: flex;
gap: 20rpx;
color: #666666;
}
.colorb {
color: #BBBBBB;
}
.Padding {
padding: 0 28rpx;
}
1 year ago
2 years ago
.addressInput {
1 year ago
margin: 7rpx 0;
position: relative;
2 years ago
background: #F0F0F0;
border-radius: 10px;
}
.textoverflow {
overflow: hidden;
text-overflow: ellipsis;
}
.size {
font-size: 28rpx;
color: #666666;
}
.margin {
margin: 0 28rpx;
}
.flexone {
1 year ago
position: relative;
/* flex: 1; */
}
.addition,
.remove {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: -52rpx;
width: 42rpx;
height: 42rpx;
}
.height79 {
height: 79rpx;
2 years ago
}
.yuan {
width: 20rpx;
height: 20rpx;
background: #2E8EF7;
border-radius: 50%;
}
.sele_car_right {
1 year ago
/* position: relative; */
2 years ago
flex-direction: column;
padding-left: 27.2rpx;
1 year ago
width: 100%;
2 years ago
}
.flex {
display: flex;
}
.jc {
justify-content: center;
}
.ac {
align-items: center;
}
.sele_car {
1 year ago
/* height: 194rpx; */
2 years ago
background: #FFFFFF;
border-radius: 10px;
1 year ago
padding: 18rpx 37px 22rpx 32rpx;
2 years ago
display: flex;
}
.header {
width: 100vw;
position: absolute;
z-index: 999999;
padding: 0 44rpx;
}
</style>