浏览代码

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

# Conflicts:
#	pages/index/index.vue
#	pages/user/finance/recharge.vue
常志远 3 年之前
父节点
当前提交
d45b79d03f

+ 43 - 0
apis/chargeProcess.js

@@ -0,0 +1,43 @@
+import request from '../utils/request.js';
+ 
+ 
+ export function personalCenter(data) {
+ 	return request({
+ 		method: 'post',
+ 		data: data,
+ 		url: '/mobile/regUser/personalCenter'
+ 	})
+ }
+ 
+export function chargingDeviceGunDetail(data) {
+	return request({
+		method: 'get',
+		data: data,
+		url: '/mobile/chargingCar/chargingDeviceGunDetail'
+	})
+}
+export function readyToCharging(data) {
+	return request({
+		method: 'post',
+		data: data,
+		url: '/mobile/chargingCar/readyToCharging'
+	})
+}
+
+
+
+export function startCarCharging(data) {
+	return request({
+		method: 'post',
+		data: data,
+		url: '/mobile/command/startCarCharging'
+	})
+}
+
+export function stopCarCharging(data) {
+	return request({
+		method: 'post',
+		data: data,
+		url: '/mobile/command/stopCarCharging'
+	})
+}

+ 15 - 0
apis/index.js

@@ -2,6 +2,21 @@ import request from '../utils/request.js';
 import requestWhite from '../utils/requestWhite.js';
 import Qs from 'qs';
 
