|
@@ -13,7 +13,7 @@
|
|
|
</uni-nav-bar>
|
|
|
<!-- 页面主体 -->
|
|
|
<view class="pageContent">
|
|
|
- <map id="map" :latitude="centerY" :longitude="centerX" scale="14" show-compass :markers="markers" @markertap="markertap"
|
|
|
+ <map id="map" :latitude="lat" :longitude="lng" scale="14" show-compass :markers="markers" @markertap="markertap"
|
|
|
show-location style="width: 100%; height:100%;">
|
|
|
<!-- 左边控件 -->
|
|
|
<view class="cover-view">
|
|
@@ -48,7 +48,7 @@
|
|
|
import uniNavBar from "@/components/uni-nav-bar/uni-nav-bar.vue"
|
|
|
import uniPopup from '@/components/uni-popup/uni-popup.vue'
|
|
|
import {checkLogin} from '@/api/login.js'
|
|
|
- import {getLookUpDatas} from '@/api/data.js'
|
|
|
+ import {getMapStoreList} from '@/api/store.js'
|
|
|
export default {
|
|
|
components: {
|
|
|
uniNavBar, uniPopup
|
|
@@ -57,8 +57,8 @@
|
|
|
return {
|
|
|
mapCtx: null, // 地图对象
|
|
|
markers: [], // 标注点
|
|
|
- centerX: '',
|
|
|
- centerY: '',
|
|
|
+ lng: '',
|
|
|
+ lat: '',
|
|
|
markData: [{
|
|
|
id: '1',
|
|
|
name: '洗车机',
|
|
@@ -112,25 +112,8 @@
|
|
|
},
|
|
|
onLoad() {
|
|
|
this.getUserLocation()
|
|
|
- // 获取订单状态数据字典
|
|
|
- this.getCodeList('ORDER_STATUS')
|
|
|
- // 获取支付方式数据字典
|
|
|
- this.getCodeList('PAY_TYPE')
|
|
|
},
|
|
|
methods: {
|
|
|
- // 获取数据字典
|
|
|
- getCodeList (code) {
|
|
|
- getLookUpDatas({type:code}).then(res =>{
|
|
|
- if (res.status == 200) {
|
|
|
- console.log(res.data,'res.data')
|
|
|
- if (code == 'ORDER_STATUS') {
|
|
|
- this.$u.vuex('vuex_payStatus', res.data)
|
|
|
- } else {
|
|
|
- this.$u.vuex('vuex_payType', res.data)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 用户位置信息授权
|
|
|
getUserLocation() {
|
|
|
let _this = this
|
|
@@ -148,8 +131,8 @@
|
|
|
},
|
|
|
// 用户拒绝授权位置信息时默认展示青海西宁位置地图
|
|
|
fail: (err) => {
|
|
|
- _this.centerX = '101.760521'
|
|
|
- _this.centerY = '36.636193'
|
|
|
+ _this.lng = '101.760521'
|
|
|
+ _this.lat = '36.636193'
|
|
|
_this.markers = _this.getMarkersData()
|
|
|
}
|
|
|
})
|
|
@@ -168,33 +151,52 @@
|
|
|
console.log(res,'rrrr')
|
|
|
let latitude = res.latitude;
|
|
|
let longitude = res.longitude;
|
|
|
- this.centerX = longitude
|
|
|
- this.centerY = latitude
|
|
|
+ // this.lng = longitude
|
|
|
+ // this.lat = latitude
|
|
|
+ this.lng = '116.510229'
|
|
|
+ this.lat = '39.848974'
|
|
|
this.markers = this.getMarkersData()
|
|
|
},
|
|
|
// 定位失败默认展示青海西宁位置地图
|
|
|
fail: (err) => {
|
|
|
- this.centerX = '101.760521'
|
|
|
- this.centerY = '36.636193'
|
|
|
+ this.lng = '101.760521'
|
|
|
+ this.lat = '36.636193'
|
|
|
this.markers = this.getMarkersData()
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 点击标点获取数据
|
|
|
+ // 点击标点进入网点详情
|
|
|
markertap(e) {
|
|
|
console.log(e)
|
|
|
uni.navigateTo({
|
|
|
url: `/pages/store/storeDetail?id=${e.markerId}`
|
|
|
})
|
|
|
},
|
|
|
- // 获取标记点数据
|
|
|
+ // 获取所有标记点数据
|
|
|
getMarkersData() {
|
|
|
- let markers = [];
|
|
|
- for (let item of this.markData) {
|
|
|
- let marker = this.createMarker(item);
|
|
|
- markers.push(marker)
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中...'
|
|
|
+ })
|
|
|
+ let params = {
|
|
|
+ lat: '39.848974',
|
|
|
+ lng: '116.510229'
|
|
|
}
|
|
|
- return markers;
|
|
|
+ getMapStoreList(params).then(res=>{
|
|
|
+ uni.hideLoading()
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.markData = res.data
|
|
|
+ let markers = [];
|
|
|
+ for (let item of this.markData) {
|
|
|
+ let marker = this.createMarker(item);
|
|
|
+ markers.push(marker)
|
|
|
+ }
|
|
|
+ this.markers = markers
|
|
|
+ console.log(this.markers,'111111')
|
|
|
+ } else {
|
|
|
+ this.toashMsg(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
},
|
|
|
// 点击回到定位坐标点
|
|
|
moveToLocation () {
|
|
@@ -267,14 +269,14 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 创建标记点
|
|
|
+ // 创建标记点 OPEN :正常营业 CLOSED:暂停营业 TO_BE_OPENED:待开业
|
|
|
createMarker(point) {
|
|
|
- let latitude = point.latitude;
|
|
|
- let longitude = point.longitude;
|
|
|
+ let latitude = point.lat;
|
|
|
+ let longitude = point.lng;
|
|
|
let iconPath = ''
|
|
|
- if (point.status===0) {
|
|
|
+ if (point.businessStatus==='CLOSED') {
|
|
|
iconPath = '/static/img/store-dky.png'
|
|
|
- } else if (point.status===1) {
|
|
|
+ } else if (point.businessStatus==='OPEN') {
|
|
|
iconPath = '/static/img/store.png'
|
|
|
} else {
|
|
|
iconPath = '/static/img/store-zt.png'
|