Browse Source

add owners query

gcz 4 years ago
parent
commit
e9efdd79ff
2 changed files with 189 additions and 0 deletions
  1. 48 0
      pages/ownersquery/ownersquery.scss
  2. 141 0
      pages/ownersquery/ownersquery.vue

+ 48 - 0
pages/ownersquery/ownersquery.scss

@@ -0,0 +1,48 @@
+.taking-pictures{
+	margin: 147rpx auto 79rpx;
+	width: 288rpx;
+	height: 288rpx;
+	background: url(../../static/img/choose-image.png) no-repeat;
+	background-size: contain;
+	text-align: center;
+	color: #fff;
+	font-size: 30rpx;
+	line-height: 42rpx;
+	padding-top: 177rpx;
+}
+
+.title{
+	margin-bottom: 30rpx;
+	border-top: 1px solid #F5F5F5;
+	text-align: center;
+	padding-top: 65rpx;
+	font-size: 36rpx;
+	font-weight: 500;
+	color: #3E3E3E;
+	line-height: 50rpx;
+	letter-spacing: 1px;
+}
+
+// 汽车号码输入框
+.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;
+}
+
+.bottom-btn{
+	height: 85rpx;
+	line-height: 85rpx;
+	background: #3397FA;
+	box-shadow: 0px 9rpx 9rpx 0px rgba(0, 0, 0, 0.03);
+	border-radius: 10rpx;
+	text-align: center;
+	font-size: 28rpx;
+	font-weight: 500;
+	color: #FFF;
+	letter-spacing: 1px
+}

+ 141 - 0
pages/ownersquery/ownersquery.vue

@@ -0,0 +1,141 @@
+<template>
+	<view>
+		<u-navbar
+		 title="车主查询" 
+		 title-color="#fff" 
+		 :custom-back="customBack" 
+		 :border-bottom="false" 
+		 back-icon-color="#CCE8FF" 
+		 :background="{background: 'linear-gradient(145deg, #41AFF9 0%, #2D8CFB 100%)' }"></u-navbar>
+		<view class="taking-pictures" @click="getPic">点击拍照</view>
+		<view class="wrap">
+			<view class="title">手输车牌号</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="bottom-btn" @click="submit">确认</view>
+		</view>
+		
+		<u-toast ref="uToast" />
+	</view>
+</template>
+
+<script>
+	export default{
+		data(){
+			return{
+				keyboardshow:false,
+				newPlateNumber:'',
+				spaceId:'',
+				vehicleClor:''
+			}
+		},
+		onLoad(page){
+			this.spaceId = page.spaceId;
+			
+		},
+		methods:{
+			customBack(){
+				this.$u.route({
+					// type:'switchTab',
+					url: 'pages/index/index'
+				});
+			},
+			getPic(){
+				let that = this;
+				uni.chooseImage({
+					count: 1, //默认9
+					sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
+					sourceType: ['camera'], //
+					success: function (res) {
+						// console.log('img',res)
+						uni.showLoading({});
+						const tempFilePaths = res.tempFilePaths;
+						// 若多选,需循环调用uni.uploadFile ,因微信小程序只支持单文件上传
+						uni.uploadFile({
+							url: `${that.config.fileUrl}/baidu/ocr`,
+							filePath: tempFilePaths[0],
+							name: 'file',
+							formData: {
+								'test': 'test'  // 上传附带参数
+							},
+							success: (res) => {
+								// 根据接口具体返回格式   赋值具体对应url
+								// alert(uploadFileRes.data);
+								let resobj=eval("("+res.data+")");
+								uni.hideLoading();
+								if(resobj.code==200){
+									console.log(resobj);
+									that.newPlateNumber = resobj.data.vehicleNo;
+									that.vehicleClor = resobj.data.vehicleClor;
+								}else{
+									that.$refs.uToast.show({
+										title: resobj.msg,
+										type: 'error'
+									});
+								}
+								
+								console.log(res);
+							},
+							fail: (err) => {
+								that.$refs.uToast.show({
+									title:err.msg,
+									type: 'error'
+								});
+								uni.hideLoading();
+							}
+						});
+					}
+				});
+					
+				
+			},
+			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);
+			},
+			submit(){
+				let param ={
+					spaceId:this.spaceId,
+					vehicleNo:this.newPlateNumber,
+					
+				};
+				this.$u.api.entrance(param)
+				.then(res=>{
+					this.$refs.uToast.show({
+						title: res.msg,
+						type: 'success',
+						url:'pages/getout/getout'
+					});
+					console.log('entrance',res)
+				}).catch(err=>{
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+						url:'pages/parking/parking'
+					});
+					console.log('entrance ',err)
+				});
+			}
+			
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import "./ownersquery.scss";
+</style>