searchVip.html
21.8 KB
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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>会员卡</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">
<link rel="stylesheet" href="../../iconfont/iconfont.css">
<link rel="stylesheet" href="css/swiper.min.css">
<link rel="stylesheet" href="../../js/bootstrap/bootstrap.css" />
<link rel="stylesheet" href="css/choumei.css">
<link rel="stylesheet" href="css/vipcard.css" />
</head>
<style>
.row{
width: 100%;
margin-left: 0;
margin-right: 0;
}
body,html{
width: 100%;
float: left;
min-height: 100%;
height: auto ;
}
body{
background: -moz-linear-gradient(top, rgba(113, 152, 130, 1), rgba(38,154, 196, 1)) ;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(rgba(113, 152, 130, 1)), to(rgba(38,154, 196, 1))) ;
background: -o-linear-gradient(top, rgba(113, 152, 130, 1), rgba(38,154, 196, 1));
}
.vipdh{
width: 100%;
padding: 5px 11px;
display: -webkit-box;
}
.vipdh>div{
padding: 0 0;
display:flex;
color: #fff;
align-items:center;
}
.vipdh>div:first-child{
text-align: left !important;
}
.vipdh>div:last-child span{
width: 100%;
display: inline-block;
text-align: right !important;
}
.search{
width: 100%;
/*height: 36px;
line-height: 36px;*/
height: auto;
border-radius: 18px;
overflow: hidden;
margin: 0;
background: rgba(250,250,250,0.7);
padding: 0 10px;
box-sizing: border-box;
display: -webkit-box;
}
.search div{
box-sizing: border-box;
padding: 0;
display:flex;
/*justify-content:center;*/
align-items:center;
}
.search div i{
color: #fff;
line-height: 100%;
display: inline-block;
padding: 8px 0;
}
.search>div:last-child{
/*overflow: hidden;*/
}
.search div input{
border-style: none;
background: none;
width: 100% !important;
padding: 8px 5px;
}
::-webkit-input-placeholder { /* WebKit browsers */
color: #fff;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #fff;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #fff;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
color: #fff;
}
.mylistdata{
height: auto;
}
.swiper-slide .oned{
width: 88%;
margin: 0 auto;
height: auto;
box-sizing: border-box;
border-radius: 8px;
position: relative;
background: -moz-linear-gradient(-45deg,rgba(2,154,227,1), rgba(213,193,91,0.6));
background: -o-linear-gradient(-45deg, rgba(2,154,227,1),rgba(213,193,91,0.6));
background: -webkit-linear-gradient(-45deg, rgba(2,154,227,1),rgba(213,193,91,0.6));
background: linear-gradient(-45deg, rgba(2,154,227,1),rgba(213,193,91,0.6));
}
.swiper-slide-active .oned{
box-shadow: 0 1px 10px 0px rgba(228,108,165,0.3);
background: -moz-linear-gradient(-45deg, rgba(252,116,147,1),rgba(185,92,193,1));
background: -o-linear-gradient(-45deg, rgba(252,116,147,1),rgba(185,92,193,1));
background: -webkit-linear-gradient(-45deg, rgba(252,116,147,1),rgba(185,92,193,1));
background: linear-gradient(-45deg, rgba(185,92,193,1),rgba(252,116,147,1));/*linear-gradient(-45deg, rgba(252,116,147,1),rgba(185,92,193,1));*/
}
.mylistdata .list{
float: left;
position: relative;
width: 100%;
margin: 0 auto;
height: 100%;
padding: 11px;
box-sizing: border-box;
border-radius: 8px;
background: url(imgs/shuiyy.png)no-repeat center center;
background-size: 90% !important;
}
.mylistdata .list .cardstype{
padding: 0;
margin-bottom: 59.3px;
background: url(imgs/ztesy.png)no-repeat top right ;
background-size: 61px !important;
}
.mylistdata .list .cardstype li{
padding:0 4px;
padding-left: 0;
display: inline-block;
float: left;
}
.mylistdata .list .cardstype li div{
font-size: 11px;
border: 1px solid #fff;
text-align: center;
color: #fff;
padding: 0 5px;
min-width: 30px;
text-align: center;
}
.mylistdata .list .parks{
width: 100%;
float: left;
color: #fff;
bottom: 10px;
box-sizing: border-box;
}
.mylistdata .list .parks>div:first-child{
font-size: 18px;
}
.mylistdata .list .parks .parksaddr{
font-size: 12px;
}
.mylistdata .list .parks>div{
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.swiper-container{
margin-top: 40px;
min-height: 25%;
height: auto;
}
.swiper-slide {
padding:0 15px 5px;
box-sizing: border-box;
width: 100%;
height: auto;
display:flex;
justify-content:center;
align-items:center;
}
.pagination1{
overflow: hidden;
overflow-y: scroll;
width: 100%;
margin-top: 47px;
}
.pagination1>span{
width: 90%;
height: auto;
border-radius: 4px;
display: inline-block;
margin-bottom: 7px;
padding: 10px;
}
.pagination1>span>div>div{
text-align: left;
}
.pagination1>span>div>div:first-child{
font-size: 18px;
}
.pagination1>span>div>div:nth-child(2){
font-size: 12px;
color: rgba(155,155,155,1);
}
.pagination1>span>div>ul{
float: right;
margin-bottom: 0 !important;
}
.pagination1>span>div>ul li{
list-style: none;
color: #fff;
float: right;
width: 56px;
box-sizing: border-box;
}
.pagination1>span>div>ul li div{
width: 20px;
height: 20px;
color: #fff;
float: left;
margin-left: 7px;
margin-bottom: 7px;
background: #fd404b;
}
.pagination1>span>div>ul div:nth-child(2){
background: #f5a623;
}
.pagination1 .swiper-pagination-bullet{
background: #fff !important;
opacity: 1 !important;
}
.pagination1 .swiper-pagination-bullet>div{
padding: 0;
}
.pagination1 .swiper-pagination-bullet>div:last-child ul{
width: 100%;
}
.pagination1>span.swiper-pagination-bullet-active{
background: #75CBBE !important;
}
.pagination1>span.swiper-pagination-bullet-active>div>div{
color: #fff !important;
}
.histextp{}
.histextp p{
color: #fff;
padding: 10px 20px 5px;
margin-bottom: 0;
}
.histext{
color: #fff;width: 100%;
padding: 0 20px;
box-sizing: border-box;
}
.histext>div{
display: flex;
justify-content:center;
align-items: center;
padding: 5px 0;
border-bottom: 1px solid rgba(244,244,244,0.3);
}
.histext>div>div{
padding: 0;
}
.histext>div>div:last-child>div:last-child{
font-size: 10px;
padding: 5px 0;
opacity: 0.6;
}
.swiper-pagination{
position: relative;
}
/*.vptop .vipdh>div:first-child>i{
display: none;
}*/
</style>
<body class="">
<div class="vptop">
<div class="vipdh row">
<div class="col-xs-1">
<i class="icon iconfont" onclick="javascript:window.history.go(-1)"></i>
</div>
<div class="col-xs-11" id="vueinput">
<div class="search row" id="search">
<div class=" col-xs-1">
<i class="icon iconfont searchvip" onclick=""></i>
</div>
<div class=" col-xs-11">
<input id="searchVip" v-model="keyy" type="text" placeholder=" 输入位置/停车场名称搜索包年包月卡" />
<!--<input id="searchVip" type="text" placeholder=" 输入位置/停车场名称搜索包年包月卡" style="height: auto !important;"/>-->
</div>
</div>
</div>
</div>
</div>
<div class="histextp" style="">
<p>搜索历史</p>
<div class="histext">
<!--<div class="row">
<div class="col-xs-1">
<i class="icon iconfont"></i>
</div>
<div class="col-xs-11">
<div>中国传感网国际创新园</div>
<div>地址地址地址</div>
</div>
</div>-->
</div>
<p>
<i class="icon iconfont"></i>
</p>
</div>
<div class="jilu" style="display: none;position: absolute;top: 50%;width: 100%;text-align: center;margin-top: -7px;color: #fff;">抱歉,无搜索记录</div>
<div class="swiper-container" >
<div class="swiper-wrapper mylistdata"></div>
</div>
<div style="position: relative;margin-top: 10px;">
<div class="swiper-pagination pagination1"></div>
</div>
</body>
</html>
<script src="../../js/jquery-3.2.1.min.js"></script>
<script src="../../js/bootstrap/bootstrap.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="js/swiper.min.js"></script>
<script src="js/choumei.js"></script>
<script src="../../js/md5.min.js"></script>
<script src="../../js/url.js"></script>
<script src="../../js/ajax.js"></script>
<script>
var app = new Vue({
el: '#vueinput',
data: {
keyy:''
},
watch:{
keyy:function(val){
searchData(val);
}
}
})
$(function(){
gethis();//获取历史记录
//点击搜索搜索数据
$('body').on('click','.searchvip',function(){
var val = $.trim($('#searchVip').val());
console.log('已该为准 '+val);
if(val&&val!=''){
$('.jilu').css('display','none');
$('.histextp').css('display','none');
searchData(val);
}else{
$('.jilu').css('display','block');
$('.histextp').css('display','block');
$('.pagination1').css('display','none');
$('.mylistdata').html('');
}
});
//点击根据历史搜索会员卡
$('body').on('click','.histext>div',function(){
var pno = $(this).attr('data-pno');
var pname = $(this).attr('data-pname');
var paddr = $(this).attr('data-paddr');
$('.histextp').css('display','none');
console.log(pname);
$('#searchVip').val(pname);
searchData(pname);
});
//点击停车场会员卡进入详情
$('body').on('click','.swiper-slide',function(){
var pno = $(this).attr('data-plNo');
var pname = $(this).attr('data-pname');
var paddr = $(this).attr('data-paddr');
var src = 'vcard.html?parkId='+pno+"&pname="+pname+"&paddr="+paddr;
var Vipsearch = {pno:pno,pname:pname,paddr:paddr};
var datas = localStorage.getItem('rntVipsearch');//localStorage.setItem('rntVipsearch',);
var shuzu = [];
if(datas){
console.log("历史记录 "+datas);
datas = JSON.parse(datas);
if(datas&&datas.length>0){
var cha = true;
shuzu = datas;
for(var i=0;i<datas.length;i++){
var no = datas[i].pno;
if(no==pno){cha = false;break;}
}
if(cha){
console.log('无重复插入 ');
if(shuzu.length>=3){
shuzu[3].pop();
shuzu.push(Vipsearch);
}else{
shuzu.push(Vipsearch);
}
console.log('插入后的'+JSON.stringify(shuzu));
localStorage.setItem('rntVipsearch',JSON.stringify(shuzu));
}
}else{
shuzu.push(Vipsearch);
localStorage.setItem('rntVipsearch',JSON.stringify(shuzu));
}
}else{
shuzu.push(Vipsearch);
localStorage.setItem('rntVipsearch',JSON.stringify(shuzu));
}
$('.histextp').css('display','none');
gethis();
setTimeout(function(){
window.location.assign(encodeURI(src));
},300);
});
});
//获取历史记录
function gethis(){
var datas = localStorage.getItem('rntVipsearch');//localStorage.setItem('rntVipsearch',);
var shuzu = [];
if(datas){
console.log(datas);
datas = JSON.parse(datas);
if(datas.length>0){
$('.histext').html('');
for(var i=0;i<datas.length;i++){
var div = document.createElement('div');
div.className = 'row';
div.setAttribute('data-pno',datas[i].pno);
div.setAttribute('data-pname',datas[i].pname);
div.setAttribute('data-paddr',datas[i].paddr);
div.setAttribute('onclick','');
div.innerHTML = '<div class="col-xs-1">'
+'<i class="icon iconfont"></i>'
+'</div>'
+'<div class="col-xs-11">'
+'<div>'+datas[i].pname+'</div>'
+'<div>'+datas[i].paddr+'</div>'
+'</div>';
$('.histext').append(div);
//console.log('发' +datas[i].pno+" "+datas[i].pname+" "+datas[i].paddr);
}
}
}
}
//根据关键字获取搜索值
function searchData(parkName){
var salt = jsajax.salt(32);
var deviceInfo = mUrl.getDevice();
var sort = [
{keyname:'app_id',value:'0eca8f5373ca4866aec2f8e9d9367104'},
{keyname:'deviceInfo',value:deviceInfo},
{keyname:'salt',value:salt},
{keyname:'sign_type',value:'md5'},
{keyname:'parkName',value:parkName}
];
var md5sign = jsajax.getsign(sort);
var jsondata = {
app_id:'0eca8f5373ca4866aec2f8e9d9367104',
deviceInfo:deviceInfo,
salt:salt,
sign_type:'md5',
sign:md5sign,
parkName:parkName
};
$('.jilu').css('display','none');
$('.histextp').css('display','none');
$('.mylistdata').html('');
//alert('根据停车场名称数据'+JSON.stringify(jsondata));
console.log('根据停车场名称数据'+JSON.stringify(jsondata));
jsajax.defaultReq(
mUrl.vipsearch,//mUrl.selectPark,
JSON.stringify(jsondata),
function (res) {
//alert("根据停车场名称获取"+JSON.stringify(res));
console.log("根据停车场名称获取"+JSON.stringify(res));
if (res.code == '0') {
var data = res.data;
var list = data.list;
var html = '';
var mylist = document.querySelector('.mylistdata');//document.getElementById('myList');
mylist.innerHTML = '';
$('.jilu').css('display','none');
$('.histextp').css('display','none');
var datainfo = res.data;
var catdtypeary = [];
if(datainfo.length>0){
console.log('执行了呀 ');
for(var i=0;i<datainfo.length;i++){
//循环一个停车场信息
var datapark = datainfo[i].parkList;//获取单个停车场信息
var cardh = '';
var plNo = '';
var plName = '';
var plAddress = '';
catdtypeary = [];
for(var j = 0;j<datapark.length;j++){
var cardType = datapark[j].cardType;//卡类型 1.年卡 2.半年卡 3.季卡 4.月卡 5.日卡
plNo = datapark[j].plNo;//停车场编号
plName = datapark[j].plName;//停车场名称
var carType = datapark[j].carType;//车类型 1.大型车 2,小型车
plAddress = datapark[j].plAddress;//地址
var cart = '';
if(cardType==1){
var tu = false;
for(var n=0;n<catdtypeary.length;n++){
if(cardType==catdtypeary[n]){
tu = true;
}
}
if(!tu){
catdtypeary.push(cardType);
cardh +='<li><div>年卡</div></li>';//'<li class="weui-media-box__info__meta month_card">年卡</li>';
}
}
if(cardType==2){
var tu = false;
for(var n=0;n<catdtypeary.length;n++){
if(cardType==catdtypeary[n]){
tu = true;
}
}
if(!tu){
catdtypeary.push(cardType);
cardh +='<li><div>半年卡</div></li>';//'<li class="weui-media-box__info__meta year_card">半年卡</li>';
}
}
if(cardType==3){
var tu = false;
for(var n=0;n<catdtypeary.length;n++){
if(cardType==catdtypeary[n]){
tu = true;
}
}
if(!tu){
catdtypeary.push(cardType);
cardh +='<li><div>季卡</div></li>';//'<li class="weui-media-box__info__meta month_card">季卡</li>';
}
}
if(cardType==4){
var tu = false;
for(var n=0;n<catdtypeary.length;n++){
if(cardType==catdtypeary[n]){
tu = true;
}
}
if(!tu){
catdtypeary.push(cardType);
cardh +='<li><div>月卡</div></li>';//'<li class="weui-media-box__info__meta year_card">月卡</li>';
}
}
if(cardType==5){
var tu = false;
for(var n=0;n<catdtypeary.length;n++){
if(cardType==catdtypeary[n]){
tu = true;
}
}
if(!tu){
catdtypeary.push(cardType);
cardh +='<li><div>日卡</div></li>';//'<li class="weui-media-box__info__meta month_card">日卡</li>';
}
}
}
mylist.innerHTML += '<div class="swiper-slide" data-plNo="'+plNo+'" data-pname="'+plName+'" data-paddr="'+plAddress+'" onclick="">'
+'<div class="oned"><div class="list">'
+'<ul class="cardstype col-xs-12">'
+cardh
+'</ul>'
+'<div class="parks">'
+'<div class="parksname">'+plName+'</div>'
+'<div class="parksaddr">'+plAddress+'</div>'
+' </div>'
+'</div></div>'
+'</div>';
}
//设置底部数据高度 start
var htop = document.documentElement.clientHeight;
var top = $('.pagination1').offset().top;
console.log('高度 '+top+" ");
$('.pagination1').css('height',(htop-top)+'px');
//end
var klx = [];
console.log(catdtypeary.length);
klx = catdtypeary.length>0?catdtypeary:[];
var htmlklx = '';
var mySwiper = new Swiper('.swiper-container',{
slidesPerView : 'auto',
centeredSlides : true,
watchSlidesProgress: true,
pagination : '.swiper-pagination',
paginationClickable: true,
initialSlide :0,
observer:true,//修改swiper自己或子元素时,自动初始化swiper
observeParents:true,//修改swiper的父元素时,自动初始化swiper
paginationBulletRender:paginationBulletRender = function (index,className){
var val = $.trim($('#searchVip').val());
$('.pagination1').html('');
$('.pagination1').css('display','block');
var astr = $('.swiper-wrapper .swiper-slide').eq(index).html();//'index'+index;//
var cardstr = $('.swiper-wrapper .swiper-slide').eq(index).children().children('.cardstype').html();
var pname = $('.swiper-wrapper .swiper-slide').eq(index).attr('data-pname');//name
var parksaddr = $('.swiper-wrapper .swiper-slide').eq(index).attr('data-paddr');//地址
if(val&&val!=''&&pname&&pname!=''){
console.log("索引值 "+index)
htmlklx = '';
for(var k = 0;k<klx.length;k++){
console.log("zhi "+klx[k]);
if(klx[k]=='1'||klx[k]==1){htmlklx +='<div>年</div>';}
if(klx[k]=='2'||klx[k]==2){htmlklx +='<div>半年</div>';}
if(klx[k]=='3'||klx[k]==3){htmlklx +='<div>季</div>';}
if(klx[k]=='4'||klx[k]==4){htmlklx +='<div>月</div>';}
if(klx[k]=='5'||klx[k]==5){htmlklx +='<div>日</div>';}
}
return '<span class="'+className+' row">'
+'<div class="col-xs-9">'
+'<div class="pname">'+pname+'</div>'
+'<div class="parksaddr">'+parksaddr+'</div>'
+'</div>'
+'<div class="col-xs-3">'
+'<ul><li>'+htmlklx+'</li></ul>'
+'</div>'
+'</span>';
}else{
$('.jilu').css('display','block');
$('.histextp').css('display','block');
$('.pagination1').css('display','none');
$('.mylistdata').html('');
return '';
}
},
onProgress: function(swiper){
for (var i = 0; i < swiper.slides.length; i++){
var slide = swiper.slides[i];
var progress = slide.progress;
scale = 1 - Math.min(Math.abs(progress * 0.2), 1);
es = slide.style;
es.opacity = 1 - Math.min(Math.abs(progress/2),1);
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = 'translate3d(0px,0,'+(-Math.abs(progress*460))+'px)';
}
},
onSetTransition: function(swiper, speed) {
for (var i = 0; i < swiper.slides.length; i++) {
es = swiper.slides[i].style;
es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = speed + 'ms';
}
}
});
}else{
$('.jilu').css('display','block');
$('.histextp').css('display','block');
$('.pagination1').css('display','none');
document.querySelector('.mylistdata').innerHTML = '';
}
} else {
alert(res.message);
}
}
);
}
</script>