Blame view

more/self/Vehiclemanagement/addCar.html 11.7 KB
313ce84a   songchongxian   创建h5 app项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
  <!DOCTYPE html>
  <html lang="en">
  <head>
      <meta charset="UTF-8">
      <title id="selecttitle">添加车辆</title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
      <meta name="format-detection" content="telephone=no" />
      <meta name="format-detection" content="email=no" />
      <meta name="apple-mobile-web-app-status-bar-style" content="black" />
      <meta name="apple-mobile-web-app-capable" content="yes" />
      <meta name="apple-mobile-web-app-title" content="">
      <meta name="google" value="notranslate"><!-- 禁止Chrome 浏览器中自动提示翻译 -->
  	<link rel="stylesheet" href="../../../iconfont/iconfont.css"/>
      <!--<link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css?v=1.1">
      <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css?v=1.1">-->
      <link rel="stylesheet" href="../../../js/bootstrap/bootstrap.css" />
      <!--<link rel="stylesheet" href="../../../css/reset.css">-->
      <link rel="stylesheet" href="../../../js/carsoft/carstyle.css"/>
      <link rel="stylesheet" href="../css/fxcommon.css"/>
  </head>
  <style>
  	body,html{
  		height: 100%;
  		
  	}
  	body{
  		box-sizing: border-box;
  	}
  	.addcp{
  		margin-top:37px;
  		padding: 0 26px;
  	}
  	.addcp .hhhd{
  		color: #fff;
  		text-align: center;
  		font-size: 17px;
  		padding: 15px 0 6px;
  		box-sizing: border-box;
  	}
  	.addbtnp{
  		width: 100%;
  		padding: 76px 57px 0;
  		box-sizing: border-box;
  	}
  	.addbtnp .addbtn{
  		width: 100%;
  		border-style: none;
  		height: 42px;
  		background: #fff;
  		color: #75CBBE;
  		border-radius: 21px;
  		font-size: 18px;
  	}
  	.sbzg{
  		width: 100%;
  		margin: 0 auto 10px;
  		/*padding: 8px 0;*/
  		box-sizing: border-box;
  		background: #fff;
  		border-radius: 6px;
  		text-align: center;
  		height: 47px;
  		line-height: 47px;
  	}
  	.sbzg>span{
  		display: inline-block;
  		width: 14.2%;
  		text-align: center;
  		padding:0 5px;
  		box-sizing: border-box;
  		height: 100%;
  		position: relative;
  		float: left;
  	}
  	.sbzgqh>span{
  		display: inline-block;
  		width: 12.5%;
  		text-align: center;
  		padding:0 5px;
  		box-sizing: border-box;
  		height: 100%;
  	}
  	.sbzg span>div{
  		height: 100%;
  	}
  	.sbzg .right{
  		height: 16px;
  		width: 1px;
  		background: rgba(232,231,231,1);
  		position: absolute;
  		right: 0;
  		top: 50%;
  		margin-top: -8px;
  	}
  	.sbzg>span:last-child .right{
  		display: none;
  	}
  	.sbzg .bottom{
  		position: absolute;
  		bottom: 5px;
  		left: 50%;
  		width: 23px;
  		height: 2px;
  		margin-left: -11.5px;
  		
  	}
  	.sbzg>span.active .bottom{
  		background: #75cbbe;
  	}
  	.sbzg span:last-child{
  		border-right: 0;
  	}
  	@keyframes mymove
  	{
  		from {border-bottom: 1px solid rgba(255,255,255,0);}
  		to {border-bottom: 1px solid #75cbbe;}
  	}
  	.qiehuan{
  		width: 120px;
  	    margin: 10px auto 30px;
  	    color: #fff;
  	    font-size: 12px;
  	    text-align: center;
  	}
  	.qiehuan i{
  		font-size: 12px;
  	}
  	.hhhd{
  		color: #fff;
  	    text-align: center;
  	    font-size: 17px;
  	    padding: 32px 0 10px;
  	    box-sizing: border-box;
  	}
  </style>
  <body ontouchstart onclick="" style="cursor: pointer;">
  	<div class="fanxtctop">
  		<div class="row">
  			<div class="col-xs-12">
  				<i class="icon iconfont" onclick="window.history.go(-1)">&#xe601;</i>
  				<span class="tt">添加车辆</span>
  			</div>
  		</div>
  	</div>
  	<div class="addcp">
  		<div class="hhhd">请输入车牌号</div>
  		<div class="sbzg" id="carsoft" onclick="">
  			<span class="active"><div></div><span class="right"></span><span class="bottom"></span></span><span><div></div><span class="right"></span><span class="bottom"></span></span><span><div></div><span class="right"></span><span class="bottom"></span></span><span><div></div><span class="right"></span><span class="bottom"></span></span><span><div></div><span class="right"></span><span class="bottom"></span></span><span><div></div><span class="right"></span><span class="bottom"></span></span><span><div></div><span class="right"></span><span class="bottom"></span></span>
  		</div>
  		<div class="qiehuan" id="qiehuan" onclick="qiehuan()">
  			<i class="icon iconfont">&#xe62f;</i>&nbsp;&nbsp;切换新能源车牌
  		</div>
  		<input class="weui-input carsoftinput" style="display: none;" id="input" type="text"  placeholder="请输入正确的车牌号码" v-model="carnumer" maxlength="7" autocomplete="off">		
  	</div>	
  	<div class="addbtnp">
  		<button class="addbtn">
  			立即添加
  		</button>
  	</div>
  	
  	<div id="ttip" style="display: none;width: 100%;position: absolute;top: 50%;margin-top: -22px;text-align: center;">
  		<div style="overflow: hidden;width: 134px;height: 44px;line-height: 44px;text-align: center;display: inline-block;border-radius: 6px;color: #fff;background: rgba(0,0,0,0.5);">车牌号有误</div>
  	</div>
  
  </body>
  <script src="../../../js/jquery-3.2.1.min.js"></script>
  <script src="../../../js/bootstrap/bootstrap.js"></script>
  <!--<script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/jquery-weui.min.js?v=1.1"></script>-->
  <!--md5 start-->
  <script src="../../../js/md5.min.js"></script>
  <!--md5 end-->
  <script src="../../../js/layui/layui/layui.js"></script>
  <script src="../../../js/soft/layer.js"></script>
  <script src="../../../js/carsoft/carsoft.js"></script>
  <script src="../../../js/url.js"></script>
  <script src="../../../js/ajax.js"></script>
  <script src="../js/vipback.js"></script>
  
  <script type="text/javascript">
  var func = {}
  //切换新能源车
  function qiehuan(){
  	if(!xinnengyuan){
  		console.log('执行切换');		
  		$('#carsoft').append('<span><div></div></span>');
  		$('#carsoft').addClass('sbzgqh');
  		console.log('切换新能源  '+$.trim($('#carsoft').text()));
  		$('#input').val($.trim($('#carsoft').text()));
  		$('.qiehuan').html('<i class="icon iconfont">&#xe62f;</i>&nbsp;&nbsp;切换普通车牌');
  		xinnengyuan = true;
  	}else{		
  		$('#carsoft').children('span:last-child').remove();
  		$('#carsoft').removeClass('sbzgqh');
  		console.log('切换普通  '+$.trim($('#carsoft').text()));
  		$('#input').val($.trim($('#carsoft').text()));
  		$('.qiehuan').html('<i class="icon iconfont">&#xe62f;</i>&nbsp;&nbsp;切换新能源车牌');
  		xinnengyuan = false;
  	}
  }
  $(function(){
      //打开键盘
      openprovice(1);   
      
  /*    $('body').on('click','#carsoft',function(){
      	alert('sh');
      	var val = $("#input").val();
  		var sin = $(this).val();
  		console.log(" sin "+sin);
  		if(val.length<1){
  			alert('sh1');
  			openprovice(1);
  		}else if(val=='WJ'){
  			alert('sh2');
  			openprovice(3);
  		}else{
  			alert('sh3');
  			openprovice(2);
  		}
  		
  		layer.open({
  			type: 1,
  			content: '<div id="pro"></div>',
  			anim: 'up',
  			shade :false,
  			title:false,
  			closeBtn:false,
  			style: 'position:fixed; bottom:0; left:0; width: 100%; height: 172px; padding:0; border:none;'
  		});
  		
     })*/
      
      
      layui.use(['layer'], function(){});
      //点击立即添加
      var sfsxny = false;   
      $('body').on('click','.addbtn',function(){
      	//$('body').append('<div id="tip" style="position: absolute;padding: 12px 25px;top: 50%;left: 50%;margin-left: -62px;margin-top: -22px;border-radius: 6px;color: #fff;background: rgba(0,0,0,0.5);">签名验证失败</div>')
      	//$('#tip1').animate({height:"100px",width:'500px'});
      	
      	
      	
      	//var carnn = $.trim($('#carsoft').text());
      	var carnn = $.trim($("#input").val());
      	console.log('车牌号  :'+carnn);
      	if(!carnn||carnn==''){
      		/*$('.ttip>div').text('最多绑定三辆车');
          		$('.ttip').show();
          		setTimeout(function(){
          			$('.ttip').hide();
          		},1500);*/
      		layer.msg('车牌号不能为空', {
  			    time: 1500 //2秒关闭(如果不配置,默认是3秒)
  			}, function(){});
  			return false;
      	}
      	console.log('长度   '+carnn.length);
  		if(carnn.length==8){        	
          	if(carnn.substring(0,1)!='W'){
          		if(carnn.substring(2,3)=='D'||carnn.substring(2,3)=='F'||carnn.substring(2,3)=='0'||carnn.substring(2,3)=='1'||carnn.substring(2,3)=='2'||carnn.substring(2,3)=='3'||carnn.substring(2,3)=='4'||carnn.substring(2,3)=='5'||carnn.substring(2,3)=='6'||carnn.substring(2,3)=='7'||carnn.substring(2,3)=='8'||carnn.substring(2,3)=='9'){
          			if(carnn.substring(4,5)=='0'||carnn.substring(4,5)=='1'||carnn.substring(4,5)=='2'||carnn.substring(4,5)=='3'||carnn.substring(4,5)=='4'||carnn.substring(4,5)=='5'||carnn.substring(4,5)=='6'||carnn.substring(4,5)=='7'||carnn.substring(4,5)=='8'||carnn.substring(4,5)=='9'){
          				if(carnn.substring(5,6)=='0'||carnn.substring(5,6)=='1'||carnn.substring(5,6)=='2'||carnn.substring(5,6)=='3'||carnn.substring(5,6)=='4'||carnn.substring(5,6)=='5'||carnn.substring(5,6)=='6'||carnn.substring(5,6)=='7'||carnn.substring(5,6)=='8'||carnn.substring(5,6)=='9'){
              				if(carnn.substring(6,7)=='0'||carnn.substring(6,7)=='1'||carnn.substring(6,7)=='2'||carnn.substring(6,7)=='3'||carnn.substring(6,7)=='4'||carnn.substring(6,7)=='5'||carnn.substring(6,7)=='6'||carnn.substring(6,7)=='7'||carnn.substring(6,7)=='8'||carnn.substring(6,7)=='9'){
  	            				if(carnn.substring(7,8)=='D'||carnn.substring(7,8)=='F'||carnn.substring(7,8)=='0'||carnn.substring(7,8)=='1'||carnn.substring(7,8)=='2'||carnn.substring(7,8)=='3'||carnn.substring(7,8)=='4'||carnn.substring(7,8)=='5'||carnn.substring(7,8)=='6'||carnn.substring(7,8)=='7'||carnn.substring(7,8)=='8'||carnn.substring(7,8)=='9'){
  	            					sfsxny = true;
  	            				}else{
  	            					layer.msg('车牌号有误', { time: 1500 }, function(){}); return false;
  	            				}
  	            			}else{layer.msg('车牌号有误', { time: 1500 }, function(){}); return false;}
              			}else{layer.msg('车牌号有误', { time: 1500 }, function(){}); return false;}
          			}else{layer.msg('车牌号有误', { time: 1500 }, function(){}); return false;}
          		}else{layer.msg('车牌号有误', { time: 1500 }, function(){}); return false;}
          	}else{layer.msg('车牌号有误', { time: 1500 }, function(){}); return false;}
          }else{
          	if(carnn.length<7){
          		layer.msg('车牌号有误', { time: 1500 }, function(){}); return false;
          	}
          	if(carnn.length>8){
          		layer.msg('车牌号有误', { time: 1500 }, function(){}); return false;
          	}
          }
      	/*var checkResult = jsajax.isVehicleNumber(carnn);
          if (!checkResult&&!sfsxny) {
          	layer.msg('车牌号有误', {
  				    time: 1500 //2秒关闭(如果不配置,默认是3秒)
  				}, function(){});
              return false;
          }*/
  		var data = [{carNumber:carnn}];
  		editc(JSON.stringify(data),'00');
      })
  });
  
  function editc(carNumbers,optType){
  		layui.use(['layer'], function(){});
  		//mUrl.Caredit
  		var salt = jsajax.salt(32);
  		var token = mUrl.GetToken();
  		var device = mUrl.getDevice();
  		var sortd = [
  			{keyname:'app_id',value:'0eca8f5373ca4866aec2f8e9d9367104'},
  			{keyname:'deviceInfo',value:device},
  			{keyname:'salt',value:salt},
  			{keyname:'sign_type',value:'md5'},
  			{keyname:'carNumbers',value:carNumbers},
  			{keyname:'token',value:token},
  			{keyname:'optType',value:optType},
  		];
  		console.log(JSON.stringify(sortd));
  		var md5sign = jsajax.getsign(sortd);
  		var jsondata = {
  			app_id : "0eca8f5373ca4866aec2f8e9d9367104",
        		carNumbers : carNumbers,
     			deviceInfo : device,
     			optType : optType,
     			salt : salt,
     			sign : md5sign,
     			sign_type : "md5",
     			token : token
  		};
  		console.log(JSON.stringify(jsondata));
  		jsajax.defaultReq(
  			mUrl.Caredit,
  			JSON.stringify(jsondata),
  			function(data){
  				console.log(JSON.stringify(data));
  				if(data.code==0){
  					window.location.href = document.referrer;
  				}else if(data.code==-10005){
  					layer.msg('最多绑定三辆车', {
  					    time: 1500 //2秒关闭(如果不配置,默认是3秒)
  					}, function(){});
  				}else{	
  					layer.msg(data.message, {
  					    time: 1500 //2秒关闭(如果不配置,默认是3秒)
  					}, function(){});
  				}
  			}
  		);		 
  	}
  </script>
  </body>
  </html>