This commit is contained in:
xiaozhiyong
2023-10-10 15:26:08 +08:00
parent 9e38c2fd0c
commit e331393f09
7 changed files with 418 additions and 385 deletions

View File

@@ -54,26 +54,31 @@
pageSize: { pageSize: {
page_size: 15, page_size: 15,
page: 1 page: 1
} },
currentMidwayIndex: '',
midwayPointList: ''
} }
}, },
onLoad(e) { onLoad(e) {
let that = this // let that = this
if (e.type) { if (e.type) {
console.log(e.type) let arr = e.type.split('/')
this.type = e.type.split('/')[0] this.type = arr[0]
this.location = e.type.split('/')[1] this.location = arr[1]
console.log(this.List, Boolean(Number(this.List))) this.currentMidwayIndex = arr[2]
this.midwayPointList = arr[3]
// console.log(this.List, Boolean(Number(this.List)))
this.TXSDK.reverseGeocoder({ this.TXSDK.reverseGeocoder({
sig: 'mOPvEv4WmyaxymycTYy00pSiad2jnQil', sig: 'mOPvEv4WmyaxymycTYy00pSiad2jnQil',
location: that.location, location: this.location,
success(e) { success: (e) => {
({ ({
province: that.addressData.province, province: this.addressData.province,
city: that.addressData.city, city: this.addressData.city,
district: that.addressData.area district: this.addressData.area
} = e.result.address_component) } = e.result.address_component)
console.log(e, that.addressData, '地址逆解析') // console.log(e, this.addressData, '地址逆解析')
}, },
fail(e) { fail(e) {
console.log(e, '地址逆解析 错误') console.log(e, '地址逆解析 错误')
@@ -88,7 +93,7 @@
}, },
methods: { methods: {
seleClick(e) { seleClick(e) {
uni.$emit('UpdateAddress', e, this.type) uni.$emit('UpdateAddress', e, this.type, this.currentMidwayIndex, this.midwayPointList)
uni.navigateBack() uni.navigateBack()
}, },
chargeChange(e) { chargeChange(e) {
@@ -144,10 +149,10 @@
}) })
}, },
getSuggestion() { getSuggestion() {
if(!this.seachValue) { if (!this.seachValue) {
uni.showToast({ uni.showToast({
title:'还没有输入地址哦~', title: '还没有输入地址哦~',
icon:'none' icon: 'none'
}) })
return return
} }

View File

@@ -7,13 +7,25 @@
<!-- <uni-icond type="back" size="30"></uni-icond> --> <!-- <uni-icond type="back" size="30"></uni-icond> -->
</view> </view>
<view class=" flex sele_car_right"> <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="yuan" />
<view class="flexone margin size">{{Route.start.title}}</view> <view class="flexone margin size">{{Route.start.title}}</view>
</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 style="background-color: #FF6700;" class="yuan" />
<view class="flexone margin size colorb">{{Route.end.title||'请输入终点'}}</view> <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> </view>
</view> </view>
@@ -62,6 +74,7 @@
isShow: { isShow: {
conditions: false conditions: false
}, },
midwayPointList: [],
header: null, header: null,
menuList: [{ menuList: [{
title: '距离', title: '距离',
@@ -106,7 +119,6 @@
}, },
mounted() { mounted() {
this.styles = uni.getMenuButtonBoundingClientRect(); this.styles = uni.getMenuButtonBoundingClientRect();
console.log(this.styles);
const query = uni.createSelectorQuery().in(this); const query = uni.createSelectorQuery().in(this);
query.select('.header').boundingClientRect(data => { query.select('.header').boundingClientRect(data => {
console.log("得到布局位置信息" + JSON.stringify(data)); console.log("得到布局位置信息" + JSON.stringify(data));
@@ -116,9 +128,21 @@
}, },
created() { created() {
this.getConditionMenu(); this.getConditionMenu();
}, },
methods: { methods: {
removeLocation(index) {
this.midwayPointList.splice(index, 1)
this.$parent.passiveRedraw(this.midwayPointList)
},
additionLocation() {
this.midwayPointList.push({
longitude: '',
latitude: '',
title: ''
})
},
getElement() { getElement() {
return this.styles.top + this.styles.height + 10 + this.header.height 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[0], this.menuList[1], this.menuList[2], this.menuList[3]] = [this.menuList[0],
this.menuList[3], this.menuList[1], this.menuList[2] this.menuList[3], this.menuList[1], this.menuList[2]
]; ];
console.log(this.menuList, '***') // console.log(this.menuList, '***')
}) })
}, },
datassFn() { datassFn() {
@@ -178,10 +202,10 @@
e.SublistOpen = !e.SublistOpen; e.SublistOpen = !e.SublistOpen;
this.$emit('closeFooterScroll') this.$emit('closeFooterScroll')
}, },
chooseLocation(e) { chooseLocation(e, index) {
uni.navigateTo({ uni.navigateTo({
url: './chooseLocation?type=' + 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() { backFn() {
@@ -237,7 +261,11 @@
padding: 0 28rpx; padding: 0 28rpx;
} }
.addressInput { .addressInput {
margin: 7rpx 0;
position: relative;
background: #F0F0F0; background: #F0F0F0;
border-radius: 10px; border-radius: 10px;
} }
@@ -257,7 +285,22 @@
} }
.flexone { .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 { .yuan {
@@ -268,10 +311,11 @@
} }
.sele_car_right { .sele_car_right {
/* position: relative; */
flex-direction: column; flex-direction: column;
flex: 1;
/* padding: 0 27.2rpx; */
padding-left: 27.2rpx; padding-left: 27.2rpx;
width: 100%;
} }
.flex { .flex {
@@ -287,10 +331,10 @@
} }
.sele_car { .sele_car {
height: 194rpx; /* height: 194rpx; */
background: #FFFFFF; background: #FFFFFF;
border-radius: 10px; border-radius: 10px;
padding: 18rpx 32rpx; padding: 18rpx 37px 22rpx 32rpx;
display: flex; display: flex;
} }

View File

@@ -54,6 +54,7 @@
latitude: '', latitude: '',
title: '' title: ''
}, },
midwayPointList: [], //途径点list
end: { end: {
longitude: '', longitude: '',
latitude: '', latitude: '',
@@ -90,6 +91,50 @@
} }
}, },
methods: { 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) { perspectives(item) {
let { let {
latitude, latitude,
@@ -139,7 +184,7 @@
let { let {
oilProductCode, juLi, siteChannel oilProductCode, juLi, siteChannel
} = arguments[1]; } = 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); siteChannel);
//处理站点数据回显 //处理站点数据回显
@@ -196,9 +241,10 @@
// 更新路线规划 // 更新路线规划
async mapRoutePlanning(start = this.Route.start, end = this.Route.end, strategy = 'LEAST_TIME') { 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(); this.zoomRoutePlanning();
// 获取筛选数据 更新油站站点 // 获取筛选数据 更新油站站点
@@ -207,7 +253,8 @@
juLi, juLi,
siteChannel siteChannel
} = this.$refs.addressSelector.datassFn(); } = 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); siteChannel);
//处理油站站点数据并显示 //处理油站站点数据并显示
@@ -235,18 +282,7 @@
closeAddressSelector() { closeAddressSelector() {
this.$refs.addressSelector.menuList.forEach(item => item.SublistOpen = false); 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() { openMapApp() {
let that = this let that = this
@@ -265,10 +301,12 @@
}, },
//获取路线规划 //获取路线规划
getMapRoutePlanning(start, end) { getMapRoutePlanning(start, end) {
// this.routePlanning(start, end)
let { let {
seleIndex seleIndex
} = this.$refs.footerScroll.$data } = this.$refs.footerScroll.$data
var _this = this; var _this = this;
return new Promise(function(res, rej) { return new Promise(function(res, rej) {
_this.TXSDK.direction({ _this.TXSDK.direction({
@@ -278,7 +316,6 @@
to: end, to: end,
policy: seleIndex || 'LEAST_TIME', policy: seleIndex || 'LEAST_TIME',
success: function(e) { success: function(e) {
console.log('获取路线规划成功')
res(e) res(e)
}, },
fail(e) { fail(e) {
@@ -289,24 +326,76 @@
}); });
}, 1000) }, 1000)
rej(e) 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) { RoutePlanningHandle(res) {
var _this = this; let coors = res.result.routes[0].polyline
var ret = res; let pl = [];
var coors = ret.result.routes[0].polyline, //坐标解压(该方法为官方文档提供)
pl = []; let kr = 1000000;
//坐标解压(返回的点串坐标,通过前向差分进行压缩) for (let i = 2; i < coors.length; i++) {
var kr = 1000000;
for (var i = 2; i < coors.length; i++) {
coors[i] = Number(coors[i - 2]) + Number(coors[i]) / kr; coors[i] = Number(coors[i - 2]) + Number(coors[i]) / kr;
} }
//将解压后的坐标放入点串数组pl中 for (let i = 0; i < coors.length; i += 2) {
for (var i = 0; i < coors.length; i += 2) {
pl.push({ pl.push({
latitude: coors[i], latitude: coors[i],
longitude: coors[i + 1], longitude: coors[i + 1],
@@ -318,8 +407,8 @@
return [{ return [{
points: pl, points: pl,
color: '#FF6700', color: '#FF6700',
width: 4, width: 5,
distance: ret.result.routes[0].distance distance: res.result.routes[0].distance
}] }]
}, },
/* 缩放路线规划 includePoints方法 points:经纬度数组 padding:边距 参考 https://uniapp.dcloud.io/api/location/map?id=cdreatemapcontext */ /* 缩放路线规划 includePoints方法 points:经纬度数组 padding:边距 参考 https://uniapp.dcloud.io/api/location/map?id=cdreatemapcontext */
@@ -356,7 +445,7 @@
console.log('点击地图') console.log('点击地图')
}, },
//更新markers点 //更新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 { let {
latitude, latitude,
@@ -372,8 +461,8 @@
latitude: latitude || this.coordinate.latitude, latitude: latitude || this.coordinate.latitude,
longitude: longitude || this.coordinate.longitude longitude: longitude || this.coordinate.longitude
} }
let taht = this; // let taht = this;
return new Promise(function(re, rj) { return new Promise((re, rj) => {
oilSiteApi.getSiteByGeoHashNew(data).then(markerList => { oilSiteApi.getSiteByGeoHashNew(data).then(markerList => {
if (markerList.code !== 20000) { if (markerList.code !== 20000) {
setTimeout(() => { setTimeout(() => {
@@ -385,7 +474,7 @@
rj(markerList.code + markerList.msg) rj(markerList.code + markerList.msg)
return return
} }
taht.selePrice = { this.selePrice = {
middlePrice: markerList.data.middlePrice, middlePrice: markerList.data.middlePrice,
minPrice: markerList.data.minPrice minPrice: markerList.data.minPrice
} }
@@ -436,22 +525,18 @@
}, },
//点击定位点事件 //点击定位点事件
markertap(e) { markertap(e) {
console.log(e, '点击了ma') console.log('点击了markertap')
}, },
//获取当前位置 //获取当前位置
getCurrentLocation() { getCurrentLocation() {
// let that = this
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
success: (res) => { success: (res) => {
// ({
// latitude: that.coordinate.latitude,
// longitude: that.coordinate.longitude
// } = res);
let { let {
latitude, latitude,
longitude longitude
} = res } = res
this.coordinate.latitude = latitude this.coordinate.latitude = latitude
this.firstLocation.latitude = latitude this.firstLocation.latitude = latitude

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

View File

@@ -5,7 +5,8 @@
</cu-custom> </cu-custom>
<view style="flex: 1;" class="flex_column"> <view style="flex: 1;" class="flex_column">
<view class="headList"> <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}} {{list.title}}
</view> </view>
</view> </view>
@@ -14,8 +15,8 @@
<view class="cu-bar search bg-white"> <view class="cu-bar search bg-white">
<view class="search-form round"> <view class="search-form round">
<text class="cuIcon-search"></text> <text class="cuIcon-search"></text>
<input @focus="InputFocus" confirm-type="search" @confirm="onSearch" <input @focus="InputFocus" confirm-type="search" @confirm="onSearch" @blur="InputBlur"
@blur="InputBlur" v-model="siteName" :adjust-position="false" type="text" placeholder="请输入搜索站点名称" /> v-model="siteAddress" :adjust-position="false" type="text" placeholder="请输入搜索站点名称" />
</view> </view>
<view class="action" @tap="toMap"> <view class="action" @tap="toMap">
<image class="icon shadow-blur round icon-gasstation" <image class="icon shadow-blur round icon-gasstation"
@@ -27,9 +28,12 @@
<!-- 筛选开始 --> <!-- 筛选开始 -->
<scroll-view style="flex: 1;" class="screentop bg-white"> <scroll-view style="flex: 1;" class="screentop bg-white">
<view @click="reunrnFn" class=""> <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" v-if="TabHead == 0" :productCodeList="productCodeList"
<sl-filter reflexTitle ref="slFilter" @result="filterRes" :menuList="ureaMenuList" v-if="TabHead == 1 && changeHs == true"></sl-filter> :areaCodeList="areaCodeList" @result="filterRes" :menuList="menuList"></sl-filter>
<sl-filter reflexTitle ref="slFilter" @result="filterRes" :menuList="productTypes" v-if="changeHs == false && TabHead == 1 "></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>
<view class="bg-white min-height-50 padding-top" v-if="siteList.length>0"> <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" <site-item v-for="(item,index) in siteList" :key="item.id" :site-item="item" :first="index==0"
@@ -67,30 +71,27 @@
data() { data() {
return { return {
companyCard:uni.getStorageSync('companyCard'), companyCard: uni.getStorageSync('companyCard'),
getSiteListTimer:null, getSiteListTimer: null,
areaCodeList:[], areaCodeList: [],
loadText:'more', loadText: 'more',
changeHs:true, changeHs: true,
TabHead:0, TabHead: 0,
tabHeadS:[ tabHeadS: [{
{ title: '加油站',
title:'加油站', value: 0,
value:0, }, {
},{ title: '尿素站',
title:'尿素站', value: 1,
value:1, }],
} productCodeList: null,
],
productCodeList:null,
filterDatas: { filterDatas: {
oilProductCode: '0#' oilProductCode: '0#'
}, },
ureaFilterDatas:[], ureaFilterDatas: [],
loadStatus: 'load', loadStatus: 'load',
siteName: '', siteAddress: '',
menuList: [ menuList: [{
{
title: '距离优先', title: '距离优先',
isMutiple: false, isMutiple: false,
key: 'sort', key: 'sort',
@@ -130,15 +131,7 @@
} }
] ]
}, },
// {
// title: '渠道',
// isMutiple: false,
// key: 'channelCode',
// detailList: [{
// title: "全部",
// value: ""
// }]
// },
{ {
title: '0#轻柴油', title: '0#轻柴油',
key: 'oilProductCode', key: 'oilProductCode',
@@ -153,7 +146,7 @@
key: 'siteBrand', key: 'siteBrand',
isSort: true, isSort: true,
isMutiple: false, isMutiple: false,
detailLists:[{ detailLists: [{
title: "全部", title: "全部",
value: "" value: ""
}], }],
@@ -163,22 +156,20 @@
}] }]
} }
], ],
ureaMenuList:[ ureaMenuList: [{
{
title: '加注方式', title: '加注方式',
isMutiple: false, isMutiple: false,
key: 'formats', key: 'formats',
detailList: [{ detailList: [{
title: "全部", title: "全部",
value: "" value: ""
},{ }, {
title: "加注机", title: "加注机",
value: "1" value: "1"
},{ }, {
title: "桶装", title: "桶装",
value: "2" value: "2"
}, }, ]
]
}, },
{ {
title: '桶装品牌', title: '桶装品牌',
@@ -188,31 +179,29 @@
title: "全部", title: "全部",
value: "" value: ""
}] }]
},], },
productTypes:[ ],
{ productTypes: [{
title: '加注方式', title: '加注方式',
isMutiple: false, isMutiple: false,
key: 'formats', key: 'formats',
detailList: [ detailList: [{
{
title: "全部", title: "全部",
value: "" value: ""
},{ }, {
title: "加注机", title: "加注机",
value: "1" value: "1"
},{ }, {
title: "桶装", title: "桶装",
value: "2" value: "2"
}, }, ]
] }],
}] ,
siteList: [], siteList: [],
InputBottom: 0, InputBottom: 0,
show: false, show: false,
currentPage: 1, currentPage: 1,
brandName:'', brandName: '',
productType:'', productType: '',
isLoadMore: false, //是否加载中 isLoadMore: false, //是否加载中
} }
}, },
@@ -241,7 +230,7 @@
this.refreshLocation() this.refreshLocation()
let storykey = uni.getStorageInfoSync() let storykey = uni.getStorageInfoSync()
let nowCompanyCard = uni.getStorageSync('companyCard') let nowCompanyCard = uni.getStorageSync('companyCard')
if(this.companyCard&&this.companyCard!==nowCompanyCard){ if (this.companyCard && this.companyCard !== nowCompanyCard) {
this.companyCard = uni.getStorageSync('companyCard'); this.companyCard = uni.getStorageSync('companyCard');
this.updateFn() this.updateFn()
} }
@@ -249,8 +238,7 @@
onLoad() { onLoad() {
if (!uni.getStorageSync('filterDatas')) { if (!uni.getStorageSync('filterDatas')) {
this.getFilterData() this.getFilterData()
} else{ } else {}
}
this.findPriceDetails() this.findPriceDetails()
if (uni.getStorageSync('productCodeList')) { if (uni.getStorageSync('productCodeList')) {
this.productCodeList = uni.getStorageSync('productCodeList') this.productCodeList = uni.getStorageSync('productCodeList')
@@ -263,9 +251,9 @@
onReachBottom() { onReachBottom() {
if (this.loadStatus == 'load') { if (this.loadStatus == 'load') {
setTimeout(() => { setTimeout(() => {
if(this.TabHead == 0){ if (this.TabHead == 0) {
this.getSiteList() this.getSiteList()
}else if(this.TabHead == 1){ } else if (this.TabHead == 1) {
this.getUreaList() this.getUreaList()
} }
}, 100) }, 100)
@@ -277,36 +265,36 @@
} }
}, },
methods: { methods: {
updateFn(){ updateFn() {
this.filterRes(this.filterDatas) this.filterRes(this.filterDatas)
setTimeout(function() { setTimeout(function() {
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, 600); }, 600);
}, },
reunrnFn(){ reunrnFn() {
}, },
getUreaList(){ getUreaList() {
let location = uni.getStorageSync('location') let location = uni.getStorageSync('location')
let data1 = { let data1 = {
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: 10, pageSize: 10,
params: { //类型Object 必有字段 备注:// 筛选对象 params: { //类型Object 必有字段 备注:// 筛选对象
siteNameOrId:this.siteName,//产品类型(加注方式) siteNameOrId: this.siteName, //产品类型(加注方式)
productType: this.productType? this.productType:'',//1-加注机; 2-桶装 productType: this.productType ? this.productType : '', //1-加注机; 2-桶装
brandName: this.brandName ? this.brandName:'', // 桶装品牌名称 brandName: this.brandName ? this.brandName : '', // 桶装品牌名称
currentLongitude:location.longitude+'',// 当前经度 currentLongitude: location.longitude + '', // 当前经度
currentLatitude:location.latitude+'', // 当前纬度 currentLatitude: location.latitude + '', // 当前纬度
} }
} }
ureaSiteApi.getByPageMobile(data1).then(res=>{ ureaSiteApi.getByPageMobile(data1).then(res => {
if (res.code == 20000) { if (res.code == 20000) {
let objs = [] let objs = []
res.data.list.forEach( ele =>{ res.data.list.forEach(ele => {
let tag let tag
if(ele.productType == 1){ if (ele.productType == 1) {
tag = '加注机' tag = '加注机'
} else if(ele.productType == 2){ } else if (ele.productType == 2) {
tag = '桶装' tag = '桶装'
} }
let obj = { let obj = {
@@ -314,11 +302,11 @@
id: ele.id, id: ele.id,
juli: ele.totalDistance, juli: ele.totalDistance,
latitude: parseInt(ele.lat), latitude: parseInt(ele.lat),
listTag:tag, listTag: tag,
longitude:parseInt(ele.lng), longitude: parseInt(ele.lng),
siteCustomerMark: null, siteCustomerMark: null,
siteId: ele.siteId, siteId: ele.siteId,
siteName:ele.siteName, siteName: ele.siteName,
sitePrice: ele.price, sitePrice: ele.price,
formats: ele.formats, formats: ele.formats,
price: ele.price price: ele.price
@@ -336,39 +324,33 @@
} }
}) })
}, },
changeHaed(code){ changeHaed(code) {
this.TabHead = code this.TabHead = code
this.siteList = [] this.siteList = []
this.siteName = '' this.siteAddress = ''
this.currentPage = 1 this.currentPage = 1
if(code == 1){ if (code == 1) {
this.getUreaList() this.getUreaList()
}else if(code == 0){ } else if (code == 0) {
this.getSiteList() this.getSiteList()
} }
}, },
ureaToDetail(list){ ureaToDetail(list) {
let itemS = JSON.stringify(list) let itemS = JSON.stringify(list)
if (uni.getStorageSync('user')) { if (uni.getStorageSync('user')) {
uni.navigateTo({ uni.navigateTo({
url: `/BagStation/pages/ureaDetail/ureaDetail?item=${itemS}`, url: `/BagStation/pages/ureaDetail/ureaDetail?item=${itemS}`
fail: (err) => {
// console.log(err)
},
success: () => {
// console.log('err')
}
}) })
} else { } else {
uni.showModal({ uni.showModal({
title:'请您登录', title: '请您登录',
content:"登录小星加油才可以加油 |˛˙꒳​˙)♡", content: "登录小星加油才可以加油 |˛˙꒳​˙)♡",
confirmText:'去登陆', confirmText: '去登陆',
success: (res) => { success: (res) => {
if(res.confirm){ if (res.confirm) {
uni.reLaunch({ uni.reLaunch({
url:'../../../BagAuth/pages/login/login' url: '../../../BagAuth/pages/login/login'
}) })
} }
} }
@@ -376,16 +358,16 @@
} }
}, },
filterRes(val) { filterRes(val) {
console.log(val,'重置') console.log(val, '重置')
if(this.TabHead ==0){ if (this.TabHead == 0) {
this.filterDatas = val this.filterDatas = val
this.currentPage = 1 this.currentPage = 1
this.siteList = [] this.siteList = []
this.getSiteList() this.getSiteList()
}else{ } else {
if( val.formats == 2){ if (val.formats == 2) {
this.changeHs = true this.changeHs = true
}else{ } else {
this.changeHs = false this.changeHs = false
} }
this.filterDatas = val this.filterDatas = val
@@ -398,19 +380,18 @@
}, },
getFilterData() { getFilterData() {
oilSiteApi.getCheckInfo().then(res => { oilSiteApi.getCheckInfo().then(res => {
console.log('resresresresres',res)
if (res.code == 20000) { if (res.code == 20000) {
uni.setStorageSync('productCodeList', res.data.productCodeList) uni.setStorageSync('productCodeList', res.data.productCodeList)
uni.setStorageSync('areaCodeList', res.data.areaCodeList) uni.setStorageSync('areaCodeList', res.data.areaCodeList)
if(uni.getStorageSync('areaCodeList')){ if (uni.getStorageSync('areaCodeList')) {
this.areaCodeList = uni.getStorageSync('areaCodeList') this.areaCodeList = uni.getStorageSync('areaCodeList')
}else{ } else {
this.areaCodeList = res.data.areaCodeList this.areaCodeList = res.data.areaCodeList
} }
this.productCodeList = uni.getStorageSync('productCodeList') this.productCodeList = uni.getStorageSync('productCodeList')
// console.log(this.productCodeList,'新的列表格式')
res.data.channelCodes.map(item => { res.data.channelCodes.map(item => {
// this.menuList[1].detailList.push({
this.menuList[3].detailLists.push({ this.menuList[3].detailLists.push({
title: item.name, title: item.name,
value: item.id value: item.id
@@ -428,49 +409,42 @@
value: item.id value: item.id
}) })
}) })
let data = [ let data = [{
{
title: '全部', title: '全部',
value: '' value: ''
}, },
{ {
title: '一级油站', title: '一级油站',
value: 'A' value: 'A'
},{ }, {
title: '二级油站', title: '二级油站',
value: 'B' value: 'B'
},{ }, {
title: '三级油站', title: '三级油站',
value: 'C' value: 'C'
},{ }, {
title: '四级油站', title: '四级油站',
value: 'D' value: 'D'
},{ }, {
title: '一级油站', title: '一级油站',
value: 'E' 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) { onSelected(e) {
// console.log(e) // console.log(e)
}, },
findPriceDetails(){ findPriceDetails() {
ureaSiteApi.findPriceDetails().then(res=>{ ureaSiteApi.findPriceDetails().then(res => {
// console.log(res) res.data.forEach(item => {
res.data.forEach(item=>{ let obj = {
let obj={ title: item,
title:item, value: item
value:item
} }
// console.log(obj)
this.ureaMenuList[1].detailList.push(obj) this.ureaMenuList[1].detailList.push(obj)
// this.productTypes[0].detailList.push(obj)
}) })
console.log(this.ureaMenuList) console.log(this.ureaMenuList)
console.log(this.productTypes) console.log(this.productTypes)
@@ -505,39 +479,31 @@
getSiteList() { getSiteList() {
this.refreshLocation() this.refreshLocation()
let location = uni.getStorageSync('location') let location = uni.getStorageSync('location')
console.log(this.filterDatas)
let data1 = { let data1 = {
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: 10, pageSize: 10,
params: { //类型Object 必有字段 备注:// 筛选对象 params: {
// sort: "juli", //类型String 必有字段 备注:// 智能排序 ( price价格最低 juli距离最近 ) 默认距离排序 siteAddress: this.siteAddress,
siteName: this.siteName,
...uni.getStorageSync('location'), ...uni.getStorageSync('location'),
// ...this.filterData
// siteBrand: this.siteName ? '' : this.filterDatas
siteBrand: this.filterDatas siteBrand: this.filterDatas
.siteBrand, // 备注:// 石油品牌 ( 1-中国石油 2-中国石化 3-壳牌 4-民营 5-中海油 6-京博 7-中化石油 8-其他 ) .siteBrand, // 备注:// 石油品牌 ( 1-中国石油 2-中国石化 3-壳牌 4-民营 5-中海油 6-京博 7-中化石油 8-其他 )
// channelCode: this.siteName ? '' : this.filterDatas
channelCode: this.filterDatas channelCode: this.filterDatas
.channelCode, // 备注:// 渠道编码 ( OIL星油 WJY万金油 LV老吕找油网 TY团油 YDJY一点加油壳牌) .channelCode, // 备注:// 渠道编码 ( OIL星油 WJY万金油 LV老吕找油网 TY团油 YDJY一点加油壳牌)
// oilProductCode: this.siteName ? '' : this.filterDatas oilProductCode: this.filterDatas
oilProductCode:this.filterDatas .oilProductCode, // 备注:// 油号选择 ( 0# 92# 92#)
.oilProductCode ,// 备注:// 油号选择 ( 0# 92# 92#)
// siteLevel: this.siteName ? '' : this.filterDatas
siteLevel: this.filterDatas siteLevel: this.filterDatas
.siteLevel , .siteLevel,
sort:this.filterDatas.sort?this.filterDatas.sort:'juli', sort: this.filterDatas.sort ? this.filterDatas.sort : 'juli',
provinceCode:this.filterDatas.provinceCode, provinceCode: this.filterDatas.provinceCode,
cityCode:this.filterDatas.cityCode, cityCode: this.filterDatas.cityCode,
areaCode:this.filterDatas.areaCode, areaCode: this.filterDatas.areaCode,
distance:this.filterDatas.distance distance: this.filterDatas.distance
} }
} }
if (!uni.getStorageSync('Authorization')) { if (!uni.getStorageSync('Authorization')) {
data1.params.role = 1 data1.params.role = 1
oilSiteApi.readOnlySites(data1).then(res => { oilSiteApi.readOnlySites(data1).then(res => {
if (res.code == 20000) { if (res.code == 20000) {
console.log(res,'+++')
this.siteList = this.siteList.concat(res.data.list) this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页 if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.loadStatus = 'nomore' this.loadStatus = 'nomore'
@@ -550,7 +516,7 @@
} else { } else {
oilSiteApi.getSiteList(data1).then(res => { oilSiteApi.getSiteList(data1).then(res => {
if (res.code == 20000) { if (res.code == 20000) {
console.log(res,'+++') console.log(res, '+++')
this.siteList = this.siteList.concat(res.data.list) this.siteList = this.siteList.concat(res.data.list)
if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页 if (res.data.list.length < 10) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.loadStatus = 'nomore' 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) { toDetail(item) {
// console.log(item)
// console.log('这里是进入前')
let itemS = JSON.stringify(item) let itemS = JSON.stringify(item)
if (uni.getStorageSync('user')) { if (uni.getStorageSync('user')) {
if(item.channelCode==='TY'){ if (item.channelCode === 'TY') {
uni.setStorageSync('OtherSiteInfo',item) uni.setStorageSync('OtherSiteInfo', item)
uni.navigateTo({ uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`, url: `/BagStation/pages/stationDetail/stationDetail?channerCode=${item.channelCode}`
fail: (err) => {
// console.log(err)
},
success: () => {
// console.log('err')
}
}) })
return return
} }
uni.navigateTo({ uni.navigateTo({
url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`, url: `/BagStation/pages/stationDetail/stationDetail?item=${itemS}`
fail: (err) => {
// console.log(err)
},
success: () => {
// console.log('err')
}
}) })
} else { } else {
uni.showModal({ uni.showModal({
@@ -657,14 +561,11 @@
}, },
nameSelect(value, item) { nameSelect(value, item) {
this.title2 = item.text this.title2 = item.text
// console.log(item)
}, },
typeSelect(value, item) { typeSelect(value, item) {
// console.log(item)
this.title1 = item.text this.title1 = item.text
}, },
optionSelect(value, item) { optionSelect(value, item) {
// console.log(item)
this.title3 = item.text this.title3 = item.text
}, },
toMap() { toMap() {
@@ -674,40 +575,31 @@
}, },
InputFocus(e) { InputFocus(e) {
this.InputBottom = e.detail.height this.InputBottom = e.detail.height
// console.log(e.detail)
// console.log(this.InputBottom)
}, },
InputBlur(e) { InputBlur(e) {
this.InputBottom = 0 this.InputBottom = 0
// console.log(this.InputBottom)
// console.log(e.detail)
}, },
onInput() { onInput() {
// setTimeout(() => {
// this.currentPage = 1
// this.siteList = []
// this.getSiteList()
// }, 100)
clearTimeout(this.getSiteListTimer); clearTimeout(this.getSiteListTimer);
this.getSiteListTimer = setTimeout(()=>{ this.getSiteListTimer = setTimeout(() => {
this.currentPage = 1 this.currentPage = 1
this.siteList = [] this.siteList = []
this.getSiteList() this.getSiteList()
},500); }, 500);
}, },
onSearch() { onSearch() {
clearTimeout(this.getSiteListTimer); clearTimeout(this.getSiteListTimer);
this.getSiteListTimer = setTimeout(()=>{ this.getSiteListTimer = setTimeout(() => {
this.currentPage = 1 this.currentPage = 1
this.siteList = [] this.siteList = []
if(this.TabHead == 0){ if (this.TabHead == 0) {
this.getSiteList() this.getSiteList()
}else if (this.TabHead == 1){ } else if (this.TabHead == 1) {
this.getUreaList() this.getUreaList()
} }
},500) }, 500)
} }
} }
@@ -715,8 +607,12 @@
</script> </script>
<style scoped> <style scoped>
.flex_column{display: flex;flex-direction: column;} .flex_column {
.headList_head{ display: flex;
flex-direction: column;
}
.headList_head {
padding: 2% 0; padding: 2% 0;
width: 16%; width: 16%;
text-align: center; text-align: center;
@@ -725,17 +621,20 @@
border-bottom: 2px solid #fff; border-bottom: 2px solid #fff;
margin: 0% 3%; margin: 0% 3%;
} }
.headList{
.headList {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
background-color: #fff; background-color: #fff;
padding: 1% 3%; padding: 1% 3%;
} }
.ativeHead{
.ativeHead {
color: red; color: red;
border-bottom: 2px solid red; border-bottom: 2px solid red;
} }
.icon-gasstation { .icon-gasstation {
width: 1.2rem; width: 1.2rem;
height: 1.2rem; height: 1.2rem;

View File

@@ -5,7 +5,7 @@ import utils from '@/utils/encode'
// const env = 'test' // const env = 'test'
const env = 'production' const env = 'production'
// 45 // 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 = 'https://www.xingoil.com/adminapi'
const productUrl = 'http://uat.xingoil.com/adminapi' const productUrl = 'http://uat.xingoil.com/adminapi'