Browse Source

临时车牌

zhengkaixin 2 years ago
parent
commit
4140ff16eb
1 changed files with 105 additions and 1 deletions
  1. 105 1
      pages/searchPile/stationAndPile/chargingPileDetails.vue

+ 105 - 1
pages/searchPile/stationAndPile/chargingPileDetails.vue

@@ -1,5 +1,15 @@
 <template>
 	<view>
+		<u-popup v-model="carTempBl" @open="carTempBlInit" :closeable="true" mode="bottom">
+			<view style="height: 250px;margin-top: 18px;">
+				<view style="font-size: 48rpx;">临时车牌:{{form.carNum}}</view>
+				<ucarkeyboard ref="uKeyboard" mode="car" 
+				@confirm="car.carNum=form.carNum,carTempBl=false" @cancel="carTempBl=false"
+				:showTips="true" :mask-close-able="false"    @change="valChange" @backspace="backspace"></ucarkeyboard>
+				
+			</view>
+		</u-popup>
+			
 		<view v-show="step==1">
 				<ujp-navbar title="费用说明页" :custom-back="customback2" ref="ujpnavbar" >
 					
@@ -183,11 +193,16 @@
 		</view>
 		<view class="car-number" v-else>
 			{{car?car.carNum:'填车牌号减免停车费用'}}
+			<img   v-if="car&&car.carNum"  @click="carTempBl=true" src="../../../static/img/riLine-edit-box-line2.svg" alt="">
+			
 			<img   v-if="!car" @click="carDet()" src="../../../static/img/riLine-edit-box-line2.svg" alt="">
 			
 		</view>
 		
 	</view>
+	
+		
+	
 <!-- 	<p class="carp"  v-if="carplateMust" >充电车辆车牌号一致则减免停车费</p>
  -->	
 		<view class="bottom">
@@ -315,6 +330,7 @@
 	import * as API_index from '@/apis/index.js'
 	import * as API from "@/apis/chargeProcess.js"
 	import * as userApi from '@/apis/user.js'
+	import ucarkeyboard from '@/components/Ucarkeyboard.vue'
 	
 	import {
 		newDate,
@@ -324,8 +340,15 @@
 	} from '@/utils'
 
 	export default {
+		components: {
+			ucarkeyboard
+		},
 		data() {
-			return {
+			return {
+				form: {
+					carNum: '鄂',
+					defaultFlag: true,
+				},
 				showNt:false,
 				showNtStep:0,
 				showNtValue:30,
@@ -374,8 +397,11 @@
 				openStatus:0,
 				isVip:false,
 				openBoolShow:false,
+				carTempBl:false,
+				maxlength:8,
 			}
 		},
+		 
 		computed:{
 			openBool(){
 				if(this.openStatus=='3'){
@@ -407,6 +433,62 @@
 		
 		},
 		methods: {
+			carTempBlInit(){
+				var aaa =	this.$refs.uKeyboard.changeCarInputValue();
+				console.log(aaa)
+				if( this.form.carNum.length&&!aaa) {
+					var c=this.$refs.uKeyboard.changeCarInputMode();
+					
+				}
+			},
+			// 按键被点击(点击退格键不会触发此事件)
+			// 按键被点击(点击退格键不会触发此事件)
+			valChange(val) {
+				
+				if(this.form.carNum.length>=this.maxlength){
+					return
+				}
+				
+				if(true){
+					this.form.carNum += val;
+				}else{
+					
+				}
+				// 将每次按键的值拼接到form.carNum变量中,注意+=写法
+				
+				//(this.form.carNum);
+			
+				var aaa =	this.$refs.uKeyboard.changeCarInputValue();
+				if((this.form.carNum.length == 0) && aaa) {
+					this.$refs.uKeyboard.changeCarInputMode();
+				}else if(!aaa){
+					this.$refs.uKeyboard.changeCarInputMode();
+				}
+			},
+			// 退格键被点击
+			backspace() {
+				// 删除form.carNum的最后一个字符
+				if(this.form.carNum.length){
+					if(true){
+						
+						this.form.carNum = this.form.carNum.substr(0, this.form.carNum.length - 1);
+						
+					}else{
+						
+						//this.selectIndex=-1;
+					}
+				}
+				
+				
+				
+				
+				//(this.form.carNum);
+				
+				var aaa =	this.$refs.uKeyboard.changeCarInputValue();
+				if(this.form.carNum.length == 0 && aaa) {
+					this.$refs.uKeyboard.changeCarInputMode();
+				}
+			},
 			lockDown(){
 				uni.showLoading({
 					title: "加载中",
@@ -489,6 +571,9 @@
 					})
 				}
 				
+			},
+			carTemp(){
+				
 			},
 			carDet(t){
 				this.onShowRole = true
@@ -516,6 +601,7 @@
 					return true;
 				}
 				 if(this.carplateMust){
+					 
 					 if(this.car&&this.car.carNum){
 						 
 					 }else{
@@ -586,6 +672,24 @@
 					this.gun = res.data.gun
 					
 					this.car = res.data.car
+					if(this.carplateMust&&this.car&&this.car.carNum){
+						
+						uni.showModal({
+												 title:"使用车牌"+this.car.carNum,
+							content:"使用临时车牌号,用于出入停车场,车牌号一致可减免停车费",
+												confirmText:"默认车牌号",
+												cancelText:"临时车牌号",
+												success: res1 => {
+													if (res1.confirm) {
+														//this.carDet()	
+													} else if (res1.cancel) {
+														//('用户点击取消');
+														this.carTempBl=true;
+														
+													}
+												}
+						})
+					}
 					
 					this.lockStatus=res.data.lockStatus;
 					this.haveLock=res.data.haveLock;