Ver Fonte

Merge branches 'master' and 'master' of http://47.92.161.104:10080/zkx/JP-ChargeTeam51

zhengkaixin há 3 anos atrás
pai
commit
dca67b0d31

+ 12 - 0
apis/site.js

@@ -26,6 +26,18 @@ export function getChargingStationData(data){
 		url: '/mobile/chargingStation/chargingStationData'
 	})
 }
+
+export function searchStationData(data){
+	console.log('搜索站点数据')
+	return request({
+		method: 'post',
+		data: data,
+		url: '/mobile/chargingStation/searchStationData'
+	})
+}
+
+
+
 export function getPileDetails(data){
 	var p = new Promise(function(resolve,rejct){
 		if(data != null)

+ 74 - 0
components/Chargermap.vue

@@ -17,6 +17,7 @@
 				myStyle:"width: 100%; height: 1200rpx;",
 				chargerIcon:'',
 				chargerSelectedIcon:'',
+				positionIcon:'',
 				personIcon:'',
 				longitude: 112.276527,
 				latitude: 30.306427,
@@ -284,6 +285,21 @@
 				this.myEmit("person",marker,pos)
 				//this.chargerList.push(marker)
 			},
+			/*
+			addPosition() {
+				console.log('addPosition'+JSON.stringify(pos))
+				let marker = new AMap.Marker({
+					content: "<img src='"+this.positionIcon+"' style='height: 40px;width: 40px' />",
+					//icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
+					//position: [pos.longitude,pos.latitude],
+					offset: new AMap.Pixel(20, 220),
+					zIndex:900,
+					autoRotation: true,
+				});
+				marker.setMap(this.mapcharger);
+				//this.myEmit("person",marker,pos)
+				//this.chargerList.push(marker)
+			},*/
 			setChargerList(sz){
 					
 					if(this.AMap==null){
@@ -387,6 +403,7 @@
 			init(){
 //				console.log('init')
 				var _this = this;
+//				this.positionIcon = require('@/static/img/location.png')
 //				this.personIcon = require("@/static/img/charger_selected.png")
 				// this.chargerIcon = require("@/static/img/charger.png");
 				// this.chargerSelectedIcon =  require("@/static/img/charger_selected_circle.png");
@@ -402,11 +419,68 @@
 						center: [this.longitude, this.latitude],
 						zoom: 14
 					});
+					/*
+					new SimpleMarker({
+					            iconLabel: '2',
+					            //自定义图标节点(img)的属性
+					            iconStyle: {
+					
+					                src: '@/static/img/location.png',
+					                style: {
+					                    width: '20px',
+					                    height: '30px'
+					                }
+					            },
+					  //设置基点偏移
+								offset: new AMap.Pixel(-10, -30),
+					
+								map: map,
+								showPositionPoint: true,
+								position: lngLats[1],
+								zIndex: 200
+							});
+*/
+					 /*
+					_this.mapcharger.plugin('AMap.Geolocation', function () {
+					        var geolocation = new AMap.Geolocation({
+					            enableHighAccuracy: true,
+					            timeout: 10000,
+					            buttonOffset: new AMap.Pixel(10, 220),
+					            zoomToAccuracy: true,
+					            buttonPosition: 'RB'
+					        });
+					        _this.mapcharger.center = geolocation;
+					        _this.mapcharger.addControl(geolocation);//地图控件右下角显示当前位置
+					    });
+					
+					_this.mapcharger.plugin(["AMap.ToolBar"],function(){
+					    //加载工具条
+					    var tool = new AMap.ToolBar({
+							locate:true,
+							direction:false,
+							ruler:false,
+							liteStyle:true,
+							useNative:true,
+//							autoPosition:true,
+//							locationMarker:
+						});
+					    _this.mapcharger.addControl(tool);    
+					});*/
+					/*
+					_this.mapcharger.plugin(["AMap.ControlBar"],function(){
+					    var controlBar = new AMap.ControlBar({
+							showZoomBar:true,
+							showControlButton:true,
+							position:{top:'10px',right:'10px'}
+						})
+					    _this.mapcharger.addControl(controlBar)
+					});*/
 					//var clickHandler = function(e) {
 					//	console.log('您在[ '+e.lnglat.getLng()+','+e.lnglat.getLat()+' ]的位置点击了地图!');
 					//};
 					//_this.mapcharger.on('click', clickHandler); 
 					_this.$emit('onload')
+					//_this.addPosition();
 					_this.listenMove();
 					
 				}, e => {

+ 14 - 0
pages.json

@@ -50,6 +50,20 @@
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
+		{
+			"name": "充电订单",
+			"path": "pages/record/index",
+			"style": {
+				//"navigationStyle": "custom" // 隐藏系统导航栏
+			}
+		},
+		{
+			"name": "订单详情",
+			"path": "pages/record/details",
+			"style": {
+				//"navigationStyle": "custom" // 隐藏系统导航栏
+			}
+		},
 		{
 			"name": "我的",
 			"path": "pages/user/index",

+ 9 - 3
pages/index/index.vue

@@ -312,7 +312,9 @@
 			},
 			fastRecharge() {
 				if (this.userId) {
-					this.gotoUrl('pages/user/finance/recharge?id=' + this.userId)
+					uni.navigateTo({
+						url: '/pages/user/finance/recharge'
+					})
 				} else {
 					uni.navigateTo({
 						url: '/pages/login/login'
@@ -321,7 +323,9 @@
 			},
 			chargingRecord() {
 				if (this.userId) {
-					this.gotoUrl('pages/user/finance/rechargeList?id=' + this.userId)
+					uni.navigateTo({
+						url: '/pages/record/index'
+					})
 				} else {
 					uni.navigateTo({
 						url: '/pages/login/login'
@@ -330,7 +334,9 @@
 			},
 			rechargeActivity() {
 				if (this.userId) {
-					this.gotoUrl('pages/user/finance/recharge?id=' + this.userId)
+					uni.navigateTo({
+						url: '/pages/user/finance/recharge'
+					})
 				} else {
 					uni.navigateTo({
 						url: '/pages/login/login'

+ 45 - 19
pages/record/details.vue

@@ -4,54 +4,80 @@
 		<view class="details">
 			<view class="details-head">
 				<u-icon name="charging-pile-fill" custom-prefix="custom-icon" color="#27B148" size="48"></u-icon>
-				<h4>荆鹏软件园充电站</h4>
+				<h4>{{chargeDetail.stationName}}</h4>
 			</view>
 			<view class="details-main">
 				<view class="details-price">
-					<span>¥</span><h3>15.00</h3><span>元</span>
+					<span>¥</span><h3>{{chargeDetail.actualFee != null ? chargeDetail.actualFee : '0.00'}}</h3><span>元</span>
 				</view>
 				<p>订单总额</p>
 			</view>
-			<view class="details-row"><p>电费(元)</p><span>¥400.00</span></view>
-			<view class="details-row"><p>服务费(元)</p><span>¥100.00</span></view>
+			<view class="details-row"><p>电费(元)</p><span>¥{{chargeDetail.totalElecMoney != null ? chargeDetail.totalElecMoney : '0.00'}}</span></view>
+			<view class="details-row"><p>服务费(元)</p><span>¥{{chargeDetail.totalServiceMoney != null ? chargeDetail.totalServiceMoney : '0.00'}}</span></view>
 		</view>
 		<view class="details">
 			<view class="details-title">
 				<h4>充电详情</h4>
 			</view>
-			<view class="details-row"><p>消费电量(kW-h)</p><span>40.000</span></view>
-			<view class="details-row"><p>开始时间</p><span>2022-05-01 10:00:00</span></view>
-			<view class="details-row"><p>结束时间</p><span>2022-05-01 11:59:59</span></view>
-			<view class="details-row"><p>充电时长</p><span>1小时59分59秒</span></view>
+			<view class="details-row"><p>消费电量(kW-h)</p><span>{{chargeDetail.electricQuantity != null ? chargeDetail.electricQuantity : '0.000'}}</span></view>
+			<view class="details-row"><p>开始时间</p><span>{{chargeDetail.startTime}}</span></view>
+			<view class="details-row"><p>结束时间</p><span>{{chargeDetail.endTime}}</span></view>
+			<view class="details-row"><p>充电时长</p><span>{{chargeDetail.chargingMinute != null ? chargeDetail.chargingMinute+'分' : '00分00秒'}}</span></view>
 		</view>
 		<view class="details">
 			<view class="details-title">
 				<h4>更多信息</h4>
 			</view>
-			<view class="details-row"><p>结束原因</p><span>用户手动结束</span></view>
-			<view class="details-row"><p>订单状态</p><span>已缴费</span></view>
-			<view class="details-row"><p>充电桩编号</p><span>A000152</span></view>
-			<view class="details-row"><p>更新时间</p><span>2022-05-01 12:00:00</span></view>
-			<view class="details-row"><p>充电车辆</p><span>鄂D999999</span></view>
+			<view class="details-row"><p>结束原因</p><span>{{chargeDetail.remark}}</span></view>
+			<view class="details-row"><p>订单状态</p><span>{{chargeDetail.statusText}}</span></view>
+			<view class="details-row"><p>充电桩编号</p><span>{{chargeDetail.deviceNo}}</span></view>
+			<view class="details-row"><p>更新时间</p><span>{{chargeDetail.updateTime}}</span></view>
+			<view class="details-row"><p>充电车辆</p><span>{{chargeDetail.carNumber}}</span></view>
 		</view>
 		<view class="detailsBtn">
-			<u-button class="detailsBtn-btn" type="primary" shape="circle" plain>返回</u-button>
+			<u-button class="detailsBtn-btn" type="primary" shape="circle" plain @click="toHome">返回主页</u-button>
 		</view>
 	</view>
 </template>
 
 <script>
+	import * as API from '@/apis/index.js'
+	
 	export default {
 		data() {
 			return {
-				form: {
-					name: '',
-					intro: '',
-				},
+				id: '',
+				chargeDetail: {},
+			}
+		},
+		onLoad(op) {
+			if(op.id) {
+				this.id = op.id;
+				this.getchargingDetail();
 			}
 		},
 		methods: {
-
+			toHome() {
+				uni.navigateTo({
+					url: '/pages/index/index'
+				})
+			},
+			getchargingDetail() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				API.chargingDetail(this.id).then((res) => {
+					uni.hideLoading();
+					
+					this.chargeDetail = res.data.chargingRecord;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			}
 		}
 	}
 </script>

+ 71 - 43
pages/record/index.vue

@@ -3,57 +3,26 @@
 		<u-navbar title="充电订单"></u-navbar>
 		
 		<view class="record">
-			<view class="recordTime">
-				<p>5月</p>
+			<view class="recordTime" @click="show = true">
+				<u-picker mode="time" v-model="show" :params="params" @confirm="confirmTime" @cancel="cancelTime"></u-picker>
+				<p>{{month}}月</p>
 				<u-icon name="arrow-down-s-fill" custom-prefix="custom-icon" color="#B3B3B3" size="32"></u-icon>
 			</view>
 			<view class="recordList">
-				<view class="recordList-item">
+				<view class="recordList-item" v-for="(item,index) in chargeList" :key="item.id" @click="gotoUrl('pages/record/details?id=' + item.id)">
 					<view class="recordList-name">
-						<h4>荆鹏软件园充电站/A0001</h4>
-						<span class="state1">排队中</span>
+						<h4>{{item.stationName}}/{{item.deviceNo}}</h4>
+						<span class="state1">{{item.statusText}}</span>
 					</view>
 					<view class="recordList-row">
-						<p>开始时间:2022-05-05 12:00:00</p>
+						<p>开始时间:{{item.status == '0' || item.status == '4' ? '暂未开始' : item.createTime}}</p>
 					</view>
 					<view class="recordList-row">
-						<p>充电电量:20.000kW-h</p>
+						<p>充电电量:{{item.electricQuantity != null ? item.electricQuantity : '0.000'}}kW-h</p>
 					</view>
 					<view class="recordList-row">
-						<p>充电时长:10分20秒</p>
-						<h4>61.50</h4>
-					</view>
-				</view>
-				<view class="recordList-item">
-					<view class="recordList-name">
-						<h4>荆鹏软件园充电站/A0001</h4>
-						<span class="state2">进行中</span>
-					</view>
-					<view class="recordList-row">
-						<p>开始时间:2022-05-05 12:00:00</p>
-					</view>
-					<view class="recordList-row">
-						<p>充电电量:20.000kW-h</p>
-					</view>
-					<view class="recordList-row">
-						<p>充电时长:10分20秒</p>
-						<h4>61.50</h4>
-					</view>
-				</view>
-				<view class="recordList-item">
-					<view class="recordList-name">
-						<h4>荆鹏软件园充电站/A0001</h4>
-						<span class="state3">已结束</span>
-					</view>
-					<view class="recordList-row">
-						<p>开始时间:2022-05-05 12:00:00</p>
-					</view>
-					<view class="recordList-row">
-						<p>充电电量:20.000kW-h</p>
-					</view>
-					<view class="recordList-row">
-						<p>充电时长:10分20秒</p>
-						<h4>61.50</h4>
+						<p>充电时长:{{item.chargingMinute != null ? item.chargingMinute+'分' : '00分00秒'}}</p>
+						<h4>{{item.actualFee != null ? item.actualFee : '0.00'}}</h4>
 					</view>
 				</view>
 			</view>
@@ -62,14 +31,73 @@
 </template>
 
 <script>
+	import * as API from '@/apis/index.js'
+	
 	export default {
 		data() {
 			return {
-
+				params: {
+					year: true,
+					month: true,
+					day: false,
+					hour: false,
+					minute: false,
+					second: false,
+					timestamp: true,
+				},
+				show: false,
+				month: '',
+				dateMonth: '',
+				chargeList: []
 			}
 		},
-		methods: {
+		onReady() {
+			var date = new Date();
+			this.month = date.getMonth() + 1;
 			
+			var year = date.getFullYear();
+			var monthN = this.month;
+			if(monthN >= 1 && monthN <= 9) {
+				monthN = "0" + monthN;
+			}
+			this.dateMonth = year + '-' + monthN;
+					
+			this.getChargeList();
+		},
+		methods: {
+			confirmTime(params) {
+				this.dateMonth = params.year + '-' + params.month;
+				if(params.month.slice(0,1) == '0') {
+					this.month = params.month.slice(1);
+				} else {
+					this.month = params.month;
+				}
+				this.getChargeList();
+				this.show = false;
+			},
+			cancelTime() {
+				this.show = false;
+			},
+			getChargeList() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				API.chargingRecordData({
+					pageIndex: 1,
+					pageSize: 100,
+					// month: this.dateMonth,
+				}).then((res) => {
+					uni.hideLoading();
+					
+					this.chargeList = res.data.data;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			}
 		}
 	}
 </script>

+ 8 - 3
pages/search/search.vue

@@ -32,7 +32,7 @@
 </template>
 
 <script>
-	let _self;
+	let _self; 
 	import * as api from '@/apis/site.js';
 	import * as WxJsApi from '@/utils/wxJsApi.js'
 	import MapLoader from '@/utils/AMap'
@@ -41,6 +41,8 @@
 		data() {
 			
 			return {
+				
+				userId:'',
 				keyword:'',
 			  stations_filter:[],
 			  stations:[
@@ -62,7 +64,10 @@
 			console.log('op'+JSON.stringify(op))*/
 		},
 		onReady() {
-			 
+			 if (this.carhelp.getPersonInfo()) {
+			 	this.userId = this.carhelp.getPersonInfo().id;
+			 			
+			 } 
 			 WxJsApi.getWxConfig(['getLocation','addEventListener']).then((res)=>{
 			 
 				// this.message=JSON.stringify(res)
@@ -137,7 +142,7 @@
 					data1.powerEnd = this.preference.obc_power.maxValue.toString();
 				*/
 				console.log('data1'+JSON.stringify(data1))
-				api.getChargingStationData(data1).then(function(res){
+				api.searchStationData(data1).then(function(res){
 					
 					console.log('getChargingStationData'+JSON.stringify(res))
 					if(!res.result || !res.data || !res.data.data)

+ 56 - 14
pages/searchPile/searchPile.vue

@@ -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};

+ 40 - 1
pages/searchPile/stationAndPile/stationDetails.vue

@@ -128,13 +128,17 @@
 		</view> 
 		
 		<view class="bottom">
-			<u-button class="button1" shape="circle" size="medium" @click="charge">扫码充电</u-button>
+			<u-button class="button1" shape="circle" size="medium" @click="getScanCode()">扫码充电</u-button>
 			<u-button class="button2" shape="circle" size="medium" @click="navigate">导航</u-button>
 		</view>
 	</view>
 </template>
 
 <script>
+	import * as indexAPI from '@/apis/index.js'
+	import * as WxJsApi from '@/utils/wxJsApi.js'
+	import MapLoader from '@/utils/AMap'
+	
 	import * as api from "@/apis/site.js"
 	let _self;
 	 
@@ -143,6 +147,7 @@
  
 		data() {
 			return {
+				userId:'',
 				currentPos:{
 						name:'荆鹏软件园充电站',
 						longitude: 112.28468,
@@ -241,7 +246,41 @@
 			}
 			_self = this;
 		},
+		onReady(){
+			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)
+			})
+			 
+		},
 		methods:{
+			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'
+					})
+				}
+			},
 			processStationsInfo(){
 				for(let i = 0;i <_self.stationDetail.devices.length;i++){
 					//console.log('device['+i.toString()+']'+JSON.stringify(_self.stationDetail.devices[i]))

+ 52 - 18
pages/searchPile/stationAndPile/stationDetailsMap.vue

@@ -5,6 +5,7 @@
 			 
 			<view>
 				<Chargermap   ref="amap" @onload="mapdown" @clickMap="clickMap"></Chargermap>
+				<u-image style='position:absolute;z-index:1024;right:20px;bottom:220px;' src="@/static/img/location.png" width="30px" height="30px" @click="setCenter"></u-image>
 			</view>
 			 
 			 <view class="chargerCard" @click="stationDetail(item)">
@@ -49,7 +50,7 @@
 				 		</view>
 				 	</view>
 				 	<view class="card_item" style="padding-bottom: 20rpx;">
-				 		<u-button shape='circle' style="color: #00B962;" @click="charge">
+				 		<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">
@@ -71,13 +72,17 @@
 
 <script>
 	let _self;
+	import * as indexAPI from '@/apis/index.js'
 	import Chargermap from '@/components/Chargermap.vue';
+	import * as WxJsApi from '@/utils/wxJsApi.js'
+	import MapLoader from '@/utils/AMap'
 	export default {
 		components: {
 			Chargermap 
 		},
 		data() {
 			return {
+				userId:'',
 				id: '',
 				longitude: 112.28468,
 				latitude: 30.307094,
@@ -104,25 +109,45 @@
 					url:'stationDetails?station='+encodeURIComponent(JSON.stringify(this.item))
 				})
 			},
-			charge(){
-				 console.log('扫码充电')
-				//#ifdef MP-WEIXIN
-				uni.scanCode({
-					success:function(res){
-						uni.navigateTo({
-							url:'chargingPileDetails?pile='+encodeURIComponent(JSON.stringify(data))
-						})
-						
-					}
-				}) 
-				return;
-				//#endif
+			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}};
 				 
-				 console.log('扫码充电1')
-				 uni.navigateTo({
-				 	url:'chargingPileDetails'
-				 })
+					 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'
+					})
+				}
 			},
 			mapdown() { 
 						var obj = {
@@ -162,6 +187,15 @@
 			onReady() {
 				//		console.log('longitude2  '+this.longitude)
 				//		console.log('latitude2  '+this.latitude) 
+				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)
+				})
 				this.isReady = true;
 				this.$refs.amap.init();
 				 

BIN
static/img/location.png