|
@@ -166,8 +166,9 @@
|
|
|
<view>
|
|
|
<Chargermap @onMoveEnd="moveEnd" ref="amap" @onload="mapdown" @clickMap="clickMap"></Chargermap>
|
|
|
<!--@location="location"-->
|
|
|
+ <u-image style='position:absolute;z-index:1024;right:20px;bottom:260px;' src="@/static/img/location.png" width="30px" height="30px" @click="setCenter"></u-image>
|
|
|
+
|
|
|
</view>
|
|
|
-
|
|
|
<view v-if="stationsmap.length>0" class="chargerCard" style="border-radius: 20rpx;" >
|
|
|
<swiper :current="currentIndex" @change="swiperChange" @transition="swiperTransition" style="height: 100%;">
|
|
|
<swiper-item v-for="(item,index) in stationsmap" :key="item.id" style="height: 100%;">
|
|
@@ -214,7 +215,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="card_item" style="padding-bottom: 20rpx;">
|
|
|
- <u-button shape='circle' style="color: #00B962;" @click="charge(item)">
|
|
|
+ <u-button shape='circle' style="color: #00B962;" @click="getScanCode">
|
|
|
<u-icon name="scan" size="26" color="#00B962" style="margin-right: 20rpx;"></u-icon>
|
|
|
<label>扫码充电</label></u-button>
|
|
|
<view class="round" >
|
|
@@ -241,6 +242,7 @@
|
|
|
<script>
|
|
|
// import api from './site-index.js'
|
|
|
// export default api
|
|
|
+import * as indexAPI from '@/apis/index.js'
|
|
|
import * as api from '@/apis/site.js';
|
|
|
import Chargermap from '@/components/Chargermap.vue';
|
|
|
import DoubleSlider from '@/components/double-slider/DoubleSlider.vue';
|
|
@@ -257,6 +259,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ centerImg:'@/static/img/location.png',
|
|
|
currentIndex:-1,
|
|
|
navBarHeight:88,
|
|
|
viewMode: true, //地图
|
|
@@ -307,7 +310,8 @@ export default {
|
|
|
obc_status: [{ value: 0, text: '对外开放' }, { value: 1, text: '不对外开放' }],
|
|
|
obc_voltage: [{ value: 0, text: '低于700V' }, { value: 1, text: '700V及以上' }],
|
|
|
obc_power: { minValue: 0, maxValue: 1000 }
|
|
|
- }
|
|
|
+ },
|
|
|
+ userId:'',
|
|
|
};
|
|
|
},
|
|
|
onLoad(op) {
|
|
@@ -324,18 +328,16 @@ export default {
|
|
|
|
|
|
},
|
|
|
onReady() {
|
|
|
-
|
|
|
- WxJsApi.getWxConfig(['getLocation','addEventListener']).then((res)=>{
|
|
|
-
|
|
|
- // this.message=JSON.stringify(res)
|
|
|
- // uni.showToast({
|
|
|
- // title:JSON.stringify(res)
|
|
|
- // })
|
|
|
- console.log(res)
|
|
|
-
|
|
|
+ if (this.carhelp.getPersonInfo()) {
|
|
|
+ this.userId = this.carhelp.getPersonInfo().id;
|
|
|
+
|
|
|
+ }
|
|
|
+ WxJsApi.getWxConfig(['getLocation', 'addEventListener', 'scanQRCode']).then((res) => {
|
|
|
+ // console.log(res)
|
|
|
}).catch(error => {
|
|
|
- console.log(res)
|
|
|
+ console.log(res)
|
|
|
})
|
|
|
+
|
|
|
|
|
|
// console.log('longitude2 '+this.longitude)
|
|
|
// console.log('latitude2 '+this.latitude)
|
|
@@ -358,7 +360,46 @@ export default {
|
|
|
this.end();
|
|
|
},
|
|
|
methods: {
|
|
|
+ setCenter(){
|
|
|
+ console.log('getPoint')
|
|
|
+ WxJsApi.getLocation().then((res) => {
|
|
|
+
|
|
|
+ _self.latitude = parseFloat(res.latitude);
|
|
|
+ _self.longitude = parseFloat(res.longitude);
|
|
|
+ //let data = {position:{latitude:latitude,longitude:longitude}};
|
|
|
+
|
|
|
+ let posCenter= {longitude: _self.longitude,latitude: _self.latitude};
|
|
|
+ this.$refs.amap.setCenter(posCenter);
|
|
|
+ }).catch(error => {
|
|
|
+ uni.showToast({
|
|
|
+ title:JSON.stringify(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+// console.log('setCenter')
|
|
|
+ },
|
|
|
+ getScanCode() {
|
|
|
+ if (this.userId) {
|
|
|
+ WxJsApi.scanQRCode(1).then(res => {
|
|
|
+ if(res) {
|
|
|
+ indexAPI.scanCode(res).then((response) => {
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+ uni.showToast({
|
|
|
+ title: error,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/login/login'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
navigateTo(){
|
|
|
console.log('导航')
|
|
|
this.$refs.amap.navigate();
|
|
@@ -612,6 +653,7 @@ export default {
|
|
|
)
|
|
|
console.log('getChargingStationData end')
|
|
|
},
|
|
|
+ /*
|
|
|
charge(item){
|
|
|
console.log('扫码充电')
|
|
|
//#ifdef MP-WEIXIN
|
|
@@ -631,7 +673,7 @@ export default {
|
|
|
url:'stationAndPile/chargingPileDetails'
|
|
|
})
|
|
|
|
|
|
- },
|
|
|
+ }, */
|
|
|
moveEnd(e){
|
|
|
console.log('moveEnd'+JSON.stringify(e))
|
|
|
let data = {latitude:e.center.lat,longtitude:e.center.lng};
|