gcz 4 年 前
コミット
be19304648

+ 12 - 5
common/apiurl.js

@@ -12,13 +12,20 @@ const apiurl = {
 	// 绑定手机号
 	bindphoneurl:'/app/order/refund2',
 	// 手机登录验证码
-	phoneLoginCodeUrl:'/client/auth/sendSmsCode',
+	phoneLoginCodeUrl:'/auth/sendSmsCode',
 	// 手机登录验证码验证
-	phoneLoginAuthUrl:'/client/auth/verifyCode',
+	phoneLoginAuthUrl:'/auth/verifyCode',
 	// code换取微信信息
-	getWXInfoUrl:'http://wx.hw.hongweisoft.com/wxpaydemoapi/wechat/h5/code/',
-	// 微信支付
-	wxPayUrl:'http://wx.hw.hongweisoft.com/wxpaydemoapi/wechat/pay',
+	getWXInfoUrl:'/wechat/h5/code/',
+	// 微信支付 在pay.js中使用
+	wxPayUrl:'/wechat/pay',
+	// 客户端首页
+	getIndexDataUrl:'/index/client',
+	
+	// 用户车辆
+	mycarsUrl:'/membervehicle',
+	// 设置为默认车辆
+	setDefaultCarUrl:'/membervehicle/modifyDefault/',
 }
 
 export {

+ 6 - 6
common/config.js

@@ -1,13 +1,13 @@
 const config = {
-	// wxAppid 
-	wxAppid:'wxbe90cc7c5233dd84',
-	//api baseUrl http://wx.hw.hongweisoft.com/wxpaydemoapi
-	baseUrl:'http://172.16.90.64:7000',
+	wxAppid:'wxbe90cc7c5233dd84',// wxAppid 
+	// baseUrl:'http://wx.hw.hongweisoft.com/parking/client',//64
+	baseUrl:'http://172.16.90.64:7000/client',//殷登顺
+	
 	
 	//登录链接
-	loginUrl:'http://wx.hw.hongweisoft.com/wxpaydemoapi/wechat/h5/authorize?returnUrl=http://172.16.90.25:8080/',
+	// loginUrl:'http://wx.hw.hongweisoft.com/parking/client/wechat/h5/authorize?returnUrl=http://wx.hw.hongweisoft.com/wxpaydemoh5',
 	//七牛云
-	imgUrl:"http://qny.gzsdtfp.com/",
+	// imgUrl:"http://qny.gzsdtfp.com/",
 }
 export {
 	config

+ 13 - 1
common/http.api.js

@@ -21,6 +21,13 @@ const install = (Vue, vm) => {
 	
 	let wxPay = (params = {}) => vm.$u.post(apiurl.wxPayUrl,params);
 	
+	let getIndexData = (params = {}) => vm.$u.post(apiurl.getIndexDataUrl,params);
+	
+	let getMycars = (params = {}) => vm.$u.get(apiurl.mycarsUrl,params);
+	let addCar = (params = {}) => vm.$u.post(apiurl.mycarsUrl,params);
+	let delCar = (params = {}) => vm.$u.delete(apiurl.mycarsUrl+'/'+params);
+	let setDefaultCar = (params = {}) => vm.$u.put(apiurl.setDefaultCarUrl+params.id);
+	
 	
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {
@@ -31,7 +38,12 @@ const install = (Vue, vm) => {
 		getPhoneLoginCode,
 		phoneLoginAuth,
 		getWXInfo,
-		wxPay
+		wxPay,
+		getIndexData,
+		getMycars,
+		addCar,
+		delCar,
+		setDefaultCar
 	};
 }
 

+ 7 - 3
common/http.interceptor.js

@@ -17,8 +17,9 @@ const install = (Vue, vm) => {
 		// config.header.Token = 'xxxxxx';
 		
 		// 方式一,存放在vuex的token,假设使用了uView封装的vuex方式,见:https://uviewui.com/components/globalVariable.html
-		config.header.token = vm.vuex_token;
-		config.header.Authorization = `Bearer ${vm.vuex_token}`;
+		// config.header.token = vm.vuex_token;
+		
+		if(vm.vuex_token){config.header.Authorization = `Bearer ${vm.vuex_token}`;}
 		
 		// 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取
 		// config.header.token = vm.$store.state.token;
@@ -46,7 +47,10 @@ const install = (Vue, vm) => {
 		if(res.code == 200) {
 			// 如果把originalData设置为了true,这里return回什么,this.$u.post的then回调中就会得到什么
 			return res;  
-		} else return false;
+		} else if(res.msg == "令牌不能为空"||res.code == 401){
+			alert('还未登录,即将跳转登录');			
+			setTimeout(()=>{location.href = location.href+'pages/center/phoneLogin/phoneLogin';});
+		}else return false;
 	}
 }
 

+ 1 - 1
manifest.json

@@ -1,5 +1,5 @@
 {
-    "name" : "uView-demo",
+    "name" : "智慧停车",
     "appid" : "__UNI__DE5C136",
     "description" : "",
     "versionName" : "1.5.0",

+ 13 - 0
pages.json

@@ -21,6 +21,19 @@
 			"style": {
 				"navigationBarTitleText": "手机号登录"
 			}
+		},
+		{
+			"path": "pages/parkingLists/parkingLists",
+			"style": {
+				"navigationBarTitleText": "停车场"
+			}
+		},
+		{
+			"path": "pages/myCars/myCars",
+			"style": {
+				"navigationStyle":"custom",// 隐藏系统导航栏
+				"navigationBarTitleText": "我的车辆"
+			}
 		}
 	],
 	"globalStyle": {

+ 5 - 14
pages/center/index.vue

@@ -1,12 +1,5 @@
 <template>
 	<view>
-		<u-navbar :is-back="false" title=" " :border-bottom="false">
-			<view class="u-flex u-row-right" style="width: 100%;">
-				<view class="camera u-flex u-row-center">
-					<u-icon name="camera-fill" color="#000000" size="48"></u-icon>
-				</view>
-			</view>
-		</u-navbar>
 		<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
 			<view class="u-m-r-10" @click="login($store.state.vuex_hasLogin)">
 				<u-avatar :src="userInfo.headImgUrl || userInfo.avatar||pic" size="140"></u-avatar>
@@ -22,10 +15,7 @@
 		
 		<view class="u-m-t-20">
 			<u-cell-group>
-				<u-cell-item icon="star" title="收藏"></u-cell-item>
-				<u-cell-item icon="photo" title="相册"></u-cell-item>
-				<u-cell-item icon="coupon" title="卡券"></u-cell-item>
-				<u-cell-item icon="heart" title="关注"></u-cell-item>
+				<u-cell-item icon="star" title="我的车辆" @click="openPage('pages/myCars/myCars')"></u-cell-item>
 			</u-cell-group>
 		</view>
 		
@@ -87,7 +77,7 @@
 				if (this.code == null || this.code === '') { // 如果没有code,则去请求
 					window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.config.wxAppid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&#wechat_redirect`
 				} else {
-					// this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
+					this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
 				}
 			},
 			handleGetWXInfo (code) { // 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
@@ -104,7 +94,7 @@
 					});
 				})
 			},			
