_libin.html
30.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
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
<include file="public/layout" />
<style>
.btn {
color: #999;
cursor: pointer !important;
}
.prom_table {
width: 90%;
margin: 30px 0;
float: right;
}
.w10 {
line-height: 20px;
width: 10%;
text-align: center;
}
.w15 {
line-height: 20px;
width: 15%;
text-align: center;
}
.w30 {
line-height: 20px;
width: 30%;
text-align: center;
}
</style>
<script src="__PUBLIC__/static/js/layer/laydate/laydate.js"></script>
<body style="background-color: #FFF; overflow: auto;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
<div class="fixed-bar">
<div class="item-title">
<div class="fixed-bar">
<div class="item-title">
<a class="back" href="javascript:window.history.back()" title="返回列表">
<i class="fa fa-arrow-circle-o-left"></i>
</a>
<div class="subject">
<h3>礼包管理</h3>
</div>
</div>
</div>
</div>
</div>
<form method="post" id="addlbform" action="{:U('Admin/Libao/addlb')}">
<input type="hidden" name="lbid" value="{$deatillp.id}"/>
<input type="hidden" id="oldurl" name="oldurl" value="{$oldurl}" class="input-txt">
<!--通用信息-->
<if class="ncap-form-default tab_div_1">
<!--<if condition="$deatillp['id'] eq null">-->
<!--<dl class="row">-->
<!--<dt class="tit">-->
<!--<label for="fkeywords">关键字搜索</label>-->
<!--</dt>-->
<!--<dd class="opt">-->
<!--<input type="text" value=""-->
<!--onkeydown="strkeydown(event, this, 'subbtn')"-->
<!--id="fkeywords" class="input-txt"/>-->
<!--<input id="subbtn" type="button" value="点击搜索商品" onclick="searGoods()"-->
<!--class="input-btn" />-->
<!--<span class="err cr"></span>-->
<!--</dd>-->
<!--</dl>-->
<!--</if>-->
<dl class="row">
<dt class="tit">
<label for="goods_name">礼包标题</label>
</dt>
<dd class="opt">
<input id="lbtitle" type="text" value="{$deatillp.lbtitle}"
maxlength="180"
onkeydown="strkeydown(event, this, 'sumbbtn')"
name="lbtitle" class="input-txt"/>
<span class="err cr" id="err_goods_name" ></span>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="goods_sn">开始时间</label>
</dt>
<dd class="opt">
<input type="text" id="startime" name="startime" value="{$deatillp.startime}" class="input-txt">
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="goods_sn">结束时间</label>
</dt>
<dd class="opt">
<input type="text" id="endtime" name="endtime" value="{$deatillp.endtime}" class="input-txt">
</dd>
</dl>
<dl class="row">
<dt class="tit">礼包类型</dt>
<dd class="opt">
<select name="lbtype" id="lbtype" >//onchange="translbtype(this);"
<option value="1" <if condition="$deatillp.lbtype eq 1">selected</if>>礼品礼包</option>
<option value="2" <if condition="$deatillp.lbtype eq 2">selected</if>>礼券礼包</option>
</select>
</dd>
</dl>
<dl class="row">
<dt class="tit"><label for="goods_name">礼包图片</label></dt>
<dd class="opt">
<div class="ncsc-goods-default-pic">
<div class="goodspic-uplaod">
<div style="">
<img id="lburl2" src="{$deatillp.lburls|default='__PUBLIC__/images/default_goods_image_240.gif'}" style="width: 240px; border:#eee solid 1px" onmouseover="layer.tips('<img src={$deatillp.lburls}>',this, {tips: [1, '#fff']});" onmouseout="layer.closeAll();">
</div>
<input type="hidden" id="img_url" name="lburl"
onkeydown="strkeydown(event, this, 'submitbtn')"
value="{$deatillp.lburl}" class="type-file-text">
<p class="hint">请上传图片格式文件,<Font color="red">大小建议为:720x540像素。</Font> </p>
<div class="handle">
<div class="ncsc-upload-btn">
<a onClick="GetUploadify_new(1,'lburl2','libao','{$erpid}','libao_form','id','lburl','{$deatillp.id}','img_call_back')">
<p><i class="icon-upload-alt"></i>图片上传</p>
</a>
</div>
</div>
</div>
</div>
</dd>
</dl>
<dl class=" row">
<dt class="tit">
<label for="goods_name">礼包说明</label>
</dt>
<dd class="opt">
<input id="lbintro" type="text" value="{$deatillp.lbintro}"
maxlength="180"
onkeydown="strkeydown(event, this, 'sumbbtn')"
name="lbintro" class="input-txt"/>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="shop_price">礼包原价</label>
</dt>
<dd class="opt">
<input type="text" value="{$deatillp.oldprice}" name="oldprice" id="oldprice"
onkeydown="strkeydown(event, this, 'sumbbtn')"
class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"
onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
<p class="notic">该礼包的零售价,可在手店上进行显示</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="shop_price">礼包价格</label>
</dt>
<dd class="opt">
<input type="text" value="{$deatillp.lbprice}" name="lbprice" id="lbprice"
onkeydown="strkeydown(event, this, 'sumbbtn')"
class="t_mane" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"
onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
<p class="notic">购买该礼包的价格,为0表示不使用金额购买</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="goods_name">兑换积分</label>
</dt>
<dd class="opt">
<input id="lbintegral" type="text" value="{$deatillp.lbintegral}"
maxlength="180"
onkeydown="strkeydown(event, this, 'sumbbtn')"
name="lbintegral" class="" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"
onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
<p class="notic">购买该礼包所需积分,为0表示不使用积分兑换</p>
</dd>
</dl>
<dl class="show1 row <if condition='$deatillp.lbtype eq 2'>dn</if>">
<dt class="tit">
<label for="goods_name">有效期</label>
</dt>
<dd class="opt">
<input id="expday" type="text" value="{$deatillp.expday}"
onkeydown="strkeydown(event, this, 'sumbbtn')"
name="expday" class="" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"
onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />天
<p class="notic">会员购买后在多久的时间内可兑换</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="goods_name">礼包总数</label>
</dt>
<dd class="opt">
<input id="num" type="text" value="{$deatillp.num}"
onkeydown="strkeydown(event, this, 'sumbbtn')"
name="num" class="" onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')"
onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
<p class="notic">参与该活动的礼包总数量</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
限购
</dt>
<dd class="opt">
<input type="text" value="{$deatillp.limitnum|default=0}" class="t_mane" name="limitnum" id="limitnum"
onkeydown="strkeydown(event, this, 'sumbbtn')"
onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
<span class="err" id="err_store_count" ></span>
<p class="notic">同一个ID只能购买该礼包的次数</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
排序
</dt>
<dd class="opt">
<input type="text" value="<if condition='$md'>$md<else/>{$deatillp.sort_order|default=0}</if>" class="t_mane" name="sort_order"
onkeydown="strkeydown(event, this, 'sumbbtn')"
onKeyUp="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" />
</dd>
</dl>
<!--<dl class="show2 row <if condition='$deatillp.lbtype neq 2'>dn</if>">-->
<!--<dt class="tit">-->
<!--<label for="is_autowx"><em>*</em>是否消费赠送</label>-->
<!--</dt>-->
<!--<dd class="opt">-->
<!--<div class="onoff" id="is_autowx">-->
<!--<label for="is_autowx1" class="cb-enable <if condition="$deatillp.isgift eq 1">selected</if>">是</label>-->
<!--<label for="is_autowx0" class="cb-disable <if condition="$deatillp.isgift eq 0">selected</if>">否</label>-->
<!--<input id="is_autowx1" name="isgift" value="1"-->
<!--onkeydown="strkeydown(event, this, 'submitbtn')"-->
<!--type="radio" <if condition="$deatillp.isgift eq 1"> checked="checked"</if>>-->
<!--<input id="is_autowx0" name="isgift" value="0"-->
<!--onkeydown="strkeydown(event, this, 'submitbtn')"-->
<!--type="radio" <if condition="$deatillp.isgift eq 0"> checked="checked"</if>>-->
<!--</div>-->
<!--</dd>-->
<!--</dl>-->
<dl class="show2 row <if condition='$deatillp.lbtype neq 2'>dn</if>">
<dt class="tit">
<label for="is_autowx"><em>*</em>领取用户</label>
</dt>
<dd class="opt">
<input id="dis_type0" type="radio" name="usertype" value="1"
<if condition="$deatillp.usertype eq 1"> checked</if>>
<label for="dis_type0">新会员</label>
<input id="dis_type1" type="radio" name="usertype" value="0"
<if condition="$deatillp.usertype eq 0"> checked</if>>
<label for="dis_type1">不限</label>
</dd>
</dl>
<dl class="show1 row <if condition='$deatillp.lbtype eq 2'>dn</if>">
<dt class="tit">
<label><em>*</em>礼包礼品</label>
</dt>
<dd class="opt">
<a onclick="search_goods()" class="ncap-btn"><i class="fa fa-search"></i>选择商品</a>
</dd>
</dl>
<dl class="show2 row <if condition='$deatillp.lbtype neq 2'>dn</if>">
<dt class="tit">
<label><em>*</em>礼包礼券</label>
</dt>
<dd class="opt">
<a onclick="search_quan()" class="ncap-btn"><i class="fa fa-search"></i>选择礼券</a>
</dd>
</dl>
<table class="prom_table">
<thead>
<tr class="show1 <if condition='$deatillp.lbtype eq 2'>dn</if>">
<td class="w15">商品编号</td>
<td class="w30">商品名称</td>
<td class="w15">商品条码</td>
<td class="w10">零售价</td>
<!--<td class="w10">市场价</td>-->
<td class="w10">数量</td>
<!--<td class="w10">库存</td>-->
<td class="w10">操作</td>
</tr>
<tr class="show2 <if condition='$deatillp.lbtype neq 2'>dn</if>">
<td class="w15">礼券名称</td>
<td class="w15">礼券类型</td>
<td class="w15" style=" text-align: center;">使用有效期</td>
<td class="w15">面值</td>
<td class="w15">使用满金额</td>
<td class="w10">数量</td>
<td class="w10">操作</td>
</tr>
</thead>
<tbody id="goods_list">
<volist name="goods" id="gg">
<if condition="$deatillp.lbtype eq 1">
<tr>
<td style="text-align: center">{$gg.goods_sn}</td>
<td style="text-align: center">{$gg.goods_name}</td>
<td style="text-align: center">{$gg.goods_code}</td>
<td style="text-align: center">{$gg.pos_price}</td>
<td style="text-align: center">
<input type="text" name="goods_num[]" class="price" style="width: 60px" value="{$gg.goods_num}"
onkeyup="this.value = this.value.replace(/^(\d+)\.(\d{3})/,'')" autocomplete="off">
<if condition="$gg.state eq 1">件<else/>次</if>
</td>
<td class="dn">
<input type="hidden" name="goods_sn[]" value="{$gg.goods_sn}">
<input type="hidden" name="goods_name[]" value="{$gg.goods_name}">
<input type="hidden" name="goods_code[]" value="{$gg.goods_code}">
<input type="hidden" name="pos_price[]" value="{$gg.pos_price}">
<input type="hidden" name="state[]" value="{$gg.state}">
</td>
<td style="text-align: center">
<a class="btn red" onclick="delpro(this)" data-id="{$gg.id}"><i
class="fa fa-trash-o"></i>删除</a>
</td>
</tr>
<else/>
<tr>
<td style="text-align: center">{$gg.name}</td>
<td style="text-align: center">{$gg.type}</td>
<td style="text-align: center">
<if condition="strpos($gg.use_start_time,'1970')!==false">
不限
<else/>
{$gg.use_start_time}
</if>
<br/>
<if condition="strpos($gg.use_end_time,'1970')!==false">
不限
<else/>
{$gg.use_end_time}
</if>
</td>
<td style="text-align: center">{$gg.money}</td>
<td style="text-align: center">{$gg.condition}</td>
<td style="text-align: center">
<input type="text" name="goods_num[]" class="price" style="width: 30px;text-align: center" value="{$gg.goods_num|default=1}"
onkeyup="this.value = this.value.replace(/^(\d+)\.(\d{3})/,'')" autocomplete="off">
</td>
<td class="dn">
<input type="hidden" name="cpid[]" value="{$gg.id}">
</td>
<td style="text-align: center">
<a class="btn red" onclick="delpro(this)" data-id="{$gg.id}"><i
class="fa fa-trash-o"></i>删除</a>
</td>
</tr>
</if>
</volist>
</tbody>
</table>
<if condition="$islook eq 0">
<div class="bot">
<a onclick="submit()" class="ncap-btn-big ncap-btn-green">确认提交</a>
</div>
</if>
</div>
<!--<div class="ncap-form-default">-->
<!--<div class="bot">-->
<!--<input type="hidden" name="goods_id" value="{$deatillp.id}">-->
<!--<a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green"-->
<!--id="sumbbtn"-->
<!--onClick="ajax_submit_form1('addlpform','{:U('Marketing/addlp?is_ajax=1')}');">确认提交</a>-->
<!--</div>-->
<!--</div>-->
</form>
<!--表单数据-->
<input type="hidden" id="qclurl" value="{$qclurl}">
<input type="hidden" id="distr_type">
</div>
<script type="text/javascript">
var condition = false;
var msg = '请输入正确的值';
var key = '';//关键字
var seardata = '';//接口返回数据
var count = '';//接口返回的个数
// input文本框失去焦点事件
$('input[type="text"]').blur(function () {
if ($(this).val() != '') {
$(this).nextAll('.cr').addClass('dn');
}
});
$(document).ready(function(){
$('#startime').layDate();
$('#endtime').layDate();
// $('#show_time').layDate();
})
//选择礼包礼品
function search_goods() {
var url = "/index.php/admin/Libao/SelectGood/";
var url2 = "/index.php/admin/Libao/getGoods";
layer.msg('加载中...', {icon: 16, shade: [0.5, '#f5f5f5'], scrollbar: false, offset: '200px', time: 0});
$.ajax({
type: "get",
url: url,
dataType: 'json',
error: function () {
layer.closeAll();
layer.msg("服务器繁忙, 请联系管理员!", {icon: 2, time: 1000});
},
success: function (data) {
layer.closeAll();
if (data == "") {
layer.msg(data.msg, {icon: 2, time: 1000});
return false;
}
if (data.code == "1" || data.code == 1) {
if (data.count == undefined || data.count == 0) {
layer.msg("未找到商品", {icon: 2, time: 1000});
return false;
}
seardata = data.data;
count = data.count;
if (seardata.length == 1) {
m_call_back(seardata[0]);
} else {
layer.open({
type: 2,
title: '选择商品',
shadeClose: true,
shade: 0.2,
area: ['96%', '70%'],
content: url2
});
}
} else {
layer.msg(data.msg, {icon: 2, time: 1000});
}
}
});
}
//选择礼包礼券
function search_quan() {
var url = "/index.php/admin/Libao/SelectCp/";
var url2 = "/index.php/admin/Libao/getCp";
layer.msg('加载中...', {icon: 16, shade: [0.5, '#f5f5f5'], scrollbar: false, offset: '200px', time: 0});
$.ajax({
type: "get",
url: url,
dataType: 'json',
error: function () {
layer.closeAll();
layer.msg("服务器繁忙, 请联系管理员!", {icon: 2, time: 1000});
},
success: function (data) {
layer.closeAll();
if (data == "") {
layer.msg(data.msg, {icon: 2, time: 1000});
return false;
}
if (data.code == "1" || data.code == 1) {
if (data.count == undefined || data.count == 0) {
layer.msg("未找到优惠券", {icon: 2, time: 1000});
return false;
}
seardata = data.data;
count = data.count;
if (seardata.length == 1) {
cp_call_back(seardata[0]);
} else {
layer.open({
type: 2,
title: '选择优惠券',
shadeClose: true,
shade: 0.2,
area: ['96%', '70%'],
content: url2
});
}
} else {
layer.msg(data.msg, {icon: 2, time: 1000});
}
}
});
}
//商品搜索页面
function getSearDate() {
return seardata;
console.log(seardate);
}
function getCount() {
return count;
}
function getSearKey() {
return key;
}
//验证选择商品
function m_call_back(data) {
var html="";
html="<tr> <td style=\"text-align: center\">"+data.WareNo+"</td> <td style=\"text-align: center\">"+data.WareName+"</td> <td style=\"text-align: center\">"+data.BarCode+"</td> <td style=\"text-align: center\">"+data.PosPrice+"</td> <td style=\"text-align: center\"> <input type=\"text\" name=\"goods_num[]\" class=\"price\" style=\"width: 60px\" value=\"1\" onkeyup=\"this.value = this.value.replace(/^(\d+)\.(\d{3})/,'')\" autocomplete=\"off\">"+(data.WaresType.toString()=="2"?"次":"件")+" </td> <td style=\"text-align: center\" onclick=\"delpro(this);\"><a class=\"btn red\" onclick=\"delpro(this)\" data-id=\"\"><i class=\"fa fa-trash-o\"></i>删除</a></td>";
html+="<td class='\"dn\"'><input type='hidden' value='"+data.WareNo+"' name='goods_sn[]'/><input type='hidden' value='"+data.BarCode+"' name='goods_code[]'/><input type='hidden' value='"+data.WareName+"' name='goods_name[]'/><input type='hidden' value='"+data.PosPrice+"' name='pos_price[]'/><input type='hidden' value='"+data.WaresType+"' name='state[]'/></td>";
html+="</tr>";
$("#goods_list").append(html);
layer.closeAll('iframe');
}
//优惠券
function cp_call_back(data) {
if(data.use_start_time.indexOf("1970-01-01") != -1){
data.use_start_time="不限"
}
if(data.use_end_time.indexOf("1970-01-01") != -1){
data.use_end_time="不限"
}
var html="";
html="<tr> <td style=\"text-align: center\">"+data.name+"</td> <td style=\"text-align: center\">"+data.type+"</td><td style=\"text-align: center\">"+data.use_start_time+"\n"+data.use_end_time+"</td> <td style=\"text-align: center\">"+data.money+"</td> <td style=\"text-align: center\">"+data.condition+"</td> <td style=\"text-align: center\"> <input type=\"text\" name=\"goods_num[]\" class=\"price\" style=\"width: 60px\" value=\"1\" onkeyup=\"this.value = this.value.replace(/^(\d+)\.(\d{3})/,'')\" autocomplete=\"off\">张 </td> <td style=\"text-align: center\" onclick=\"delpro(this);\"><a class=\"btn red\" onclick=\"delpro(this)\" data-id=\"\"><i class=\"fa fa-trash-o\"></i>删除</a></td>";
html+="<td class='\"dn\"'><input type='hidden' value='"+data.id+"' name='cpid[]'/></td>";
html+="</tr>";
$("#goods_list").append(html);
layer.closeAll('iframe');
}
//删除选择商品
function delpro(obj) {
layer.open({
content:'是否确认删除?'
,btn:['确认','取消'],
btn1:function (index) {
$(obj).parents('tr').remove();
layer.closeAll();
}
})
}
// 选择礼包类型
$("#lbtype").change(function(){
console.log($(this).val());
if($(this).val().toString()=="1")
{
$(".show1").show();
$(".show2").hide();
}
else
{
$(".show1").hide();
$(".show2").show();
}
$("#goods_list").html("");
})
// 上传图片回调
function img_call_back(fileurl_tmp) {
var getqclurl = $("#qclurl").val();
$("#img_url").val(fileurl_tmp);
$("#lburl2").attr('src', getqclurl + fileurl_tmp);
}
//确认保存
function submit() {
/*---时间---*/
var startdate = new Date($('#startime').val().replace(/-/g, "/"));
var enddate = new Date($('#endtime').val().replace(/-/g, "/"));
if (enddate <= startdate) {
$('#endtime').next().removeClass('dn');
layer.msg('结束时间必须大于开始时间', {icon: 2, time: 2000});
return false;
}
if ($('#lbtitle').val() == '') {
layer.msg('请输入礼包名称', {icon: 2, time: 2000});
return false;
}
if ($('#oldprice').val() == '') {
layer.msg('请输入礼包原价', {icon: 2, time: 2000});
return false;
}
if ($('#lbprice').val() == '') {
layer.msg('请输入礼包价格', {icon: 2, time: 2000});
return false;
}
else {
/*---
if(parseFloat($('#lbprice').val())<=0.1)
{
layer.msg('礼包价格需大于0.1', {icon: 2, time: 2000});
return false;
}---*/
}
if ($('#lbintegral').val() == '') {
layer.msg('请输入礼包积分', {icon: 2, time: 2000});
return false;
}
if(($('#lbprice').val() == '' || $('#lbprice').val() == '0') &&($('#lbintegral').val() == '' || $('#lbintegral').val() == '0'))
{
layer.msg('礼包价格和礼包积分不允许全为空或0', {icon: 2, time: 2000});
return false;
}
if ($('#num').val() == '' || $('#num').val() == '0') {
layer.msg('礼包总数必须大于0', {icon: 2, time: 2000});
return false;
}
if($("#lbtype").val()==1 && ($('#expday').val() == '' || $('#expday').val() == '0'))
{
layer.msg('礼包有效天数必须大于0', {icon: 2, time: 2000});
return false;
}
if ($('#limitnum').val() == '') {
layer.msg('限购数量不能为空', {icon: 2, time: 2000});
return false;
}
if ($('#img_url').val() == '') {
layer.msg('请选择礼包图片', {icon: 2, time: 2000});
return false;
}
if($("#goods_list tr").length<2)
{
layer.msg('礼包礼品/礼券数量不能小于2种', {icon: 2, time: 2000});
return false;
}
layer.msg('加载中...', {icon: 16, shade: [0.5, '#f5f5f5'], scrollbar: false, offset: '10px', time: 100000});
$('#addlbform').submit();
}
// // 选择主商品回调
// function call_back(goods_id, goods_name, store_count, price, distr_type) {
// $('#goods_id').val(goods_id);
// $('#goods_name').val(goods_name);
// $('#distr_type').val(distr_type);
// layer.closeAll('iframe');
// }
//
// function call_back_search(table_html) {
// $('#goods_list').append(table_html);
// var a = [];
// $("input[name*='goods_id']").each(function (i, e) {
// if ($.inArray($(e).val(), a) == -1) {
// a[a.length] = $(e).val();
// } else {
// $(e).parent().parent().remove();
// }
// });
// layer.closeAll('iframe');
// }
//
// function call_back_add(html) {
// $('#goods_list').append(html);
// }
//
// function call_back_close(id) {
// $('#' + id + '').remove();
// }
//
// function searchGoods() {
// if ($('#goods_name').val() == '') {
// layer.msg('请先选择必买的商品', {icon: 2, time: 2000});
// return false;
// }
//
// var idlist = '';
// $("input[name*='goods_id']").each(function () {
// idlist += $(this).val() + ',';
// });
//
// var type = $('#distr_type').val();
// var main=$('#goods_id').val();
// var url = '/index.php?m=Admin&c=Promotion&a=search_goods2&distr_type=' + type + '&main_goods=' + main + '&idlist=' + idlist;
// layer.open({
// type: 2,
// title: '选择商品',
// shadeClose: true,
// shade: 0.3,
// area: ['96%', '80%'],
// content: url
// });
// }
//
// // 搭配选择回调
// function search_call_back(table_html) {
// $('#goods_list').append(table_html);
// var a = [];
// $("input[name*='goods_id']").each(function (i, e) {
// if ($.inArray($(e).val(), a) == -1) {
// a[a.length] = $(e).val();
// } else {
// $(e).parent().parent().parent().remove();
// }
// });
// layer.closeAll('iframe');
// }
</script>
</body>
</html>