Authored by dongjunjie

店铺装修校验

@@ -47,7 +47,7 @@ var g = new common.grid({ @@ -47,7 +47,7 @@ var g = new common.grid({
47 display: "包含品牌", 47 display: "包含品牌",
48 name: "brands", 48 name: "brands",
49 render: function(item) { 49 render: function(item) {
50 - console.log(item); 50 + //console.log(item);
51 if (item.brands instanceof Array && item.brands.length > 0) { 51 if (item.brands instanceof Array && item.brands.length > 0) {
52 var html = ''; 52 var html = '';
53 $.each(item.brands, function(i, value) { 53 $.each(item.brands, function(i, value) {
@@ -98,6 +98,10 @@ var g = new common.grid({ @@ -98,6 +98,10 @@ var g = new common.grid({
98 }else{ 98 }else{
99 HtmArr.push('<a href="/supplier/store/decorationDetail/'+item.id+'/'+item.templateId+'/'+item.shopsType+'/editor/" class="btn btn-success btn-xs">装修编辑</a>'); 99 HtmArr.push('<a href="/supplier/store/decorationDetail/'+item.id+'/'+item.templateId+'/'+item.shopsType+'/editor/" class="btn btn-success btn-xs">装修编辑</a>');
100 } 100 }
  101 +
  102 + if (item.checkStatus == 900) {
  103 + HtmArr.push('<a href="javascript:void(0)" class="btn btn-warning btn-xs commentBtn" data-comment="'+item.comment+'">驳回理由</a>');
  104 + }
101 return HtmArr.join(''); 105 return HtmArr.join('');
102 } 106 }
103 }] 107 }]
@@ -108,4 +112,15 @@ g.init($("#gridurl").val()); @@ -108,4 +112,15 @@ g.init($("#gridurl").val());
108 // 筛选 112 // 筛选
109 $(document).on('click', "#filter-btn", function() { 113 $(document).on('click', "#filter-btn", function() {
110 g.reload(); 114 g.reload();
  115 +});
  116 +
  117 +//查看驳回理由
  118 +$(document).on('click', ".commentBtn", function() {
  119 + var comment = $(this).attr("data-comment");
  120 + common.dialog.confirm(
  121 + "查看驳回理由",
  122 + comment,
  123 + function(){},
  124 + function(){}
  125 + );
111 }); 126 });
@@ -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 +});
1 /* 1 /*
2 pc端店铺模板css 2 pc端店铺模板css
3 */ 3 */
4 -.grid ul.upload-image-list{padding: 0 10px}  
5 -.grid input.numInput{ width: 50px} 4 +.editor-dialog ul.upload-image-list{padding: 0 10px}
  5 +.editor-dialog input.numInput{ width: 50px}
  6 +.editorTitle input.error,.editor-dialog input.error{ border: 2px solid #ff0000}
6 .editorTip{ color: #ff0000} 7 .editorTip{ color: #ff0000}
7 8
8 .contentpanel-pc {color: #585858; font-size: 12px; font-family:'Microsoft YaHei'} 9 .contentpanel-pc {color: #585858; font-size: 12px; font-family:'Microsoft YaHei'}
1 -exports.domain = require('../config/common.js').domain; 1 +//exports.domain = require('../config/common.js').domain;
2 //exports.domain = 'http://localhost:30012'; 2 //exports.domain = 'http://localhost:30012';
3 -//exports.domain = 'http://172.16.6.115:8080/platform'; 3 +exports.domain = 'http://172.16.6.115:8080/platform';
4 4
5 exports.res = [ 5 exports.res = [
6 { 6 {
7 - route: '/supplier/store/decorationDetail/:id/:shopId/:shopType/:shopName', 7 + route: '/supplier/store/decorationDetail/:id/:templateId/:shopType/:shopName',
8 method: 'GET', 8 method: 'GET',
9 view: 'pages/store/shop2', 9 view: 'pages/store/shop2',
10 src:'/store/shop' 10 src:'/store/shop'
@@ -36,7 +36,8 @@ exports.res = [ @@ -36,7 +36,8 @@ exports.res = [
36 url:"/ShopsDecoratorRest/auditShopsDecorator", 36 url:"/ShopsDecoratorRest/auditShopsDecorator",
37 params:[ 37 params:[
38 {name: 'id', type: 'Number'}, 38 {name: 'id', type: 'Number'},
39 - {name: 'checkStatus', type: 'Number'} 39 + {name: 'checkStatus', type: 'Number'},
  40 + {name: 'comment', type: 'String'}
40 ] 41 ]
41 }, 42 },
42 {//最新上架的商品 43 {//最新上架的商品
@@ -22,13 +22,13 @@ @@ -22,13 +22,13 @@
22 <h4>选择模板</h4> 22 <h4>选择模板</h4>
23 </div> 23 </div>
24 <div class="col-sm-3"> 24 <div class="col-sm-3">
25 - <div class="moduleTypeView" style="margin-top: 10px"> 25 + <div class="moduleTypeView">
26 <label class="radio-inline"><input type="radio" name="brandLevel" value="1">基础模板</label> 26 <label class="radio-inline"><input type="radio" name="brandLevel" value="1">基础模板</label>
27 <label class="radio-inline"><input type="radio" name="brandLevel" value="2">经典模板</label> 27 <label class="radio-inline"><input type="radio" name="brandLevel" value="2">经典模板</label>
28 </div> 28 </div>
29 </div> 29 </div>
30 <div class="col-sm-3"> 30 <div class="col-sm-3">
31 - <div class="moduleTypeSelect" style="display: none"> 31 + <div class="moduleTypeSelect" style="display: none; margin-top: -10px">
32 <label>PC端使用模板:</label> 32 <label>PC端使用模板:</label>
33 <select id="templateSelect" style="width: 120px; display: inline-block" class="form-control"> 33 <select id="templateSelect" style="width: 120px; display: inline-block" class="form-control">
34 <option value="0" selected="selected">--选择模板--</option> 34 <option value="0" selected="selected">--选择模板--</option>
@@ -38,15 +38,15 @@ @@ -38,15 +38,15 @@
38 </div> 38 </div>
39 </div> 39 </div>
40 <div class="col-sm-3"> 40 <div class="col-sm-3">
41 - <div class="moduleView" style="display: none; text-align: right"> 41 + <div class="moduleView" style="display: none; text-align: right; margin-top: -10px">
42 <input type="button" class="btn btn-default " value="返回" onclick="history.go(-1)"> 42 <input type="button" class="btn btn-default " value="返回" onclick="history.go(-1)">
43 </div> 43 </div>
44 - <div class="moduleSubmite" style="display: none; text-align: right"> 44 + <div class="moduleSubmite" style="display: none; text-align: right; margin-top: -10px">
45 <input id="saveModule" type="button" class="btn btn-success" value="暂存"> 45 <input id="saveModule" type="button" class="btn btn-success" value="暂存">
46 <input id="submitModule" type="button" class="btn btn-primary" value="提交审核"> 46 <input id="submitModule" type="button" class="btn btn-primary" value="提交审核">
47 <input type="button" class="btn btn-default " value="返回" onclick="history.go(-1)"> 47 <input type="button" class="btn btn-default " value="返回" onclick="history.go(-1)">
48 </div> 48 </div>
49 - <div class="moduleCheck" style="display: none; text-align: right"> 49 + <div class="moduleCheck" style="display: none; text-align: right; margin-top: -10px">
50 <input id="checkOk" type="button" class="btn btn-primary" value="审核通过"> 50 <input id="checkOk" type="button" class="btn btn-primary" value="审核通过">
51 <input id="checkNo" type="button" class="btn btn-danger" value="驳回"> 51 <input id="checkNo" type="button" class="btn btn-danger" value="驳回">
52 <input type="button" class="btn btn-default " value="返回" onclick="history.go(-1)"> 52 <input type="button" class="btn btn-default " value="返回" onclick="history.go(-1)">
@@ -159,7 +159,9 @@ @@ -159,7 +159,9 @@
159 </div> 159 </div>
160 <!--热销推荐--> 160 <!--热销推荐-->
161 <div class="model-recommend model-hotRecommend model-editor" data-toggle="editor-hotRecommend" data-title="[[resources.hotRecommend.title]]编辑"> 161 <div class="model-recommend model-hotRecommend model-editor" data-toggle="editor-hotRecommend" data-title="[[resources.hotRecommend.title]]编辑">
  162 + [[if resources.hotRecommend.title]]
162 <div class="recommendTitle">[[resources.hotRecommend.title]]</div> 163 <div class="recommendTitle">[[resources.hotRecommend.title]]</div>
  164 + [[/if]]
163 <div class="recommendDetail hotRecommendDetail"> 165 <div class="recommendDetail hotRecommendDetail">
164 <ul> 166 <ul>
165 [[each resources.hotRecommend.data as item _index]] 167 [[each resources.hotRecommend.data as item _index]]
@@ -192,7 +194,11 @@ @@ -192,7 +194,11 @@
192 <ul> 194 <ul>
193 [[each resources.goodsTabBar.data.new as item _index]] 195 [[each resources.goodsTabBar.data.new as item _index]]
194 [[if item.name]] 196 [[if item.name]]
195 - <li><a href="[[item.url]]">[[item.name]]</a></li> 197 + [[if _index == 0]]
  198 + <li style="border-right: 0"><a href="[[item.url]]">[[item.name]]</a></li>
  199 + [[else]]
  200 + <li><a href="[[item.url]]">[[item.name]]</a></li>
  201 + [[/if]]
196 [[/if]] 202 [[/if]]
197 [[/each]] 203 [[/each]]
198 </ul> 204 </ul>
@@ -217,7 +223,11 @@ @@ -217,7 +223,11 @@
217 <ul> 223 <ul>
218 [[each resources.goodsTabBar.data.hot as item _index]] 224 [[each resources.goodsTabBar.data.hot as item _index]]
219 [[if item.name]] 225 [[if item.name]]
220 - <li><a href="[[item.url]]">[[item.name]]</a></li> 226 + [[if _index == 0]]
  227 + <li style="border-right: 0"><a href="[[item.url]]">[[item.name]]</a></li>
  228 + [[else]]
  229 + <li><a href="[[item.url]]">[[item.name]]</a></li>
  230 + [[/if]]
221 [[/if]] 231 [[/if]]
222 [[/each]] 232 [[/each]]
223 </ul> 233 </ul>
@@ -286,7 +296,9 @@ @@ -286,7 +296,9 @@
286 <div class="sortListDetail model-editor" data-toggle="editor-recommend-app" data-title="热门品类编辑"> 296 <div class="sortListDetail model-editor" data-toggle="editor-recommend-app" data-title="热门品类编辑">
287 <ul> 297 <ul>
288 [[each resources.recommend.data as item _index]] 298 [[each resources.recommend.data as item _index]]
289 - <li><img src="[[item.src]]"><a href="[[item.url]]">[[item.name]]</a></li> 299 + [[if item.isShowInApp == "Y"]]
  300 + <li><img src="[[item.src]]"><a href="[[item.url]]">[[item.name]]</a></li>
  301 + [[/if]]
290 [[/each]] 302 [[/each]]
291 </ul> 303 </ul>
292 <div class="clear"></div> 304 <div class="clear"></div>
@@ -319,7 +331,7 @@ @@ -319,7 +331,7 @@
319 <ul> 331 <ul>
320 [[each product_list as item _index]] 332 [[each product_list as item _index]]
321 <li class="topAdd" data-productId="[[item.product_id]]" data-productName="[[item.product_name]]" data-productPrice="[[item.sales_price]]"> 333 <li class="topAdd" data-productId="[[item.product_id]]" data-productName="[[item.product_name]]" data-productPrice="[[item.sales_price]]">
322 - <a href="javascript:"><img src="[[item.default_images]]"><b></b><span>top[[_index]]</span><i></i></a> 334 + <a href="javascript:"><img src="[[item.default_images]]"><b></b><span>top[[_index+1]]</span><i></i></a>
323 </li> 335 </li>
324 [[/each]] 336 [[/each]]
325 </ul> 337 </ul>