+export function scanCode(res) {
+	// res="jp_team51_charge_id:A_11111"
+	var str1 = res.slice(0,19);
+	var str2 = res.slice(20,21);
+	var id = res.slice(22);
+	
+	if(str1 == 'jp_team51_charge_id') {
+		if(str2 == 'A') {
+			uni.navigateTo({
+				url: '/pages/searchPile/stationAndPile/stationDetails?id=' + id
+			})
+		}
+	}
+}
+
 export function activityInfoList(data) {
 	return requestWhite({
 		method: 'post',

+ 17 - 1
apis/login.js

@@ -1,7 +1,6 @@
  import requestWhite from '../utils/requestWhite.js';
 import Qs from 'qs';
 
- 
 export function findByOpenId(data) {
 	var url='/mobile/regUser/findByOpenId';
 	return requestWhite({
@@ -11,6 +10,23 @@ export function findByOpenId(data) {
 	})
 }
 
+ export function findNoLTextConfigure(data) {
+ 	var url='/mobile/dataDictionary/findNoLTextConfigure';
+ 	return requestWhite({
+ 		method: 'post',
+ 		data: data,
+ 		url: url
+ 	})
+ }
+export function findConfigureByKey(data) {
+	var url='/mobile/dataDictionary/findConfigureByKey';
+	return requestWhite({
+		method: 'post',
+		data: data,
+		url: url
+	})
+}
+
 export function validateCode(data) {
 	 
 	return requestWhite({

+ 8 - 0
apis/news.js

@@ -9,3 +9,11 @@ export function newsInfoList(data) {
 		url: '/mobile/newsInfo/newsInfoList'
 	})
 }
+
+export function newsInfoDetail(id) {
+	 
+	return requestWhite({
+		method: 'get',
+		url: '/mobile/newsInfo/newsInfoDetail?id=' + id
+	})
+}

+ 5 - 1
apis/site.js

@@ -1,7 +1,11 @@
 import request from '../utils/request.js';
 import Qs from 'qs';
 export function geChargingStationData(data){
-	
+	return request({
+		method: 'post',
+		data: data,
+		url: '/mobile/chargingStation/chargingStationData'
+	})
 }
 export function getPileDetails(data){
 	var p = new Promise(function(resolve,rejct){

+ 37 - 1
apis/user.js

@@ -1,6 +1,41 @@
 import request from '../utils/request.js';
 import requestWhite from '../utils/requestWhite.js';
+import Qs from 'qs';
 
+export function updatePersonInformation (data) {
+	 
+	return request({
+		method: 'post',
+		data:data ,
+		url: '/mobile/regUser/updatePersonInformation'
+	})
+}
+
+export function regUserCarList () {
+	 
+	return request({
+		method: 'get',
+		url: '/mobile/regUser/regUserCarList'
+	})
+}
+
+export function addRegUserCar (data) {
+	 
+	return request({
+		method: 'post',
+		data:data ,
+		url: '/mobile/regUser/addRegUserCar'
+	})
+}
+
+export function deleteRegUserCar (data) {
+	 
+	return request({
+		method: 'post',
+		data:data ,
+		url: '/mobile/regUser/deleteRegUserCar'
+	})
+}
 
 export function helpList (data) {
 	 
@@ -9,5 +44,6 @@ export function helpList (data) {
 		data:data ,
 		url: '/mobile/roleSharing/helpList'
 	})
-} 
+}
+
 

+ 2 - 4
apis/weixin.js

@@ -4,12 +4,10 @@ import requestWhite from '../utils/requestWhite.js';
 import Qs from 'qs';
 
 //微信支付
-export function wxpay(orderId) {
+export function wxpay(data) {
 	return request({
 		url: '/wxPay/wxJsapiPay',
-		data: {
-			chargingMarketingId: orderId
-		},
+		data: data,
 		method: 'post',
 	})
 }

+ 70 - 17
components/Chargermap.vue

@@ -68,11 +68,12 @@
 						longitude:112.279274,
 						latitude:30.303273,
 					}
-				]
+				],
 			};
 		},
 		methods:{
-			getLocation () {
+			getLocation1() {
+//			  console.log('getLocation');
 			  const self = this;
 			  AMap.plugin('AMap.Geolocation', function () {
 				var geolocation = new AMap.Geolocation({
@@ -88,26 +89,30 @@
 				 
 				function onComplete (data) {
 				  // data是具体的定位信息
+				  self.$emit('location',data);
 				  console.log('定位成功信息:', data.addressComponent.city);
 				  self.city = data.addressComponent.city;
 				}
 				 
 				function onError (data) {
 				  // 定位出错
-				  console.log('定位失败错误:', data);
+//				  console.log('定位失败错误:', data);
 				  // 调用IP定位
-				  self.getLngLatLocation();
+				  let ret = { position:{longitude: 112.28468,latitude: 30.307094}};
+				  self.$emit('location',ret);
+				  //self.getLngLatLocation();
 				}
 			  });
 			}, 
 			// 通过IP获取当前位置
 			getLngLatLocation () {
+				const self = this;
 			  AMap.plugin('AMap.CitySearch', function () {
 				var citySearch = new AMap.CitySearch();
 				citySearch.getLocalCity(function (status, result) {
 				  if (status === 'complete' && result.info === 'OK') {
 					// 查询成功,result即为当前所在城市信息
-					console.log('通过ip获取当前城市:', result);
+					//console.log('通过ip获取当前城市:', result);
 					// 逆向地理编码
 					AMap.plugin('AMap.Geocoder', function () {
 					  var geocoder = new AMap.Geocoder({
@@ -118,8 +123,9 @@
 					  var lnglat = result.rectangle.split(';')[0].split(',');
 					  geocoder.getAddress(lnglat, function (status, data) {
 						if (status === 'complete' && data.info === 'OK') {
-						  // result为对应的地理位置详细信息
-						  console.log(data);
+						  // result为对应的地理位置详细信息	
+						   //self.$emit('location',data);
+							console.log('location'+JSON.stringify(data));
 						}
 					  });
 					});
@@ -127,12 +133,58 @@
 				});
 			  });
 			}, 
+			searchBtn(startLngLat,endLst){
+				var _this = this;
+				
+				AMap.plugin('AMap.Driving', function() {
+				  var driving = new AMap.Driving({
+					// 驾车路线规划策略,AMap.DrivingPolicy.LEAST_TIME是最快捷模式
+					policy: AMap.DrivingPolicy.LEAST_TIME
+				  })
+				  
+				 //var startLngLat = [_this.longitude, _this.latitude]
+				 //var endLngLat = [116.427281, 39.903719]
+				 for(let i=0;i< endLst.length;i++)
+				 {
+					 let item = endLst[i];
+					 let endLngLat = [item.longitude,item.latitude]
+					 console.log('search start['+JSON.stringify(startLngLat))					 
+					 console.log('search end]'+JSON.stringify(endLngLat))
+					 
+					  driving.search(startLngLat, endLngLat, function (status, result) {
+							console.log(result)
+							console.log('秒'+result.routes[0].time)//秒
+							console.log('距离'+result.routes[0].distance)//米
+							//uni.showToast({
+							//	title:result.routes[0].time+"秒,"+result.routes[0].distance+"米"
+							//})
+							 endLst[i].distance = result.routes[0].distance/1000.0;
+							 endLst[i].time = result.routes[0].time/60.0;
+					  })
+					  
+					  //var startLngLat2 = [_this.longitude, _this.latitude]
+					  //var endLngLat2 = [_this.longitude2, _this.latitude2]
+					
+					 /* 
+					  driving.search(startLngLat2, endLngLat2, function (status, result) {
+												console.log(result)
+												console.log(result.routes[0].time)//秒
+												console.log(result.routes[0].distance)//米
+												uni.showToast({
+													title:result.routes[0].time+"秒,"+result.routes[0].distance+"米"
+												})
+					  })*/
+				}
+				 
+				}) 
+			},
 			updateCharger(pos){
 //				console.log('更新充电桩1'+JSON.stringify(pos)) 
 //				console.log('更新充电桩2'+JSON.stringify(this.chargerList[0].info)) 
-				let index = this.chargerList.findIndex(item => item.info.latitude === pos.latitude && item.info.longitude === pos.longitude);
+//				let index = this.chargerList.findIndex(item => item.info.latitude === pos.latitude && item.info.longitude === pos.longitude);
 				//let index = this.chargerList.findIndex(item => (Math.abs(item.info.longitude-pos.longitude)<0.000001 && Math.abs(item.info.longitude - pos.latitude)<0.000001));
-				
+				let index = this.chargerList.findIndex(item => item.info.id === pos.id);
+					console.log('更新充电桩['+ index + ']'+JSON.stringify(pos)) 
 				if(index>=0){
 					let station_icon2 = "width: 100px;height: 36px;line-height: 20px;border-radius: 50px;background-color: rgba(0, 185, 98, 100);text-align: center;display: flex;";
 					let corner2=" width: 0;height: 0;position: absolute;top: 36px;left: 0;right: 0;margin: auto;border-bottom: 6px solid transparent;border-left: 6px solid transparent;border-right: 6px solid transparent;border-top: 8px solid #00b962 ;";
@@ -150,8 +202,8 @@
 					content+="</div>";
 					content+="</div>";
 					
- 					console.log('找到充电桩[]'+content)
-					//let content = "<div  style='height: 40px;width: 100px;display: flex;flex-direction: row;   flex-wrap: wrap; background-color: #00B962!important;border-radius: 20px;'>		    <div><img src='"+this.chargerSelectedIcon+"' style='idth: 40px;height: 40px'></div><div style='display: flex;flex-direction:column;color:#FFFFFF;'><div style='margin-left:10px'>¥"+ pos.price +"</div><div style='margin-left:10px'>空闲"+pos.idleNum + "</div> </div></div>";
+// 					console.log('找到充电桩[]'+content)
+					//content = "<div  style='height: 40px;width: 100px;display: flex;flex-direction: row;   flex-wrap: wrap; background-color: #00B962!important;border-radius: 20px;'>		    <div><img src='"+this.chargerSelectedIcon+"' style='idth: 40px;height: 40px'></div><div style='display: flex;flex-direction:column;color:#FFFFFF;'><div style='margin-left:10px'>¥"+ pos.price +"</div><div style='margin-left:10px'>空闲"+pos.idleNum + "</div> </div></div>";
 					this.chargerList[index].info.selected = true;
 					this.chargerList[index].marker.setContent(content);						
 				} 
@@ -308,7 +360,7 @@
 			},
 			
 			init(){
-				console.log('init')
+//				console.log('init')
 				var _this = this;
 //				this.personIcon = require("@/static/img/charger_selected.png")
 				// this.chargerIcon = require("@/static/img/charger.png");
@@ -321,14 +373,15 @@
 					//使用地图容器ID创建
 					_this.mapcharger=new AMap.Map("container", {
 						resizeEnable: true,
+						dragEnable : true,
 						center: [this.longitude, this.latitude],
 						zoom: 14
 					});
 					 
-					var clickHandler = function(e) {
-						console.log('您在[ '+e.lnglat.getLng()+','+e.lnglat.getLat()+' ]的位置点击了地图!');
-					};
-					_this.mapcharger.on('click', clickHandler); 
+					//var clickHandler = function(e) {
+					//	console.log('您在[ '+e.lnglat.getLng()+','+e.lnglat.getLat()+' ]的位置点击了地图!');
+					//};
+					//_this.mapcharger.on('click', clickHandler); 
 					_this.$emit('onload')
 					var mapMovestart = function(){
 						console.log('movestart')
@@ -339,7 +392,7 @@
 					var mapMoveend = function(){
 						let pos = _this.logMapInfo();
 						_this.$emit('onMoveEnd',pos);
-						console.log('mapMoveend')
+//						console.log('mapMoveend')
 					}
 					_this.mapcharger.on('movestart', mapMovestart);
 					_this.mapcharger.on('mapmove', mapMove);

+ 1 - 1
manifest.json

@@ -70,7 +70,7 @@
     },
     "h5" : {
         "devServer" : {
-            "port" : 8080,
+            "port" : 80,
             "https" : false,
             "disableHostCheck" : true
         },

+ 6 - 6
pages.json

@@ -58,22 +58,22 @@
 			}
 		},
 		{
-			"name": "车量管理",
-			"path": "pages/user/car/index",
+			"name": "个人资料",
+			"path": "pages/user/data",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name": "车量信息",
-			"path": "pages/user/car/carAdd",
+			"name": "车量管理",
+			"path": "pages/user/car/index",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		},
 		{
-			"name": "添加车牌",
-			"path": "pages/user/car/carDet",
+			"name": "车量管理",
+			"path": "pages/user/car/carAdd",
 			"style": {
 				//"navigationStyle": "custom" // 隐藏系统导航栏
 			}

+ 37 - 9
pages/article/articleDetails.vue

@@ -3,29 +3,57 @@
 		<u-navbar title="文章详情"></u-navbar>
 		<view class="main">
 			<view class="new-title">
-				推进以县城为载体的城镇化建设,快电助力县镇充电网络建设
+				{{newsDetail.title}}
 			</view>
 			<view class="time">
 				<view class="time-left">
-					2022-05-11 09:00:00
+					{{newsDetail.createTime}}
 				</view>
 				<view class="time-tight">
-					<text class="iconfont">&#xe612;</text><text class="num">566</text>
+					<text class="iconfont">&#xe612;</text><text class="num">{{newsDetail.readNum}}</text>
 				</view>
 			</view>
 			<view class="news-content">
-				 近日,中共中央办公厅、国务院办公厅印发了《关于推进以县城为重要载体的城镇化建设的意见》。《意见》明确,推进以县城为重要载体的城镇化建设。推动公共交通工具和物流配送、市政环卫等车辆电动化。优化公共充换电设施建设布局,加快建设充电桩。随着国家、地方出台的一系列优惠政策,新能源汽车快速下沉至三四线城市及县镇市场。据中汽协数据显示,2021年,新能源汽车下乡车型共完成销售106.8万辆,同比增长169.2%,比整体市场增速高约10个百分点,贡献率逼近30%。随着新能源汽车加速下沉,县镇市场的充电补能需求大幅增加。日前,第三方充换电网络快电发布的《2022五一新能源汽车出行报告》显示,今年五一期间,三四线城市、乡镇市场新能源汽车充电量同比增长227%。其中,漳州市、柳州市、宝鸡市等位列三四线城市充电量前三位。
-			<img src="/static/img/新闻图.png" alt="">
-			《意见》提出,推动公共交通工具和物流配送、市政环卫等车辆电动化。优化公共充换电设施建设布局,加快建设充电桩。可以预期,新能源汽车在县级城市、乡镇市场将迎来新一轮增长。随着这些地区新能源汽车保有量的增加,也对充电基础设施建设提出了更高要求。
-			目前,县镇地区充电桩数量较少、位置更隐蔽、日常维护差。即便车主找到充电桩也有可能是“坏桩”,车主充电体验差且提升难度较大。而对充电运营商来说,县镇车流密度相对较低,在场站选址、日常运维、营收增长等环节均存在难题,很多场站仅靠政府补贴难以生存。因此,解决充电站运营痛点、完善充电基础设施网络已迫在眉睫。
-			第三方充换电网络快电正凭借其构建的覆盖全国的互联互通充电网络,积极推动县镇充电基础设施发展,帮助车主和充电运营商实现共赢。一方面,快电连接了包括特来电、星星充电等在内的主流充电桩运营商,可为车主实时推荐附近好用的充电桩,解决县镇车主找不到桩、找到坏桩等难题。
-			另一方面,快电可为充电运营商提供从选址、建站到获客、运营再到后期维护的全流程服务,破解县镇市场盈利难题。与此同时,快电还可提供增值服务支持,帮助场站增设餐饮、购物、按摩、车后服务等,帮助其不断拓展营收渠道,实现持续盈利。
+				{{newsDetail.content}}
 			</view>
 		</view>
 	</view>
 </template>
 
 <script>
+	import * as newsApi from '@/apis/news.js'
+	
+	export default {
+		data() {
+			return {
+				id: '',
+				newsDetail: '',
+			}
+		},
+		onLoad(op) {
+			this.id =op.id;
+			
+			this.getNewsInfoDetail();
+		},
+		methods: {
+			getNewsInfoDetail() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				newsApi.newsInfoDetail(this.id).then((res) => {
+					uni.hideLoading()					
+					this.newsDetail = res.data;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			}
+		}
+	}	
 </script>
 
 <style lang="scss" scoped>

+ 30 - 63
pages/article/newsNotice.vue

@@ -10,68 +10,17 @@
 		
 		<view class="swiper-box">
 			<u-swiper  :list="list" mode="dot">
-			
-		
-		
 		</u-swiper>
 		</view>
 		
 		<view class="news">
-		
-			<view class="news-content" @click="gotoUrl('pages/article/articleDetails?id=')">
-				<view class="content-text">
-					日印计划联手开发低成本充电桩 推动新兴市场电动车发展
-					<view class="news-time">05-01 09:00</view>
-				</view>
-				<view class="content-img">
-					<img src="/static/img/11091323191.jpg" alt="">
-				</view>
-			</view>
-			<view class="news-content">
-				<view class="content-text">
-					我国新能源汽车市场腾飞在即,充换电何时能够不再“拖后腿”?
-					<view class="news-time">05-01 09:00</view>
-				</view>
-				<view class="content-img">
-					<img src="/static/img/103613441.jpg" alt="">
-				</view>
-			</view>
-		
-			<view class="news-content">
+			<view class="news-content" v-for="(item,index) in newsList" :key="item.id" @click="gotoUrl('pages/article/articleDetails?id=' + item.id)">
 				<view class="content-text">
-					新疆建成首个充电桩实验室
-					<view class="news-time">05-01 09:00</view>
+					{{item.title}}
+					<view class="news-time">{{item.createTime.slice(5)}}</view>
 				</view>
 				<view class="content-img">
-					<img src="/static/img/180023631.jpg" alt="">
-				</view>
-			</view>
-			<view class="news-content">
-				<view class="content-text">
-					三一集团成立动能换电公司 经营范围含集中式快速充电站
-					<view class="news-time">05-01 09:00</view>
-				</view>
-				<view class="content-img">
-					<img src="/static/img/06002925191.jpg" alt="">
-				</view>
-			</view>
-			<view class="news-content">
-				<view class="content-text">
-					梳理我国充换电基础设施行业9大问题,14条建议提供解决方案
-					<view class="news-time">05-01 09:00</view>
-				</view>
-				<view class="content-img">
-					<img src="/static/img/08425983191.png" alt="">
-				</view>
-			</view>
-		
-			<view class="news-content">
-				<view class="content-text">
-					梳理我国充换电基础设施行业9大问题,14条建议提供解决方案
-					<view class="news-time">05-01 09:00</view>
-				</view>
-				<view class="content-img">
-					<img src="/static/img/image_default.png" alt="">
+					<img :src="item.pic" alt="">
 				</view>
 			</view>
 		</view>
@@ -80,17 +29,19 @@
 </template>
 
 <script>
+	import * as newsApi from '@/apis/news.js'
+	
 	export default {
 		data() {
 			return {
 				tabList: [
-					{name: '通知公告'},
-					{name: '行业新闻'},
-					{name: '优惠活动'},
+					{name: '通知公告',type: '1'},
+					{name: '行业新闻',type: '2'},
+					{name: '优惠活动',type: '3'},
 				],
 				current: 0,
-				newstype: '',
 				newsList: [],
+				newsType: '1',
 				pageIndex: 1,
 				recordsTotal: 0,
 				list: [{
@@ -111,9 +62,8 @@
 		methods: {
 			change(index) {
 				this.current = index;
-				if(this.tabList.length){
-					this.newstype=this.tabList[index]
-				}
+				this.newsType = this.tabList[index].type;
+				
 				this.getNewsList(true)
 			},
 			getNewsList(bl) {
@@ -126,7 +76,24 @@
 					this.pageIndex = 1;
 				}
 				
-				uni.hideLoading();
+				newsApi.newsInfoList({
+					pageIndex: 1,
+					pageSize: 10,
+					type: this.newsType
+				}).then((res) => {
+					uni.hideLoading()
+					
+					this.newsList = [
+						...this.newsList,
+						...res.data.data
+					];
+					this.recordsTotal = res.data.recordsTotal		
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
 			},
 			myLoadmore() {
 				this.pageIndex += 1;

+ 54 - 43
pages/index/index.vue

@@ -10,7 +10,7 @@
 		<!-- 选项列表 -->
 		<view class="option-list">
 
-			<view class="list-item" @click="scanCode">
+			<view class="list-item" @click="getScanCode">
 				<view class="icon iconfont" style="background-color:#59d96e;">
 					&#xe61a;
 				</view>
@@ -154,19 +154,8 @@
 		<view class=" top-up">
 			<view class="top-up-title"><text class="line"></text>充值活动</view>
 			<view class="img-box">
-				<view class="img-1" @click="rechargeActivity">
-					<img src="/static/img/瓷片区1.png" alt="">
-					<view class="img-text">
-						充100送20
-						<view class="img-text2">即充即赠 立享优惠</view>
-					</view>
-				</view>
-				<view class="img-1">
-					<img src="/static/img/瓷片区2.png" alt="">
-					<view class="img-text" style="color: #FF7C00;">
-						邀请有礼
-						<view class="img-text2 color">最高可得500元</view>
-					</view>
+				<view class="img-1" v-for="(item,index) in activityList" :key="item.id" @click="rechargeActivity">
+					<img :src="item.picUrl" alt="">
 				</view>
 			</view>
 		</view>
@@ -183,32 +172,13 @@
 		</view>
 		<view class="news">
 
-			<view class="news-content" @click="gotoUrl('pages/article/articleDetails?id=')">
-				<view class="content-text">
-					日印计划联手开发低成本充电桩 推动新兴市场电动车发展
-					<view class="news-time">05-01 09:00</view>
-				</view>
-				<view class="content-img">
-					<img src="/static/img/11091323191.jpg" alt="">
-				</view>
-			</view>
-			<view class="news-content">
-				<view class="content-text">
-					我国新能源汽车市场腾飞在即,充换电何时能够不再“拖后腿”?
-					<view class="news-time">05-01 09:00</view>
-				</view>
-				<view class="content-img">
-					<img src="/static/img/103613441.jpg" alt="">
-				</view>
-			</view>
-
-			<view class="news-content">
+			<view class="news-content" v-for="(item,index) in newsList" :key="item.id" @click="gotoUrl('pages/article/articleDetails?id=' + item.id)">
 				<view class="content-text">
-					新疆建成首个充电桩实验室
-					<view class="news-time">05-01 09:00</view>
+					{{item.title}}
+					<view class="news-time">{{item.createTime.slice(5)}}</view>
 				</view>
 				<view class="content-img">
-					<img src="/static/img/180023631.jpg" alt="">
+					<img :src="item.pic" alt="">
 				</view>
 			</view>
 		</view>
@@ -302,10 +272,19 @@
 				})
 			},
 			//微信扫二维码
-			scanCode() {
+			getScanCode() {
 				if (this.userId != '') {
 					WxJsApi.scanQRCode(1).then(res => {
-
+						if(res) {
+							Api.scanCode(res).then((response) => {
+						
+							}).catch(error => {
+								uni.showToast({
+									title: error,
+									icon: "none"
+								})
+							})
+						}
 					}).catch(error => {
 
 					})
@@ -343,7 +322,23 @@
 				}
 			},
 			getActivityInfoList() {
-
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				Api.activityInfoList({
+					pageIndex: 1,
+					pageSize: 10
+				}).then((res) => {
+					uni.hideLoading()					
+					this.activityList = res.data.data;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
 			},
 			getPoint() {
 				WxJsApi.getLocation().then((res) => {
@@ -371,8 +366,24 @@
 					this.newsList = [];
 					this.pageIndex = 1;
 				}
-
-				uni.hideLoading();
+				
+				newsApi.newsInfoList({
+					pageIndex: 1,
+					pageSize: 10
+				}).then((res) => {
+					uni.hideLoading()
+					
+					this.newsList = [
+						...this.newsList,
+						...res.data.data
+					];
+					this.recordsTotal = res.data.recordsTotal		
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
 			},
 			myLoadmore() {
 				this.pageIndex += 1;
@@ -859,7 +870,7 @@
 
 	
 
-	// 登录提示
+// 登录提示
 	.login-prompt {
 		width: 91.4%;
 		height: 40px;

+ 26 - 3
pages/login/login.vue

@@ -37,6 +37,7 @@
 
 <script>
 	import * as loginApi from '@/apis/login.js'
+	
 	import {
 		checkPhone
 	} from '@/utils'
@@ -52,6 +53,8 @@
 				sendMsgSecond: 60,
 				codeTips: '',
 				value: false,
+				code: '',
+				codeId: '',
 			}
 		},
 		computed: {
@@ -64,6 +67,20 @@
 				return style;
 			}
 		},
+		onLoad(op) {
+			if(op.id) {
+				var str1 = res.slice(0,19);
+				var str2 = res.slice(20,21);
+				var str3 = res.slice(22);
+				
+				if(str1 == 'jp_team51_charge_id') {
+					if(str2 == 'A') {
+						this.code = str2;
+						this.codeId = str3;
+					}
+				} 
+			}
+		},
 		methods: {
 			codeChange(text) {
 				this.codeTips = text;
@@ -165,9 +182,15 @@
 					this.carhelp.setToken(token);
 					this.carhelp.setPersonInfo(response.data.regUser);
 					
-					uni.redirectTo({
-						url: '/pages/index/index'
-					})
+					if(this.code == 'A') {
+						uni.redirectTo({
+							url: '/pages/searchPile/stationAndPile/chargingPileDetails?id=' + this.codeId
+						})
+					} else {
+						uni.redirectTo({
+							url: '/pages/index/index'
+						})
+					}
 				}).catch(error => {
 					uni.showToast({
 						title: error,

+ 38 - 14
pages/login/welcome.vue

@@ -2,7 +2,7 @@
 	<view>
 		<view class="welcome">
 			<view class="welcome-state1">
-				<view class="welcome-next" @click="gotoIndex()">跳过</view>
+				<view class="welcome-next" @click="gotoIndex()">{{step}}|跳过</view>
 				<view class="welcome-foot">
 					<u-image width="185px" height="48px" src="../../static/img/logo.png"></u-image>
 				</view>
@@ -21,14 +21,27 @@
 </template>
 
 <script>
+	import * as loginApi from '@/apis/login.js'
+	
 	export default {
 		data() {
 			return {
-				
+				step:3
 			}
 		},
 		methods: {
-			 
+			 findNoLTextConfigure(){
+				 loginApi.findNoLTextConfigure().then((response) => {
+				
+				 	this.carhelp.setConfig(response.data.configure) 
+				 	this.setBackImg()
+				 }).catch(error => {
+				 	uni.showToast({
+				 		title: error,
+				 		icon: "none"
+				 	})
+				 })
+			 },
 			findByOpenId(){
 				var openId=this.carhelp.getOpenId()
 				if(openId==""){
@@ -51,10 +64,6 @@
 				}).then((response) => {
 					let [error, res] = response;
 					 
-					//var backImg="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
-					this.carhelp.setConfig(res.data.data.configure) 
-					this.setBackImg()
-					
 					if (res.data.code == 200&&res.data.result) {			
 						var token = res ? res.data.data.token : '';					
 						this.carhelp.setPersonInfo(res.data.data.regUser );
@@ -74,25 +83,40 @@
 			},
 			setBackImg(){
 				var  img=this.carhelp.getConfig().homepageLogo
+				// img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"		
 				if(img){
-					this.customStyle0="background:url("+img+") no-repeat;background-size: 100%;"
+					document.body.style="background:url("+img+") no-repeat;background-size: 100%;"
 				}
-			},gotoIndex(){
+			},
+			gotoIndex(){
 				uni.redirectTo({
 					url: '/pages/index/index'
 				});
+			},
+			indexstep(){
+					setTimeout(()=>{
+						this.step--;
+						if(this.step<0){
+							this.gotoIndex()
+						}else{
+							this.indexstep()
+						}
+						
+					},1000)
 			}
 			
+			
 		},
 		onLoad() {
+			this.indexstep()
+			this.setBackImg( )
 			 
-				this.setBackImg( )
-			 
+		},
+		onUnload(){
+			document.body.style=""
 		},
 		onReady() {
-			setTimeout(()=>{
-				this.gotoIndex()
-			},3000)
+			this.findNoLTextConfigure()
 			this.findByOpenId()
 		}
 	}

+ 344 - 161
pages/searchPile/chargeProcess/charge.vue

@@ -1,165 +1,348 @@
-<template>
-	<view>
-		<u-navbar title="充电"></u-navbar>
-		<view class="recharge">
-			<view class="title">请选择充电金额</view>
-			<p>当前余额¥10.00</p>
-			<view class="rechargeMain">
-				<view class="recharge-item" v-for="(item,index) in moneyList" :key="item.id">{{item.name}}</view>
-			</view>
-			<p>其他充电模式</p>
-			<view class="self-stop">
-				充满自停
-			</view>
- 
-
-
-		</view>
-	<view class="but-box">
-		<u-button shape="circle">开始充电</u-button>
-	</view>
-	</view>
-</template>
-
-<script>
-	export default {
-		data() {
+<template>
+	<view>
+		<u-navbar title="充电"></u-navbar>
+		<view class="recharge">
+			<view class="title">请选择充电金额</view>
+			<p>当前余额¥{{user.balance}}</p>
+			<view class="rechargeMain">
+				<view class="recharge-item"
+				@click="moneyClick(item.id)"
+				 :class="!otherNum&&moneyActiveClass == item.id ? 'active' : ''"
+				 v-for="(item,index) in moneyList" :key="item.id">
+					{{item.name}}元
+				</view>
+				<view class="recharge-item"
+				  :class="otherNum ? 'active' : ''"
+				 style="
+					padding: 8px 0px;">
+					<u-input v-model="otherNum" @input="ckInput" type="digit" placeholder="其他充值金额" />
+
+				</view>
+				<view style="color: rgba(153, 153, 153, 100);
+				font-size: 12px;
+				text-align: left;
+				font-family: AlibabaPuHui-regular;">*金额范围为1元-500元</view>
+
+			</view>
+			<p>其他充电模式</p>
+			<view 
+		
+			@click="moneyClick(-1)"
+			:class="!otherNum&&moneyActiveClass == -1? 'active' : ''"
+			class="self-stop ">
+				充满自停
+			</view>
+
+
+
+		</view>
+		<view class="but-box">
+			<u-button @click="submit" shape="circle">开始充电</u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import * as API from '@/apis/chargeProcess.js'
+
+	export default {
+		data() {
 			return {
+				moneyActiveClass:"5",
+				detail: {},
+				//提交信息
+				submitForm: {
+					deviceNo: '',
+					channelNo: '',
+					carNumber: '',
+					chargeStrategy: 2,
+					amount:0
+					//paytype:'YE',
+				},
+				user: {},
+				otherNum: '',
+				moneyList: [{
+						id: '5',
+						name: '5'
+					},
+					{
+						id: '10',
+						name: '10'
+					},
+					{
+						id: '20',
+						name: '20'
+					},
+					{
+						id: '50',
+						name: '50'
+					},
+					{
+						id: '100',
+						name: '100'
+					},
+
+				],
+
+
+			}
+		},
+		onLoad(op) {
+			if (op.deviceNo) {
+				this.submitForm.deviceNo = op.deviceNo;
+				this.submitForm.channelNo = op.gun;
+				this.submitForm.carNumber = '鄂DD12352';
+				
+			}
+
+
+		},
+		onShow() {
+			this.getHomePage()
+		},
+		methods: {
+			ckInput(text){
+				if(text.indexOf('.')>0){
+					
+					this.$nextTick(()=>{
+						this.otherNum=text.substring(0,text.indexOf('.'))
+						uni.showToast({
+							title:"请输入正整数"
+						})
+					})
+				}
+				var t	=Number(text);
+				if(t<1){
+					this.$nextTick(()=>{
+						this.otherNum='';
+					})
+						
+				}
+				if(t>500){
+					this.$nextTick(()=>{
+						this.otherNum=500;
+					})
+						
+				}
 				
-				moneyList: [{
-						id: '1',
-						name: '5'
-					},
-					{
-						id: '2',
-						name: '10'
-					},
-					{
-						id: '3',
-						name: '20'
-					},
-					{
-						id: '4',
-						name: '50'
-					},
-					{
-						id: '5',
-						name: '100'
-					},
-					{
-						id: '6',
-						name: '其他充值金额'
-					},
-				],
-
-
-			}
-		},
-
-	}
-</script>
-<style>
-	page {
-		background-color: #fff;
-	}
-</style>
-
-<style lang="scss" scoped>
-	/deep/.u-radio-group {
-		width: 100%;
-	}
-
-	/deep/.u-radio {
-		position: relative;
-	}
-
-	/deep/.u-radio__icon-wrap {
-		position: absolute;
-		right: 0;
-	}
-
-	.recharge-item:last-child {
-		font-size: 14px !important;
-		color: #999999;
-	}
-
-	.recharge {
-		padding: 16px;
-
-		.title {
-			font-size: 16px;
-		}
-
-		p {
-			color: #666;
-			margin-top: 4px;
-		}
-
-		.rechargeMain {
-			display: flex;
-			flex-wrap: wrap;
-			justify-content: space-between;
-			margin-top: 12px;
-			margin-bottom: 20px;
-
-			.recharge-item {
-				width: 31%;
-				border: 1px solid #e3e3e3;
-				padding: 15px 0;
-				border-radius: 4px;
-				text-align: center;
-				margin-bottom: 10px;
-				font-size: 16px;
-			}
-
-			.active {
-				background-color: #EFFFF7;
-				border-color: #00B962;
-				color: #00B962;
-			}
-		}
-
-		.self-stop {
-			width: 105px;
-			height: 48px;
-			line-height: 48px;
-			border-radius: 4px;
-			color: #101010;
-			font-size: 16px;
-			text-align: center;
-			font-family: Arial;
-			border: 1px solid rgba(227, 227, 227, 100);
-			margin-top: 12px;
-		}
-	}
-
-	.recharge-input {
-		margin-top: 8px;
-		margin-bottom: 32px;
-	}
-
-	.recharge-radio {
-		margin-top: 10px;
-
-		.recharge-radio-item {
-			display: flex;
-			align-items: center;
-		}
-
-		.recharge-radio-name {
-			margin-left: 8px;
-		}
-	}
-	.but-box{
-		width: 335px;
-		height: 44px;
-		margin: 0 auto;
-		.u-size-default[data-v-3bf2dba7]{
-			background-color: rgba(0, 185, 98, 100);
-			color: rgba(255, 255, 255, 100);
-			font-size: 16px;
-			text-align: center;
-		}
-	}
+			},
+			moneyClick(index) {
+				this.moneyActiveClass = index;
+				
+			},
+			confirm() {
+			
+				//console.log(JSON.stringify(this.submitForm))
+				
+				
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+
+				//this.submitForm.deviceNo = this.detail.deviceNo;
+				API.startCarCharging(this.submitForm).then((res) => {
+					console.log(JSON.stringify(this.res))
+					this.gotoUrl("/pages/searchPile/chargeProcess/dcCharging");
+
+
+				}).catch(error => {
+					uni.hideLoading()
+					if (error == '用户账户余额不足!') {
+						uni.showModal({
+							title: '支付',
+							content: '用户账户余额不足,是否充值?',
+							success: res => {
+								if (res.confirm) {
+									//付钱  改为组件
+									this.gotoUrl("pages/user/finance/recharge");
+
+								} else if (res.cancel) {
+									console.log('用户点击取消');
+								}
+							}
+						});
+					} else {
+						uni.showToast({
+							title: error
+						})
+					}
+
+				})
+			},
+			getHomePage() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				API.personalCenter().then((res) => {
+					this.user = res.data
+					this.isReady = true;
+					uni.hideLoading()
+
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
+			},
+			
+			submit() {
 	
+				if(this.moneyActiveClass==-1&&!this.otherNum){
+					this.submitForm.chargeStrategy=0;
+					this.submitForm.amount=0
+				}else{
+					this.submitForm.chargeStrategy=2;
+					if(this.otherNum){
+						this.submitForm.amount=this.otherNum
+					}else{
+						this.submitForm.amount=this.moneyActiveClass
+					}
+				}
+				
+				if (!this.submitForm.channelNo) {
+					uni.showToast({
+						title: '请先选择充电通道'
+					})
+					return
+				}
+				
+			 
+				if (this.submitForm.chargeStrategy == 0 && this.user.balance < 5) {
+					uni.showModal({
+						title: '支付',
+						content: '余额不足5元无法开启充满自停,是否充值?',
+						success: res => {
+							if (res.confirm) {
+								//付钱  改为组件
+								this.gotoUrl("pages/user/finance/recharge");
+
+							} else if (res.cancel) {
+								console.log('用户点击取消');
+							}
+						}
+					});
+				} else {
+
+					this.confirm()
+				}
+
+
+			},
+		}
+
+	}
+</script>
+<style>
+	page {
+		background-color: #fff;
+	}
+</style>
+
+<style lang="scss" scoped>
+	/deep/.u-radio-group {
+		width: 100%;
+	}
+
+	/deep/.u-radio {
+		position: relative;
+	}
+
+	/deep/.u-radio__icon-wrap {
+		position: absolute;
+		right: 0;
+	}
+
+	.recharge-item:last-child {
+		font-size: 14px !important;
+		color: #999999;
+	}
+
+	.recharge {
+		padding: 16px;
+
+		.title {
+			font-size: 16px;
+		}
+
+		p {
+			color: #666;
+			margin-top: 4px;
+		}
+	.self-stop.active{
+		 
+			background-color: #EFFFF7;
+			border-color: #00B962;
+			color: #00B962;
+		
+	}
+		.rechargeMain {
+			display: flex;
+			flex-wrap: wrap;
+			justify-content: space-between;
+			margin-top: 12px;
+			margin-bottom: 20px;
+
+			.recharge-item {
+				width: 31%;
+				border: 1px solid #e3e3e3;
+				padding: 15px 0;
+				border-radius: 4px;
+				text-align: center;
+				margin-bottom: 10px;
+				font-size: 16px;
+			}
+
+			.active {
+				background-color: #EFFFF7;
+				border-color: #00B962;
+				color: #00B962;
+			}
+		}
+
+		.self-stop {
+			width: 105px;
+			height: 48px;
+			line-height: 48px;
+			border-radius: 4px;
+			color: #101010;
+			font-size: 16px;
+			text-align: center;
+			font-family: Arial;
+			border: 1px solid rgba(227, 227, 227, 100);
+			margin-top: 12px;
+		}
+	}
+
+	.recharge-input {
+		margin-top: 8px;
+		margin-bottom: 32px;
+	}
+
+	.recharge-radio {
+		margin-top: 10px;
+
+		.recharge-radio-item {
+			display: flex;
+			align-items: center;
+		}
+
+		.recharge-radio-name {
+			margin-left: 8px;
+		}
+	}
+
+	.but-box {
+		width: 335px;
+		height: 44px;
+		margin: 0 auto;
+
+		.u-size-default[data-v-3bf2dba7] {
+			background-color: rgba(0, 185, 98, 100);
+			color: rgba(255, 255, 255, 100);
+			font-size: 16px;
+			text-align: center;
+		}
+	}
 </style>

+ 337 - 113
pages/searchPile/searchPile.vue

@@ -7,7 +7,8 @@
 						<label class="arrow">{{ area }}</label>
 						<u-icon name="arrow-down-fill" size="13" color="#c0c4cc"></u-icon>
 					</view>
-					<view style="margin-left: 20rpx;margin-right: 20rpx; flex:1"><u-search placeholder="搜索站点名称" v-model="keyword" :showAction="false"></u-search></view>
+					<view style="margin-left: 20rpx;margin-right: 20rpx; flex:1" >
+						<u-search placeholder="搜索站点名称" v-model="keyword" :showAction="false"  @focus="navigate"></u-search></view>
 					<view style="margin-right: 20rpx;" v-show="viewMode" @click="listMode">
 						<text class="iconfont">&#xe613;</text> <text class="list">列表</text>
 <!--						<u-icon name="list-dot" size="26" color="#c0c4cc"></u-icon>
@@ -46,6 +47,7 @@
 						<u-tag
 							class="preference_item"
 							v-for="(item, index) in info.miles_type"
+							:key="index"
 							:style="index == preference.miles_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
 							shape="circle"
 							:text="item.text"
@@ -59,6 +61,7 @@
 						<u-tag
 							class="preference_item"
 							v-for="(item, index) in info.obc_type"
+							:key="index"
 							:style="index == preference.obc_type_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
 							shape="circle"
 							:text="item.text"
@@ -73,6 +76,7 @@
 						<u-tag
 							class="preference_item_plus"
 							v-for="(item, index) in info.obc_status"
+							:key="index"
 							:style="index == preference.obc_status_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
 							shape="circle"
 							:text="item.text"
@@ -86,6 +90,7 @@
 						<u-tag
 							class="preference_item_plus"
 							v-for="(item, index) in info.obc_voltage"
+							:key="index"
 							:style="index == preference.obc_voltage_index ? 'background-color:#00B962;color:#FFFFFF' : 'background-color:#EFF4F2;color:#926666'"
 							shape="circle"
 							:text="item.text"
@@ -127,7 +132,7 @@
 			</view>
 			<view v-show="!viewMode" >
 				 
-				<view v-for="(item,index) in stations" :key="item.id" class="charing-slow" >
+				<view v-for="(item,index) in stationslist" :key="item.id" class="charing-slow" >
 					<text :class="item.type == '快充' ? 'fast-charge':'trickle-charge'">{{item.type}}</text> <text class="station-items">{{item.name}}</text>
 					<view class="address">
 						{{item.position}}
@@ -147,7 +152,7 @@
 							<text style="color:#009143;">空闲{{item.idleNum}}</text>/总数{{item.total}}
 						</view>
 						<view class="distance">
-							<text class="iconfont distance-font">&#xe615;</text>{{item.distance}}公里 {{item.time}}分钟
+							<text class="iconfont distance-font">&#xe615;</text>{{item.distance.toFixed(2)}}公里 {{item.time.toFixed(0)}}分钟
 						</view>
 					</view>
 				</view>
@@ -159,17 +164,17 @@
 			</view>
 			<view v-show="viewMode" >					
 				<view>
-					<Chargermap  @onMoveEnd="moveEnd" ref="amap" @onload="mapdown" @clickMap="clickMap"></Chargermap>
+					<Chargermap @location="location"  @onMoveEnd="moveEnd" ref="amap" @onload="mapdown" @clickMap="clickMap"></Chargermap>
 				</view>
 				 
-				<view v-if="stations.length>0" class="chargerCard" style="border-radius: 20rpx;" > 
+				<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 stations" style="height: 100%;">							 
+					 	<swiper-item v-for="(item,index) in stationsmap" :key="item.id" style="height: 100%;">							 
 							
 							<view class="swiper-item" style="height: 100%; background-color: #ffffff;">
 								<view class="card_item" style="font-size: 35rpx;padding-top: 5rpx;">
 									<view style="display: flex;flex-direction: row;">
-										<view class="round2" style="margin-right: 5rpx;">
+										<view :class="item.type == '快充'? 'fast-charge':'trickle-charge'" >
 											{{item.type}}
 										</view>
 										<view>
@@ -214,10 +219,10 @@
 									<view class="round">
 										<text class="iconfont distance-font">&#xe615;</text>
 										<view  style="margin-right: 10rpx;">
-											{{item.distance}}公里											
+											{{item.distance.toFixed(2)}}公里											
 										</view>
 										<view  style="margin-right: 10rpx;">
-											{{item.time}}分钟
+											{{item.time.toFixed(0)}}分钟
 										</view>
 									</view>
 								</view>
@@ -225,6 +230,7 @@
 						</swiper-item>
 					</swiper>
 				</view>
+
 			</view>
 		</view>
 		<Tabbar :current="1"></Tabbar>
@@ -238,7 +244,9 @@ import * as api from '@/apis/site.js';
 import Chargermap from '@/components/Chargermap.vue';
 import DoubleSlider from '@/components/double-slider/DoubleSlider.vue';
 import Tabbar from '@/components/Tabbar.vue';
-
+import * as WxJsApi from '@/utils/wxJsApi.js'
+import MapLoader from '@/utils/AMap'
+//import * as navigation from '@/pages/navigation/index.vue'
 let _self;
 export default {
 	components: {
@@ -256,8 +264,8 @@ export default {
 			mapopen: false,
 			isReady: false,
 			id: '',
-			longitude: 112.28468,
-			latitude: 30.307094,
+			longitude: 112.28308,
+			latitude: 30.312084,
 			//			longitude: '',
 			//			latitude: '',
 			nearbyStationInfo: {
@@ -273,13 +281,16 @@ export default {
 				save_preference: false,
 				obc_power: { minValue: 0, maxValue: 500 }
 			},
-			stations:[
+			stationsmap:[
 /*				{name:'荆鹏软件园充电站',position:'湖北省荆州市沙市区江津东路附155号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'慢充'},
 				{name:'荆鹏软件园充电站2',position:'湖北省荆州市沙市区江津东路附156号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'快充'},
 				{name:'荆鹏软件园充电站3',position:'湖北省荆州市沙市区江津东路附157号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'慢充'},
 				{name:'荆鹏大道求助站充电站',position:'湖北省荆州市沙市区江津东路附158号',price:1.2,idle:10,total:10,distance:0.1,time:1,type:'快充'},
 	*/			
 			],
+			first:true,
+			timer:null,
+			stationslist:[],
 			info: {
 				miles_type: [
 					{ distance: 1, text: '1公里' },
@@ -307,44 +318,26 @@ export default {
 			if (op.latitude != null) this.latitude = op.latitude;
 			if (op.id != null) this.id = op.id;
 		}
+		
 	},
 	onReady() {
+		 
+		 WxJsApi.getWxConfig(['getLocation','addEventListener']).then((res)=>{
+		 
+		 	// this.message=JSON.stringify(res)
+		 	// uni.showToast({
+		 	// 	title:JSON.stringify(res)
+		 	// })
+		 	console.log(res)
+		  
+		 }).catch(error => {
+		 		console.log(res)
+		 })
+		 
 		//		console.log('longitude2  '+this.longitude)
 		//		console.log('latitude2  '+this.latitude)
-		this.getNearbyStationInfo();
-		this.isReady = true;
 		this.$refs.amap.init();
-		 
-		//let state = {};
-		uni.getSystemInfo({
-			success: (res) => {
-				// #ifndef MP
-				let navbarH = 0
-				// #endif
-				// #ifdef MP
-				let navbarH = uni.upx2px(90)
-				// #endif
-				/*state.status_width = res.windowWidth;
-				console.log('window width'+state.status_width);*/
-				
-				let scrollH = res.windowHeight;// - uni.upx2px(88) - navbarH
-				console.log('布局结果'+ JSON.stringify(res));
-				console.log('scrollH'+scrollH)
-				//#ifdef MP-WEIXIN
-				const {
-					statusBarHeight,
-					windowWidth,
-				} = uni.getSystemInfoSync();
-				console.log('height ' + statusBarHeight);
-				//this.status_height = uni.getStatusbarHeight();
-				let res1 =  uni.getMenuButtonBoundingClientRect()
-				console.log('layout selectHeight '+JSON.stringify(res1))
-				//state.selectHeight = (res1.top-res.statusBarHeight)*2+ res1.height;
-				//#endif
-				//console.log('status height'+state.status_height)
-				_self.$refs.amap.setMyStyle("height:"+(scrollH-88-50)+ "px;width:100%;");
-			}
-		})
+		
 //		this.$refs.amap.setMyStyle("height:1500rpx;width:100%;");
 //	this.$refs.amap.setMyStyle("height:calc(100%-176rpx);width:100%;");
 				
@@ -352,11 +345,241 @@ export default {
 		//		console.log('latitude3  '+this.latitude)
 	},
 	onShow() {
+		
+		console.log('onShow')
 		if (this.isReady) {
-			this.getNearbyStationInfo();
+			 
 		}
 	},
+	onHide(){
+		this.end();
+	},
 	methods: {
+		navigate(){
+			console.log('naviage to ')
+			uni.navigateTo({
+				url:'/pages/search/search'
+			})
+		},
+		getPoint() {
+		
+			console.log('getPoint')
+			WxJsApi.getLocation().then((res) => {
+				
+				var latitude = parseFloat(res.latitude);
+				var longitude = parseFloat(res.longitude);
+				let data = {position:{latitude:latitude,longitude:longitude}};
+				
+				if(_self.first)
+				{
+					var obj = {
+									longitude: longitude,
+									latitude: latitude
+								};
+					this.$refs.amap.setPerson(obj);	
+					_self.first = false;
+				}
+			
+				this.location(data);
+				console.log('当前位置' +JSON.stringify(data))
+				
+				//this.latitude2 = latitude;
+				//this.longitude2 = longitude;
+				/*uni.showToast({
+					title:JSON.stringify(res)
+				})*/
+				//this.message=JSON.stringify(res)
+			}).catch(error => {
+				uni.showToast({
+					title:JSON.stringify(error)
+				})					
+			})
+		},
+		start() {
+			let self = this;
+		  // 将定时器名字赋值到变量中
+		  this.timer = setInterval(() => {
+			//console.log("开始---");
+			
+			//self.$refs.amap.getLocation1();
+			//self.$refs.amap.getLocation ();
+		  }, 10000);
+		},
+		end() {
+		  clearInterval(this.timer);
+		  this.timer = null // 这里最好清除一下,回归默认值
+		  // 众所周知,定时器返回一个随机整数,用于表示定时器的编号,后面通过名字可以取消这个定时器的执行。
+		  console.log(this.timer);
+		},
+		location(e){
+			if(e.position){
+				if(e.position.latitude && e.position.longitude)
+				if(this.latitude != e.position.latitude || 
+					this.longitude != e.position.longitude)
+					{
+						this.longitude = e.position.longitude;
+						this.latitude = e.position.latitude;
+						
+						let data = {latitude:this.latitude,longtitude:this.longitude,findType:"1"};
+						this.getChargingStationData(data);
+						console.log('获取定位'+JSON.stringify(e));
+						
+					}
+			}
+		},
+		getChargingStationData(pos){
+			//return;
+			if(pos == null)
+				return ;			
+			console.log('getChargingStationData'+JSON.stringify(pos))
+			let data1 = { pageIndex:0,pageSize:20};
+			if(this.info.obc_type[this.preference.obc_type_index].text.indexOf('直流快充')>=0)
+				data1.type = "1";
+			else if(this.info.obc_type[this.preference.obc_type_index].text.indexOf('交流慢充')>=0)
+				data1.type = "2";
+			if(pos.longtitude != null)
+				data1.longitude = pos.longtitude.toString();
+			if(pos.latitude != null)
+				data1.latitude = pos.latitude.toString(); 
+			if(this.info.miles_type[this.preference.miles_index].distance!=null)
+				data1.radius = this.info.miles_type[this.preference.miles_index].distance.toString();
+			data1.online = "0";//在线	
+			if(pos.findType != null)
+				data1.findType = pos.findType;
+			else
+				data1.findType = "0";
+			
+			if(this.preference.obc_power.minValue!=null)
+				data1.powerStart = this.preference.obc_power.minValue.toString();
+			if(this.preference.obc_power.maxValue!=null)
+				data1.powerEnd = this.preference.obc_power.maxValue.toString();
+			
+			console.log('data1'+JSON.stringify(data1))
+			api.geChargingStationData(data1).then(function(res){
+				
+				if(!res.result || !res.data || !res.data.data)
+				{
+					console.log('getChargingStationData res nulll')
+					return;					
+				}
+				let items = res.data.data;
+				
+
+				if(data1.findType == "0")
+				{
+					console.log('getChargingStationData res1'+JSON.stringify(res));
+					_self.stationsmap = [];
+					for(let i = 0;i<items.length;i++)
+					{
+						let obj = {
+									name:'',
+									position:'',
+									price:1.2,
+									idleNum:10,
+									total:10,									
+									type: data1.type == "2" ? '慢充':'快充',
+									id: i,									
+									distance:0.9,
+									time:9,
+									park: '以实际费用为准',
+//									longitude: 112.28541 + i * 0.001,
+//									latitude: 30.308354 + i * 0.01
+									};
+						if(items[i].name!=null)
+							obj.name = items[i].name;
+						if(items[i].address!=null)
+							obj.position = items[i].address;
+						if(items[i].coostPrice!=null)
+							obj.price = items[i].coostPrice;
+						if(items[i].availableNum!=null)
+							obj.idleNum = items[i].availableNum;
+						if(items[i].totalNum!=null)
+							obj.total = items[i].totalNum;
+						if(items[i].longitude!=null)
+							obj.longitude = items[i].longitude;
+						if(items[i].latitude!=null)
+							obj.latitude = items[i].latitude;
+						if(items[i].distance!=null)
+							obj.distance = items[i].distance;
+						if(items[i].time != null){
+							obj.time = items[i].time;
+						}
+						if(items[i].park != null)
+							obj.park = items[i].park;
+						/*
+						let obj = {name:items[i].name,
+									position:items[i].address,
+									price:items[i].coostPrice,									
+									idleNum:items[i].availableNum,
+									total:items[i].totalNum,
+									distance:0.1,
+									time:1,
+									type:'慢充',
+									id: items[i].id,
+									park: i%2 == 0? '以实际费用为准':'2小时免费停车',
+									longitude: items[i].longitude,
+									latitude: items[i].latitude
+									};*/
+						_self.stationsmap.push(obj);						
+					}
+					_self.$refs.amap.searchBtn([_self.longitude, _self.latitude],_self.stationsmap)
+ 					_self.$refs.amap.setChargerList(_self.stationsmap);
+				}else if(data1.findType == "1")
+				{
+					_self.stationslist = [];
+					console.log('getChargingStationData res2'+JSON.stringify(res));
+					for(let i = 0;i<items.length;i++)
+					{
+						
+						let obj = {
+								name:'',
+								position:'',
+								price:1.2,
+								idleNum:10,
+								total:10,									
+								type: data1.type == "2" ? '慢充':'快充',
+								id: i,									
+								distance:0.9,
+								time:9,
+								park: '以实际费用为准',
+	//									longitude: 112.28541 + i * 0.001,
+	//									latitude: 30.308354 + i * 0.01
+								};
+							if(items[i].name!=null)
+								obj.name = items[i].name;
+							if(items[i].address!=null)
+								obj.position = items[i].address;
+							if(items[i].coostPrice!=null)
+								obj.price = items[i].coostPrice;
+							if(items[i].availableNum!=null)
+								obj.idleNum = items[i].availableNum;
+							if(items[i].totalNum!=null)
+								obj.total = items[i].totalNum;
+							if(items[i].longitude!=null)
+								obj.longitude = items[i].longitude;
+							if(items[i].latitude!=null)
+								obj.latitude = items[i].latitude;
+							if(items[i].distance!=null)
+								obj.distance = items[i].distance;
+							if(items[i].time != null){
+								obj.time = items[i].time;
+							}
+							if(items[i].park != null)
+								obj.park = items[i].park;
+									//arr.push(obj);
+							_self.stationslist.push(obj);
+					}
+					_self.$refs.amap.searchBtn([_self.longitude, _self.latitude],_self.stationslist)
+					
+					console.log(' getChargingStationData stations'+JSON.stringify(_self.stationslist))
+					 
+				}
+			},function(err){
+				console.log('getChargingStationData err'+JSON.stringify(err))
+			}
+			)
+			console.log('getChargingStationData end')
+		},		
 		charge(item){
 			 console.log('扫码充电')
 			//#ifdef MP-WEIXIN
@@ -376,9 +599,11 @@ export default {
 			 	url:'stationAndPile/chargingPileDetails'
 			 })
 			
-		},
+		},		
 		moveEnd(e){
-			console.log('moveEnd'+JSON.stringify(e))
+			console.log('moveEnd'+JSON.stringify(e))			
+			let data = {latitude:e.center.lat,longtitude:e.center.lng};
+			this.getChargingStationData(data);
 		},
 		clickTabItem (index) {
 			
@@ -386,19 +611,23 @@ export default {
 		},
 		swiperChange (e) {
 			this.currentIndex = e.detail.current
-			let station = this.stations[this.currentIndex];
+			let station = this.stationsmap[this.currentIndex];
 			
 			let posCenter= {longitude: station.longitude,latitude: station.latitude};
-			console.log('currentIndex'+JSON.stringify(this.currentIndex))
-			console.log('currentIndex'+JSON.stringify(posCenter))
-			console.log('station'+JSON.stringify(station))
-			this.$refs.amap.setCenter(posCenter);
+//			console.log('currentIndex'+JSON.stringify(this.currentIndex))
+//			console.log('currentIndex'+JSON.stringify(posCenter))
+//			console.log('station'+JSON.stringify(station))
+			let bounds = this.$refs.amap.logMapInfo();
+			/*if( (posCenter.latitude<bounds.bounds.northeast.lat && posCenter.latitude>bounds.bounds.sourthwest.lat)
+			&&  (posCenter.longitude<bounds.bounds.northeast.lng && posCenter.longitude>bounds.bounds.sourthwest.lng)
+			){
+				console.log('bounds'+JSON.stringify(bounds));
+				
+			}else{			
+				this.$refs.amap.setCenter(posCenter);				
+			}*/
 			this.$refs.amap.updateCharger(station);
-			 //console.log('currentIndex'+e.detail.current)
-			/*if(e.detail.current>= 2) {
-			this.scrollIntoView = 'index' + (e.detail.current-2)
-			}
-			*/
+			  
 		},
 		swiperTransition (e) {
 			// console.log(e)
@@ -458,6 +687,8 @@ export default {
 		close() {
 			console.log('偏好设置' + JSON.stringify(this.preference));
 			this.show = false;
+			let data = {latitude:this.latitude,longtitude:this.longitude};
+			this.getChargingStationData(data);
 			// console.log('close');
 		},
 		// 获取当前位置
@@ -473,7 +704,7 @@ export default {
 							//obj.obj.price = 2.25;
 							//obj.obj.idleNum = 12;
 							_self.$refs.amap.updateCharger(obj.obj);
-							let index = _self.stations.findIndex(item => item.id == obj.obj.id);
+							let index = _self.stationsmap.findIndex(item => item.id == obj.obj.id);
 							_self.currentIndex = index;
 							console.log('find Index'+index);
 						}
@@ -489,45 +720,47 @@ export default {
 			//console.log('this'+JSON.stringify(this))
 //			console.log('longitude1  ' + this.longitude);
 //			console.log('latitude1  ' + this.latitude);
-
-			var obj = {
-				longitude: _self.longitude,
-				latitude: _self.latitude
-			};
-//			console.log('obj ' + JSON.stringify(obj));
-			this.$refs.amap.setPerson(obj);
-			/*			var obj2 = {
-				longitude: this.nearbyStationInfo.longitude,
-				latitude: this.nearbyStationInfo.latitude
-			};*/
-			let arr = [];
-			for (let i = 0; i < 10; i++) {
-				let obj = {name:'荆鹏软件园充电站'+i.toString(),
-							position:'湖北省荆州市沙市区江津东路附155号',
-							price:1.2,idleNum:10,total:10,distance:0.1,
-							time:1,
-							type:'慢充',
-							id: i,
-							park: i%2 == 0? '以实际费用为准':'2小时免费停车',
-							longitude: 112.28541 + i * 0.001,
-							latitude: 30.308354 + i * 0.01
-							};
-				if(i%2 == 0){
-					obj.longitude = 112.28571 ;
-					obj.latitude = 30.307539;
-				}else{
-					obj.type = '快充';
+			//this.start();
+			//this.$refs.amap.getLocation1();
+//			this.getNearbyStationInfo();
+			this.isReady = true;
+			//this.$refs.amap.getLocation ();
+			//let state = {};
+			uni.getSystemInfo({
+				success: (res) => {
+					// #ifndef MP
+					let navbarH = 0
+					// #endif
+					// #ifdef MP
+					let navbarH = uni.upx2px(90)
+					// #endif
+					/*state.status_width = res.windowWidth;
+					console.log('window width'+state.status_width);*/
+					
+					let scrollH = res.windowHeight;// - uni.upx2px(88) - navbarH
+	//				console.log('布局结果'+ JSON.stringify(res));
+	//				console.log('scrollH'+scrollH)
+					//#ifdef MP-WEIXIN
+					const {
+						statusBarHeight,
+						windowWidth,
+					} = uni.getSystemInfoSync();
+	//				console.log('height ' + statusBarHeight);
+					//this.status_height = uni.getStatusbarHeight();
+					let res1 =  uni.getMenuButtonBoundingClientRect()
+	//				console.log('layout selectHeight '+JSON.stringify(res1))
+					//state.selectHeight = (res1.top-res.statusBarHeight)*2+ res1.height;
+					//#endif
+					//console.log('status height'+state.status_height)
+					_self.$refs.amap.setMyStyle("height:"+(scrollH-88-50)+ "px;width:100%;");
 				}
-				
-				//arr.push(obj);
-				this.stations.push(obj);
-			}
-			console.log('stations'+JSON.stringify(this.stations))
-
-			this.$refs.amap.setChargerList(this.stations);
-			//this.$refs.amap.setPerson(obj);
-			//this.$refs.amap.setSite(obj2);
-		},
+			})
+			
+		
+			
+			this.getPoint();
+			
+ 		},
 		gotoLine(item, downid) {
 			uni.navigateTo({
 				url: '/pages/route/index?id=' + item.routeId + '&upid=' + item.startStationId + '&downid=' + downid
@@ -543,22 +776,13 @@ export default {
 		},
 
 		getNearbyStationInfo() {
-			var obj = {
-				longitude: this.longitude,
-				latitude: this.latitude,
-				id: this.id
-			};
+			
+			let data1 = {latitude:this.latitude,longtitude:this.longitude,findType:"1"};
+			this.getChargingStationData(data1);
+			let data2 = {latitude:this.latitude,longtitude:this.longitude,findType:"0"};
+			this.getChargingStationData(data2);
 
-			//this.$refs.common.showLoading();
-			/*
-					API.nearbyStationInfo(obj).then((res) => {
-						this.nearbyStationInfo=res.data;
-						
-						this.$refs.common.showLoading(false);
-					}).catch(error => {
-						this.$refs.common.showLoading(false,error);
-						
-					})*/
+			 
 		}
 	}
 };

+ 375 - 284
pages/searchPile/stationAndPile/chargingPileDetails.vue

@@ -1,286 +1,377 @@
-<template>
-	<view >
-		<!-- 头部 -->
-		<view class="title"> <text class="iconfont back">&#xe602;</text><text>充电桩详情</text></view>
-<!-- 主体 -->
-<!-- 充电桩信息 -->
-       <view class="main">
-		   <view class="main-detail">
-			   <view class="detail-name">
-			   	充电桩编号
-			   </view>
-		   	    <view class="detail-content" style="font-weight: 900;">{{pile.no}}</view>
-		   </view>
-		   <view class="main-detail">
-		   			   <view class="detail-name">
-		   			   	接口类型
-		   			   </view>
-		   	    <view class="detail-content">{{pile.interface}}</view>
-		   </view>
-		   <view class="main-detail">
-		   			   <view class="detail-name">
-		   			   	类型
-		   			   </view>
-		   	    <view class="detail-content">{{pile.type}}</view>
-		   </view>
-		   <view class="main-detail">
-		   			   <view class="detail-name">
-		   			   	充电功率
-		   			   </view>
-		   	    <view class="detail-content"  style="font-weight: 900;">{{pile.power.toFixed(1)}}kW</view>
-		   </view>
-	    <!-- 收费标准 -->
-		<view class="rates">
-			<view class="rates-title">
-				<view class="title-left">
-					收费标准
-				</view>
-				<view class="title-right">
-					峰谷平电价计费
-				</view>
-				
-			</view>
-			<!-- 时段分类 -->
-		<view class="time-rates">
-			<view class="time-part"  v-for="(item,index) in pile.price" :key="index">
-				<view class="part-top">
-					<view class="time">
-						{{item.time}}
-					</view>
-					<view class="price">
+<template>
+	<view>
+		<u-navbar title="充电桩详情" :is-back="false"></u-navbar>
+
+		<!-- 充电桩信息 -->
+		<view class="main">
+			<view class="main-detail">
+				<view class="detail-name">
+					充电桩编号
+				</view>
+				<view class="detail-content" style="font-weight: 900;">{{detail.deviceNo}}</view>
+			</view>
+			<view class="main-detail">
+				<view class="detail-name">
+					接口类型
+				</view>
+				<view class="detail-content">{{detail.interfaceType}}</view>
+			</view>
+			<view class="main-detail">
+				<view class="detail-name">
+					充电类型
+				</view>
+				<view class="detail-content">{{detail.chargingType}}</view>
+			</view>
+			<view class="main-detail">
+				<view class="detail-name">
+					充电功率
+				</view>
+				<view class="detail-content" style="font-weight: 900;">{{detail.chargingPower/1000}}kW</view>
+			</view>
+			<!-- 收费标准 -->
+			<view class="rates">
+				<view class="rates-title">
+					<view class="title-left">
+						收费标准
+					</view>
+					<view class="title-right">
+						峰谷平电价计费
+					</view>
+
+				</view>
+				<!-- 时段分类 -->
+				<view class="time-rates">
+					<view class="time-part" v-for="(item,index) in prices" :key="index">
+						<view class="part-top">
+							<view class="time">
+								{{item.startTime}}-{{item.endTime}}
+							</view>
+							<view class="price">
+
+								<text class="price-number">{{item.electricityPrice}}</text>
+								<text class="price-unit">元/度</text>
+							</view>
+						</view>
+						<view class="part-bottom">
+							<view class="unitPrice-servicePrice">
+								充电单价:¥{{item.costPrice}} | 服务费:¥{{item.servicePrice}}
+							</view>
+						</view>
+
+					</view>
+				</view>
+
+			</view>
+
+			<!-- 提示 -->
+			<view class="tips">
+				<u-alert-tips size="12" type="warning" :description="description"></u-alert-tips>
+				<view class="iconfont tips-font">
+					&#xe60f;
+				</view>
+			</view>
+		</view>
+		<!-- 底部按钮 -->
+
+		<view class="bottom">
+			<view class="botton" @click="charge" :style="isReady?'':'background-color:#98aba2'">开始充电</view>
+		</view>
+	</view>
+
+
+</template>
+<script>
+	import * as API from "@/apis/chargeProcess.js"
+
+	export default {
+		data() {
+			return {
+				isReady: false,
+				onShowRole: false,
+				id: "",
+				car: {},
+				gun: {},
+				prices: {},
+				detail: {
+					no: '',
+					interface: '',
+					type: '',
+					power: 0,
+					price: [
+
+					]
+
+				},
+				description: '温馨提示:充电前请确保您的车辆已与充电桩连接!并关闭车内电源。'
+			}
+		},
+		onLoad(op) {
+			if (op.id) {
+				this.id = op.id
+				this.getPile()
+			} else {
+				uni.showToast({
+					title: "请扫码充电"
+				})
+			}
+		},
+		onReady() {
+
+		},
+		onShow() {
+			uni.hideToast();
+
+			if (this.onShowRole) {
+				this.getPile()
+			}
+
+		},
+		methods: {
+			role() {
+				uni.hideToast();
+				console.log(1)
+				var id = this.id;
+				var info = this.carhelp.getPersonInfo();
+				if (info) {
+					if (this.car == null) {
+						uni.showModal({
+							content: "需要绑定车辆后扫码充电",
+							confirmText: "前往绑定",
+							success: (res) => {
+								uni.hideToast();
+								if (res.confirm) {
+								 
+									this.onShowRole = true
+									uni.navigateTo({
+										url: "/pages/user/car/carAdd?code=jp_team51_charge_id:A_" + id
+									})
+								} else if (res.cancel) {
+									console.log('用户点击取消');
+								}
 						
-						<text class="price-number">{{item.price}}</text>
-						<text class="price-unit">元/度</text>
-					</view>
-				</view>
-				<view class="part-bottom">
-					<view class="unitPrice-servicePrice">
-						充电单价:¥{{item.single_price.toFixed(4)}} | 服务费:¥{{item.service_price.toFixed(4)}}
-					</view>
-				</view>
-			</view> 			
-		</view>
-
-		</view >
-			
-			<!-- 提示 -->
-			<view class="tips">
-				  <u-alert-tips size="12"  type="warning"  :description="description" ></u-alert-tips>
-				  <view class="iconfont tips-font">
-				  	&#xe60f;
-				  </view>
-			</view>
-	   </view>
-<!-- 底部按钮 -->
-
-<view class="bottom">
-	<view class="botton" @click="charge">开始充电</view>
-</view>
-	</view>
-	
-	
-</template>
-<script>
-	
-	import * as api from "@/apis/site.js"
-	let _self;
-	export default {
-		data() {
-		return{
-			pile:{
-				no:'',
-				interface:'',
-				type:'',
-				power:0,
-				price:[
-					 
-				]
-/*				no:'A00666',
-				interface:'国际直流',
-				type:'快充',
-				power:60000,
-				price:[
-					{time:'00:00-07:00',single_price:1.0,service_price:0.25,price:1.25},
-					{time:'07:00-09:00',single_price:1.0,service_price:0.25,price:1.25},
-					{time:'09:00-15:00',single_price:1.0,service_price:0.25,price:1.25},
-					{time:'15:00-20:00',single_price:1.0,service_price:0.25,price:1.25},
-					{time:'20:00-22:00',single_price:1.0,service_price:0.25,price:1.25},
-					{time:'22:00-23:00',single_price:1.0,service_price:0.25,price:1.25},
-					{time:'23:00-23:59',single_price:1.0,service_price:0.25,price:1.25},
-				]*/
-			},
-			description: '温馨提示:充电前请确保您的车辆已与充电桩连接!并关闭车内电源。'
-		}
-		}
-		,
-		onLoad(op){
-			_self = this;
-			api.getPileDetails(op).then(function(res){
-				_self.pile = res;
-			})
-		},
-		methods:{
-			charge(){
-				uni.navigateTo({
-					url:'/pages/searchPile/chargeProcess/charge?pile='+encodeURIComponent(JSON.stringify(_self.pile))
-					 
-				})
-			}
-			
-		}
-	}
-</script>
-
-
-<style lang="scss">
-	// 头部
-	.title {
-		width: 100%;
-		line-height: 44px;
-		background-color: rgba(255, 255, 255, 100);
-		text-align: center;
-		border: 1px solid rgba(242, 242, 242, 100);
-		position: fixed;
-		top: 0;
-		
-	}
-	
-	// 主体
-	.main{
-		width: 100%;
-		margin-top: 44px;
-		// margin-bottom: 64px;
-		padding-bottom: 234px;
-		.main-detail{
-			display: flex;
-			justify-content: space-between;
-			padding: 14px 16px 0 0;
-			height: 48px;
-			line-height: 48px;
-			background-color: #fff;
-			border-bottom: 1px solid rgba(242, 242, 242, 100);
-			.detail-name{
-               margin-left: 16px;
-				height: 20px;
-				line-height: 23px;
-				color: rgba(102, 102, 102, 100);
-				font-size: 14px;
-				
-			}
-			.detail-content{
-				height: 23px;
-				line-height: 23px;
-				color: rgba(51, 51, 51, 100);
-				font-size: 14px;
-				
-			}
-		}
-		// 收费标准
-	   .rates{
-		   width: 100%;
-		   background-color: #fff;
-		   margin-top: 12px;
-		   .rates-title{
-			   display: flex;
-			   justify-content: space-between;
-			   height: 48px;
-			   line-height: 48px;
-			   padding: 0px 16px 0 ;
-			   border-bottom: 1px solid rgba(242, 242, 242, 100);
-		   }
-		   .time-part{
-			   width: 100%;
-			   .part-top{
-				   display: flex;
-				   justify-content: space-between;
-				   padding: 16px;
-				   .time{
-					   color: rgba(16, 16, 16, 100);
-					   font-size: 16px;
-				   }
-				   .price{
-					   .price-number{
-						   color: rgba(255, 61, 0, 100);
-						   font-size: 18px;
-						   text-align: right;
-						   font-family: Roboto-regular;
-						   display: inline-block;
-						   height: 20px;
-						   font-weight: 600;
-					   }
-					   .price-unit{
-						   color: rgba(102, 102, 102, 100);
-						   font-size: 14px;
-						   text-align: right;
-						   margin-left: 4px;
-						   display: inline-block;
-						   height: 20px;
-					   }
-				   }
-			   }
-			   .part-bottom{
-				   .unitPrice-servicePrice{
-					   eight: 18px;
-					   color: rgba(136, 136, 136, 100);
-					   font-size: 12px;
-					   text-align: right;
-					   padding-right: 16px;
-					   padding-bottom: 18px;
-				   }
-			   }
-		   }
-	   }
-	 .tips{
-		
-		 font-size: 12px;
-		 margin-top: 12px;
-		  background-color: #fff;
-		  position: relative;
-		  .tips-font{
-			  color: #ff7300;
-			  position: absolute;
-			  top: 16px;
-			  left: 16px;
-		  }
-		  /deep/.u-alert-tips--border--warning-disabled[data-v-4d234687]{
-			  border-color: #fff;
-		  }
-		  /deep/.u-alert-tips--bg--warning-light[data-v-4d234687]{
-			  background-color: #fff;
-			  padding: 12px 16px 12px 36px;
-			  line-height: 17px;
-		  }
-		 
-		 /deep/.u-alert-desc[data-v-4d234687]{
-		 			 font-size: 12px;
-					 color: #ff7300;
-					
-		 }
-	 }
-	}
-	
-	// 尾部
-	.bottom{
-		background-color: #fff;;
-		width: 100%;
-		height: 64px;
-		line-height: 64px;
-		position: fixed;
-		bottom: 0;
-		left: 0;
-		z-index:999;
-		padding: 12px 16px;
-		.botton{
-			width: 343px;
-			height: 40px;
-			line-height: 40px;
-			border-radius: 50px;
-			background-color: rgba(0, 185, 98, 100);
-			color: rgba(255, 255, 255, 100);
-			font-size: 16px;
-			text-align: center;
-			margin: 0 auto;
-		}
-		
-	}
+
+
+							}
+						})
+					} else {
+						uni.hideLoading();
+						this.isReady=true;
+					}
+				} else {
+
+					uni.showModal({
+						content: "请登录后使用扫码充电",
+						showCancel: false,
+						success: () => {
+							this.onShowRole = true
+							uni.navigateTo({
+								url: "/pages/login/login?code=jp_team51_charge_id:A_" + id
+							})
+						}
+					})
+				}
+			},
+			getPile() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+
+				API.chargingDeviceGunDetail({
+					gunNo: this.id
+				}).then((res) => {
+
+					this.detail = res.data.device
+					this.prices = res.data.prices
+					this.gun = res.data.gun
+					this.car = res.data.car
+					this.role()
+					uni.hideLoading()
+
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
+			},
+			charge() {
+				this.role()
+				if(this.isReady){
+					uni.navigateTo({
+						url:'/pages/searchPile/chargeProcess/charge?deviceNo='+this.detail.deviceNo+"&gun="+this.gun.channelNo
+					})
+				}
+				
+			}
+
+		}
+	}
+</script>
+
+
+<style lang="scss">
+	// 头部
+	.title {
+		width: 100%;
+		line-height: 44px;
+		background-color: rgba(255, 255, 255, 100);
+		text-align: center;
+		border: 1px solid rgba(242, 242, 242, 100);
+		position: fixed;
+		top: 0;
+
+	}
+
+	// 主体
+	.main {
+		width: 100%;
+
+		.main-detail {
+			display: flex;
+			justify-content: space-between;
+			padding: 14px 16px 0 0;
+			height: 48px;
+			line-height: 48px;
+			background-color: #fff;
+			border-bottom: 1px solid rgba(242, 242, 242, 100);
+
+			.detail-name {
+				margin-left: 16px;
+				height: 20px;
+				line-height: 23px;
+				color: rgba(102, 102, 102, 100);
+				font-size: 14px;
+
+			}
+
+			.detail-content {
+				height: 23px;
+				line-height: 23px;
+				color: rgba(51, 51, 51, 100);
+				font-size: 14px;
+
+			}
+		}
+
+		// 收费标准
+		.rates {
+			width: 100%;
+			background-color: #fff;
+			margin-top: 12px;
+
+			.rates-title {
+				display: flex;
+				justify-content: space-between;
+				height: 48px;
+				line-height: 48px;
+				padding: 0px 16px 0;
+				border-bottom: 1px solid rgba(242, 242, 242, 100);
+			}
+
+			.time-part {
+				width: 100%;
+
+				.part-top {
+					display: flex;
+					justify-content: space-between;
+					padding: 16px;
+
+					.time {
+						color: rgba(16, 16, 16, 100);
+						font-size: 16px;
+					}
+
+					.price {
+						.price-number {
+							color: rgba(255, 61, 0, 100);
+							font-size: 18px;
+							text-align: right;
+							font-family: Roboto-regular;
+							display: inline-block;
+							height: 20px;
+							font-weight: 600;
+						}
+
+						.price-unit {
+							color: rgba(102, 102, 102, 100);
+							font-size: 14px;
+							text-align: right;
+							margin-left: 4px;
+							display: inline-block;
+							height: 20px;
+						}
+					}
+				}
+
+				.part-bottom {
+					.unitPrice-servicePrice {
+						eight: 18px;
+						color: rgba(136, 136, 136, 100);
+						font-size: 12px;
+						text-align: right;
+						padding-right: 16px;
+						padding-bottom: 18px;
+					}
+				}
+			}
+		}
+
+		.tips {
+
+			font-size: 12px;
+			margin-top: 12px;
+			background-color: #fff;
+			position: relative;
+
+			.tips-font {
+				color: #ff7300;
+				position: absolute;
+				top: 16px;
+				left: 16px;
+			}
+
+			/deep/.u-alert-tips--border--warning-disabled[data-v-4d234687] {
+				border-color: #fff;
+			}
+
+			/deep/.u-alert-tips--bg--warning-light[data-v-4d234687] {
+				background-color: #fff;
+				padding: 12px 16px 12px 36px;
+				line-height: 17px;
+			}
+
+			/deep/.u-alert-desc[data-v-4d234687] {
+				font-size: 12px;
+				color: #ff7300;
+
+			}
+		}
+	}
+
+	// 尾部
+	.bottom {
+		background-color: #fff;
+		;
+		width: 100%;
+		height: 64px;
+		line-height: 64px;
+		position: fixed;
+		bottom: 0;
+		left: 0;
+		z-index: 999;
+		padding: 12px 16px;
+
+		.botton {
+			width: 343px;
+			height: 40px;
+			line-height: 40px;
+			border-radius: 50px;
+			background-color: rgba(0, 185, 98, 100);
+			color: rgba(255, 255, 255, 100);
+			font-size: 16px;
+			text-align: center;
+			margin: 0 auto;
+		}
+
+	}
 </style>

+ 104 - 13
pages/user/car/carAdd.vue

@@ -1,8 +1,8 @@
 <template>
 	<view>
 		<u-navbar title="车辆管理">
-			<view class="slot-wrap" @click="showDelete">
-				<span class="navBtn">删除车辆</span>
+			<view class="slot-wrap">
+				<span class="navBtn" @click="showDelete">删除车辆</span>
 			</view>
 		</u-navbar>
 		<view>
@@ -10,9 +10,10 @@
 		</view>
 		<view class="carDet">
 			<u-form :model="form" ref="uForm">
-				<u-form-item label="姓名"><u-input v-model="form.name" /></u-form-item>
-				<u-form-item label="简介"><u-input v-model="form.intro" /></u-form-item>
-				<u-form-item label="开关"><u-switch slot="right" v-model="switchVal"></u-switch></u-form-item>
+				<u-keyboard ref="uKeyboard" mode="car" v-model="keyShow" @change="valChange" @backspace="backspace"></u-keyboard>
+				<u-form-item label="车牌号码" label-width="150rpx"><u-input input-align="right" v-model="form.carNum" @click="keyShow=true" /></u-form-item>
+				<u-form-item label="车辆类型" label-width="150rpx"><u-input input-align="right" placeholder="新能源车" placeholder-style="color:black" disabled /></u-form-item>
+				<u-form-item label="设为默认车辆" label-width="180rpx"><u-switch slot="right" v-model="form.defaultFlag"></u-switch></u-form-item>
 			</u-form>
 		</view>
 		<u-button class="login-btn" type="success" shape="circle" @click="keepCar">保存</u-button>
@@ -20,32 +21,122 @@
 </template>
 
 <script>
+	import * as userApi from '@/apis/user.js'
+	
 	export default {
 		data() {
 			return {
+				keyShow: false,
 				show: false,
 				title: '删除车辆',
 				content: '是否删除此车牌号?',
 				form: {
-					name: '',
-					intro: '',
+					id: '',
+					carNum: '',
+					defaultFlag: true,
 				},
-				switchVal: false
+				carList: [],
+			}
+		},
+		onLoad(op) {
+			if(op.id){
+				var str1 = res.slice(0,19);
+				var str2 = res.slice(20,21);
+				var str3 = res.slice(22);
+				
+				if(str1 == 'jp_team51_charge_id') {
+					if(str2 == 'A') {
+						this.code = str2;
+						this.codeId = str3;
+					}
+				} else {
+					this.form.id = op.id;
+					this.getCarList();
+				}
 			}
 		},
 		methods: {
+			// 按键被点击(点击退格键不会触发此事件)
+			valChange(val) {
+				// 将每次按键的值拼接到form.carNum变量中,注意+=写法
+				this.form.carNum += val;
+				console.log(this.form.carNum);
+			},
+			// 退格键被点击
+			backspace() {
+				// 删除form.carNum的最后一个字符
+				if(this.form.carNum.length) this.form.carNum = this.form.carNum.substr(0, this.form.carNum.length - 1);
+				console.log(this.form.carNum);
+			},
+			getCarList() {	
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				userApi.regUserCarList().then((res) => {
+					uni.hideLoading();
+					this.carList = res.data;
+
+					for(var i=0;i<this.carList.length;i++) {
+						var carId = this.carList[i].id
+						if(this.form.id == carId) {			
+							this.form.carNum = this.carList[i].carNum;
+							this.form.defaultFlag = this.carList[i].defaultFlag;
+						}
+					}
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			showDelete() {
 				this.show = true;
 			},
 			confirmDelete() {
-				this.show = false;
-				uni.redirectTo({
-					url: '/pages/user/car/index'
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				userApi.deleteRegUserCar({
+					id: this.form.id
+				}).then((res) => {
+					uni.hideLoading();
+					
+					this.show = false;
+					uni.redirectTo({
+						url: '/pages/user/car/index'
+					})
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
 				})
 			},
 			keepCar() {
-				uni.redirectTo({
-					url: '/pages/user/car/index'
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				userApi.addRegUserCar(this.form).then((res) => {
+					uni.hideLoading();				
+							
+					if(this.code == 'A') {
+						uni.redirectTo({
+							url: '/pages/searchPile/stationAndPile/chargingPileDetails?id=' + this.codeId
+						})
+					} else {
+						uni.redirectTo({
+							url: '/pages/user/car/index'
+						})
+					}
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
 				})
 			}
 		}

+ 36 - 9
pages/user/car/index.vue

@@ -1,17 +1,17 @@
 <template>
 	<view>
 		<u-navbar title="车辆管理"></u-navbar>
-		<!-- <view class="carNone">
+		<view class="carNone" v-if="carList.length == 0">
 			<img src="/static/img/none2.svg" alt="">
 			<p>暂无绑定车辆</p>
-			<view class="carNone-btn">
+			<view class="carNone-btn" @click="addCar">
 				添加车牌
 			</view>
-		</view> -->
-		<view class="car">
-			<view class="car-item" @click="gotoUrl('pages/user/car/carAdd?id=')">
-				<span>默认</span>
-				<font>鄂D 999999</font>
+		</view>
+		<view class="car" v-else>
+			<view class="car-item" v-for="(item,index) in carList" :key="item.id" @click="toCarAdd(item)">
+				<span v-if="item.defaultFlag">默认</span>
+				<font>{{item.carNum}}</font>
 			</view>
 			<view class="car-btn" @click="addCar">添加车牌</view>
 		</view>
@@ -19,16 +19,42 @@
 </template>
 
 <script>
+	import * as userApi from '@/apis/user.js'
+	
 	export default {
 		data() {
 			return {
-				
+				carList: [],
 			}
 		},
+		onReady() {
+			this.getCarList();
+		},
 		methods: {
+			toCarAdd(item) {
+				uni.navigateTo({
+					url: '/pages/user/car/carAdd?id=' + item.id
+				})
+			},
+			getCarList() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				userApi.regUserCarList().then((res) => {
+					uni.hideLoading();
+					
+					this.carList = res.data;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			addCar() {
 				uni.navigateTo({
-					url: '/pages/user/car/carDet'
+					url: '/pages/user/car/carAdd'
 				})
 			}
 		}
@@ -65,6 +91,7 @@
 	.car{
 		padding: 24px;
 		.car-item{
+			margin: 10px;
 			background-color: #00B962;
 			height: 80px;
 			border-radius: 8px;

+ 81 - 3
pages/user/data.vue

@@ -6,11 +6,11 @@
 				<view class="data-icon">
 					<u-icon name="camera-fill" custom-prefix="custom-icon" color="#fff" size="32"></u-icon>
 				</view>
-				<u-avatar src="/static/img/head.png" size="216"></u-avatar>
+				<u-avatar :src="form.headImg+'?x-oss-process=image/resize,m_fill,w_256,h_256'" size="216" @click="uploadPhoto"></u-avatar>
 			</view>
 			<view class="data-input">
 				<u-form :model="form" ref="uForm" >
-					<u-form-item label-position="top" label="昵称"><u-input v-model="form.name" /></u-form-item>
+					<u-form-item label-position="top" label="昵称"><u-input v-model="form.nickName" /></u-form-item>
 				</u-form>
 			</view>
 			<u-button class="login-btn" type="success" shape="circle" @click="submit">提交</u-button>
@@ -19,15 +19,93 @@
 </template>
 
 <script>
+	import * as userApi from '@/apis/user.js'
+	import * as loginApi from '@/apis/login.js'
+	
 	export default {
 		data() {
 			return {
+				userId: '',
 				form: {
-					name: '',
+					nickName: '',
+					headImg: '',
 				},
 			}
 		},
+		onReady() {	
+			this.getUserInfo();
+		},
 		methods: {
+			getUserInfo() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				loginApi.findByOpenId({
+					openId: this.carhelp.getOpenId(),
+				}).then((res) => {
+					uni.hideLoading();
+					
+					this.form.headImg = res.data.regUser.headImg;
+					this.form.nickName = res.data.regUser.nickName;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			uploadPhoto() {
+				// 上传图片
+				let _self = this;
+				uni.chooseImage({
+					count: 1, //默认9
+					sourceType: ['album', 'camera'], //从相册选择
+					success: (res) => {
+						let imgFile = res.tempFilePaths;
+
+						var token = this.carhelp.getToken()
+						for (let i = 0; i < imgFile.length; i++) {
+			
+							wx.uploadFile({
+								url: process.car.BASE_URL + "uploadPicture",	
+								name: 'photoFile',
+								header: {		 
+									'Authorization': token,	 
+									'accept': 'application/json',
+									//#ifdef MP-WEIXIN
+									"Content-Type": "multipart/form-data", //记得设置
+									//#endif
+			
+								},
+								filePath: imgFile[0],
+								success: function(result) {
+									let imgUrls = JSON.parse(result.data)
+									_self.form.headImg = imgUrls.data;
+								}
+							})
+						}
+					},
+				});
+			},
+			submit() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				userApi.updatePersonInformation(this.form).then((res) => {
+					uni.hideLoading();
+					
+					uni.redirectTo({
+						url: '/pages/user/index'
+					})
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			}
 		}
 	}
 </script>

+ 6 - 3
pages/user/finance/recharge.vue

@@ -88,7 +88,10 @@
 					title: "加载中",
 					mask: true,
 				})
-				Pay.wxpay(this.chargingMarketingId).then((response) => {
+				Pay.wxpay({
+					chargingMarketingId: this.chargingMarketingId,
+					type:2
+				}).then((response) => {
 					if (!response.result) {
 						uni.showToast({
 							title: response.message
@@ -96,6 +99,7 @@
 						return
 					}
 					var data = response.data
+					
 					uni.hideLoading()
 					console.log("Pay+" + new Date().getTime())
 					wxPayJs(data);
@@ -131,8 +135,7 @@
 					mask: true,
 				})
 				var data = {
-
-				};
+						type:2				};
 
 
 				API.marketingData(data).then((res) => {

+ 96 - 18
pages/user/index.vue

@@ -1,11 +1,19 @@
 <template>
 	<view>
-		<view class="userHead">
+		<view class="userHead" v-if="userId != ''" @click="toData">
+			<view class="userHead-img">
+				<u-avatar :src="headImg" size="96"></u-avatar>
+			</view>
+			<view class="userHead-text">
+				<h3>{{userPhone}}</h3>
+			</view>
+		</view>
+		<view class="userHead" v-else>
 			<view class="userHead-img">
 				<u-avatar src="../../assets/img/head.png" size="96"></u-avatar>
 			</view>
 			<view class="userHead-text">
-				<h3>177****8888</h3>
+				<h3>点击登录/注册</h3>
 			</view>
 		</view>
 		<view class="userData">
@@ -70,6 +78,8 @@
 </template>
 
 <script>
+	import * as userApi from '@/apis/user.js'
+	import * as loginApi from '@/apis/login.js'
 	import Tabbar from '@/components/Tabbar.vue'
 	
 	export default {
@@ -79,6 +89,8 @@
 		data() {
 			return {
 				userId: '',
+				headImg: '',
+				userPhone: '',
 				show: false,
 				title: '联系客服',
 				content: '0716-8123456',
@@ -92,32 +104,98 @@
 			if(this.carhelp.getPersonInfo() != null) {
 				this.userId = this.carhelp.getPersonInfo().id;
 			}
+			
+			this.getUserInfo();
 		},
 		methods: {
-			toBalance() {
-				uni.navigateTo({
-					url: '/pages/user/finance/balance'
+			getUserInfo() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})		
+				loginApi.findByOpenId({
+					openId: this.carhelp.getOpenId(),
+				}).then((res) => {
+					uni.hideLoading();
+					
+					this.headImg = res.data.regUser.headImg;
+					
+					var phone = res.data.regUser.phone;
+					var phone1 = phone.slice(0,3);
+					var phone2 = phone.slice(-4);
+					this.userPhone = phone1 + '****' + phone2;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
 				})
 			},
-			toRecharge() {
-				uni.navigateTo({
-					url: '/pages/user/finance/recharge'
-				})
+			toData() {			
+				if(this.userId != '') {
+					uni.navigateTo({
+						url: '/pages/user/data'
+					})
+				} else {
+					uni.redirectTo({
+						url: '/pages/login/login'
+					})
+				}
+			},
+			toBalance() {			
+				if(this.userId != '') {
+					uni.navigateTo({
+						url: '/pages/user/finance/balance'
+					})
+				} else {
+					uni.redirectTo({
+						url: '/pages/login/login'
+					})
+				}
+			},
+			toRecharge() {	
+				if(this.userId != '') {
+					uni.navigateTo({
+						url: '/pages/user/finance/recharge'
+					})
+				} else {
+					uni.redirectTo({
+						url: '/pages/login/login'
+					})
+				}
 			},
 			carManage() {
-				uni.navigateTo({
-					url: '/pages/user/car/index'
-				})
+				if(this.userId != '') {
+					uni.navigateTo({
+						url: '/pages/user/car/index'
+					})
+				} else {
+					uni.redirectTo({
+						url: '/pages/login/login'
+					})
+				}
 			},
 			feedback() {
-				uni.navigateTo({
-					url: '/pages/user/message'
-				})
+				if(this.userId != '') {
+					uni.navigateTo({
+						url: '/pages/user/message'
+					})
+				} else {
+					uni.redirectTo({
+						url: '/pages/login/login'
+					})
+				}		
 			},
 			setUp() {
-				uni.navigateTo({
-					url: '/pages/user/setting'
-				})
+				if(this.userId != '') {
+					uni.navigateTo({
+						url: '/pages/user/setting'
+					})
+				} else {
+					uni.redirectTo({
+						url: '/pages/login/login'
+					})
+				}
 			},
 			openModal() {
 				this.show = true;

+ 109 - 7
pages/user/phone.vue

@@ -4,33 +4,135 @@
 		<view class="login-form">
 			<view class="login-form-item">
 				<view class="input">
-					<u-input v-model="tel" type="number" placeholder="请输入手机号" placeholder-style="font-size:16px;color:#ccc;"/>
+					<u-input v-model="form.telephone" type="number" placeholder="请输入手机号" placeholder-style="font-size:16px;color:#ccc;"/>
 				</view>
 			</view>
 			<view class="login-form-item">
 				<view class="input">
-					<view class="code">获取验证码</view>
-					<u-input v-model="tel" type="number" placeholder="请输入验证码" placeholder-style="font-size:16px;color:#ccc;"/>
+					<view class="code" @click="getCode">{{codeTips}}</view>
+					<u-input v-model="form.verifyCode" type="number" placeholder="请输入验证码" placeholder-style="font-size:16px;color:#ccc;"/>
 				</view>
 			</view>
 		</view>
 		
 		<u-button class="login-btn" type="success" shape="circle" @click="sure">确定修改</u-button>
+		
+		<u-verification-code :seconds="sendMsgSecond" ref="uCode" @change="codeChange" @end="end" @start="start" change-text="已发送(XS)">
+		</u-verification-code>
 	</view>
 </template>
 
 <script>
+	import {
+		checkPhone
+	} from '@/utils'
+	
 	export default {
 		data() {
 			return {
-				tel:'',
+				form: {
+					telephone: '',
+					verifyCode: '',
+				},
+				isSendMsgIng: false,
+				sendMsgSecond: 60,
+				codeTips: '',
 			}
 		},
 		methods: {
+			codeChange(text) {
+				this.codeTips = text;
+			},
+			start() {
+				if (!this.isSendMsgIng) {
+					uni.showLoading({
+						title: "加载中",
+						mask: true,
+					})
+					loginApi.getVerifyCode(this.form.telephone).then((response) => {
+						uni.hideLoading();
+						this.carhelp.set("getvcodetime", new Date().getTime());
+			
+						if (!"") {
+							//倒计时
+							uni.showToast({
+								title: "发送成功"
+							})
+						} else {
+							uni.showToast({
+								title: "您的验证码已经发送[5分钟有效],请勿重复点击"
+							})
+						}
+					}).catch(error => {
+						uni.showToast({
+							title: error,
+							icon: "none"
+						})
+					})
+				}
+			},
+			//倒计时
+			end() {
+				this.sendMsgSecond = 60;
+				this.isSendMsgIng = false;
+			},
+			// 获取验证码
+			getCode() {
+				if (this.$refs.uCode.canGetCode) {} else {
+					uni.showToast({
+						title: '倒计时结束后再发送',
+						icon: "none"
+					})
+					return
+				}
+			
+				var checkPhoneResult = checkPhone(this.form.telephone);
+			
+				if (checkPhoneResult !== true) {
+					uni.showToast({
+						title: checkPhoneResult,
+					})
+					return;
+				}
+				this.$refs.uCode.start();
+			},
 			sure() {
-				uni.redirectTo({
-					url: '/pages/login/login'
-				})
+				var checkPhoneResult = checkPhone(this.form.telephone);
+				
+				if(!this.form.telephone || checkPhoneResult != true) {
+					uni.showToast({
+						title: checkPhoneResult,
+						icon: "none"
+					})
+					return;
+				}
+				if(!this.form.verifyCode) {
+					uni.showToast({
+						title: "请输入验证码",
+						icon: "none"
+					})
+					return
+				}
+				
+				// uni.showLoading({
+				// 	title: "加载中",
+				// 	mask: true,
+				// })		
+				// loginApi.validateCode({
+				// 	verifyCode: this.form.verifyCode,
+				// 	telephone: this.form.telephone,
+				// }).then((response) => {
+				// 	uni.hideLoading();
+					
+					uni.redirectTo({
+						url: '/pages/login/login'
+					})
+				// }).catch(error => {
+				// 	uni.showToast({
+				// 		title: error,
+				// 		icon: "none"
+				// 	})
+				// })
 			}
 		}
 	}

+ 13 - 1
pages/user/setting.vue

@@ -2,7 +2,7 @@
 	<view>
 		<u-navbar title="设置"></u-navbar>
 		<u-cell-group>
-			<u-cell-item title="修改手机号" value="155****1111" @click="gotoUrl('pages/user/phone')"></u-cell-item>
+			<u-cell-item title="修改手机号" v-model="userPhone" @click="gotoUrl('pages/user/phone')"></u-cell-item>
 			<u-cell-item title="注销账号" value="注销后无法恢复,请谨慎操作" :value-style="valueStyle" @click="gotoUrl('pages/user/logout')"></u-cell-item>
 		</u-cell-group>
 		<view class="logout-btn" @click="signOut">
@@ -15,11 +15,23 @@
 	export default {
 		data() {
 			return {
+				userId: '',
+				userPhone: '',
 				valueStyle: {
 					color:'#ff3300',
 				}
 			}
 		},
+		onReady() {
+			if(this.carhelp.getPersonInfo() != null) {
+				this.userId = this.carhelp.getPersonInfo().id;
+				
+				var phone = this.carhelp.getPersonInfo().phone;
+				var phone1 = phone.slice(0,3);
+				var phone2 = phone.slice(-4);
+				this.userPhone = phone1 + '****' + phone2;
+			}
+		},
 		methods: {
 			signOut() {
 				uni.redirectTo({

+ 1 - 1
utils/AMap.js

@@ -5,7 +5,7 @@ export default function MapLoader() {
 		if (window.AMap) {
 			resolve(window.AMap)
 		} else {
-			console.log("map")
+//			console.log("map")
 			var script = document.createElement('script')
 			script.type = 'text/javascript'
 			script.async = true

+ 1 - 4
utils/requestSon.js

@@ -50,10 +50,7 @@ const request = (options) => {
 				reject(res.data.message)
 			} else {
 				if(!res.data.result){
-					uni.showToast({
-						title: res.data.message,
-						position:'bottom'
-					})
+					
 					reject(res.data.message);
 				}else{
 					resolve(res.data);

+ 2 - 2
vue.config.js

@@ -17,8 +17,8 @@ if(process.env.NODE_ENV === "production"){
 		assetsDir: 'static',
 		lintOnSave: false,
 		devServer: {
-			host: 'localhost',
-			port: 8080,
+			host: 'xpgj.xiaoxinda.com',
+			port: 80,
 			//解析缓存
 			disableHostCheck: true,
 			//支持gzip