-			handlewxpay(){
+			handlewxpay(){				
 				if(!this.$store.state.vuex_wxinfo.openId){ // 如果微信openId,则需用code去后台获取
 					this.$refs.uToast.show({
 						title: '请登录后重试!',
@@ -151,5 +141,6 @@
 </script>
 
 <style lang="scss" scoped>
-
+page{background-color: $my-page-bg-color;}
+.user-box{background-color: #fff;}
 </style>

+ 126 - 0
pages/index/index.scss

@@ -12,4 +12,130 @@ page{background-color: $my-page-bg-color;}
 		align-items: center;
 	}
 	.scan{margin-left: 23rpx;}
+}
+.content-nav{
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	.content-nav-item{
+		.content-nav-item-icon-wrap{
+			width: 77rpx;
+			height: 75rpx;
+			margin: 0 auto 13rpx;
+			border-radius: 30rpx;
+			background: linear-gradient(163deg, #FFCC60 0%, #FF9221 100%);;
+		}
+		.content-nav-item-icon-text{
+			font-size: 22rpx;
+			font-weight: 500;
+			color: #5A5A5A;
+			line-height: 1;
+		}
+	}
+	.content-nav-item + .content-nav-item{
+		margin-left: 74rpx;
+	}
+}
+.pending-order-head{
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+	color: $my-main-color;
+	.pending-order-head-left{
+		font-size: 30rpx;
+		b{font-weight: 500;font-size: 50rpx;margin-right: 5rpx;}
+	}
+	.pending-order-head-right{
+		font-size: 22rpx;
+		font-weight: 500;
+	}
+}
+.pending-order-body{
+	.pending-order-body-nav{
+		display: flex;
+		border-radius: 32px;
+		border: 1px solid $my-main-color;
+		margin-bottom: 36rpx;
+		.nav-item{
+			flex: 1;
+			height: 62rpx;
+			line-height: 62rpx;
+			font-size: 24rpx;
+			text-align: center;
+			&.active{
+				background: $my-main-color;
+				color: #fff;
+				border-radius: 32rpx;
+			}
+		}
+	}
+	.pending-order-body-wrap{
+		display: flex;
+		flex-wrap: wrap;
+		justify-content: space-between;
+		.pending-order-body-left-label{
+			font-size: 22rpx;
+			font-weight: 500;
+			color: #787878;
+		}
+	}
+	.pending-order-body-left{
+		.car-number{
+			margin-bottom: 32rpx;
+			font-size: 30rpx;
+			font-weight: 600;
+			color: #3A3A3A;
+			line-height: 42rpx;
+			letter-spacing: 1px;
+		}
+		.duration{
+			margin-bottom: 5rpx;
+		}
+	}
+	.pending-order-body-right{
+		text-align: left;
+		font-size: 22rpx;
+		.order{
+			margin-bottom: 28rpx;			
+			font-weight: 400;
+			color: #9A9A9A;
+		}
+		.cost{
+			.number{
+				font-size: 36rpx;
+				line-height: 50rpx;
+				color: $my-main-color;
+			}
+		}
+	}
+	.go-pay-wrap{
+		margin-top: 37rpx;
+		width: 100%;
+		text-align: center;
+		.go-pay{
+			display: inline-block;
+			padding: 12rpx 39rpx 11rpx;
+			background: linear-gradient(90deg, #FF2727 0%, #FF9A13 100%, #FF0F0F 100%);
+			color: #fff;
+			border-radius: 35rpx;
+			cursor: pointer;
+		}
+	}
+	
+}
+
+.orderDetails{
+	color: #545454;
+	/deep/ dl{
+		margin: 20rpx 38rpx;
+		display: flex;
+		font-size: 30rpx;
+		dt{
+			width: 150rpx;
+			color: #A3A3A3;
+		}
+		dd{
+			flex: 1;
+		}
+	}
 }

+ 215 - 7
pages/index/index.vue

@@ -1,32 +1,240 @@
 <template>
-	<view class="wrap">
+	<view>
 		<u-navbar :is-back='false' :border-bottom="false" :background="{ background: '#008CFF' }" title=""></u-navbar>
 		<view class="header-bar">
-			<view class="city">
+			<view class="city" @click="handleCitySelect">
 				{{city}}<u-icon name="arrow-down" color="#fff" size="32"></u-icon>
 			</view>
-			<u-search placeholder="搜索发票、停车场" :show-action="false" v-model="keyword"></u-search>
+			<u-search placeholder="搜索发票、停车场" :show-action="false" @search="handleSearch" v-model="keyword"></u-search>
 			<u-icon class="scan" name="scan" color="#fff" size="48"></u-icon>
 		</view>
-		<u-swiper :list="bannerList"></u-swiper>
+		
+		<u-swiper :list="bannerList" border-radius="0"></u-swiper>
+		
+		<u-city-select v-model="cityOpen" @city-change="cityChange" :areaCode='["52", "5201"]' ></u-city-select>
+		
+		<u-card :show-head="false" :show-foot="false" border-radius="16" margin="20rpx 40rpx" padding="30">
+			<view class="content-nav" slot="body">
+				<view class="content-nav-item">
+					<view class="content-nav-item-icon-wrap">
+						<u-image src="../../static/img/index-content-nav-01.png" width="77rpx" height="75rpx" mode="heightFix"></u-image>
+					</view>
+					<view class="content-nav-item-icon-text">停车缴费</view>
+				</view>
+				<view class="content-nav-item">
+					<view class="content-nav-item-icon-wrap">
+						<u-image src="../../static/img/index-content-nav-02.png" width="77rpx" height="75rpx" mode="heightFix"></u-image>
+					</view>
+					<view class="content-nav-item-icon-text">优惠活动</view>
+				</view>
+				<view class="content-nav-item">
+					<view class="content-nav-item-icon-wrap">
+						<u-image src="../../static/img/index-content-nav-03.png" width="77rpx" height="75rpx" mode="heightFix"></u-image>
+					</view>
+					<view class="content-nav-item-icon-text">车辆管理</view>
+				</view>
+				<view class="content-nav-item">
+					<view class="content-nav-item-icon-wrap">
+						<u-image src="../../static/img/index-content-nav-04.png" width="77rpx" height="75rpx" mode="heightFix"></u-image>
+					</view>
+					<view class="content-nav-item-icon-text">我的停车</view>
+				</view>
+			</view>
+		</u-card>
+		
+		<u-card :show-foot="false" border-radius="16" margin="20rpx 40rpx" padding="30">
+			<view class="pending-order-head" slot="head">
+				<view class="pending-order-head-left"><b>P</b>甜蜜小镇D18组团停车场</view>
+				<view class="pending-order-head-right" @click="orderDetails"><u-icon class="arrow-down" name="arrow-down" size="32"></u-icon></view>
+			</view>
+			<view class="pending-order-body" slot="body">
+				<view class="pending-order-body-nav">
+					<view class="nav-item nav-manual" @click="orderNav=0" :class="{active:orderNav==0}">手动缴费</view>
+					<view class="nav-item nav-auto" @click="orderNav=1" :class="{active:orderNav==1}">无感支付</view>
+				</view>
+				<view class="pending-order-body-wrap" v-show="orderNav==0">
+					<view class="pending-order-body-left">
+						<view class="car-number">贵A37W45</view>
+						<view class="duration">
+							<span class="pending-order-body-left-label">停车时长</span>
+							<span>01:30:25</span>
+						</view>
+					</view>
+					<view class="pending-order-body-right">
+						<view class="order">订单号:5222021022300045</view>
+						<view class="cost">
+							<span class="pending-order-body-left-label">停车费用</span>
+							<span>
+								<span class="number">10.25</span>
+								元
+							</span>
+						</view>
+					</view>	
+					<view class="go-pay-wrap">
+						<view class="go-pay" @click="handlewxpay">去支付</view>
+					</view>
+					
+				</view>
+				<view class="pending-order-body-wrap" v-show="orderNav==1">
+					
+				</view>
+			</view>
+		</u-card>
+		
+		<u-modal 
+			v-model="bindCarShow" 
+			title="绑定车牌号" 
+			:show-cancel-button="true" 
+			confirm-text="去绑定" 
+			content="首次使用请先绑定您的车牌"
+			@confirm="$u.route({url:'pages/myCars/myCars'})"></u-modal>
+			
+		<!-- 订单细节 -->
+		<u-modal v-model="showOrderDetails" title="停车场信息" confirm-text="知道了" :title-style="{color: '#008CFF'}">
+			<view class="slot-content">
+				<rich-text class="orderDetails" :nodes="content"></rich-text>
+			</view>
+		</u-modal>
+		<u-toast ref="uToast" />
 	</view>
 </template>
 
 <script>
+	import getUrlParams from "../../utils/getUrlParams.js";
 	export default {
+		// components: {
+		// 	citySelect
+		// },
 		data() {
 			return {
 				city: '贵阳市',
 				keyword:'',
 				bannerList:[
-					{image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',title: '昨夜星辰昨夜风,画楼西畔桂堂东'}
-				]
+					{image: '/static/img/index-banner01.png',title: ''}
+				],
+				cityOpen:false,
+				pendingOrder:[],
+				code:null,//微信code
+				orderNav:0,//手动,无感
+				bindCarShow:false,//绑定车询问弹窗
+				showOrderDetails:false,//是否线上订单细节
+				content:`
+				<dl>
+					<dt>车场名称:</dt>
+					<dd>贵阳云岩区甜蜜小镇D18组团停车场</dd>
+				</dl>
+				<dl>
+					<dt>免费时长:</dt>
+					<dd>15分钟</dd>
+				</dl>
+				`,
+				
 			}
 		},
 		onLoad() {
-
+			this.handleGetIndexData();
+			let locationLocaturl = window.location.search;
+			this.code = getUrlParams(locationLocaturl,"code");
+			if(this.code&&!this.$store.state.vuex_wxinfo.openId){this.handleGetWXInfo(this.code)};
 		},
 		methods: {
+			handleSearch(){
+				console.log('this.keyword',this.keyword);
+				this.$u.route({
+					url:'pages/parkingLists/parkingLists',
+					params: {
+						keyword: this.keyword
+					}
+				})
+			},
+			handleCitySelect(){
+				this.cityOpen = true;				
+			},
+			cityChange(e){
+				console.log('cityChange',e);
+				this.city = e.city.label;
+			},
+			handleGetIndexData(){
+				this.$u.api.getIndexData()
+				.then(res=>{
+					console.log('getIndexData',res);
+					if(res.data.vehicleList.length<1){
+						this.bindCarShow = true;
+					}
+				}).catch(err=>{
+					alert(err.msg);
+					console.log('getIndexData err',err)
+				});
+			},
+			getCode () {
+				var local = window.location.href // 获取页面url
+				let locationLocaturl = window.location.search;
+				this.code = getUrlParams(locationLocaturl,"code"); // 截取code
+				if (this.code == null || this.code === '') { // 如果没有code,则去请求
+					window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.config.wxAppid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&#wechat_redirect`
+				} else {
+					this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
+				}
+			},
+			handleGetWXInfo (code) { // 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
+				let _this = this
+				this.$u.api.getWXInfo(code).then((res) => {
+					if (res.code === 200 ) {
+						this.$u.vuex('vuex_wxinfo',res.data);
+						// 继续支付
+					}
+				}).catch((err) => {
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+				})
+			},			
+			handlewxpay(){;
+				if(!this.$store.state.vuex_wxinfo.openId){ // 如果微信openId,则需用code去后台获取
+					this.$refs.uToast.show({
+						title: '请登录后重试!',
+						type: 'info',
+						// url: '/pages/user/index'
+					});
+					this.getCode();
+				} else {
+					// 别的业务逻辑
+					this.getWXPay();
+				}
+			},
+			async getWXPay(id){
+				let params = {
+					orderId:id||new Date().getTime(),
+					openid:this.$store.state.vuex_wxinfo.openId,
+					tradeType:"test"
+				};
+				await this.$wxApi.config();
+				this.$pay.wxPay(params).then(res =>{
+					console.log('wxPay',res.code);
+					if(res.code == 0){
+						// 成功
+						// uni.reLaunch({
+						// 	url: '/pages/buySuccess/buySuccess?orderId=' + params.orderId
+						// })
+					}else if(res.code == 1){
+						// 取消
+						// uni.redirectTo({
+						// 	url: '/pages/userCenter/myOrder/myOrder'
+						// })
+					}else if(res.code == 2){
+						this.$refs.uToast.show({
+							title: '支付失败,请检查!',
+							type: 'error',
+							// url: '/pages/user/index'
+						});
+					}
+				});
+			},
+			//
+			orderDetails(){
+				this.showOrderDetails = true;
+			}
 
 		}
 	}

+ 141 - 0
pages/myCars/myCars.scss

@@ -0,0 +1,141 @@
+.header{
	height: 296rpx;
+	overflow: hidden;
	background: url(../../static/img/myCars-header-bg.png) no-repeat;
	background-size: contain;
+	color: $my-main-color;
	
}
+.header .header-title{
+	margin-top: 80rpx;
	color: #fff;
	font-size: 50rpx;
+	text-align: center;
}
+
+.statistics{
+	margin: -78rpx 0 59rpx;
+	background-color: #fff;
+	box-shadow: 0px 6rpx 10px 0px rgba(0, 0, 0, 0.06);
+	border-radius: 15rpx;
+	height: 182rpx;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	color: #323232;
+	
+}
+.statistics-title{
+		font-size: 60rpx;
+		letter-spacing: 2rpx;
+	}
+.statistics-center{
+	width: 4rpx;
+	height: 106rpx;
+	margin: 0 103rpx;
+	box-shadow: 0px 6rpx 10rpx 0rx rgba(0, 0, 0, 0.06);
+	opacity: 0.5;
+	border: 1px solid #979797;
+}
+.statistics-number-wrap{
+	font-size: 28rpx;
+}
+.statistics-number-wrap .number{
+	margin-right: 4rpx;
+	font-size: 72rpx;
+}
+.add-car-btn{
+	height: 100rpx;
+	line-height: 100rpx;
+	background: #008CFF;
+	color: #fff;;
+	font-size: 28rpx;
+	text-align: center;
+	box-shadow: 0px 7rpx 13rpx 0px rgba(16, 153, 250, 0.31);
+	border-radius: 10rpx;
+	margin-bottom: 50rpx;
+}
+.new-plate-number{	
+	margin-bottom: 70rpx;
+}
+.message-input-wrap{
+	margin: 0 -40rpx;
+}
+.message-input-wrap /deep/ .u-input ~ uni-view:last-of-type .u-char-item{
+	background-color: #E8FFE8;
+}
+
+.mycars-item{
+	display: flex;
+	align-items: center;
+	height: 111rpx;
+	border-bottom: 1px solid #EAEAEA;
+}
+.mycars-item-name{
+	// margin-right: 43rpx;
+	width: 258rpx;
+	font-size: 36rpx;
+	color: #4B4B4B;
+}
+.mycars-item-type{
+	font-size: 26rpx;
+	color: #959595;	
+}
+.mycars-item-tool{
+	flex: 1;
+	font-size: 22rpx;
+	color: #C9C9C9;
+	text-align: right;
+}
+.mycars-item-tool .default{
+	display: inline-block;
+	box-sizing: border-box;
+	width: 75rpx;
+	height:38rpx;
+	line-height: 34rpx;
+	border-radius: 5rpx;
+	border: 1px solid #E3E3E3;
+	text-align: center;
+	margin-right: 17rpx;
+	font-size: 18rpx;
+	color: #CDCDCD;
+}
+.mycars-item-tool .default.isDefault{
+	background-color: #FFEEE3;
+	border-color: #FFEEE3;
+	color: #FA6400;
+	
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 158 - 0
pages/myCars/myCars.vue

@@ -0,0 +1,158 @@
+<template>
+	<view>
+		<view class="header">
+			<view class="header-title">我的车辆</view>
+		</view>
+		<view class="wrap">
+			<view class="statistics">
+				<view class="statistics-title">车辆</view>
+				<view class="statistics-center"></view>
+				<view class="statistics-number-wrap"><span class="number">{{mycarsTotal}}</span>辆</view>
+			</view>
+			<view class="new-plate-number">
+				<view class="message-input-wrap" @click="messageInputClick">
+					<u-message-input :maxlength="8" width="70" font-size="50" :disabled-keyboard="true" v-model="newPlateNumber"></u-message-input>
+				</view>				
+				<u-keyboard ref="uKeyboard" mode="car" @change="keyboardChange" @backspace="backspace" v-model="keyboardshow"></u-keyboard>
+			</view>
+			<view class="add-car-btn" @click="handleAddCar">添加车辆</view>
+			<view class="mycars">
+				<view class="mycars-item" v-for="item in mycars">
+					<view class="mycars-item-name">{{item.vehicleNo}}</view>
+					<view class="mycars-item-type">{{item.energyTpye | energyTpye}}</view>
+					<view class="mycars-item-tool">
+						<span class="default" :class="{'isDefault':item.isDefault == 1}" @click="handlesetDefault(item.id)">默认</span>
+						<span @click="handleDelCar(item.id,item.vehicleNo)">删除</span>
+					</view>
+				</view>
+			</view>
+		</view>
+		
+		<u-toast ref="uToast" />
+		<u-modal v-model="delCarshow" :show-cancel-button="true" @confirm="confirmDelCar" :content="delCarContent"></u-modal>
+	</view>
+</template>
+
+<script>
+	export default{
+		data(){
+			return{
+				keyboardshow:false,
+				delCarshow:false,
+				delCarId:null,
+				delCarContent:'',
+				newPlateNumber:'贵A44555',
+				vehicleColor:0,
+				mycars:[],
+				mycarsTotal:0,
+				
+			}
+		},
+		onLoad(){
+			this.handlegetMycars();
+			
+		},
+		methods:{
+			handlegetMycars(){
+				this.$u.api.getMycars()
+				.then(res=>{
+					this.mycars = res.data.rows;
+					this.mycarsTotal = res.data.total;
+					console.log('this.mycars',this.mycars)
+				}).catch(err=>{
+					console.log('getMycars ',err)
+				});
+			},
+			handleAddCar(){
+				let param ={
+					vehicleNo: this.newPlateNumber,
+					vehicleColor: this.vehicleColor
+				};
+				this.$u.api.addCar(param)
+				.then(res=>{
+					this.$refs.uToast.show({
+						title: res.msg,
+						type: 'success',
+					});
+					this.handlegetMycars();
+					console.log('getMycars',res)
+				}).catch(err=>{
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+					console.log('getMycars ',err)
+				});
+			},
+			handleDelCar(id,content){
+				this.delCarContent = `是否删除${content}`;
+				this.delCarId = id;
+				this.delCarshow = true;
+				
+			},
+			confirmDelCar(){
+				console.log(this.delCarId);
+				this.$u.api.delCar(this.delCarId)
+				.then(res=>{
+					this.$refs.uToast.show({
+						title: res.msg,
+						type: 'success',
+					});
+					this.handlegetMycars();
+					console.log('getMycars',res)
+				}).catch(err=>{
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+					console.log('getMycars ',err)
+				});				
+			},
+			messageInputClick(){
+				this.keyboardshow = true;
+			},
+			// 按键被点击(点击退格键不会触发此事件)
+			keyboardChange(val) {
+				// 将每次按键的值拼接到value变量中,注意+=写法
+				this.newPlateNumber += val;
+				console.log(this.newPlateNumber);
+			},
+			// 退格键被点击
+			backspace() {
+				// 删除value的最后一个字符
+				if(this.newPlateNumber.length) this.newPlateNumber = this.newPlateNumber.substr(0, this.newPlateNumber.length - 1);
+				console.log(this.newPlateNumber);
+			},
+			// 设置默认车辆
+			handlesetDefault(id){
+				this.$u.api.setDefaultCar({id:id})
+				.then(res=>{
+					this.handlegetMycars();
+					console.log('handlesetDefault',res)
+				}).catch(err=>{
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+					console.log('handlesetDefault err',err)
+				});	
+			}
+			
+		},
+		filters: {
+		  energyTpye(value) {
+			if (value === 1) {
+			  return '汽油车';
+			}else if (value === 2) {
+			  return '新能源';
+			} else {
+			  return '汽油车';
+			}
+		  },
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import url("./myCars.scss");
+</style>

+ 0 - 0
pages/parkingLists/parkingLists.scss


+ 26 - 0
pages/parkingLists/parkingLists.vue

@@ -0,0 +1,26 @@
+<template>
+	<view class="wrap">
+		<u-empty src="http://img.momen.vip/xsfm.jpg" icon-size="360" text="正在建设中" mode="search"></u-empty>
+	</view>
+</template>
+
+<script>
+	export default{
+		data(){
+			return{
+				
+			}
+		},
+		onLoad(){
+			
+		},
+		methods:{
+			
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.wrap{margin-top: 20vh;}
+	@import url("./parkingLists.scss");
+</style>

+ 1 - 1
pay.js

@@ -16,7 +16,7 @@ export default {
 			title: '支付中'
 		});
 		return new Promise(r => {
-			$http.post("http://wx.hw.hongweisoft.com/wxpaydemoapi/wechat/pay",obj)
+			$http.post("/wechat/pay",obj)
 			// this.$u.post("/wechat/h5/pay",obj)
 				.then(res=>{
 					//#ifdef H5

BIN
static/center-selected.png


BIN
static/center.png


BIN
static/img/index-banner01.png


BIN
static/img/index-content-nav-01.png


BIN
static/img/index-content-nav-02.png


BIN
static/img/index-content-nav-03.png


BIN
static/img/index-content-nav-04.png


BIN
static/img/myCars-header-bg.png


BIN
static/index-selected.png


BIN
static/index.png


BIN
static/找车位-1.png


BIN
static/找车位.png


+ 1 - 0
uni.scss

@@ -3,3 +3,4 @@
  * uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用 
  */
 @import 'uview-ui/theme.scss';
+.wrap{margin: 0 40rpx;position: relative;}

+ 237 - 0
uview-ui/components/u-city-select/u-city-select.vue

@@ -0,0 +1,237 @@
+<template>
+	<u-popup v-model="value" mode="bottom" :popup="false" :mask="true" :closeable="true" :safe-area-inset-bottom="true"
+	 close-icon-color="#ffffff" :z-index="uZIndex" :maskCloseAble="maskCloseAble" @close="close">
+		<u-tabs v-if="value" :list="genTabsList" :is-scroll="true" :current="tabsIndex" @change="tabsChange" ref="tabs"></u-tabs>
+		<view class="area-box">
+			<view class="u-flex" :class="{ 'change':isChange }">
+				<view class="area-item">
+					<view class="u-padding-10 u-bg-gray" style="height: 100%;">
+						<scroll-view :scroll-y="true" style="height: 100%">
+							<u-cell-group>
+								<u-cell-item v-for="(item,index) in provinces" :title="item.label" :arrow="false" :index="index" :key="index"
+								 @click="provinceChange">
+									<u-icon v-if="isChooseP&&province===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
+								</u-cell-item>
+							</u-cell-group>
+						</scroll-view>
+					</view>
+				</view>
+				<view class="area-item">
+					<view class="u-padding-10 u-bg-gray" style="height: 100%;">
+						<scroll-view :scroll-y="true" style="height: 100%">
+							<u-cell-group v-if="isChooseP">
+								<u-cell-item v-for="(item,index) in citys" :title="item.label" :arrow="false" :index="index" :key="index"
+								 @click="cityChange">
+									<u-icon v-if="isChooseC&&city===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
+								</u-cell-item>
+							</u-cell-group>
+						</scroll-view>
+					</view>
+				</view>
+
+				<view class="area-item">
+					<view class="u-padding-10 u-bg-gray" style="height: 100%;">
+						<scroll-view :scroll-y="true" style="height: 100%">
+							<u-cell-group v-if="isChooseC">
+								<u-cell-item v-for="(item,index) in areas" :title="item.label" :arrow="false" :index="index" :key="index"
+								 @click="areaChange">
+									<u-icon v-if="isChooseA&&area===index" slot="right-icon" size="34" name="checkbox-mark"></u-icon>
+								</u-cell-item>
+							</u-cell-group>
+						</scroll-view>
+					</view>
+				</view>
+			</view>
+		</view>
+	</u-popup>
+</template>
+
+<script>
+	import provinces from "uview-ui/libs/util/province.js";
+	import citys from "uview-ui/libs/util/city.js";
+	import areas from "uview-ui/libs/util/area.js";
+	/**
+	 * city-select 省市区级联选择器
+	 * @property {String Number} z-index 弹出时的z-index值(默认1075)
+	 * @property {Boolean} mask-close-able 是否允许通过点击遮罩关闭Picker(默认true)
+	 * @property {String} default-region 默认选中的地区,中文形式
+	 * @property {String} default-code 默认选中的地区,编号形式
+	 */
+	export default {
+		name: 'u-city-select',
+		props: {
+			// 通过双向绑定控制组件的弹出与收起
+			value: {
+				type: Boolean,
+				default: false
+			},
+			// 默认显示的地区,可传类似["河北省", "秦皇岛市", "北戴河区"]
+			defaultRegion: {
+				type: Array,
+				default () {
+					return [];
+				}
+			},
+			// 默认显示地区的编码,defaultRegion和areaCode同时存在,areaCode优先,可传类似["13", "1303", "130304"]
+			areaCode: {
+				type: Array,
+				default () {
+					return [];
+				}
+			},
+			// 是否允许通过点击遮罩关闭Picker
+			maskCloseAble: {
+				type: Boolean,
+				default: true
+			},
+			// 弹出的z-index值
+			zIndex: {
+				type: [String, Number],
+				default: 0
+			}
+		},
+		data() {
+			return {
+				cityValue: "",
+				isChooseP: false, //是否已经选择了省
+				province: 0, //省级下标
+				provinces: provinces,
+				isChooseC: false, //是否已经选择了市
+				city: 0, //市级下标
+				citys: citys[0],
+				isChooseA: false, //是否已经选择了区
+				area: 0, //区级下标
+				areas: areas[0][0],
+				tabsIndex: 0,
+			}
+		},
+		mounted() {
+			this.init();
+		},
+		computed: {
+			isChange() {
+				return this.tabsIndex > 1;
+			},
+			genTabsList() {
+				let tabsList = [{
+					name: "请选择"
+				}];
+				if (this.isChooseP) {
+					tabsList[0]['name'] = this.provinces[this.province]['label'];
+					tabsList[1] = {
+						name: "请选择"
+					};
+				}
+				if (this.isChooseC) {
+					tabsList[1]['name'] = this.citys[this.city]['label'];
+					tabsList[2] = {
+						name: "请选择"
+					};
+				}
+				if (this.isChooseA) {
+					tabsList[2]['name'] = this.areas[this.area]['label'];
+				}
+				return tabsList;
+			},
+			uZIndex() {
+				// 如果用户有传递z-index值,优先使用
+				return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
+			}
+		},
+		methods: {
+			init() {
+				if (this.areaCode.length == 3) {
+					this.setProvince("", this.areaCode[0]);
+					this.setCity("", this.areaCode[1]);
+					this.setArea("", this.areaCode[2]);
+				} else if (this.defaultRegion.length == 3) {
+					this.setProvince(this.defaultRegion[0], "");
+					this.setCity(this.defaultRegion[1], "");
+					this.setArea(this.defaultRegion[2], "");
+				};
+			},
+			setProvince(label = "", value = "") {
+				this.provinces.map((v, k) => {
+					if (value ? v.value == value : v.label == label) {
+						this.provinceChange(k);
+					}
+				})
+			},
+			setCity(label = "", value = "") {
+				this.citys.map((v, k) => {
+					if (value ? v.value == value : v.label == label) {
+						this.cityChange(k);
+					}
+				})
+			},
+			setArea(label = "", value = "") {
+				this.areas.map((v, k) => {
+					if (value ? v.value == value : v.label == label) {
+						this.isChooseA = true;
+						this.area = k;
+					}
+				})
+			},
+			close() {
+				this.$emit('input', false);
+			},
+			tabsChange(index) {
+				this.tabsIndex = index;
+			},
+			provinceChange(index) {
+				this.isChooseP = true;
+				this.isChooseC = false;
+				this.isChooseA = false;
+				this.province = index;
+				this.citys = citys[index];
+				this.tabsIndex = 1;
+			},
+			cityChange(index) {
+				this.isChooseC = true;
+				this.isChooseA = false;
+				this.city = index;
+				this.areas = areas[this.province][index];
+				this.tabsIndex = 2;
+				// 只选到市添加以下代码
+				let result = {};
+				result.province = this.provinces[this.province];
+				result.city = this.citys[this.city];
+				this.$emit('city-change', result);
+				this.close();
+			},
+			areaChange(index) {
+				this.isChooseA = true;
+				this.area = index;
+				let result = {};
+				result.province = this.provinces[this.province];
+				result.city = this.citys[this.city];
+				result.area = this.areas[this.area];
+				this.$emit('city-change', result);
+				this.close();
+			}
+		}
+
+	}
+</script>
+<style lang="scss">
+	.area-box {
+		width: 100%;
+		overflow: hidden;
+		height: 800rpx;
+
+		>view {
+			width: 150%;
+			transition: transform 0.3s ease-in-out 0s;
+			transform: translateX(0);
+
+			&.change {
+				transform: translateX(-33.3333333%);
+			}
+		}
+
+		.area-item {
+			width: 33.3333333%;
+			height: 800rpx;
+		}
+	}
+</style>

+ 1 - 1
wxapi.js

@@ -2,7 +2,7 @@
 const wx = require('@/js_sdk/jweixin-1.4.0.js')
 
 //配置注册url
-const url = 'http://wx.hw.hongweisoft.com/wxpaydemoapi/wechat/pay/getJsapiTicket';
+const url = '/wechat/pay/getJsapiTicket';
 
 //http方法
 // import $http from './utils/axios.js'