shopping_card.html
16 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>服务卡-{$tpshop_config['shop_info_store_title']}</title>
<include file="public/header" />
<style type="text/css">
select {
/*Chrome和Firefox里面的边框是不一样的,所以复写了一下*/
border: 0;
/*很关键:将默认的select选择框样式清除*/
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
/*为下拉小箭头留出一点位置,避免被文字覆盖*/
padding-right: 14px;
}
.card_info .info_text{width: 56%}
.btn{display: inline-block; width:14%; height: 30px; line-height: 30px }
.btn.back{ background: #f7f7f7; border-radius:5px; }
.btn_x{width: 80px;height: 25px; line-height: 25px; cursor: pointer; border: 1px solid #E6E9EE;text-align: center;
background-color: #f6f7fb;color: #434a54; width: 60px; display: inline-block}
.btn_x:hover{background-color:#EC5151; color: #fff;border-color:#EC5151}
.kc_p{height: 30px; line-height: 30px;margin:0 20px; }
.kc_p.bt{border-bottom: 1px solid #f7e9e2;}
.text_inp{font-size: 12px;color: #777;background-color: #FFF;
vertical-align: top;display: inline-block;
height: 25px;padding: 1px;
border: solid 1px #E6E9EE;outline: 0 none;
}
.fyu_class{margin-bottom:10px; overflow-y:scroll; max-height: 300px}
.ftxt_span{display: inline-block; width: 150px; overflow: hidden;text-overflow:ellipsis;white-space: nowrap; }
</style>
<body>
<ul class="card_head">
<li class="on" onclick="javascript:window.location.href='{:U('Mobile/User/shopping_card',array('stoid'=>$Think.request.stoid))}'">
<span>订购卡券</span>
</li>
<li onclick="javascript:window.location.href='{:U('Mobile/User/shopping_hascard',array('stoid'=>$Think.request.stoid))}'">
<span>已购卡券</span>
</li>
</ul>
<div class="card_info">
<p>
<label>使用门店:</label>
<select id="stolist" class="info_text" onchange="sel_1(this);">
<option value="">全部</option>
<foreach name="clist_c" item="vc">
<option value="{$vc.id}">{$vc.storagename}</option>
</foreach>
</select>
<span class="btn back" onclick="on_sear()">搜索</span>
</p>
<p>
<label>服务类型:</label>
<select class="info_text" id="temp1" onchange="sel_2(this);">
<option value="">全部</option>
<foreach name="clist_x" item="vx">
<option value="{$vx.xzno}">{$vx.xzname}</option>
</foreach>
</select>
<span class="btn"> </span>
</p>
</div>
<div class="card_nav">
<ul id="temp2">
<li data-id="" class="on" onclick="sel_3(this);">
全部
</li>
<foreach name="clist_b" item="vb">
<li data-id="{$vb.xzno}" onclick="sel_3(this);">
{$vb.xzname}
</li>
</foreach>
<!--<li>-->
<!--季卡-->
<!--</li>-->
<!--<li>-->
<!--年卡-->
<!--</li>-->
<!--<li>-->
<!--类别4-->
<!--</li>-->
</ul>
</div>
<ul class="card_list">
<foreach name='cardlist' item='cardlist' key="k">
<li class="<if condition="$k%3 eq 0">blue<else/><if condition="$k%3 eq 1">red<else/>green</if></if>">
<p class="tit">有效期至:{$cardlist.enddate}</p>
<div class="left">
<p></p>
<p class="color"><span>{:floatval($cardlist.qty)}</span>次</p>
</div>
<div class="right">
<p><span>{$cardlist.price}</span>元</p>
<p class="cut">{$cardlist.servername}</p>
<!--//:floatval()-->
</div>
<div class="f_card">
<span class="fl cut">注:{$cardlist.remark}</span>
<a class="fr buy" onclick="setsalecard(this);" data-id="{$cardlist.id}">立即购买</a>
<div class="clear"></div>
</div>
</li>
</foreach>
<!--<li class="blue">-->
<!--<p class="tit">有效期至:2017-12-25</p>-->
<!--<div class="left">-->
<!--<p></p>-->
<!--<p class="color"><span>5</span>次</p>-->
<!--</div>-->
<!--<div class="right">-->
<!--<p><span>180</span>元</p>-->
<!--<p class="cut">宝宝游泳卡</p>-->
<!--</div>-->
<!--<div class="f_card">-->
<!--<span class="fl cut">注:可在田娜门店使用。仅限周末可用,需提前一天预约。</span>-->
<!--<a class="fr buy">立即购买</a>-->
<!--<div class="clear"></div>-->
<!--</div>-->
<!--</li>-->
<!--<li class="red">-->
<!--<p class="tit">有效期至:2017-12-25</p>-->
<!--<div class="left">-->
<!--<p></p>-->
<!--<p class="color"><span>5</span>次</p>-->
<!--</div>-->
<!--<div class="right">-->
<!--<p><span>180</span>元</p>-->
<!--<p class="cut">宝宝游泳卡</p>-->
<!--</div>-->
<!--<div class="f_card">-->
<!--<span class="fl cut">注:可在田娜门店使用。仅限周末可用,需提前一天预约。</span>-->
<!--<a class="fr buy">立即购买</a>-->
<!--<div class="clear"></div>-->
<!--</div>-->
<!--</li>-->
<!--<li class="green">-->
<!--<p class="tit">有效期至:2017-12-25</p>-->
<!--<div class="left">-->
<!--<p></p>-->
<!--<p class="color"><span>5</span>次</p>-->
<!--</div>-->
<!--<div class="right">-->
<!--<p><span>180</span>元</p>-->
<!--<p class="cut">宝宝游泳卡</p>-->
<!--</div>-->
<!--<div class="f_card">-->
<!--<span class="fl cut">注:可在田娜门店使用。仅限周末可用,需提前一天预约。</span>-->
<!--<a class="fr buy">立即购买</a>-->
<!--<div class="clear"></div>-->
<!--</div>-->
<!--</li>-->
</ul>
<div class="layermbox dn" onclick="hide_shop()">
<div class="laymshade"></div>
<div class="layermmain">
<div class="section">
<div class="layermchild" style="width: 80%;">
<ul class="shop_list">
<li>
<a>
<span class="tit">门店</span>
<span class="tit">次数</span>
</a>
</li>
<li>
<a>
<span><p>田娜门店</p><p>2017-08-23</p></em></span>
<span>1次</span>
</a>
</li>
<li>
<a>
<span><p>田娜门店</p><p>2017-08-23</p></em></span>
<span>1次</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<!---弹出窗进行购买--->
<div id="fbuyPop" class="layermbox layermbox0_1 dn">
<form action="/Mobile/Payment/getPay" method="post" name="points" id="points">
<input name="stoid" value="{$Think.request.stoid}" type="hidden">
<input id="seleid" name="seleid" value="" type="hidden">
<input name="recharge_type" value="2" type="hidden">
<div class="laymshade"></div>
<div class="layermmain">
<div class="section">
<div class="layermchild layermanim">
<div class="layermcont">
<ul class="tcbox">
<li class="liFirst" style="height: 90px">
<span id="fpopclose" class="close"></span>
<div class="tcinfo" style="left:0; bottom: 20px">
<div><font id="fpointname" style="font-size:20px">充100送50</font></div>
<div class="tcprice">
<i>¥</i><font id="fpointprice">100.00</font>
</div>
</div>
</li>
</ul>
<div id="fsumbitbtn" class="layermbtn" onClick="checkup()">确定</div>
</div>
</div>
</div>
</div>
</div>
<input id="storageid" type="hidden" value=""/>
<input id="serve_cate" type="hidden" value=""/>
<input id="card_cate" type="hidden" value=""/>
<!-- 微信浏览器 调用微信 分享js-->
<include file="public/wx_share"/>
<!-- 微信浏览器 调用微信 分享js end-->
<!--输入库存的弹出界面-->
<div class="tan dn">
<p class="kc_p" style="margin-top: 10px"><input placeholder="请输入门店名称" class="text_inp" id="xh_sto" value="" type="width:100px" />
<span onclick="sear_name(this)" class="btn_x">搜索</span></p>
<div id="fyu" class="fyu_class">
<!--<p class="kc_p"><label>hfhdfuhu<input value="" type="radio"></label></p>-->
</div>
</div>
</body>
</html>
<script type="text/javascript">
var cardlist=JSON.parse('{$cardlist1}');
var serve_list=JSON.parse('{$clist_x1}');
var card_list=JSON.parse('{$clist_b1}');
var storageid='';
var serve_cate='';
var card_cate='';
var servercardid=''; //服务卡Id
var temp=new Array(); //临时存放_服务卡项目
var temp1=new Array(); //临时存放_服务类型
var temp2=new Array(); //临时存放_卡片类型
// $(".card_nav li").click(function(){
// card_cate=$(this).attr("data-id");
// $(".card_nav li").removeClass("on");
// $(this).addClass("on");
// getdata(3);
// });
function show_shop(){
$(".layermbox").removeClass("dn");
}
function hide_shop(){
$(".layermbox").addClass("dn");
}
function sel_1(obj) {
storageid=$(obj).val();
serve_cate="";
card_cate="";
getdata(1);
}
function sel_2(obj) {
serve_cate=$(obj).val();
card_cate="";
getdata(2);
}
function sel_3(obj) {
card_cate=$(obj).attr("data-id");
$(".card_nav li").removeClass("on");
$(obj).addClass("on");
getdata(3);
}
function getdata(k) {
var ismiss=true;
temp=[];
temp1=[];
temp2=[];
var html="";
var t=0;
for(var i=0;i<cardlist.length;i++)
{
var row=cardlist[i]
if(storageid!="" && row.storageid!="" && row.storageid.indexOf(storageid)==-1) //门店
{
ismiss=false;
}
if(serve_cate!="" && row.xmno!=serve_cate) //服务类型
{
ismiss=false;
}
if(card_cate!="" && row.kno!=card_cate) //卡类型
{
ismiss=false;
}
if(ismiss)
{
t++;
if(temp1.indexOf(row.xmno)==-1)
{
temp1.push(row.xmno);
}
if(temp2.indexOf(row.kno)==-1)
{
temp2.push(row.kno);
}
temp.push(row);
// html+="<li class='"+(t%3==0?'blue':(t%3==1?'red':'green'))+"'> <p class='tit'>有效期至:"+row.enddate.toString().substring(0,10)+"</p> <div class='left'> <p></p> <p class='color'><span>"+parseInt(row.qty)+"</span>次</p> </div> <div class='right'> <p><span>"+parseFloat(row.price)+"</span>元</p> <p class='cut'>"+row.servername+"</p> </div> <div class='f_card'> <span class='fl cut'>注:"+row.remark+"</span> <a class='fr buy' onclick='setsalecard(this);' data-id='"+row.id+"'>立即购买</a> <div class='clear'></div> </div> </li>";
}
ismiss=true;
}
// $(".card_list").html(html);
reset_info(k);
}
function reset_info(obj) {
var html="";
var html1="";
var html2=""
switch (obj)
{
case 1:
for(var t1=0;t1<serve_list.length;t1++)
{
if(temp1.toString().indexOf(serve_list[t1].xzno)>-1)
{
html1+="<option value=\""+serve_list[t1].xzno+"\">"+serve_list[t1].xzname+"</option>";
}
}
for(var t2=0;t2<card_list.length;t2++)
{
if(temp2.toString().indexOf(card_list[t2].xzno)>-1)
{
html2+="<li data-id=\""+card_list[t2].xzno+"\" onclick=\"sel_3(this);\">"+card_list[t2].xzname+"</li>";
}
}
$("#temp1").html("<option value=\"\">全部</option>"+html1);
$("#temp2").html("<li class=\"on\" data-id=\"\" onclick=\"sel_3(this);\">全部</li>"+html2);
break;
case 2:
for(var t2=0;t2<card_list.length;t2++)
{
if(temp2.toString().indexOf(card_list[t2].xzno)>-1)
{
html2+="<li data-id=\""+card_list[t2].xzno+"\" onclick=\"sel_3(this);\">"+card_list[t2].xzname+"</li>";
}
}
$("#temp2").html("<li class=\"on\" data-id=\"\" onclick=\"sel_3(this);\">全部</li>"+html2);
break;
default:break;
}
for(var t=0;t<temp.length;t++) //项目
{
var row=temp[t];
html+="<li class='"+(t%3==0?'blue':(t%3==1?'red':'green'))+"'> <p class='tit'>有效期至:"+row.enddate.toString().substring(0,10)+"</p> <div class='left'> <p></p> <p class='color'><span>"+parseInt(row.qty)+"</span>次</p> </div> <div class='right'> <p><span>"+parseFloat(row.price)+"</span>元</p> <p class='cut'>"+row.servername+"</p> </div> <div class='f_card'> <span class='fl cut'>注:"+row.remark+"</span> <a class='fr buy' onclick='setsalecard(this);' data-id='"+row.id+"'>立即购买</a> <div class='clear'></div> </div> </li>";
}
if(html==""){html="<div class=\"tac\">暂无卡券</div>";}
$(".card_list").html(html);
}
//立即购买
function pay(obj)
{
money=$(obj).attr("money");
yid=$(obj).attr("yid");
aid=$(obj).attr("aid");
url="/Mobile/User2/withdrawonlinepay/m/"+money+"/y/"+yid+"/a/"+aid+"/stoid/"+{:I('get.stoid')}+".html";
//alert(url);
$.ajax({
type : "GET",
url:url,//+tab,
// data : $('#filter_form').serialize(),// 你的formid 搜索表单 序列化提交
success: function(data)
{
}
});
}
/*--弹出立即购买--*/
function setsalecard(obj){
servercardid=$(obj).attr("data-id");
var name=$(obj).parent().parent().find(".right .cut").html();
var price=$(obj).parent().parent().find(".right span").html();
$("#seleid").val(servercardid);
$("#points").submit();
// $("#fpointname").text(name);
// $("#fpointprice").text(price);
// $("body").css('overflow','hidden');
// $("#fbuyPop").removeClass("dn");
}
$("#fpopclose").click(function () {
$("body").css('overflow','visible');
$("#fbuyPop").addClass("dn");
});
/*---开始充值---*/
function checkup() {
$("#fsumbitbtn").text("提交中");
if($(".fsumbitbtn").text()=="提交中")
{
layer.open({content:'请勿重复提交',time:1});
return false;
}
$("#points").submit();
}
var li=0;
function on_sear() {
//弹出批量库存
li= layer.open({
type: 1,
title: ['搜索门店', 'font-size:14px;'],
content: $('.tan').html(),
style: 'width: 280px; min-height: 200px;',
cancel: function () {
tan_outskuid=""; tan_skuid="";
},
});
}
//-------搜索门店的时候--------
function sear_name(ob) {
var na=$(ob).parent().find('input').val();
if(na=="") {
layer.open({content: '请输入门店名称', time: 1});
return false;
}
var arr=new Array();
$("#stolist option").each(function () {
var val=$(this).attr('value');
var txt=$(this).text();
if(txt.indexOf(na)!=-1){
var ie={val:val,txt:txt};
arr.push(ie);
}
});
if(arr.length<=0){
layer.open({content:'未找到相应的门店',time:1}); return false;
}
if(arr.length==1){
$("#stolist").val(arr[0].val); layer.close(li);
var ob1=document.getElementById('stolist');
sel_1(ob1);
return false;
}
var obj=$(ob).parent().parent();
var html="";
arr.forEach(function (ie,ind) {
html+= "<p class='kc_p bt' onclick='set_val(this)' val='"+ie.val+"'><span class='ftxt_span'>"+ie.txt
+"</span><span class='btn_x' style='float: right; position: relative;top: 3px; height: 22px; line-height: 22px'>选择</span></p>"
})
obj.find("#fyu").html(html);
}
function set_val(ob) {
var val=$(ob).attr('val');
$("#stolist").val(val);
var ob1=document.getElementById('stolist');
sel_1(ob1);
layer.close(li);
}
</script>