更新
This commit is contained in:
@@ -54,26 +54,31 @@
|
||||
pageSize: {
|
||||
page_size: 15,
|
||||
page: 1
|
||||
}
|
||||
},
|
||||
currentMidwayIndex: '',
|
||||
midwayPointList: ''
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
let that = this
|
||||
// let that = this
|
||||
if (e.type) {
|
||||
console.log(e.type)
|
||||
this.type = e.type.split('/')[0]
|
||||
this.location = e.type.split('/')[1]
|
||||
console.log(this.List, Boolean(Number(this.List)))
|
||||
let arr = e.type.split('/')
|
||||
this.type = arr[0]
|
||||
this.location = arr[1]
|
||||
this.currentMidwayIndex = arr[2]
|
||||
this.midwayPointList = arr[3]
|
||||
|
||||
// console.log(this.List, Boolean(Number(this.List)))
|
||||
this.TXSDK.reverseGeocoder({
|
||||
sig: 'mOPvEv4WmyaxymycTYy00pSiad2jnQil',
|
||||
location: that.location,
|
||||
success(e) {
|
||||
location: this.location,
|
||||
success: (e) => {
|
||||
({
|
||||
province: that.addressData.province,
|
||||
city: that.addressData.city,
|
||||
district: that.addressData.area
|
||||
province: this.addressData.province,
|
||||
city: this.addressData.city,
|
||||
district: this.addressData.area
|
||||
} = e.result.address_component)
|
||||
console.log(e, that.addressData, '地址逆解析')
|
||||
// console.log(e, this.addressData, '地址逆解析')
|
||||
},
|
||||
fail(e) {
|
||||
console.log(e, '地址逆解析 错误')
|
||||
@@ -88,7 +93,7 @@
|
||||
},
|
||||
methods: {
|
||||
seleClick(e) {
|
||||
uni.$emit('UpdateAddress', e, this.type)
|
||||
uni.$emit('UpdateAddress', e, this.type, this.currentMidwayIndex, this.midwayPointList)
|
||||
uni.navigateBack()
|
||||
},
|
||||
chargeChange(e) {
|
||||
@@ -144,10 +149,10 @@
|
||||
})
|
||||
},
|
||||
getSuggestion() {
|
||||
if(!this.seachValue) {
|
||||
if (!this.seachValue) {
|
||||
uni.showToast({
|
||||
title:'还没有输入地址哦~',
|
||||
icon:'none'
|
||||
title: '还没有输入地址哦~',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -7,13 +7,25 @@
|
||||
<!-- <uni-icond type="back" size="30"></uni-icond> -->
|
||||
</view>
|
||||
<view class=" flex sele_car_right">
|
||||
<view @click="chooseLocation('start')" class=" Padding flex ac flexone">
|
||||
|
||||
<view @click="chooseLocation('start')" class=" Padding flex ac flexone height79">
|
||||
<view class="yuan" />
|
||||
<view class="flexone margin size">{{Route.start.title}}</view>
|
||||
</view>
|
||||
<view @click="chooseLocation('end')" class=" Padding addressInput flex ac flexone">
|
||||
|
||||
<view v-for="item,index in midwayPointList" :key="index"
|
||||
@click="chooseLocation('midwayPoint',index)" class=" Padding addressInput flex ac flexone height79">
|
||||
<view style="background-color: #32CD32;" class="yuan" />
|
||||
<view class="flexone margin size">{{item.title || '请输入途经点'}}</view>
|
||||
<image @click.stop="removeLocation(index)" class="remove" src="../../../static/img/remove.png"></image>
|
||||
</view>
|
||||
|
||||
<view @click="chooseLocation('end')" class=" Padding addressInput flex ac flexone height79">
|
||||
<view style="background-color: #FF6700;" class="yuan" />
|
||||
<view class="flexone margin size colorb">{{Route.end.title||'请输入终点'}}</view>
|
||||
<image v-if="midwayPointList.length <= 1" @click.stop="additionLocation"
|
||||
:style="{'top':midwayPointList.length?'50%':'0'}" class="addition"
|
||||
src="../../../static/img/addition.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -62,6 +74,7 @@
|
||||
isShow: {
|
||||
conditions: false
|
||||
},
|
||||
midwayPointList: [],
|
||||
header: null,
|
||||
menuList: [{
|
||||
title: '距离',
|
||||
@@ -106,7 +119,6 @@
|
||||
},
|
||||
mounted() {
|
||||
this.styles = uni.getMenuButtonBoundingClientRect();
|
||||
console.log(this.styles);
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('.header').boundingClientRect(data => {
|
||||
console.log("得到布局位置信息" + JSON.stringify(data));
|
||||
@@ -116,9 +128,21 @@
|
||||
},
|
||||
created() {
|
||||
this.getConditionMenu();
|
||||
|
||||
},
|
||||
methods: {
|
||||
removeLocation(index) {
|
||||
|
||||
this.midwayPointList.splice(index, 1)
|
||||
this.$parent.passiveRedraw(this.midwayPointList)
|
||||
|
||||
},
|
||||
additionLocation() {
|
||||
this.midwayPointList.push({
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
title: ''
|
||||
})
|
||||
},
|
||||
getElement() {
|
||||
return this.styles.top + this.styles.height + 10 + this.header.height
|
||||
},
|
||||
@@ -160,7 +184,7 @@
|
||||
[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, '***')
|
||||
// console.log(this.menuList, '***')
|
||||
})
|
||||
},
|
||||
datassFn() {
|
||||
@@ -178,10 +202,10 @@
|
||||
e.SublistOpen = !e.SublistOpen;
|
||||
this.$emit('closeFooterScroll')
|
||||
},
|
||||
chooseLocation(e) {
|
||||
chooseLocation(e, index) {
|
||||
uni.navigateTo({
|
||||
url: './chooseLocation?type=' +
|
||||
`${e}/${this.Route.start.latitude},${this.Route.start.longitude}`
|
||||
`${e}/${this.Route.start.latitude},${this.Route.start.longitude}/${index}/${JSON.stringify(this.midwayPointList)}`
|
||||
})
|
||||
},
|
||||
backFn() {
|
||||
@@ -237,7 +261,11 @@
|
||||
padding: 0 28rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.addressInput {
|
||||
margin: 7rpx 0;
|
||||
position: relative;
|
||||
background: #F0F0F0;
|
||||
border-radius: 10px;
|
||||
}
|
||||
@@ -257,7 +285,22 @@
|
||||
}
|
||||
|
||||
.flexone {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
/* flex: 1; */
|
||||
}
|
||||
|
||||
.addition,
|
||||
.remove {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
right: -52rpx;
|
||||
width: 42rpx;
|
||||
height: 42rpx;
|
||||
}
|
||||
|
||||
.height79 {
|
||||
height: 79rpx;
|
||||
}
|
||||
|
||||
.yuan {
|
||||
@@ -268,10 +311,11 @@
|
||||
}
|
||||
|
||||
.sele_car_right {
|
||||
/* position: relative; */
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
/* padding: 0 27.2rpx; */
|
||||
padding-left: 27.2rpx;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
.flex {
|
||||
@@ -287,10 +331,10 @@
|
||||
}
|
||||
|
||||
.sele_car {
|
||||
height: 194rpx;
|
||||
/* height: 194rpx; */
|
||||
background: #FFFFFF;
|
||||
border-radius: 10px;
|
||||
padding: 18rpx 32rpx;
|
||||
padding: 18rpx 37px 22rpx 32rpx;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
latitude: '',
|
||||
title: ''
|
||||
},
|
||||
midwayPointList: [], //途径点list
|
||||
end: {
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
@@ -90,6 +91,50 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//监听更新位置事件
|
||||
UpdateAddress() {
|
||||
let that = this
|
||||
uni.$on('UpdateAddress', (region, type, currentMidwayIndex, midwayPointList) => {
|
||||
if (type === 'midwayPoint') {
|
||||
let list = JSON.parse(midwayPointList)
|
||||
|
||||
list[currentMidwayIndex].longitude = region.location.lng
|
||||
list[currentMidwayIndex].latitude = region.location.lat
|
||||
list[currentMidwayIndex].title = region.title;
|
||||
|
||||
|
||||
let addressSelector = this.$refs.addressSelector
|
||||
addressSelector.midwayPointList[currentMidwayIndex].longitude = region.location.lng
|
||||
addressSelector.midwayPointList[currentMidwayIndex].latitude = region.location.lat
|
||||
addressSelector.midwayPointList[currentMidwayIndex].title = region.title;
|
||||
|
||||
this.Route.midwayPointList = list
|
||||
|
||||
} else {
|
||||
this.Route[type].longitude = region.location.lng;
|
||||
this.Route[type].latitude = region.location.lat;
|
||||
this.Route[type].title = region.title;
|
||||
}
|
||||
|
||||
this.Route['midwayPointList'].forEach((item, index) => {
|
||||
if (!item.longitude || !item.latitude) {
|
||||
this.$refs.addressSelector.midwayPointList.splice(index, 1)
|
||||
this.Route.midwayPointList.splice(index, 1)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
this.mapEventListeners('updateRoute', this.Route.start, this.Route.end)
|
||||
this.mapEventListeners('UpdateLocation', this.Route, 'lately')
|
||||
})
|
||||
},
|
||||
|
||||
passiveRedraw(midwayPointList) {
|
||||
this.Route.midwayPointList = midwayPointList
|
||||
this.mapEventListeners('updateRoute')
|
||||
},
|
||||
|
||||
perspectives(item) {
|
||||
let {
|
||||
latitude,
|
||||
@@ -139,7 +184,7 @@
|
||||
let {
|
||||
oilProductCode, juLi, siteChannel
|
||||
} = arguments[1];
|
||||
let markerList = await this.mapUpdateMarkers(this.polyline[0].points, oilProductCode, juLi,
|
||||
let markerList = await this.mapUpdateMarkers(this.polyline[2].points, oilProductCode, juLi,
|
||||
siteChannel);
|
||||
//处理站点数据回显
|
||||
|
||||
@@ -196,9 +241,10 @@
|
||||
// 更新路线规划
|
||||
async mapRoutePlanning(start = this.Route.start, end = this.Route.end, strategy = 'LEAST_TIME') {
|
||||
// 获取路径
|
||||
let res = await this.getMapRoutePlanning(start, end);
|
||||
await this.routePlanning(start, end)
|
||||
// let res = await this.getMapRoutePlanning(start, end);
|
||||
//处理数据
|
||||
this.polyline = this.RoutePlanningHandle(res);
|
||||
// this.polyline = this.RoutePlanningHandle(res);
|
||||
//缩放显示所有经纬度
|
||||
this.zoomRoutePlanning();
|
||||
// 获取筛选数据 更新油站站点
|
||||
@@ -207,7 +253,8 @@
|
||||
juLi,
|
||||
siteChannel
|
||||
} = this.$refs.addressSelector.datassFn();
|
||||
let markerList = await this.mapUpdateMarkers(this.polyline[0].points, oilProductCode, juLi,
|
||||
|
||||
let markerList = await this.mapUpdateMarkers(this.polyline[2].points, oilProductCode, juLi,
|
||||
siteChannel);
|
||||
|
||||
//处理油站站点数据并显示
|
||||
@@ -235,18 +282,7 @@
|
||||
closeAddressSelector() {
|
||||
this.$refs.addressSelector.menuList.forEach(item => item.SublistOpen = false);
|
||||
},
|
||||
//监听更新位置事件
|
||||
UpdateAddress() {
|
||||
let that = this
|
||||
uni.$on('UpdateAddress', function(region, type) {
|
||||
// console.log(`%c ${(type=='start'?'起点更新':'终点更新')} 地址→ ${region.title}`,'color:red;font-size:50px')
|
||||
that.Route[type].longitude = region.location.lng;
|
||||
that.Route[type].latitude = region.location.lat;
|
||||
that.Route[type].title = region.title;
|
||||
that.mapEventListeners('updateRoute', that.Route.start, that.Route.end)
|
||||
that.mapEventListeners('UpdateLocation', that.Route, 'lately')
|
||||
})
|
||||
},
|
||||
|
||||
//拉起导航
|
||||
openMapApp() {
|
||||
let that = this
|
||||
@@ -265,10 +301,12 @@
|
||||
},
|
||||
//获取路线规划
|
||||
getMapRoutePlanning(start, end) {
|
||||
// this.routePlanning(start, end)
|
||||
let {
|
||||
seleIndex
|
||||
} = this.$refs.footerScroll.$data
|
||||
|
||||
|
||||
var _this = this;
|
||||
return new Promise(function(res, rej) {
|
||||
_this.TXSDK.direction({
|
||||
@@ -278,7 +316,6 @@
|
||||
to: end,
|
||||
policy: seleIndex || 'LEAST_TIME',
|
||||
success: function(e) {
|
||||
console.log('获取路线规划成功')
|
||||
res(e)
|
||||
},
|
||||
fail(e) {
|
||||
@@ -289,24 +326,76 @@
|
||||
});
|
||||
}, 1000)
|
||||
rej(e)
|
||||
console.log('获取路线规划失败', e)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
routePlanning(start, end) {
|
||||
let threeLines = []
|
||||
|
||||
let {
|
||||
seleIndex
|
||||
} = this.$refs.footerScroll.$data
|
||||
|
||||
let waypoints = ''
|
||||
if (this.Route.midwayPointList.length) {
|
||||
this.Route.midwayPointList.forEach(item => {
|
||||
waypoints += `${waypoints.length ? ';' : ''}${item.latitude},${item.longitude}`
|
||||
})
|
||||
}
|
||||
let _transfer = (policy) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.TXSDK.direction({
|
||||
sig: 'mOPvEv4WmyaxymycTYy00pSiad2jnQil',
|
||||
mode: 'driving',
|
||||
from: start,
|
||||
to: end,
|
||||
waypoints: waypoints,
|
||||
policy: policy,
|
||||
success: res => {
|
||||
resolve(res)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
let map = {
|
||||
// 顺序会影响线层叠关系,越往后层级越高
|
||||
'LEAST_TIME': [1, 2, 0],
|
||||
'LEAST_FEE': [0, 2, 1],
|
||||
'AVOID_HIGHWAY': [0, 1, 2]
|
||||
}
|
||||
|
||||
return Promise.all([_transfer('LEAST_TIME'), _transfer('LEAST_FEE'), _transfer('AVOID_HIGHWAY')])
|
||||
.then(res => {
|
||||
let currentMap = map[seleIndex]
|
||||
currentMap.forEach((item, index) => {
|
||||
let currentRes = res[item]
|
||||
let [result] = this.RoutePlanningHandle(currentRes)
|
||||
if (index == 2) {
|
||||
result.color = '#FF6700'
|
||||
} else {
|
||||
result.color = '#00BFFF'
|
||||
}
|
||||
threeLines.push(result)
|
||||
})
|
||||
this.polyline = threeLines
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
//获取到的路线规划数据进行处理
|
||||
RoutePlanningHandle(res) {
|
||||
var _this = this;
|
||||
var ret = res;
|
||||
var coors = ret.result.routes[0].polyline,
|
||||
pl = [];
|
||||
//坐标解压(返回的点串坐标,通过前向差分进行压缩)
|
||||
var kr = 1000000;
|
||||
for (var i = 2; i < coors.length; i++) {
|
||||
let coors = res.result.routes[0].polyline
|
||||
let pl = [];
|
||||
//坐标解压(该方法为官方文档提供)
|
||||
let kr = 1000000;
|
||||
for (let i = 2; i < coors.length; i++) {
|
||||
coors[i] = Number(coors[i - 2]) + Number(coors[i]) / kr;
|
||||
}
|
||||
//将解压后的坐标放入点串数组pl中
|
||||
for (var i = 0; i < coors.length; i += 2) {
|
||||
for (let i = 0; i < coors.length; i += 2) {
|
||||
pl.push({
|
||||
latitude: coors[i],
|
||||
longitude: coors[i + 1],
|
||||
@@ -318,8 +407,8 @@
|
||||
return [{
|
||||
points: pl,
|
||||
color: '#FF6700',
|
||||
width: 4,
|
||||
distance: ret.result.routes[0].distance
|
||||
width: 5,
|
||||
distance: res.result.routes[0].distance
|
||||
}]
|
||||
},
|
||||
/* 缩放路线规划 includePoints方法 points:经纬度数组 padding:边距 参考 https://uniapp.dcloud.io/api/location/map?id=cdreatemapcontext */
|
||||
@@ -356,7 +445,7 @@
|
||||
console.log('点击地图')
|
||||
},
|
||||
//更新markers点
|
||||
async mapUpdateMarkers(points = this.polyline[0].points, oilProductCode = '0#', juLi = '5', siteChannel = '') {
|
||||
async mapUpdateMarkers(points = this.polyline[2].points, oilProductCode = '0#', juLi = '5', siteChannel = '') {
|
||||
//标记
|
||||
let {
|
||||
latitude,
|
||||
@@ -372,8 +461,8 @@
|
||||
latitude: latitude || this.coordinate.latitude,
|
||||
longitude: longitude || this.coordinate.longitude
|
||||
}
|
||||
let taht = this;
|
||||
return new Promise(function(re, rj) {
|
||||
// let taht = this;
|
||||
return new Promise((re, rj) => {
|
||||
oilSiteApi.getSiteByGeoHashNew(data).then(markerList => {
|
||||
if (markerList.code !== 20000) {
|
||||
setTimeout(() => {
|
||||
@@ -385,7 +474,7 @@
|
||||
rj(markerList.code + markerList.msg)
|
||||
return
|
||||
}
|
||||
taht.selePrice = {
|
||||
this.selePrice = {
|
||||
middlePrice: markerList.data.middlePrice,
|
||||
minPrice: markerList.data.minPrice
|
||||
}
|
||||
@@ -436,22 +525,18 @@
|
||||
},
|
||||
//点击定位点事件
|
||||
markertap(e) {
|
||||
console.log(e, '点击了ma')
|
||||
console.log('点击了markertap')
|
||||
},
|
||||
//获取当前位置
|
||||
getCurrentLocation() {
|
||||
// let that = this
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success: (res) => {
|
||||
// ({
|
||||
// latitude: that.coordinate.latitude,
|
||||
// longitude: that.coordinate.longitude
|
||||
// } = res);
|
||||
let {
|
||||
latitude,
|
||||
longitude
|
||||
} = res
|
||||
|
||||
this.coordinate.latitude = latitude
|
||||
this.firstLocation.latitude = latitude
|
||||
|
||||
|
||||
BIN
BagStation/static/img/addition.png
Normal file
BIN
BagStation/static/img/addition.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 909 B |
BIN
BagStation/static/img/remove.png
Normal file
BIN
BagStation/static/img/remove.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 871 B |
@@ -5,7 +5,8 @@
|
||||
</cu-custom>
|
||||
<view style="flex: 1;" class="flex_column">
|
||||
<view class="headList">
|
||||
<view class="headList_head" v-for="(list,i) in tabHeadS" :class="[TabHead == i? 'ativeHead':'']" :key='i' @tap='changeHaed(list.value)'>
|
||||
<view class="headList_head" v-for="(list,i) in tabHeadS" :class="[TabHead == i? 'ativeHead':'']"
|
||||
:key='i' @tap='changeHaed(list.value)'>
|
||||
{{list.title}}
|
||||
</view>
|
||||
</view>
|
||||
@@ -14,8 +15,8 @@
|
||||
<view class="cu-bar search bg-white">
|
||||
<view class="search-form round">
|
||||
<text class="cuIcon-search"></text>
|
||||
<input @focus="InputFocus" confirm-type="search" @confirm="onSearch"
|
||||
@blur="InputBlur" v-model="siteName" :adjust-position="false" type="text" placeholder="请输入搜索站点名称" />
|
||||
<input @focus="InputFocus" confirm-type="search" @confirm="onSearch" @blur="InputBlur"
|
||||
v-model="siteAddress" :adjust-position="false" type="text" placeholder="请输入搜索站点名称" />
|
||||
</view>
|
||||
<view class="action" @tap="toMap">
|
||||
<image class="icon shadow-blur round icon-gasstation"
|
||||
@@ -27,9 +28,12 @@
|
||||
<!-- 筛选开始 -->
|
||||
<scroll-view style="flex: 1;" class="screentop bg-white">
|
||||
<view @click="reunrnFn" class="">
|
||||
<sl-filter reflexTitle ref="slFilter" v-if="TabHead == 0" :productCodeList="productCodeList" :areaCodeList="areaCodeList" @result="filterRes" :menuList="menuList" ></sl-filter>
|
||||
<sl-filter reflexTitle ref="slFilter" @result="filterRes" :menuList="ureaMenuList" v-if="TabHead == 1 && changeHs == true"></sl-filter>
|
||||
<sl-filter reflexTitle ref="slFilter" @result="filterRes" :menuList="productTypes" v-if="changeHs == false && TabHead == 1 "></sl-filter>
|
||||
<sl-filter reflexTitle ref="slFilter" v-if="TabHead == 0" :productCodeList="productCodeList"
|
||||
:areaCodeList="areaCodeList" @result="filterRes" :menuList="menuList"></sl-filter>
|
||||
<sl-filter reflexTitle ref="slFilter" @result="filterRes" :menuList="ureaMenuList"
|
||||
v-if="TabHead == 1 && changeHs == true"></sl-filter>
|
||||
<sl-filter reflexTitle ref="slFilter" @result="filterRes" :menuList="productTypes"
|
||||
v-if="changeHs == false && TabHead == 1 "></sl-filter>
|
||||
</view>
|
||||
<view class="bg-white min-height-50 padding-top" v-if="siteList.length>0">
|
||||
<site-item v-for="(item,index) in siteList" :key="item.id" :site-item="item" :first="index==0"
|
||||
@@ -67,30 +71,27 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
companyCard:uni.getStorageSync('companyCard'),
|
||||
getSiteListTimer:null,
|
||||
areaCodeList:[],
|
||||
loadText:'more',
|
||||
changeHs:true,
|
||||
TabHead:0,
|
||||
tabHeadS:[
|
||||
{
|
||||
title:'加油站',
|
||||
value:0,
|
||||
},{
|
||||
title:'尿素站',
|
||||
value:1,
|
||||
}
|
||||
],
|
||||
productCodeList:null,
|
||||
companyCard: uni.getStorageSync('companyCard'),
|
||||
getSiteListTimer: null,
|
||||
areaCodeList: [],
|
||||
loadText: 'more',
|
||||
changeHs: true,
|
||||
TabHead: 0,
|
||||
tabHeadS: [{
|
||||
title: '加油站',
|
||||
value: 0,
|
||||
}, {
|
||||
title: '尿素站',
|
||||
value: 1,
|
||||
}],
|
||||
productCodeList: null,
|
||||
filterDatas: {
|
||||
oilProductCode: '0#'
|
||||
},
|
||||
ureaFilterDatas:[],
|
||||
ureaFilterDatas: [],
|
||||
loadStatus: 'load',
|
||||
siteName: '',
|
||||
menuList: [
|
||||
{
|
||||
siteAddress: '',
|
||||
menuList: [{
|
||||
title: '距离优先',
|
||||
isMutiple: false,
|
||||
key: 'sort',
|
||||
@@ -130,15 +131,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// title: '渠道',
|
||||
// isMutiple: false,
|
||||
// key: 'channelCode',
|
||||
// detailList: [{
|
||||
// title: "全部",
|
||||
// value: ""
|
||||
// }]
|
||||
// },
|
||||
|
||||
{
|
||||
title: '0#轻柴油',
|
||||
key: 'oilProductCode',
|
||||
@@ -153,7 +146,7 @@
|
||||
key: 'siteBrand',
|
||||
isSort: true,
|
||||
isMutiple: false,
|
||||
detailLists:[{
|
||||
detailLists: [{
|
||||
title: "全部",
|
||||
value: ""
|
||||
}],
|
||||
@@ -163,22 +156,20 @@
|
||||
}]
|
||||
}
|
||||
],
|
||||
ureaMenuList:[
|
||||
{
|
||||
ureaMenuList: [{
|
||||
title: '加注方式',
|
||||
isMutiple: false,
|
||||
key: 'formats',
|
||||
detailList: [{
|
||||
title: "全部",
|
||||
value: ""
|
||||
},{
|
||||
}, {
|
||||
title: "加注机",
|
||||
value: "1"
|
||||
},{
|
||||
}, {
|
||||
title: "桶装",
|
||||
value: "2"
|
||||
},
|
||||
]
|
||||
}, ]
|
||||
},
|
||||
{
|
||||
title: '桶装品牌',
|
||||
@@ -188,31 +179,29 @@
|
||||
title: "全部",
|
||||
value: ""
|
||||
}]
|
||||
},],
|
||||
productTypes:[
|
||||
{
|
||||
},
|
||||
],
|
||||
productTypes: [{
|
||||
title: '加注方式',
|
||||
isMutiple: false,
|
||||
key: 'formats',
|
||||
detailList: [
|
||||
{
|
||||
detailList: [{
|
||||
title: "全部",
|
||||
value: ""
|
||||
},{
|
||||
}, {
|
||||
title: "加注机",
|
||||
value: "1"
|
||||
},{
|
||||
}, {
|
||||
title: "桶装",
|
||||
value: "2"
|
||||
},
|
||||
]
|
||||
}] ,
|
||||
}, ]
|
||||
}],
|
||||
siteList: [],
|
||||
InputBottom: 0,
|
||||
show: false,
|
||||
currentPage: 1,
|
||||
brandName:'',
|
||||
productType:'',
|
||||
brandName: '',
|
||||
productType: '',
|
||||
isLoadMore: false, //是否加载中
|
||||
}
|
||||
},
|
||||
@@ -241,7 +230,7 @@
|
||||
this.refreshLocation()
|
||||
let storykey = uni.getStorageInfoSync()
|
||||
let nowCompanyCard = uni.getStorageSync('companyCard')
|
||||
if(this.companyCard&&this.companyCard!==nowCompanyCard){
|
||||
if (this.companyCard && this.companyCard !== nowCompanyCard) {
|
||||
this.companyCard = uni.getStorageSync('companyCard');
|
||||
this.updateFn()
|
||||
}
|
||||
@@ -249,8 +238,7 @@
|
||||
onLoad() {
|
||||
if (!uni.getStorageSync('filterDatas')) {
|
||||
this.getFilterData()
|
||||
} else{
|
||||
}
|
||||
} else {}
|
||||
this.findPriceDetails()
|
||||
if (uni.getStorageSync('productCodeList')) {
|
||||
this.productCodeList = uni.getStorageSync('productCodeList')
|
||||
@@ -263,9 +251,9 @@
|
||||
onReachBottom() {
|
||||
if (this.loadStatus == 'load') {
|
||||
setTimeout(() => {
|
||||
if(this.TabHead == 0){
|
||||
if (this.TabHead == 0) {
|
||||
this.getSiteList()
|
||||
}else if(this.TabHead == 1){
|
||||
} else if (this.TabHead == 1) {
|
||||
this.getUreaList()
|
||||
}
|
||||
}, 100)
|
||||
@@ -277,36 +265,36 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateFn(){
|
||||
updateFn() {
|
||||
this.filterRes(this.filterDatas)
|
||||
setTimeout(function() {
|
||||
uni.stopPullDownRefresh()
|
||||
}, 600);
|
||||
},
|
||||
reunrnFn(){
|
||||
reunrnFn() {
|
||||
|
||||
},
|
||||
getUreaList(){
|
||||
getUreaList() {
|
||||
let location = uni.getStorageSync('location')
|
||||
let data1 = {
|
||||
currentPage: this.currentPage,
|
||||
pageSize: 10,
|
||||
params: { //类型:Object 必有字段 备注:// 筛选对象
|
||||
siteNameOrId:this.siteName,//产品类型(加注方式):
|
||||
productType: this.productType? this.productType:'',//1-加注机; 2-桶装
|
||||
brandName: this.brandName ? this.brandName:'', // 桶装品牌名称
|
||||
currentLongitude:location.longitude+'',// 当前经度
|
||||
currentLatitude:location.latitude+'', // 当前纬度
|
||||
siteNameOrId: this.siteName, //产品类型(加注方式):
|
||||
productType: this.productType ? this.productType : '', //1-加注机; 2-桶装
|
||||
brandName: this.brandName ? this.brandName : '', // 桶装品牌名称
|
||||
currentLongitude: location.longitude + '', // 当前经度
|
||||
currentLatitude: location.latitude + '', // 当前纬度
|
||||
}
|
||||
}
|
||||
ureaSiteApi.getByPageMobile(data1).then(res=>{
|
||||
ureaSiteApi.getByPageMobile(data1).then(res => {
|
||||
if (res.code == 20000) {
|
||||
let objs = []
|
||||
res.data.list.forEach( ele =>{
|
||||
res.data.list.forEach(ele => {
|
||||
let tag
|
||||
if(ele.productType == 1){
|
||||
if (ele.productType == 1) {
|
||||
tag = '加注机'
|
||||
} else if(ele.productType == 2){
|
||||
} else if (ele.productType == 2) {
|
||||
tag = '桶装'
|
||||
}
|
||||
let obj = {
|
||||
@@ -314,11 +302,11 @@
|
||||
id: ele.id,
|
||||
juli: ele.totalDistance,
|
||||
latitude: parseInt(ele.lat),
|
||||
listTag:tag,
|
||||
longitude:parseInt(ele.lng),
|
||||
listTag: tag,
|
||||
longitude: parseInt(ele.lng),
|
||||
siteCustomerMark: null,
|
||||
siteId: ele.siteId,
|
||||
siteName:ele.siteName,
|
||||
siteName: ele.siteName,
|
||||
sitePrice: ele.price,
|
||||
formats: ele.formats,
|
||||
price: ele.price
|
||||
@@ -336,39 +324,33 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
changeHaed(code){
|
||||
changeHaed(code) {
|
||||
this.TabHead = code
|
||||
this.siteList = []
|
||||
this.siteName = ''
|
||||
this.siteAddress = ''
|
||||
this.currentPage = 1
|
||||
if(code == 1){
|
||||
if (code == 1) {
|
||||
this.getUreaList()
|
||||
}else if(code == 0){
|
||||
} else if (code == 0) {
|
||||
this.getSiteList()
|
||||
}
|
||||
},
|
||||
ureaToDetail(list){
|
||||
ureaToDetail(list) {
|
||||
|
||||
let itemS = JSON.stringify(list)
|
||||
if (uni.getStorageSync('user')) {
|
||||
uni.navigateTo({
|
||||
url: `/BagStation/pages/ureaDetail/ureaDetail?item=${itemS}`,
|
||||
fail: (err) => {
|
||||
// console.log(err)
|
||||
},
|
||||
success: () => {
|
||||
// console.log('err')
|
||||
}
|
||||
url: `/BagStation/pages/ureaDetail/ureaDetail?item=${itemS}`
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
title:'请您登录',
|
||||
content:"登录小星加油才可以加油 |˛˙꒳˙)♡",
|
||||
confirmText:'去登陆',
|
||||
title: '请您登录',
|
||||
content: "登录小星加油才可以加油 |˛˙꒳˙)♡",
|
||||
confirmText: '去登陆',
|
||||
success: (res) => {
|
||||
if(res.confirm){
|
||||
if (res.confirm) {
|
||||
uni.reLaunch({
|
||||
url:'../../../BagAuth/pages/login/login'
|
||||
url: '../../../BagAuth/pages/login/login'
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -376,16 +358,16 @@
|
||||
}
|
||||
},
|
||||
filterRes(val) {
|
||||
console.log(val,'重置')
|
||||
if(this.TabHead ==0){
|
||||
console.log(val, '重置')
|
||||
if (this.TabHead == 0) {
|
||||
this.filterDatas = val
|
||||
this.currentPage = 1
|
||||
this.siteList = []
|
||||
this.getSiteList()
|
||||
}else{
|
||||
if( val.formats == 2){
|
||||
} else {
|
||||
if (val.formats == 2) {
|
||||
this.changeHs = true
|
||||
}else{
|
||||
} else {
|
||||
this.changeHs = false
|
||||
}
|
||||
this.filterDatas = val
|
||||
@@ -398,19 +380,18 @@
|
||||
},
|
||||
getFilterData() {
|
||||
oilSiteApi.getCheckInfo().then(res => {
|
||||
console.log('resresresresres',res)
|
||||
if (res.code == 20000) {
|
||||
uni.setStorageSync('productCodeList', res.data.productCodeList)
|
||||
uni.setStorageSync('areaCodeList', res.data.areaCodeList)
|
||||
if(uni.getStorageSync('areaCodeList')){
|
||||
if (uni.getStorageSync('areaCodeList')) {
|
||||
this.areaCodeList = uni.getStorageSync('areaCodeList')
|
||||
}else{
|
||||
} else {
|
||||
this.areaCodeList = res.data.areaCodeList
|
||||
}
|
||||
this.productCodeList = uni.getStorageSync('productCodeList')
|
||||
// console.log(this.productCodeList,'新的列表格式')
|
||||
|
||||
res.data.channelCodes.map(item => {
|
||||
// this.menuList[1].detailList.push({
|
||||
|
||||
this.menuList[3].detailLists.push({
|
||||
title: item.name,
|
||||
value: item.id
|
||||
@@ -428,49 +409,42 @@
|
||||
value: item.id
|
||||
})
|
||||
})
|
||||
let data = [
|
||||
{
|
||||
let data = [{
|
||||
title: '全部',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
title: '一级油站',
|
||||
value: 'A'
|
||||
},{
|
||||
}, {
|
||||
title: '二级油站',
|
||||
value: 'B'
|
||||
},{
|
||||
}, {
|
||||
title: '三级油站',
|
||||
value: 'C'
|
||||
},{
|
||||
}, {
|
||||
title: '四级油站',
|
||||
value: 'D'
|
||||
},{
|
||||
}, {
|
||||
title: '一级油站',
|
||||
value: 'E'
|
||||
},
|
||||
]
|
||||
// this.oliMenuList[3].detailList = data
|
||||
// // console.log(channelCodes, productCodes, siteBrands)
|
||||
// this.$refs.slFilter.resetMenuList(this.menuList)
|
||||
}
|
||||
console.log(this.menuList,uni.getStorageSync('areaCodeList'),'----')
|
||||
console.log(this.menuList, uni.getStorageSync('areaCodeList'), '----')
|
||||
})
|
||||
},
|
||||
onSelected(e) {
|
||||
// console.log(e)
|
||||
},
|
||||
findPriceDetails(){
|
||||
ureaSiteApi.findPriceDetails().then(res=>{
|
||||
// console.log(res)
|
||||
res.data.forEach(item=>{
|
||||
let obj={
|
||||
title:item,
|
||||
value:item
|
||||
findPriceDetails() {
|
||||
ureaSiteApi.findPriceDetails().then(res => {
|
||||
res.data.forEach(item => {
|
||||
let obj = {
|
||||
title: item,
|
||||
value: item
|
||||
}
|
||||
// console.log(obj)
|
||||
this.ureaMenuList[1].detailList.push(obj)
|
||||
// this.productTypes[0].detailList.push(obj)
|
||||
})
|
||||
console.log(this.ureaMenuList)
|
||||
console.log(this.productTypes)
|
||||
@@ -505,39 +479,31 @@
|
||||
getSiteList() {
|
||||
this.refreshLocation()
|
||||
let location = uni.getStorageSync('location')
|
||||
console.log(this.filterDatas)
|
||||
let data1 = {
|
||||
currentPage: this.currentPage,
|
||||
pageSize: 10,
|
||||
params: { //类型:Object 必有字段 备注:// 筛选对象
|
||||
// sort: "juli", //类型:String 必有字段 备注:// 智能排序 ( price:价格最低 juli:距离最近 ) 默认距离排序
|
||||
siteName: this.siteName,
|
||||
params: {
|
||||
siteAddress: this.siteAddress,
|
||||
...uni.getStorageSync('location'),
|
||||
// ...this.filterData
|
||||
// siteBrand: this.siteName ? '' : this.filterDatas
|
||||
siteBrand: this.filterDatas
|
||||
.siteBrand, // 备注:// 石油品牌 ( 1-中国石油 2-中国石化 3-壳牌 4-民营 5-中海油 6-京博 7-中化石油 8-其他 )
|
||||
// channelCode: this.siteName ? '' : this.filterDatas
|
||||
channelCode: this.filterDatas
|
||||
.channelCode, // 备注:// 渠道编码 ( OIL:星油 WJY:万金油 LV:老吕(找油网) TY:团油 YDJY:一点加油(壳牌))
|
||||
// oilProductCode: this.siteName ? '' : this.filterDatas
|
||||
oilProductCode:this.filterDatas
|
||||
.oilProductCode ,// 备注:// 油号选择 ( 0# 92# 92#)
|
||||
// siteLevel: this.siteName ? '' : this.filterDatas
|
||||
oilProductCode: this.filterDatas
|
||||
.oilProductCode, // 备注:// 油号选择 ( 0# 92# 92#)
|
||||
siteLevel: this.filterDatas
|
||||
.siteLevel ,
|
||||
sort:this.filterDatas.sort?this.filterDatas.sort:'juli',
|
||||
provinceCode:this.filterDatas.provinceCode,
|
||||
cityCode:this.filterDatas.cityCode,
|
||||
areaCode:this.filterDatas.areaCode,
|
||||
distance:this.filterDatas.distance
|
||||
.siteLevel,
|
||||
sort: this.filterDatas.sort ? this.filterDatas.sort : 'juli',
|
||||
provinceCode: this.filterDatas.provinceCode,
|
||||
cityCode: this.filterDatas.cityCode,
|
||||
areaCode: this.filterDatas.areaCode,
|
||||
distance: this.filterDatas.distance
|
||||
}
|
||||
}
|
||||
if (!uni.getStorageSync('Authorization')) {
|
||||
data1.params.role = 1
|
||||
oilSiteApi.readOnlySites(data1).then(res => {
|
||||
if (res.code == 20000) {
|
||||
console.log(res,'+++')
|
||||
this.siteList = this.siteList.concat(res.data.list)
|
||||
if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.loadStatus = 'nomore'
|
||||
@@ -550,7 +516,7 @@
|
||||
} else {
|
||||
oilSiteApi.getSiteList(data1).then(res => {
|
||||
if (res.code == 20000) {
|
||||
console.log(res,'+++')
|
||||
console.log(res, '+++')
|
||||
this.siteList = this.siteList.concat(res.data.list)
|
||||
if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.loadStatus = 'nomore'
|
||||
@@ -563,82 +529,20 @@
|
||||
}
|
||||
|
||||
},
|
||||
// getSiteList() {
|
||||
// this.refreshLocation()
|
||||
|
||||
// let data1 = {
|
||||
// currentPage: this.currentPage,
|
||||
// pageSize: 10,
|
||||
// params: { //类型:Object 必有字段 备注:// 筛选对象
|
||||
// sort: "juli", //类型:String 必有字段 备注:// 智能排序 ( price:价格最低 juli:距离最近 ) 默认距离排序
|
||||
// siteName: this.siteName,
|
||||
// longitude: 116.397451, // 必有字段 备注:// 当前位置经度
|
||||
// latitude: 39.909187, // 必有字段 备注:// 当前位置维度
|
||||
// ...uni.getStorageSync('location'),
|
||||
// // ...this.filterData
|
||||
// siteBrand: this.siteName ? '' : this.filterData
|
||||
// .siteBrand, // 备注:// 石油品牌 ( 1-中国石油 2-中国石化 3-壳牌 4-民营 5-中海油 6-京博 7-中化石油 8-其他 )
|
||||
// channelCode: this.siteName ? '' : this.filterData
|
||||
// .channelCode, // 备注:// 渠道编码 ( OIL:星油 WJY:万金油 LV:老吕(找油网) TY:团油 YDJY:一点加油(壳牌))
|
||||
// oilProductCode: this.siteName ? '' : this.filterData
|
||||
// .oilProductCode // 备注:// 油号选择 ( 0# 92# 92#)
|
||||
// }
|
||||
|
||||
// }
|
||||
// if (!uni.getStorageSync('Authorization')) {
|
||||
// oilSiteApi.readOnlySites(data1).then(res => {
|
||||
// if (res.code == 20000) {
|
||||
// this.siteList = this.siteList.concat(res.data.list)
|
||||
// if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
// this.loadStatus = 'nomore'
|
||||
// } else {
|
||||
// this.currentPage++
|
||||
// this.loadStatus = 'load'
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// } else {
|
||||
// oilSiteApi.getSiteList(data1).then(res => {
|
||||
// if (res.code == 20000) {
|
||||
// this.siteList = this.siteList.concat(res.data.list)
|
||||
// if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
// this.loadStatus = 'nomore'
|
||||
// } else {
|
||||
// this.currentPage++
|
||||
// this.loadStatus = 'load'
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
// },
|
||||
toDetail(item) {
|
||||
// console.log(item)
|
||||
// console.log('这里是进入前')
|
||||
let itemS = JSON.stringify(item)
|
||||
|
||||
if (uni.getStorageSync('user')) {
|
||||
if(item.channelCode==='TY'){
|
||||
uni.setStorageSync('OtherSiteInfo',item)
|
||||
if (item.channelCode === 'TY') {
|
||||
uni.setStorageSync('OtherSiteInfo', item)
|
||||
uni.navigateTo({
|
||||
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`,
|
||||
fail: (err) => {
|
||||
// console.log(err)
|
||||
},
|
||||
success: () => {
|
||||
// console.log('err')
|
||||
}
|
||||
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`,
|
||||
fail: (err) => {
|
||||
// console.log(err)
|
||||
},
|
||||
success: () => {
|
||||
// console.log('err')
|
||||
}
|
||||
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`
|
||||
})
|
||||
} else {
|
||||
uni.showModal({
|
||||
@@ -657,14 +561,11 @@
|
||||
},
|
||||
nameSelect(value, item) {
|
||||
this.title2 = item.text
|
||||
// console.log(item)
|
||||
},
|
||||
typeSelect(value, item) {
|
||||
// console.log(item)
|
||||
this.title1 = item.text
|
||||
},
|
||||
optionSelect(value, item) {
|
||||
// console.log(item)
|
||||
this.title3 = item.text
|
||||
},
|
||||
toMap() {
|
||||
@@ -674,40 +575,31 @@
|
||||
},
|
||||
InputFocus(e) {
|
||||
this.InputBottom = e.detail.height
|
||||
// console.log(e.detail)
|
||||
// console.log(this.InputBottom)
|
||||
},
|
||||
InputBlur(e) {
|
||||
this.InputBottom = 0
|
||||
// console.log(this.InputBottom)
|
||||
// console.log(e.detail)
|
||||
|
||||
|
||||
},
|
||||
onInput() {
|
||||
// setTimeout(() => {
|
||||
// this.currentPage = 1
|
||||
// this.siteList = []
|
||||
// this.getSiteList()
|
||||
// }, 100)
|
||||
clearTimeout(this.getSiteListTimer);
|
||||
this.getSiteListTimer = setTimeout(()=>{
|
||||
this.getSiteListTimer = setTimeout(() => {
|
||||
this.currentPage = 1
|
||||
this.siteList = []
|
||||
this.getSiteList()
|
||||
},500);
|
||||
}, 500);
|
||||
},
|
||||
onSearch() {
|
||||
clearTimeout(this.getSiteListTimer);
|
||||
this.getSiteListTimer = setTimeout(()=>{
|
||||
this.getSiteListTimer = setTimeout(() => {
|
||||
this.currentPage = 1
|
||||
this.siteList = []
|
||||
if(this.TabHead == 0){
|
||||
if (this.TabHead == 0) {
|
||||
this.getSiteList()
|
||||
}else if (this.TabHead == 1){
|
||||
} else if (this.TabHead == 1) {
|
||||
this.getUreaList()
|
||||
}
|
||||
},500)
|
||||
}, 500)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -715,8 +607,12 @@
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.flex_column{display: flex;flex-direction: column;}
|
||||
.headList_head{
|
||||
.flex_column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.headList_head {
|
||||
padding: 2% 0;
|
||||
width: 16%;
|
||||
text-align: center;
|
||||
@@ -725,17 +621,20 @@
|
||||
border-bottom: 2px solid #fff;
|
||||
margin: 0% 3%;
|
||||
}
|
||||
.headList{
|
||||
|
||||
.headList {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
padding: 1% 3%;
|
||||
}
|
||||
.ativeHead{
|
||||
|
||||
.ativeHead {
|
||||
color: red;
|
||||
border-bottom: 2px solid red;
|
||||
}
|
||||
|
||||
.icon-gasstation {
|
||||
width: 1.2rem;
|
||||
height: 1.2rem;
|
||||
|
||||
@@ -5,7 +5,7 @@ import utils from '@/utils/encode'
|
||||
// const env = 'test'
|
||||
const env = 'production'
|
||||
// 45
|
||||
const testUrl = 'http://192.168.1.83:38080'
|
||||
const testUrl = 'http://192.168.1.132:38080'
|
||||
// const productUrl = 'https://www.xingoil.com/adminapi'
|
||||
|
||||
const productUrl = 'http://uat.xingoil.com/adminapi'
|
||||
|
||||
Reference in New Issue
Block a user