|
@@ -106,13 +106,13 @@ function getParams(){ |
|
@@ -106,13 +106,13 @@ function getParams(){ |
106
|
shopOperate = paramList[4];
|
106
|
shopOperate = paramList[4];
|
107
|
}
|
107
|
}
|
108
|
if(shopOperate == 'editor'){
|
108
|
if(shopOperate == 'editor'){
|
109
|
- $(".moduleTypeSelect").show();
|
109
|
+ $(".moduleTypeSelect").show().find("#templateSelect").removeAttr("disabled");
|
110
|
$(".moduleSubmite").show().siblings().hide();
|
110
|
$(".moduleSubmite").show().siblings().hide();
|
111
|
}else if(shopOperate == 'view'){
|
111
|
}else if(shopOperate == 'view'){
|
112
|
$(".moduleTypeSelect").hide();
|
112
|
$(".moduleTypeSelect").hide();
|
113
|
$(".moduleView").show().siblings().hide();
|
113
|
$(".moduleView").show().siblings().hide();
|
114
|
}else if(shopOperate == 'check'){
|
114
|
}else if(shopOperate == 'check'){
|
115
|
- $(".moduleTypeSelect").hide();
|
115
|
+ $(".moduleTypeSelect").show().find("#templateSelect").attr("disabled","disabled");
|
116
|
$(".moduleCheck").show().siblings().hide();
|
116
|
$(".moduleCheck").show().siblings().hide();
|
117
|
}
|
117
|
}
|
118
|
}
|
118
|
}
|
|
@@ -142,11 +142,14 @@ function editorIconEvent(title,id){ |
|
@@ -142,11 +142,14 @@ function editorIconEvent(title,id){ |
142
|
title,
|
142
|
title,
|
143
|
"<div class='editorTitle'></div><div class='editor-dialog' id='"+ id +"'></div><div class='editorTip'></div> ",
|
143
|
"<div class='editorTitle'></div><div class='editor-dialog' id='"+ id +"'></div><div class='editorTip'></div> ",
|
144
|
function(){
|
144
|
function(){
|
145
|
- if(!(curDialogId == "editor-largePic-app" || curDialogId == "editor-recommend-app" || curDialogId == "editor-brand-app")){
|
|
|
146
|
- freshJson(id, g.__rows, 1);
|
145
|
+ if(editorCheck(id)){
|
|
|
146
|
+ if(!(curDialogId == "editor-largePic-app" || curDialogId == "editor-recommend-app" || curDialogId == "editor-brand-app")){
|
|
|
147
|
+ freshJson(id, g.__rows, 1);
|
|
|
148
|
+ }
|
|
|
149
|
+ showMain();
|
|
|
150
|
+ }else{
|
|
|
151
|
+ return false;
|
147
|
}
|
152
|
}
|
148
|
- showMain();
|
|
|
149
|
- //return false;
|
|
|
150
|
},
|
153
|
},
|
151
|
function(){
|
154
|
function(){
|
152
|
if(!(curDialogId == "editor-largePic-app" || curDialogId == "editor-recommend-app" || curDialogId == "editor-brand-app")){
|
155
|
if(!(curDialogId == "editor-largePic-app" || curDialogId == "editor-recommend-app" || curDialogId == "editor-brand-app")){
|
|
@@ -154,7 +157,6 @@ function editorIconEvent(title,id){ |
|
@@ -154,7 +157,6 @@ function editorIconEvent(title,id){ |
154
|
}
|
157
|
}
|
155
|
}
|
158
|
}
|
156
|
);
|
159
|
);
|
157
|
-
|
|
|
158
|
gridInit(id);
|
160
|
gridInit(id);
|
159
|
untilEditorEvent(id);
|
161
|
untilEditorEvent(id);
|
160
|
editorTipInit(id);
|
162
|
editorTipInit(id);
|
|
@@ -202,7 +204,6 @@ function findTopNewProducts(){ |
|
@@ -202,7 +204,6 @@ function findTopNewProducts(){ |
202
|
"size": 20
|
204
|
"size": 20
|
203
|
}
|
205
|
}
|
204
|
},function(rs){
|
206
|
},function(rs){
|
205
|
- console.log(rs.data);
|
|
|
206
|
topNewProducts = rs.data;
|
207
|
topNewProducts = rs.data;
|
207
|
},true);
|
208
|
},true);
|
208
|
}
|
209
|
}
|
|
@@ -239,125 +240,26 @@ function saveDecoration(submitStatus){ |
|
@@ -239,125 +240,26 @@ function saveDecoration(submitStatus){ |
239
|
});
|
240
|
});
|
240
|
}
|
241
|
}
|
241
|
//Ajax审核
|
242
|
//Ajax审核
|
242
|
-function checkDecoration(checkStatus){
|
|
|
243
|
- common.util.__ajax({
|
|
|
244
|
- url:'/store/shop-decoration-check',
|
|
|
245
|
- data: {
|
|
|
246
|
- "id": _id,
|
|
|
247
|
- "checkStatus": checkStatus
|
|
|
248
|
- }
|
|
|
249
|
- },function(rs){});
|
|
|
250
|
-}
|
|
|
251
|
-
|
|
|
252
|
-/********************事件绑定*********************/
|
|
|
253
|
-
|
|
|
254
|
-//pc跟app的tab选项事件
|
|
|
255
|
-$(document).on("click",".tabheader .nav-tabs li",function(){
|
|
|
256
|
- $(this).addClass('active').siblings('li').removeClass('active');
|
|
|
257
|
- curPlatform = $(this).attr("data-toggle");
|
|
|
258
|
- if(curPlatform == "shopWeb-app"){
|
|
|
259
|
- $(".moduleTypeView").hide();
|
|
|
260
|
- }else{
|
|
|
261
|
- $(".moduleTypeView").show();
|
|
|
262
|
- }
|
|
|
263
|
- showMain();
|
|
|
264
|
-})
|
|
|
265
|
-//基础模板,经典模板切换
|
|
|
266
|
-$(document).on("click","input[name=brandLevel]",function(){
|
|
|
267
|
- curTemplateType = $("input[name=brandLevel]:checked").val();
|
|
|
268
|
- showMain();
|
|
|
269
|
-})
|
|
|
270
|
-//选择使用模板
|
|
|
271
|
-$(document).on("change","#templateSelect",function(){
|
|
|
272
|
- jsonMain.templateName = $(this).val();
|
|
|
273
|
-})
|
|
|
274
|
-//暂存模板
|
|
|
275
|
-$(document).on("click","#saveModule",function(){
|
|
|
276
|
- if(jsonMain.templateName == "0"){
|
|
|
277
|
- alert("请选择展示使用模板!");
|
|
|
278
|
- return;
|
|
|
279
|
- }
|
|
|
280
|
- saveDecoration(100);
|
|
|
281
|
-})
|
|
|
282
|
-//提交审核
|
|
|
283
|
-$(document).on("click","#submitModule",function(){
|
|
|
284
|
- if(jsonMain.templateName == "0"){
|
|
|
285
|
- alert("请选择展示使用模板!");
|
|
|
286
|
- return;
|
|
|
287
|
- }
|
|
|
288
|
- saveDecoration(200);
|
|
|
289
|
-})
|
|
|
290
|
-//审核通过
|
|
|
291
|
-$(document).on("click","#checkOk",function(){
|
|
|
292
|
- checkDecoration(300);
|
|
|
293
|
-})
|
|
|
294
|
-//驳回
|
|
|
295
|
-$(document).on("click","#checkNo",function(){
|
|
|
296
|
- checkDecoration(900);
|
|
|
297
|
-})
|
|
|
298
|
-//删除
|
|
|
299
|
-$(document).on("click",".deleteBtn",function(){
|
|
|
300
|
- var _index = $(this).data("index")+"";
|
|
|
301
|
- var indexList = _index.split("_");
|
|
|
302
|
-
|
|
|
303
|
- if(indexList.length > 1){
|
|
|
304
|
- [].splice.call(g.__rows[indexList[0]].data,indexList[1],1);
|
|
|
305
|
- }else{
|
|
|
306
|
- [].splice.call(g.__rows,indexList[0],1);
|
|
|
307
|
- }
|
|
|
308
|
- g.init(g.__rows);
|
|
|
309
|
- untilEditorEvent(curDialogId);
|
|
|
310
|
-
|
|
|
311
|
- if(curDialogId == "editor-newProduct" || curDialogId == "editor-hotProduct"){
|
|
|
312
|
- productTopDataLink(g.__rows);
|
|
|
313
|
- }
|
|
|
314
|
-});
|
|
|
315
|
-//添加一条
|
|
|
316
|
-$(document).on("click",".addBtn",function(){
|
|
|
317
|
- var _index = $(this).data("index")+"";
|
|
|
318
|
- var indexList = _index.split("_");
|
|
|
319
|
-
|
|
|
320
|
- if(indexList.length > 1){
|
|
|
321
|
- g.__rows[indexList[0]].data.push($.extend({},ENUM[curDialogId]));
|
|
|
322
|
- }else{
|
|
|
323
|
- g.__rows.push($.extend({},ENUM[curDialogId]));
|
|
|
324
|
- }
|
|
|
325
|
- g.init(g.__rows);
|
|
|
326
|
- untilEditorEvent(curDialogId);
|
|
|
327
|
-});
|
|
|
328
|
-//input change同时更新json
|
|
|
329
|
-$(document).on("change",".inputChange",function(){
|
|
|
330
|
- var _index = $(this).attr("data-index");
|
|
|
331
|
- var indexList = _index.split("_");
|
|
|
332
|
- var _name = $(this).attr("name");
|
|
|
333
|
-
|
|
|
334
|
- if(indexList.length > 1){
|
|
|
335
|
- (g.__rows[indexList[0]].data)[indexList[1]][_name] = $(this).val();
|
|
|
336
|
- }else{
|
|
|
337
|
- g.__rows[indexList[0]][_name] = $(this).val();
|
|
|
338
|
- }
|
|
|
339
|
-});
|
|
|
340
|
-//选择Top20
|
|
|
341
|
-$(document).on("click",".topAdd",function(){
|
|
|
342
|
- if(g.__rows.length < 8){
|
|
|
343
|
- if(!$(this).hasClass("selected")){
|
|
|
344
|
- $(this).addClass("selected");
|
|
|
345
|
- var item = $.extend({},ENUM[curDialogId]);
|
|
|
346
|
- item.src = $(this).find('img').attr("src");
|
|
|
347
|
- item.productId = $(this).attr("data-productId");
|
|
|
348
|
- item.productName = $(this).attr("data-productName");
|
|
|
349
|
- item.productPrice = $(this).attr("data-productPrice");
|
|
|
350
|
-
|
|
|
351
|
- g.__rows.push(item);
|
|
|
352
|
- g.init(g.__rows);
|
|
|
353
|
- untilEditorEvent(curDialogId);
|
|
|
354
|
-
|
|
|
355
|
- $(".topTip span").text("已经勾选"+ g.__rows.length +"件,最多勾选8件商品!");
|
|
|
356
|
- }
|
243
|
+function checkDecoration(checkStatus,comment){
|
|
|
244
|
+ if(comment){
|
|
|
245
|
+ common.util.__ajax({
|
|
|
246
|
+ url:'/store/shop-decoration-check',
|
|
|
247
|
+ data: {
|
|
|
248
|
+ "id": _id,
|
|
|
249
|
+ "checkStatus": checkStatus,
|
|
|
250
|
+ "comment": comment
|
|
|
251
|
+ }
|
|
|
252
|
+ },function(rs){});
|
357
|
}else{
|
253
|
}else{
|
358
|
- $(".topTip span").text("商品数量已满8个,无法继续添加商品!");
|
254
|
+ common.util.__ajax({
|
|
|
255
|
+ url:'/store/shop-decoration-check',
|
|
|
256
|
+ data: {
|
|
|
257
|
+ "id": _id,
|
|
|
258
|
+ "checkStatus": checkStatus
|
|
|
259
|
+ }
|
|
|
260
|
+ },function(rs){});
|
359
|
}
|
261
|
}
|
360
|
-});
|
262
|
+}
|
361
|
|
263
|
|
362
|
/********************工具类*********************/
|
264
|
/********************工具类*********************/
|
363
|
|
265
|
|
|
@@ -458,6 +360,7 @@ function gridInit(id){ |
|
@@ -458,6 +360,7 @@ function gridInit(id){ |
458
|
el:"#"+id,
|
360
|
el:"#"+id,
|
459
|
columns:[
|
361
|
columns:[
|
460
|
{display:"排序", render:function(item){
|
362
|
{display:"排序", render:function(item){
|
|
|
363
|
+ item.position=item.position || (item.__index+1);
|
461
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
364
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
462
|
}},
|
365
|
}},
|
463
|
{display:"名称", render:function(item){
|
366
|
{display:"名称", render:function(item){
|
|
@@ -467,11 +370,18 @@ function gridInit(id){ |
|
@@ -467,11 +370,18 @@ function gridInit(id){ |
467
|
return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />";
|
370
|
return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />";
|
468
|
}},
|
371
|
}},
|
469
|
{display:"操作", render:function(item){
|
372
|
{display:"操作", render:function(item){
|
470
|
- var html = "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
471
|
- if(item.__index == g.__rows.length-1){
|
|
|
472
|
- html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
373
|
+ var htmlPic = "",i=item.__index;
|
|
|
374
|
+ if(i == (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
375
|
+ htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
376
|
+ htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
473
|
}
|
377
|
}
|
474
|
- return html;
|
378
|
+ if(i < (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
379
|
+ htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' />";
|
|
|
380
|
+ }
|
|
|
381
|
+ if(i == (g.__rows.length-1) && g.__rows.length == 1){
|
|
|
382
|
+ htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
383
|
+ }
|
|
|
384
|
+ return htmlPic;
|
475
|
}}
|
385
|
}}
|
476
|
]
|
386
|
]
|
477
|
});
|
387
|
});
|
|
@@ -486,6 +396,7 @@ function gridInit(id){ |
|
@@ -486,6 +396,7 @@ function gridInit(id){ |
486
|
el:"#"+id,
|
396
|
el:"#"+id,
|
487
|
columns:[
|
397
|
columns:[
|
488
|
{display:"排序", render:function(item){
|
398
|
{display:"排序", render:function(item){
|
|
|
399
|
+ item.position=item.position || (item.__index+1);
|
489
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
400
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
490
|
}},
|
401
|
}},
|
491
|
{display:"名称", render:function(item){
|
402
|
{display:"名称", render:function(item){
|
|
@@ -500,17 +411,24 @@ function gridInit(id){ |
|
@@ -500,17 +411,24 @@ function gridInit(id){ |
500
|
}},
|
411
|
}},
|
501
|
{display:"APP展示", render:function(item){
|
412
|
{display:"APP展示", render:function(item){
|
502
|
if(item.isShowInApp == "Y"){
|
413
|
if(item.isShowInApp == "Y"){
|
503
|
- return "<input class='form-control' type=checkBox name='isShowInApp' value='"+item.isShowInApp+"' checked />";
|
414
|
+ return "<input class='form-control checkBoxChange' type=checkBox name='isShowInApp' data-index='"+item.__index+"' checked />";
|
504
|
}else{
|
415
|
}else{
|
505
|
- return "<input class='form-control' type=checkBox name='isShowInApp' value='"+item.isShowInApp+"' />";
|
416
|
+ return "<input class='form-control checkBoxChange' type=checkBox name='isShowInApp' data-index='"+item.__index+"' />";
|
506
|
}
|
417
|
}
|
507
|
}},
|
418
|
}},
|
508
|
{display:"操作", render:function(item){
|
419
|
{display:"操作", render:function(item){
|
509
|
- var html = "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
510
|
- if(item.__index == g.__rows.length-1){
|
|
|
511
|
- html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
420
|
+ var htmlPic = "",i=item.__index;
|
|
|
421
|
+ if(i == (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
422
|
+ htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
423
|
+ htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
512
|
}
|
424
|
}
|
513
|
- return html;
|
425
|
+ if(i < (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
426
|
+ htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' />";
|
|
|
427
|
+ }
|
|
|
428
|
+ if(i == (g.__rows.length-1) && g.__rows.length == 1){
|
|
|
429
|
+ htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
430
|
+ }
|
|
|
431
|
+ return htmlPic;
|
514
|
}}
|
432
|
}}
|
515
|
]
|
433
|
]
|
516
|
});
|
434
|
});
|
|
@@ -525,6 +443,7 @@ function gridInit(id){ |
|
@@ -525,6 +443,7 @@ function gridInit(id){ |
525
|
el:"#"+id,
|
443
|
el:"#"+id,
|
526
|
columns:[
|
444
|
columns:[
|
527
|
{display:"排序", render:function(item){
|
445
|
{display:"排序", render:function(item){
|
|
|
446
|
+ item.position=item.position || (item.__index+1);
|
528
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
447
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
529
|
}},
|
448
|
}},
|
530
|
{display:"图片", render:function(item){
|
449
|
{display:"图片", render:function(item){
|
|
@@ -534,11 +453,18 @@ function gridInit(id){ |
|
@@ -534,11 +453,18 @@ function gridInit(id){ |
534
|
return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />";
|
453
|
return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />";
|
535
|
}},
|
454
|
}},
|
536
|
{display:"操作", render:function(item){
|
455
|
{display:"操作", render:function(item){
|
537
|
- var html = "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
538
|
- if(item.__index == g.__rows.length-1){
|
|
|
539
|
- html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
456
|
+ var htmlPic = "",i=item.__index;
|
|
|
457
|
+ if(i == (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
458
|
+ htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
459
|
+ htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
540
|
}
|
460
|
}
|
541
|
- return html;
|
461
|
+ if(i < (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
462
|
+ htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' />";
|
|
|
463
|
+ }
|
|
|
464
|
+ if(i == (g.__rows.length-1) && g.__rows.length == 1){
|
|
|
465
|
+ htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
466
|
+ }
|
|
|
467
|
+ return htmlPic;
|
542
|
}}
|
468
|
}}
|
543
|
]
|
469
|
]
|
544
|
});
|
470
|
});
|
|
@@ -552,6 +478,7 @@ function gridInit(id){ |
|
@@ -552,6 +478,7 @@ function gridInit(id){ |
552
|
el:"#"+id,
|
478
|
el:"#"+id,
|
553
|
columns:[
|
479
|
columns:[
|
554
|
{display:"排序", render:function(item){
|
480
|
{display:"排序", render:function(item){
|
|
|
481
|
+ item.position=item.position || (item.__index+1);
|
555
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
482
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
556
|
}},
|
483
|
}},
|
557
|
{display:"图片", render:function(item){
|
484
|
{display:"图片", render:function(item){
|
|
@@ -570,11 +497,18 @@ function gridInit(id){ |
|
@@ -570,11 +497,18 @@ function gridInit(id){ |
570
|
return "<span style='white-space: nowrap'>" + (item.publishStatus==0?"未发布":"已发布") + "</span>";
|
497
|
return "<span style='white-space: nowrap'>" + (item.publishStatus==0?"未发布":"已发布") + "</span>";
|
571
|
}},
|
498
|
}},
|
572
|
{display:"操作", render:function(item){
|
499
|
{display:"操作", render:function(item){
|
573
|
- var html = "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
574
|
- if(item.__index == g.__rows.length-1){
|
|
|
575
|
- html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
500
|
+ var htmlPic = "",i=item.__index;
|
|
|
501
|
+ if(i == (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
502
|
+ htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
503
|
+ htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
576
|
}
|
504
|
}
|
577
|
- return html;
|
505
|
+ if(i < (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
506
|
+ htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' />";
|
|
|
507
|
+ }
|
|
|
508
|
+ if(i == (g.__rows.length-1) && g.__rows.length == 1){
|
|
|
509
|
+ htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
510
|
+ }
|
|
|
511
|
+ return htmlPic;
|
578
|
}}
|
512
|
}}
|
579
|
]
|
513
|
]
|
580
|
});
|
514
|
});
|
|
@@ -591,6 +525,7 @@ function gridInit(id){ |
|
@@ -591,6 +525,7 @@ function gridInit(id){ |
591
|
if(item.__index == 0){
|
525
|
if(item.__index == 0){
|
592
|
return item.position;
|
526
|
return item.position;
|
593
|
}else{
|
527
|
}else{
|
|
|
528
|
+ item.position=item.position || (item.__index);
|
594
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
529
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
595
|
}
|
530
|
}
|
596
|
}},
|
531
|
}},
|
|
@@ -611,11 +546,11 @@ function gridInit(id){ |
|
@@ -611,11 +546,11 @@ function gridInit(id){ |
611
|
{display:"操作", render:function(item){
|
546
|
{display:"操作", render:function(item){
|
612
|
var html = "";
|
547
|
var html = "";
|
613
|
if(item.__index == 0 && g.__rows.length == 1){
|
548
|
if(item.__index == 0 && g.__rows.length == 1){
|
614
|
- html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
549
|
+ html += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
615
|
}else{
|
550
|
}else{
|
616
|
if(g.__rows.length > 1 && item.__index > 0){
|
551
|
if(g.__rows.length > 1 && item.__index > 0){
|
617
|
html += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
552
|
html += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
618
|
- if(g.__rows.length > 1 && item.__index == g.__rows.length - 1){
|
553
|
+ if(g.__rows.length > 1 && g.__rows.length < 5 && item.__index == g.__rows.length - 1){
|
619
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
554
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
620
|
}
|
555
|
}
|
621
|
}
|
556
|
}
|
|
@@ -637,6 +572,7 @@ function gridInit(id){ |
|
@@ -637,6 +572,7 @@ function gridInit(id){ |
637
|
if(item.__index == 0){
|
572
|
if(item.__index == 0){
|
638
|
return item.position;
|
573
|
return item.position;
|
639
|
}else{
|
574
|
}else{
|
|
|
575
|
+ item.position=item.position || (item.__index);
|
640
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
576
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
641
|
}
|
577
|
}
|
642
|
}},
|
578
|
}},
|
|
@@ -657,11 +593,11 @@ function gridInit(id){ |
|
@@ -657,11 +593,11 @@ function gridInit(id){ |
657
|
{display:"操作", render:function(item){
|
593
|
{display:"操作", render:function(item){
|
658
|
var html = "";
|
594
|
var html = "";
|
659
|
if(item.__index == 0 && g.__rows.length == 1){
|
595
|
if(item.__index == 0 && g.__rows.length == 1){
|
660
|
- html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
596
|
+ html += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
661
|
}else{
|
597
|
}else{
|
662
|
if(g.__rows.length > 1 && item.__index > 0){
|
598
|
if(g.__rows.length > 1 && item.__index > 0){
|
663
|
html += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
599
|
html += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
664
|
- if(g.__rows.length > 1 && item.__index == g.__rows.length - 1){
|
600
|
+ if(g.__rows.length > 1 && g.__rows.length < 5 && item.__index == g.__rows.length - 1){
|
665
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
601
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
666
|
}
|
602
|
}
|
667
|
}
|
603
|
}
|
|
@@ -683,6 +619,7 @@ function gridInit(id){ |
|
@@ -683,6 +619,7 @@ function gridInit(id){ |
683
|
el:"#editor-newProduct-grid",
|
619
|
el:"#editor-newProduct-grid",
|
684
|
columns:[
|
620
|
columns:[
|
685
|
{display:"排序", render:function(item){
|
621
|
{display:"排序", render:function(item){
|
|
|
622
|
+ item.position=item.position || (item.__index+1);
|
686
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
623
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
687
|
}},
|
624
|
}},
|
688
|
{display:"图片", render:function(item){
|
625
|
{display:"图片", render:function(item){
|
|
@@ -708,6 +645,7 @@ function gridInit(id){ |
|
@@ -708,6 +645,7 @@ function gridInit(id){ |
708
|
el:"#editor-hotProduct-grid",
|
645
|
el:"#editor-hotProduct-grid",
|
709
|
columns:[
|
646
|
columns:[
|
710
|
{display:"排序", render:function(item){
|
647
|
{display:"排序", render:function(item){
|
|
|
648
|
+ item.position=item.position || (item.__index+1);
|
711
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
649
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
712
|
}},
|
650
|
}},
|
713
|
{display:"图片", render:function(item){
|
651
|
{display:"图片", render:function(item){
|
|
@@ -877,10 +815,10 @@ function editorTipInit(id){ |
|
@@ -877,10 +815,10 @@ function editorTipInit(id){ |
877
|
tipHtml = "<span>提示:请上传像素160*240的图片。</span>";
|
815
|
tipHtml = "<span>提示:请上传像素160*240的图片。</span>";
|
878
|
break;
|
816
|
break;
|
879
|
case "editor-newGoodTab":
|
817
|
case "editor-newGoodTab":
|
880
|
- tipHtml = "<span>提示:标题名称最多5个汉字。</span>";
|
818
|
+ tipHtml = "<span>提示:最多编辑5个标签,标题名称最多5个汉字。</span>";
|
881
|
break;
|
819
|
break;
|
882
|
case "editor-hotGoodTab":
|
820
|
case "editor-hotGoodTab":
|
883
|
- tipHtml = "<span>提示:标题名称最多5个汉字。</span>";
|
821
|
+ tipHtml = "<span>提示:最多编辑5个标签,标题名称最多5个汉字。</span>";
|
884
|
break;
|
822
|
break;
|
885
|
default :
|
823
|
default :
|
886
|
break;
|
824
|
break;
|
|
@@ -890,66 +828,104 @@ function editorTipInit(id){ |
|
@@ -890,66 +828,104 @@ function editorTipInit(id){ |
890
|
//弹出框编辑校验
|
828
|
//弹出框编辑校验
|
891
|
function editorCheck(id){
|
829
|
function editorCheck(id){
|
892
|
switch (id){
|
830
|
switch (id){
|
893
|
- case "editor-banner":
|
|
|
894
|
- return true;
|
|
|
895
|
- break;
|
|
|
896
|
-
|
|
|
897
|
- case "editor-nav":
|
|
|
898
|
- return true;
|
|
|
899
|
- break;
|
|
|
900
|
-
|
|
|
901
|
case "editor-largePic":
|
831
|
case "editor-largePic":
|
902
|
- return true;
|
832
|
+ return (checkNumInput() && checkEndTime());
|
903
|
break;
|
833
|
break;
|
904
|
|
834
|
|
905
|
case "editor-smallPic":
|
835
|
case "editor-smallPic":
|
906
|
- return true;
|
836
|
+ return (checkNumInput() && checkEndTime());
|
907
|
break;
|
837
|
break;
|
908
|
|
838
|
|
909
|
case "editor-brand":
|
839
|
case "editor-brand":
|
910
|
- return true;
|
840
|
+ return checkNumInput();
|
911
|
break;
|
841
|
break;
|
912
|
|
842
|
|
913
|
case "editor-recommend":
|
843
|
case "editor-recommend":
|
914
|
- return true;
|
844
|
+ var title = $(".editorTitle input[name='title']");
|
|
|
845
|
+ if(title.val()){
|
|
|
846
|
+ if(checkNumInput()){
|
|
|
847
|
+ var nameList = $(".grid input[name='name']");
|
|
|
848
|
+ for(var i=0; i<nameList.length; i++){
|
|
|
849
|
+ if(!nameList.eq(i).val()){
|
|
|
850
|
+ nameList.eq(i).focus().addClass("error");
|
|
|
851
|
+ common.util.__tip("中文名不能为空!");
|
|
|
852
|
+ return false;
|
|
|
853
|
+ }
|
|
|
854
|
+ }
|
|
|
855
|
+ return true;
|
|
|
856
|
+ }
|
|
|
857
|
+ }else{
|
|
|
858
|
+ title.focus().addClass("error");
|
|
|
859
|
+ common.util.__tip("模块标题不能为空!");
|
|
|
860
|
+ return false;
|
|
|
861
|
+ }
|
915
|
break;
|
862
|
break;
|
916
|
|
863
|
|
917
|
case "editor-hotRecommend":
|
864
|
case "editor-hotRecommend":
|
918
|
- return true;
|
865
|
+ return checkNumInput();
|
919
|
break;
|
866
|
break;
|
920
|
|
867
|
|
921
|
case "editor-signboard":
|
868
|
case "editor-signboard":
|
922
|
- var endTimeList = $(".grid input[name='endTime']");
|
|
|
923
|
- for(var i=0; i<endTimeList.length; i++){
|
|
|
924
|
- if(!endTimeList.eq(i).val()){
|
|
|
925
|
- alert("结束时间为空!");
|
|
|
926
|
- endTimeList.eq(i).focus();
|
|
|
927
|
- return false;
|
|
|
928
|
- }
|
|
|
929
|
- }
|
|
|
930
|
- return true;
|
869
|
+ return (checkNumInput() && checkEndTime());
|
931
|
break;
|
870
|
break;
|
932
|
|
871
|
|
933
|
case "editor-newGoodTab":
|
872
|
case "editor-newGoodTab":
|
934
|
- return true;
|
873
|
+ return checkNumInput();
|
935
|
break;
|
874
|
break;
|
936
|
|
875
|
|
937
|
case "editor-hotGoodTab":
|
876
|
case "editor-hotGoodTab":
|
938
|
- return true;
|
877
|
+ return checkNumInput();
|
939
|
break;
|
878
|
break;
|
940
|
|
879
|
|
941
|
case "editor-newProduct":
|
880
|
case "editor-newProduct":
|
942
|
- return true;
|
881
|
+ return checkNumInput();
|
943
|
break;
|
882
|
break;
|
944
|
|
883
|
|
945
|
case "editor-hotProduct":
|
884
|
case "editor-hotProduct":
|
946
|
- return true;
|
885
|
+ return checkNumInput();
|
947
|
break;
|
886
|
break;
|
948
|
|
887
|
|
949
|
default :
|
888
|
default :
|
|
|
889
|
+ return true;
|
950
|
break;
|
890
|
break;
|
951
|
}
|
891
|
}
|
952
|
}
|
892
|
}
|
|
|
893
|
+//排序序号校验
|
|
|
894
|
+function checkNumInput(){
|
|
|
895
|
+ var positionList = $(".grid input[name='position']");
|
|
|
896
|
+ for(var i=0; i<positionList.length; i++){
|
|
|
897
|
+ if(positionList.eq(i).val()){
|
|
|
898
|
+ if(!isNaN(positionList.eq(i).val())){
|
|
|
899
|
+ if(positionList.eq(i).val() <= 0){
|
|
|
900
|
+ positionList.eq(i).focus().select().addClass("error");
|
|
|
901
|
+ common.util.__tip("排序数字请大于0!");
|
|
|
902
|
+ return false;
|
|
|
903
|
+ }
|
|
|
904
|
+ }else{
|
|
|
905
|
+ positionList.eq(i).focus().select().addClass("error");
|
|
|
906
|
+ common.util.__tip("排序必须为数字!");
|
|
|
907
|
+ return false;
|
|
|
908
|
+ }
|
|
|
909
|
+ }else{
|
|
|
910
|
+ positionList.eq(i).focus().addClass("error");
|
|
|
911
|
+ common.util.__tip("排序不能为空!");
|
|
|
912
|
+ return false;
|
|
|
913
|
+ }
|
|
|
914
|
+ }
|
|
|
915
|
+ return true;
|
|
|
916
|
+}
|
|
|
917
|
+//结束时间校验
|
|
|
918
|
+function checkEndTime(){
|
|
|
919
|
+ var endTimeList = $(".grid input[name='endTime']");
|
|
|
920
|
+ for(var i=0; i<endTimeList.length; i++){
|
|
|
921
|
+ if(!endTimeList.eq(i).val()){
|
|
|
922
|
+ endTimeList.eq(i).focus().addClass("error");
|
|
|
923
|
+ common.util.__tip("结束时间不能为空!");
|
|
|
924
|
+ return false;
|
|
|
925
|
+ }
|
|
|
926
|
+ }
|
|
|
927
|
+ return true;
|
|
|
928
|
+}
|
953
|
//编辑动画事件
|
929
|
//编辑动画事件
|
954
|
function showEditorIconEvent(){
|
930
|
function showEditorIconEvent(){
|
955
|
if(shopOperate == 'editor'){
|
931
|
if(shopOperate == 'editor'){
|
|
@@ -1080,4 +1056,147 @@ function cloneArr(arr1,arr2){ |
|
@@ -1080,4 +1056,147 @@ function cloneArr(arr1,arr2){ |
1080
|
arr2.push($.extend(true,{},arr1[i]));
|
1056
|
arr2.push($.extend(true,{},arr1[i]));
|
1081
|
}
|
1057
|
}
|
1082
|
return arr2;
|
1058
|
return arr2;
|
1083
|
-} |
|
|
|
|
1059
|
+}
|
|
|
1060
|
+
|
|
|
1061
|
+/********************事件绑定*********************/
|
|
|
1062
|
+
|
|
|
1063
|
+//pc跟app的tab选项事件
|
|
|
1064
|
+$(document).on("click",".tabheader .nav-tabs li",function(){
|
|
|
1065
|
+ $(this).addClass('active').siblings('li').removeClass('active');
|
|
|
1066
|
+ curPlatform = $(this).attr("data-toggle");
|
|
|
1067
|
+ if(curPlatform == "shopWeb-app"){
|
|
|
1068
|
+ $(".moduleTypeView").hide();
|
|
|
1069
|
+ }else{
|
|
|
1070
|
+ $(".moduleTypeView").show();
|
|
|
1071
|
+ }
|
|
|
1072
|
+ showMain();
|
|
|
1073
|
+})
|
|
|
1074
|
+//基础模板,经典模板切换
|
|
|
1075
|
+$(document).on("click","input[name=brandLevel]",function(){
|
|
|
1076
|
+ curTemplateType = $("input[name=brandLevel]:checked").val();
|
|
|
1077
|
+ showMain();
|
|
|
1078
|
+})
|
|
|
1079
|
+//选择使用模板
|
|
|
1080
|
+$(document).on("change","#templateSelect",function(){
|
|
|
1081
|
+ jsonMain.templateName = $(this).val();
|
|
|
1082
|
+})
|
|
|
1083
|
+//暂存模板
|
|
|
1084
|
+$(document).on("click","#saveModule",function(){
|
|
|
1085
|
+ if(jsonMain.templateName == "0"){
|
|
|
1086
|
+ common.util.__tip("请选择展示使用模板!");
|
|
|
1087
|
+ return;
|
|
|
1088
|
+ }
|
|
|
1089
|
+ saveDecoration(100);
|
|
|
1090
|
+})
|
|
|
1091
|
+//提交审核
|
|
|
1092
|
+$(document).on("click","#submitModule",function(){
|
|
|
1093
|
+ if(jsonMain.templateName == "0"){
|
|
|
1094
|
+ common.util.__tip("请选择展示使用模板!");
|
|
|
1095
|
+ return;
|
|
|
1096
|
+ }
|
|
|
1097
|
+ saveDecoration(200);
|
|
|
1098
|
+})
|
|
|
1099
|
+//审核通过
|
|
|
1100
|
+$(document).on("click","#checkOk",function(){
|
|
|
1101
|
+ common.dialog.confirm(
|
|
|
1102
|
+ "审核确认",
|
|
|
1103
|
+ "你确认<strong style='color:#5cb85c'>审核通过</strong>么?",
|
|
|
1104
|
+ function(){
|
|
|
1105
|
+ checkDecoration(300);
|
|
|
1106
|
+ },
|
|
|
1107
|
+ function(){}
|
|
|
1108
|
+ );
|
|
|
1109
|
+})
|
|
|
1110
|
+//驳回
|
|
|
1111
|
+$(document).on("click","#checkNo",function(){
|
|
|
1112
|
+ common.dialog.confirm(
|
|
|
1113
|
+ "审核驳回",
|
|
|
1114
|
+ "你确认<strong style='color:#d9534f'>审核驳回</strong>么?如果确认,<strong style='color: #f0ad4e'>请填写驳回理由!</strong>" +
|
|
|
1115
|
+ "<textarea id='checkComment' class='form-control' rows='3' style='margin: 10px 0'></textarea>" +
|
|
|
1116
|
+ "<div class='editorTip' style='display: none'><span>提示:请填写驳回理由!</span></div>",
|
|
|
1117
|
+ function(){
|
|
|
1118
|
+ var comment = $("#checkComment").val();
|
|
|
1119
|
+ if(comment){
|
|
|
1120
|
+ checkDecoration(900,comment);
|
|
|
1121
|
+ }else{
|
|
|
1122
|
+ $(".editorTip").show();
|
|
|
1123
|
+ return false;
|
|
|
1124
|
+ }
|
|
|
1125
|
+ },
|
|
|
1126
|
+ function(){}
|
|
|
1127
|
+ );
|
|
|
1128
|
+})
|
|
|
1129
|
+//删除
|
|
|
1130
|
+$(document).on("click",".deleteBtn",function(){
|
|
|
1131
|
+ var _index = $(this).data("index")+"";
|
|
|
1132
|
+ var indexList = _index.split("_");
|
|
|
1133
|
+
|
|
|
1134
|
+ if(indexList.length > 1){
|
|
|
1135
|
+ [].splice.call(g.__rows[indexList[0]].data,indexList[1],1);
|
|
|
1136
|
+ }else{
|
|
|
1137
|
+ [].splice.call(g.__rows,indexList[0],1);
|
|
|
1138
|
+ }
|
|
|
1139
|
+ g.init(g.__rows);
|
|
|
1140
|
+ untilEditorEvent(curDialogId);
|
|
|
1141
|
+
|
|
|
1142
|
+ if(curDialogId == "editor-newProduct" || curDialogId == "editor-hotProduct"){
|
|
|
1143
|
+ productTopDataLink(g.__rows);
|
|
|
1144
|
+ }
|
|
|
1145
|
+});
|
|
|
1146
|
+//添加一条
|
|
|
1147
|
+$(document).on("click",".addBtn",function(){
|
|
|
1148
|
+ var _index = $(this).data("index")+"";
|
|
|
1149
|
+ var indexList = _index.split("_");
|
|
|
1150
|
+
|
|
|
1151
|
+ if(indexList.length > 1){
|
|
|
1152
|
+ g.__rows[indexList[0]].data.push($.extend({},ENUM[curDialogId]));
|
|
|
1153
|
+ }else{
|
|
|
1154
|
+ g.__rows.push($.extend({},ENUM[curDialogId]));
|
|
|
1155
|
+ }
|
|
|
1156
|
+ g.init(g.__rows);
|
|
|
1157
|
+ untilEditorEvent(curDialogId);
|
|
|
1158
|
+});
|
|
|
1159
|
+//input change同时更新json
|
|
|
1160
|
+$(document).on("change",".inputChange",function(){
|
|
|
1161
|
+ var _index = $(this).attr("data-index");
|
|
|
1162
|
+ var indexList = _index.split("_");
|
|
|
1163
|
+ var _name = $(this).attr("name");
|
|
|
1164
|
+
|
|
|
1165
|
+ if(indexList.length > 1){
|
|
|
1166
|
+ (g.__rows[indexList[0]].data)[indexList[1]][_name] = $(this).val();
|
|
|
1167
|
+ }else{
|
|
|
1168
|
+ g.__rows[indexList[0]][_name] = $(this).val();
|
|
|
1169
|
+ }
|
|
|
1170
|
+ $(this).removeClass("error");
|
|
|
1171
|
+});
|
|
|
1172
|
+//checkBox change同时更新json
|
|
|
1173
|
+$(document).on("change",".checkBoxChange",function(){
|
|
|
1174
|
+ var _index = $(this).attr("data-index");
|
|
|
1175
|
+ var _name = $(this).attr("name");
|
|
|
1176
|
+ if($(this).is(':checked')){
|
|
|
1177
|
+ g.__rows[_index][_name] = "Y";
|
|
|
1178
|
+ }else{
|
|
|
1179
|
+ g.__rows[_index][_name] = "N";
|
|
|
1180
|
+ }
|
|
|
1181
|
+});
|
|
|
1182
|
+//选择Top20
|
|
|
1183
|
+$(document).on("click",".topAdd",function(){
|
|
|
1184
|
+ if(g.__rows.length < 8){
|
|
|
1185
|
+ if(!$(this).hasClass("selected")){
|
|
|
1186
|
+ $(this).addClass("selected");
|
|
|
1187
|
+ var item = $.extend({},ENUM[curDialogId]);
|
|
|
1188
|
+ item.src = $(this).find('img').attr("src");
|
|
|
1189
|
+ item.productId = $(this).attr("data-productId");
|
|
|
1190
|
+ item.productName = $(this).attr("data-productName");
|
|
|
1191
|
+ item.productPrice = $(this).attr("data-productPrice");
|
|
|
1192
|
+
|
|
|
1193
|
+ g.__rows.push(item);
|
|
|
1194
|
+ g.init(g.__rows);
|
|
|
1195
|
+ untilEditorEvent(curDialogId);
|
|
|
1196
|
+
|
|
|
1197
|
+ $(".topTip span").text("已经勾选"+ g.__rows.length +"件,最多勾选8件商品!");
|
|
|
1198
|
+ }
|
|
|
1199
|
+ }else{
|
|
|
1200
|
+ $(".topTip span").text("商品数量已满8个,无法继续添加商品!");
|
|
|
1201
|
+ }
|
|
|
1202
|
+}); |