shop_user.html1
19.4 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
<include file="public/layout" />
<link href="__PUBLIC__/static/css/marketing.css" rel="stylesheet" type="text/css">
<link href="__PUBLIC__/static/css/shop_index.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC__/static/js/layer/laydate/laydate.js"></script>
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
<div class="fixed-bar">
<div class="item-title">
<div class="ftitle">
<h3>个人中心</h3>
<div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
</div>
</div>
</div>
<!-- 操作说明 -->
<div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
<div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
<h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
<span title="收起提示" id="explanationZoom" style="display: block;"></span>
</div>
<ul>
<li>鼠标移动至模块点击进行编辑广告图</li>
</ul>
</div>
<div class="flexigrid">
<div class="activity">
<div class="leftBox">
<div class="phone">
<img class="p_top" src="__PUBLIC__/static/images/phone_top.png" style="width: 315px;" />
</div>
<div class="shopBody" style="width: 315px;">
<div class="scrollimg" style="height: 180px;">
<div class="mengban">
<div class="operation">
<a href="javascript:viod(0)" class="showbtn" onclick="editgg(401);">
<img src="__PUBLIC__/static/images/index/update.png" /><span>编辑</span>
</a>
<a href="javascript:viod(0)" class="delete" onclick="del(401)">
<img src="__PUBLIC__/static/images/index/del.png" /><span>删除</span>
</a>
</div>
</div>
<div class="bd" style="height: 60px;">
<p class="vam">广告图<br/>尺寸:720*310px</p>
<span class="dis_vm"></span>
</div>
</div>
</div>
<div class="foot" style="width: 315px;">
<div class="foot_user">
<img src="__PUBLIC__/static/images/index/touxiang.png" />
</div>
<img src="__PUBLIC__/static/images/index/foot_user.jpg" style="width: 100%;" />
</div>
</div>
<div class="rightBox">
<form method="post" id="handleposition" action="{:U('Admin/Ad/addEditAd_user')}">
<input type="hidden" id="ad_id" name="ad_id" value="" />
<input type="hidden" id="typeid" name="typeid" value="" />
<div class="ncap-form-default tab_div_1">
<dl class="row first">
<dt class="tit">
<label><em>*</em>轮播图片:</label>
</dt>
<dd class="opt">
<select class="class-select" id="mylist" name="mylist" onchange="select_change()">
<!--<option></option>-->
</select>
<span class="addbtn" onclick="addImg()">+增加</span>
<p class="notic">选择现有轮播图</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label><em>*</em> 广告名称:</label>
</dt>
<dd class="opt">
<input type="text" placeholder="自定义广告名称" class="input-txt" maxlength="100" onkeydown="strkeydown(event, this, 'sumbitbtn')" id="ad_name" name="ad_name" value="">
<span class="err cr" id="err_ad_name"></span>
<p class="notic">填写广告图名称</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="articleForm"><em>*</em>开始日期:</label>
</dt>
<dd class="opt">
<input type="text" class="input-txt" id="start_time" placeholder="请输入开始日期" onkeydown="strkeydown(event, this, 'sumbitbtn')" name="start_time" value="" />
<span class="err cr"></span>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="articleForm"><em>*</em>结束时间:</label>
</dt>
<dd class="opt">
<input type="text" class="input-txt" id="end_time" placeholder="请输入结束时间" onkeydown="strkeydown(event, this, 'sumbitbtn')" name="end_time" value="" />
<span class="err cr"></span>
</dd>
</dl>
<dl class="row dn">
<dt class="tit">
<label><em>*</em>广告链接:</label>
</dt>
<dd class="opt">
<input type="text" placeholder="广告链接" class="input-txt" maxlength="120" onkeydown="strkeydown(event, this, 'sumbitbtn')" id="ad_link" name="ad_link" value="">
<span class="err cr" id="err_ad_link"></span>
<p class="notic">设置链接到的页面地址</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label><em>*</em> 广告图片:</label>
</dt>
<dd class="opt">
<div class="ncsc-goods-default-pic">
<div class="goodspic-uplaod">
<div style="">
<img id="original_img2" src="__PUBLIC__/images/default_goods_image_120.gif" style="width:120px;border:#eee solid 1px" onmouseout="layer.closeAll();">
</div>
<input type="hidden" id="ad_code" name="ad_code" onkeydown="strkeydown(event, this, 'submitbtn')" value="" class="type-file-text">
<p class="hint">请上传图片格式文件,
<Font color="red">大小就广告位置备注大小。</Font>
</p>
<div class="handle">
<div class="ncsc-upload-btn">
<a id="ad_img" onClick="GetUploadify_new(1,'ad_code','ad','{$erpid}','ad','ad_id','ad_code','{$info.ad_id}','call_back')">
<p><i class="icon-upload-alt"></i>图片上传</p>
</a>
</div>
</div>
</div>
</div>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label><em>*</em> 默认排序:</label>
</dt>
<dd class="opt">
<input type="text" class="input-text" id="orderby" name="orderby" value="" />
<span class="err"></span>
<p class="notic">选择图片排列顺序</p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="t_mane"><em>*</em>显示</label>
</dt>
<dd class="opt">
<div class="onoff">
<label id="ad_enabled1" class="cb-enable selected">是</label>
<label id="ad_enabled2" class="cb-disable">否</label>
<input id="ad_enabled" name="ad_enabled" type="hidden" value="" onkeydown="strkeydown(event, this, 'submitbtn')" />
</div>
<p class="notic">手机端是否显示</p>
</dd>
</dl>
<dl class="row last dn">
<dt class="tit">
</dt>
<dd class="opt">
<a class="btnRed" href="JavaScript:void(0);" onclick="adsubmit()">确认提交</a>
<a class="btnRed delBtn" onclick="delId()">删除</a>
</dd>
</dl>
</div>
</form>
</div>
</div>
</div>
</div>
<input type="hidden" id="qclurl" value="{$qclurl}" name="qclurl">
<input type="hidden" id="hiderpid" value="{$erpid}" name="hiderpid">
<script type="text/javascript">
//表数据
var table_shop;
$(function() {
$("#start_time").layDate();
$("#end_time").layDate();
editgg(401);
//显示按钮
$(".showbtn").click(function(event) {
$(".last").removeClass("dn");
$(this).find("span").css("color","#C4182E");
$(this).find("img").attr("src","__PUBLIC__/static/images/index/update_on.png");
$(".delBtn").css("visibility","visible");
event.stopPropagation();
});
//删除全部
$(".delete").click(function(event) {
$(".last").removeClass("dn");
// event.stopPropagation();
});
//是否在前台显示
$("#ad_enabled1").click(function() {
if ($("#ad_enabled1").hasClass("selected")) {
$("#ad_enabled").val("1");
}
});
$("#ad_enabled2").click(function() {
if ($("#ad_enabled2").hasClass("selected")) {
$("#ad_enabled").val("0");
}
});
});
//蒙版
// function showmengban(obj, num) {
// $(".mengban").addClass("dn");
// $(".last").addClass("dn");
// $(obj).find(".mengban").removeClass("dn");
// editgg(num);
// }
//广告链接
$("#ad_link").focusout(function(){
var ad_link = $("#ad_link").val();
if (!ad_link.match('^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+')) {
$("#ad_link").parent().find("span").text("请输入正确的网址格式");
return false;
}else{
$("#ad_link").parent().find("span").text("");
}
});
//提交
function adsubmit() {
layer.msg('加载中...', {
icon: 16,
shade: [0.5, '#f5f5f5'],
scrollbar: false,
offset: '200px',
time: 100000
});
//广告名称
var ad_name = $("#ad_name").val();
if (ad_name == "") {
$("#ad_name").parent().find("span").text("请输入广告名称");
layer.msg("请输入广告名称", {
icon: 2,
time: 1000
});
$("#ad_name").focus();
return false
}
//广告时间
var startdate = $("#start_time").val();
var enddate = $("#end_time").val();
if (startdate != "" && enddate != "") {
var d1 = new Date(startdate.replace(/\-/g, "\/"));
var d2 = new Date(enddate.replace(/\-/g, "\/"));
if (d1 > d2) {
layer.msg("开始时间不能大于结束时间", {
icon: 2,
time: 1000
});
$("#start_time").focus();
$("#start_time").parent().find("span").text("开始时间不能大于结束时间");
return false
}
}else if(startdate == "" || enddate == ""){
$("#start_time").focus();
$("#start_time").parent().find("span").text("请输入广告时间");
layer.msg("请输入广告时间", {
icon: 2,
time: 1000
});
$("#ad_link").focus();
return false;
}
// //广告链接
// var ad_link = $("#ad_link").val();
// if (ad_link == "") {
// $("#ad_link").parent().find("span").text("请输入广告链接");
// layer.msg("请输入广告链接", {
// icon: 2,
// time: 1000
// });
// $("#ad_link").focus();
// return false;
// }
//广告图片
var ad_code = $("#ad_code").val();
if (ad_code == "") {
$("#ad_code").parent().find("span").text("请上传广告图片");
layer.msg("请上传广告图片", {
icon: 2,
time: 1000
});
$("#ad_code").focus();
return false;
}
// //默认排序
// var orderby = $("#orderby").val().replace("[1-9]\d*.\d*|0.\d*[1-9]\d*", 0);
// if (orderby == "") {
// $("#orderby").parent().find("span").text("请输入默认排序");
// layer.msg("请输入默认排序", {
// icon: 2,
// time: 1000
// });
// $("#orderby").focus();
// return false;
// }
//是否在前台显示图片
var enabled = $("#ad_enabled").val();
$('#handleposition').submit();
}
//编辑按钮
function editgg(typeid) {
layer.msg('加载中...', {
icon: 16,
shade: [0.5, '#f5f5f5'],
scrollbar: false,
offset: '200px',
time: 100000
});
// $("#original_img2").mouseover(function() {
// layer.tips('<img src=__PUBLIC__/images/default_goods_image_120.gif>', this, {
// tips: [1, '#fff']
// });
// });
// alert("/index.php?m=Admin&c=ad&a=getgg&typeid=" + typeid);
$.ajax({
type: "get",
dataType: 'json',
url: "/index.php?m=Admin&c=ad&a=getgg&typeid=" + typeid, //+tab,
success: function(data) {
layer.closeAll();
if (data.code == 1) {
// if (typeid == 2 || typeid == 309) {
// $(".first").removeClass("dn");
// }
// $(".first").addClass("dn");
clearDate();
// layer.msg(data.msg, {
// icon: 2,
// time: 1000
// });
$(".first").addClass("dn");
$("#typeid").val(typeid);
$(".last").removeClass("dn");
$(".delBtn").css("visibility", "hidden");
} else {
table_shop = eval(data.data);
var html = "";
$("#mylist option").remove();
// if (typeid == 401) {
// $(".first").removeClass("dn");
if (table_shop.length>0) {
for (var i = 0; i < table_shop.length; i++) {
html += "<option value='" + table_shop[i].ad_id + "'>" + table_shop[i].ad_name + "</option>";
}
$("#mylist").append(html);
}
else
{
$(".first").addClass("dn");
}
$("#typeid").val(typeid);
$("#ad_id").val(table_shop[0].ad_id);
$("#ad_name").val(table_shop[0].ad_name);
$("#start_time").val(getLocalTime(table_shop[0].start_time));
$("#end_time").val(getLocalTime(table_shop[0].end_time));
$("#ad_link").val(table_shop[0].ad_link);
$("#ad_code").val(table_shop[0].ad_code);
imgUrl($("#ad_code").val());
$("#orderby").val(table_shop[0].orderby);
if (table_shop[0].enabled == 1) {
$("#ad_enabled1").addClass("selected");
$("#ad_enabled2").removeClass("selected");
} else {
$("#ad_enabled1").removeClass("selected");
$("#ad_enabled2").addClass("selected");
}
$("#ad_enabled").val(table_shop[0].enabled);
// } else if (typeid == 309) {
//// $(".first").removeClass("dn");
// for (var i = 0; i < table_shop.length; i++) {
// html += "<option value='" + table_shop[i].ad_id + "'>" + table_shop[i].ad_name + "</option>";
// }
// $("#mylist").append(html);
// $("#typeid").val(typeid);
// $("#ad_id").val(table_shop[0].ad_id);
// $("#ad_name").val(table_shop[0].ad_name);
// $("#start_time").val(getLocalTime(table_shop[0].start_time));
// $("#end_time").val(getLocalTime(table_shop[0].end_time));
// $("#ad_link").val(table_shop[0].ad_link);
// $("#ad_code").val(table_shop[0].ad_code);
// imgUrl($("#ad_code").val());
// $("#orderby").val(table_shop[0].orderby);
// if (table_shop[0].enabled == 1) {
// $("#ad_enabled1").addClass("selected");
// $("#ad_enabled2").removeClass("selected");
// } else {
// $("#ad_enabled1").removeClass("selected");
// $("#ad_enabled2").addClass("selected");
// }
// $("#ad_enabled").val(table_shop[0].enabled);
// } else {
//// $(".first").addClass("dn");
// $("#ad_id").val(table_shop[0].ad_id);
// $("#typeid").val(typeid);
// $("#ad_name").val(table_shop[0].ad_name);
// $("#start_time").val(getLocalTime(table_shop[0].start_time));
// $("#end_time").val(getLocalTime(table_shop[0].end_time));
// $("#ad_link").val(table_shop[0].ad_link);
// $("#ad_code").val(table_shop[0].ad_code);
// imgUrl($("#ad_code").val());
// $("#orderby").val(table_shop[0].orderby);
// if (table_shop[0].enabled == 1) {
// $("#ad_enabled1").addClass("selected");
// $("#ad_enabled2").removeClass("selected");
// } else {
// $("#ad_enabled1").removeClass("selected");
// $("#ad_enabled2").addClass("selected");
// }
// $("#ad_enabled").val(table_shop[0].enabled);
// }
}
},
error: function(request) {
layer.closeAll();
layer.msg("服务器繁忙, 请联系管理员!", {
icon: 2
});
return;
},
});
}
// 删除操作
function del(typeid) {
// var id = $("#ad_id").val();
if (!confirm('确定要删除吗?')) {
return false;
}
// alert("/index.php?m=Admin&c=ad&a=delAd&id='" + id + "'&typeid='" + typeid+" ");
$.ajax({
type: "get",
dataType: 'json',
url: "/index.php?m=Admin&c=ad&a=delAd&typeid=" + typeid,
success: function(data) {
layer.closeAll();
if (data.code == 1) {
clearDate();
layer.msg(data.msg, {
icon: 1,
time: 1000
});
addImg();
}
}
});
}
//删除轮播图
function delId() {
var id = $("#ad_id").val();
if (!confirm('确定要删除吗?')) {
return false;
}
// alert("/index.php?m=Admin&c=ad&a=delAd&id='" + id + "'&typeid='" + typeid+" ");
$.ajax({
type: "get",
dataType: 'json',
url: "/index.php?m=Admin&c=ad&a=delAdid&id=" + id,
success: function(data) {
layer.closeAll();
if (data.code == 1) {
clearDate();
layer.msg(data.msg, {
icon: 1,
time: 1000
});
addImg();
setTimeout(function () {
location.href=location.href;
},1000);
} else {
// layer.msg("删除失败或无记录!",{icon:2,time:1000});
$(".delBtn").css("visibility","hidden");
}
}
});
// layer.msg("删除失败或无记录!",{icon:2,time:1000});
}
//轮播图修改
function select_change() {
var str = $("#mylist").val();
for (var i = 0; i < table_shop.length; i++) {
if (table_shop[i].ad_id == str) {
$("#ad_id").val(table_shop[i].ad_id);
$("#ad_name").val(table_shop[i].ad_name);
$("#start_time").val(getLocalTime(table_shop[i].start_time));
$("#end_time").val(getLocalTime(table_shop[i].end_time));
$("#ad_link").val(table_shop[i].ad_link);
$("#ad_code").val(table_shop[i].ad_code);
imgUrl($("#ad_code").val());
$("#orderby").val(table_shop[i].orderby);
if (table_shop[i].enabled == 1) {
$("#ad_enabled1").addClass("selected");
$("#ad_enabled2").removeClass("selected");
} else {
$("#ad_enabled1").removeClass("selected");
$("#ad_enabled2").addClass("selected");
}
$("#ad_enabled").val(table_shop[0].enabled);
}
}
}
//数据清空
function clearDate() {
$("#mylist").val('');
$("#ad_id").val('');
$("#ad_name").val('');
$("#start_time").val('');
$("#end_time").val('');
$("#ad_link").val('');
$("#ad_code").val('');
$("#original_img2").attr("src", "__PUBLIC__/images/default_goods_image_120.gif");
$("#original_img2").mouseover(function() {
layer.tips('<img src=__PUBLIC__/images/default_goods_image_120.gif>', this, {
tips: [1, '#fff']
});
});
$("#orderby").val('');
}
//时间戳转换成日期格式
function getLocalTime(nS) {
var myDate = new Date(nS * 1000);
var result = myDate.getFullYear() + '-' + (myDate.getMonth() + 1) + '-' + myDate.getDate() + ' ' + myDate.getHours() + ':' + myDate.getMinutes() + ':' + myDate.getSeconds();
return result;
}
//图片路径
function imgUrl(imgstr) {
var getqclurl = $("#qclurl").val();
if (imgstr.length > 0) {
imgstr = $("#ad_code").val();
} else {
imgstr = "__PUBLIC__/images/default_goods_image_120.gif";
}
$("#original_img2").attr("src", getqclurl + imgstr);
$("#original_img2").mouseover(function() {
layer.tips('<img src=' + getqclurl + imgstr + '>', this, {
tips: [1, '#fff']
});
});
}
//新增轮播图
function addImg() {
clearDate();
//清空select的默认选项
$("#mylist").attr("value", '${requestScope.status}');
// $(".first").addClass("dn");
$(".paixu").removeClass("dn");
$(".last").removeClass("dn");
$(".delBtn").css("visibility", "hidden");
}
// 上传商品图片成功回调函数
function call_back(fileurl_tmp) {
var getqclurl = $("#qclurl").val();
$("#ad_code").val(fileurl_tmp);
$("#original_img2").attr('onmouseover', "layer.tips('<img src=" + getqclurl + fileurl_tmp + ">',this,{tips: [1, '#fff']});");
$("#original_img2").attr('src', getqclurl + fileurl_tmp);
}
</script>
</body>
</html>