Authored by weiqingting

Merge branch 'yohobuy_shops_dev_v4.4_20160525' into develop

@@ -5,7 +5,7 @@ var $ = require('jquery'), @@ -5,7 +5,7 @@ var $ = require('jquery'),
5 5
6 var g; //grid 6 var g; //grid
7 var curDialogId; //当前打开的编辑弹层ID 7 var curDialogId; //当前打开的编辑弹层ID
8 -var curPlatform = "shopWeb-pc"; //当前渲染页面用的模板名称 8 +var curPlatform = "pc"; //当前渲染页面用的模板名称
9 var curTemplateType = "2"; //当前模板类型 1:基础模板,2:经典模板 9 var curTemplateType = "2"; //当前模板类型 1:基础模板,2:经典模板
10 var shopType = 1; //店铺类型 1:单品牌,2:多品牌 10 var shopType = 1; //店铺类型 1:单品牌,2:多品牌
11 var shopOperate = 'view'; //操作 editor:可编辑, view:查看不可编辑 11 var shopOperate = 'view'; //操作 editor:可编辑, view:查看不可编辑
@@ -15,7 +15,7 @@ var ENUM = { @@ -15,7 +15,7 @@ var ENUM = {
15 "editor-largePic2":{"position":"", "data":[{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0}]}, 15 "editor-largePic2":{"position":"", "data":[{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0}]},
16 "editor-smallPic":{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0}, 16 "editor-smallPic":{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0},
17 "editor-brand":{"position":"", "name":"", "url":""}, 17 "editor-brand":{"position":"", "name":"", "url":""},
18 - "editor-recommend": {"position":"", "name":"", "enName":"", "src":"", "url":"","isShowInApp":"Y"}, 18 + "editor-recommend": {"position":"", "name":"", "enName":"", "src":"", "url":""},
19 "editor-hotRecommend":{"position":"", "src":"", "url":""}, 19 "editor-hotRecommend":{"position":"", "src":"", "url":""},
20 "editor-signboard":{"position":"", "src":"", "url":"","startTime": "","endTime": "","publishStatus": 0}, 20 "editor-signboard":{"position":"", "src":"", "url":"","startTime": "","endTime": "","publishStatus": 0},
21 "editor-newGoodTab":{"position":"", "name":"", "url":""}, 21 "editor-newGoodTab":{"position":"", "name":"", "url":""},
@@ -28,6 +28,10 @@ var resourcesNew = { @@ -28,6 +28,10 @@ var resourcesNew = {
28 "id":"", 28 "id":"",
29 "data": [{"shopSrc": defaultSrc, "detailSrc": defaultSrc, "isShowShopName": "N"}] 29 "data": [{"shopSrc": defaultSrc, "detailSrc": defaultSrc, "isShowShopName": "N"}]
30 }, 30 },
  31 + "shopTopBanner_base":{
  32 + "id":"",
  33 + "data": [{"shopSrc": defaultSrc, "detailSrc": defaultSrc, "isShowShopName": "N"}]
  34 + },
31 "navigationBar":{ 35 "navigationBar":{
32 "id":"", 36 "id":"",
33 "data": [{"name":"",url:""}, {"name":"",url:""}, {"name":"",url:""}] 37 "data": [{"name":"",url:""}, {"name":"",url:""}, {"name":"",url:""}]
@@ -50,7 +54,7 @@ var resourcesNew = { @@ -50,7 +54,7 @@ var resourcesNew = {
50 "recommend":{ 54 "recommend":{
51 "id":"", 55 "id":"",
52 "title":"经典推荐", 56 "title":"经典推荐",
53 - "data": [{"position":1, "name":"默认商品", "enName":"", "src":defaultSrc, "url":"","isShowInApp":"Y"}] 57 + "data": [{"position":1, "name":"默认商品", "enName":"", "src":defaultSrc, "url":""}]
54 }, 58 },
55 "hotRecommend":{ 59 "hotRecommend":{
56 "id":"", 60 "id":"",
@@ -105,6 +109,16 @@ var resourcesNew = { @@ -105,6 +109,16 @@ var resourcesNew = {
105 "allHotProducts_APP":{ 109 "allHotProducts_APP":{
106 "id":"", 110 "id":"",
107 "data":[] 111 "data":[]
  112 + },
  113 + "largeSlideImg_APP":{
  114 + "id":"",
  115 + "isUsed":"N",
  116 + "data": [{"position": 1, "data":[{"src": defaultSrc, "url": "", "startTime": "", "endTime": ""}]}]
  117 + },
  118 + "recommend_APP":{
  119 + "id":"",
  120 + "isUsed":"N",
  121 + "data": [{"position":1, "name":"默认商品", "enName":"", "src":defaultSrc, "url":""}]
108 } 122 }
109 } //初始化装修信息json 123 } //初始化装修信息json
110 var shopsId, _id, jsonMain, jsonClone; 124 var shopsId, _id, jsonMain, jsonClone;
@@ -127,26 +141,34 @@ function getParams(){ @@ -127,26 +141,34 @@ function getParams(){
127 _id = paramList[4]; 141 _id = paramList[4];
128 } 142 }
129 if(shopOperate == 'editor'){ 143 if(shopOperate == 'editor'){
130 - $(".moduleTypeSelect").show().find("#templateSelect").removeAttr("disabled");  
131 $(".moduleSubmite").show().siblings().hide(); 144 $(".moduleSubmite").show().siblings().hide();
132 }else if(shopOperate == 'view'){ 145 }else if(shopOperate == 'view'){
133 - $(".moduleTypeSelect").hide(); 146 + $(".tabheader").hide();
134 $(".moduleView").show().siblings().hide(); 147 $(".moduleView").show().siblings().hide();
135 }else if(shopOperate == 'check'){ 148 }else if(shopOperate == 'check'){
136 - $(".moduleTypeSelect").show().find("#templateSelect").attr("disabled","disabled"); 149 + $(".tabheader").hide();
137 $(".moduleCheck").show().siblings().hide(); 150 $(".moduleCheck").show().siblings().hide();
138 } 151 }
139 } 152 }
140 //json渲染模板 153 //json渲染模板
141 function showMain(){ 154 function showMain(){
142 - $('#templateSelect').val(jsonMain.templateType);  
143 - $("input[name='brandLevel'][value='"+curTemplateType+"']").attr('checked',"checked"); 155 + // tab自动选中基础模板,经典模板
  156 + $('.tabheader .nav').find("li[data-toggle='"+ curTemplateType +"']").addClass("active");
  157 + // radio自动选中pc端或者app端
  158 + $('.moduleTypeView').find("input[name='brandLevel'][value='"+ curPlatform +"']").attr("checked","checked");
144 159
145 - if(curPlatform == "shopWeb-pc"){  
146 - //console.log(jsonMain);  
147 - $('#main').empty().html(common.util.__template2($("#"+curPlatform+"-"+curTemplateType).html(),jsonMain));  
148 - } else if(curPlatform == "shopWeb-app"){  
149 - $('#main').empty().html(common.util.__template2($("#"+curPlatform).html(),jsonMain)); 160 + //渲染装修模板
  161 + if(curTemplateType == 1){
  162 + $('#main').empty().html(common.util.__template2($("#"+curTemplateType+"-pc").html(),jsonMain));
  163 + }else if(curTemplateType == 2){
  164 + $('#main').empty().html(common.util.__template2($("#"+curTemplateType+"-"+curPlatform).html(),jsonMain));
  165 + }
  166 +
  167 + //基础模板不显示pc端跟app端
  168 + if(curTemplateType == "1"){
  169 + $(".moduleTypeView").hide();
  170 + }else{
  171 + $(".moduleTypeView").show();
150 } 172 }
151 //单品牌,多品牌 173 //单品牌,多品牌
152 if(shopType == 2){ 174 if(shopType == 2){
@@ -166,25 +188,55 @@ function showMain(){ @@ -166,25 +188,55 @@ function showMain(){
166 function editorIconEvent(title,id){ 188 function editorIconEvent(title,id){
167 $('.editorIcon').on('click',function(){ 189 $('.editorIcon').on('click',function(){
168 curDialogId = id; 190 curDialogId = id;
169 - common.dialog.confirm(  
170 - title,  
171 - "<div class='editorTitle'></div><div class='editor-dialog' id='"+ id +"'></div><div class='editorTip'></div> ",  
172 - function(){  
173 - if(editorCheck(id)){  
174 - if(!(curDialogId == "editor-largePic-app" || curDialogId == "editor-recommend-app" || curDialogId == "editor-brand-app")){  
175 - freshJson(id, g.__rows, 1); 191 + var option = {
  192 + title:title,
  193 + content:"<div class='editorTitle'></div><div class='editor-dialog' id='"+ id +"'></div><div class='editorTip'></div> ",
  194 + width:'70%',
  195 + button:[
  196 + {
  197 + value:"取消",
  198 + callback:function(){
  199 + if(curDialogId != "editor-brand-app"){
  200 + freshJson(id, g.__rows, 0);
  201 + }
  202 + }
  203 + },
  204 + {
  205 + value:"确认",
  206 + css:"btn-info",
  207 + callback:function(){
  208 + if(editorCheck(id)){
  209 + if(curDialogId != "editor-brand-app"){
  210 + freshJson(id, g.__rows, 1);
  211 + }
  212 + showMain();
  213 + }else{
  214 + return false;
  215 + }
176 } 216 }
177 - showMain();  
178 - }else{  
179 - return false;  
180 } 217 }
181 - },  
182 - function(){  
183 - if(!(curDialogId == "editor-largePic-app" || curDialogId == "editor-recommend-app" || curDialogId == "editor-brand-app")){  
184 - freshJson(id, g.__rows, 0); 218 + ]
  219 + }
  220 + if(id == "editor-recommend" && curPlatform == "pc" && jsonMain.resources.recommend_APP.isUsed == "Y"){
  221 + option.button.push({
  222 + value:"保存并同步至APP",
  223 + css:"btn-success",
  224 + callback: function(){
  225 + if(editorCheck(id)){
  226 + freshJson(id, g.__rows, 1);
  227 + cloneArr(sortJson(g.__rows,1),jsonMain.resources.recommend_APP.data);
  228 + cloneArr(sortJson(g.__rows,1),jsonClone.resources.recommend_APP.data);
  229 + removeUrlParam("editor-recommend",jsonMain.resources.recommend_APP.data); //去除url
  230 + removeUrlParam("editor-recommend",jsonClone.resources.recommend_APP.data);
  231 + common.util.__tip("同步APP成功!","success");
  232 + showMain();
  233 + }else{
  234 + return false;
  235 + }
185 } 236 }
186 - }  
187 - ); 237 + });
  238 + }
  239 + new common.dialog(option);
188 gridInit(id); 240 gridInit(id);
189 untilEditorEvent(id); 241 untilEditorEvent(id);
190 editorTipInit(id); 242 editorTipInit(id);
@@ -220,6 +272,7 @@ function findDecoration(){ @@ -220,6 +272,7 @@ function findDecoration(){
220 common.util.__tip("店铺没有品牌,无法装修,请返回添加品牌!"); 272 common.util.__tip("店铺没有品牌,无法装修,请返回添加品牌!");
221 return; 273 return;
222 } 274 }
  275 + //初始化模板类型
223 if(jsonMain.templateType && jsonMain.templateType != "0"){ 276 if(jsonMain.templateType && jsonMain.templateType != "0"){
224 curTemplateType = jsonMain.templateType; 277 curTemplateType = jsonMain.templateType;
225 } 278 }
@@ -237,11 +290,7 @@ function findDecoration(){ @@ -237,11 +290,7 @@ function findDecoration(){
237 if(!jsonMain.resources.allHotProducts_APP.data || jsonMain.resources.allHotProducts_APP.data.length < 1){ 290 if(!jsonMain.resources.allHotProducts_APP.data || jsonMain.resources.allHotProducts_APP.data.length < 1){
238 findTopHotProducts_APP(); 291 findTopHotProducts_APP();
239 } 292 }
240 - /*  
241 - findTopNewProducts();  
242 - findTopHotProducts();  
243 - findTopHotProducts_APP();  
244 - */ 293 + /*findTopNewProducts(); findTopHotProducts(); findTopHotProducts_APP();*/
245 } 294 }
246 showMain(); 295 showMain();
247 },true); 296 },true);
@@ -351,9 +400,36 @@ function checkDecoration(checkStatus,comment){ @@ -351,9 +400,36 @@ function checkDecoration(checkStatus,comment){
351 //弹层表单grid生成器 400 //弹层表单grid生成器
352 function gridInit(id){ 401 function gridInit(id){
353 switch (id){ 402 switch (id){
354 - //店铺顶部banner 403 + //基础模板顶部banner
  404 + case "editor-banner-base":
  405 + g = new common.grid({
  406 + hash: false,
  407 + el:"#"+id,
  408 + columns:[
  409 + {display:"店铺banner图片", render:function(item){
  410 + return "<input type=file name='shopBannerImage' id='shopBannerImage_"+item.__index+"' value='"+item.shopSrc+"' />";
  411 + }},
  412 + {display:"是否显示店铺名称", render:function(item){
  413 + if(item.isShowShopName == "Y"){
  414 + return "<lable><input type='radio' name='isShowShopName' value='Y' checked='checked'>显示店铺名称</lable><br>" +
  415 + "<lable><input type='radio' name='isShowShopName' value='N'>不显示店铺名称</lable>";
  416 + }else{
  417 + return "<lable><input type='radio' name='isShowShopName' value='Y'>显示店铺名称</lable><br>" +
  418 + "<lable><input type='radio' name='isShowShopName' value='N' checked='checked'>不显示店铺名称</lable>";
  419 + }
  420 + }},
  421 + {display:"商品详情页banner图片", render:function(item){
  422 + return "<input type=file name='DetailbannerImage' id='DetailbannerImage_"+item.__index+"' value='"+item.detailSrc+"' />";
  423 + }}
  424 + ]
  425 + });
  426 + g.__rows=""||jsonClone.resources.shopTopBanner_base.data;
  427 + g.init(g.__rows);
  428 + break;
  429 +
  430 + //经典模板顶部banner
355 case "editor-banner": 431 case "editor-banner":
356 - if(curPlatform == "shopWeb-pc"){ 432 + if(curPlatform == "pc"){
357 g = new common.grid({ 433 g = new common.grid({
358 hash: false, 434 hash: false,
359 el:"#"+id, 435 el:"#"+id,
@@ -377,7 +453,7 @@ function gridInit(id){ @@ -377,7 +453,7 @@ function gridInit(id){
377 }); 453 });
378 g.__rows=""||jsonClone.resources.shopTopBanner.data; 454 g.__rows=""||jsonClone.resources.shopTopBanner.data;
379 } 455 }
380 - if(curPlatform == "shopWeb-app"){ 456 + if(curPlatform == "app"){
381 g = new common.grid({ 457 g = new common.grid({
382 hash: false, 458 hash: false,
383 el:"#"+id, 459 el:"#"+id,
@@ -414,7 +490,7 @@ function gridInit(id){ @@ -414,7 +490,7 @@ function gridInit(id){
414 return "<input class='form-control inputChange' type=text name='name' value='"+item.name+"' data-index='"+item.__index+"' maxlength='5' />"; 490 return "<input class='form-control inputChange' type=text name='name' value='"+item.name+"' data-index='"+item.__index+"' maxlength='5' />";
415 }}, 491 }},
416 {display:"链接", render:function(item){ 492 {display:"链接", render:function(item){
417 - return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />"; 493 + return '<input class="form-control inputChange urlInput" type=text name="url" value="'+item.url+'" data-index="'+item.__index+'" />';
418 }} 494 }}
419 ] 495 ]
420 }); 496 });
@@ -441,12 +517,17 @@ function gridInit(id){ @@ -441,12 +517,17 @@ function gridInit(id){
441 }, 517 },
442 {display:"操作", render:function(item){ 518 {display:"操作", render:function(item){
443 if(g.__rows.length > 1){ 519 if(g.__rows.length > 1){
444 - return "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' />"; 520 + return "<input type=button class='btn btn-warning btn-xs deleteBtn' style='margin-top:6px' value='删除' data-index='"+item.__index+"' />";
445 } 521 }
446 }} 522 }}
447 ] 523 ]
448 }); 524 });
449 - g.__rows=""||jsonClone.resources.largeSlideImg.data; 525 + if(curPlatform == "pc"){
  526 + g.__rows=""||jsonClone.resources.largeSlideImg.data;
  527 + }
  528 + if(curPlatform == "app"){
  529 + g.__rows=""||jsonClone.resources.largeSlideImg_APP.data;
  530 + }
450 g.init(g.__rows); 531 g.init(g.__rows);
451 break; 532 break;
452 533
@@ -468,10 +549,10 @@ function gridInit(id){ @@ -468,10 +549,10 @@ function gridInit(id){
468 } 549 }
469 ] 550 ]
470 }); 551 });
471 - if(curPlatform == "shopWeb-pc"){ 552 + if(curPlatform == "pc"){
472 g.__rows=""||jsonClone.resources.oneRowTwoColImages.data; 553 g.__rows=""||jsonClone.resources.oneRowTwoColImages.data;
473 } 554 }
474 - if(curPlatform == "shopWeb-app"){ 555 + if(curPlatform == "app"){
475 g.__rows=""||jsonClone.resources.oneRowTwoColImages_APP.data; 556 g.__rows=""||jsonClone.resources.oneRowTwoColImages_APP.data;
476 } 557 }
477 g.init(g.__rows); 558 g.init(g.__rows);
@@ -498,7 +579,6 @@ function gridInit(id){ @@ -498,7 +579,6 @@ function gridInit(id){
498 579
499 //经典推荐recommend 580 //经典推荐recommend
500 case "editor-recommend": 581 case "editor-recommend":
501 - $('.editorTitle').html("<div class='form-inline' style='margin-bottom: 10px'><label>标题名称编辑:</label><input class='form-control' type=text name='title' value='"+ jsonMain.resources.recommend.title +"' /></div> ");  
502 g = new common.grid({ 582 g = new common.grid({
503 hash: false, 583 hash: false,
504 el:"#"+id, 584 el:"#"+id,
@@ -517,14 +597,7 @@ function gridInit(id){ @@ -517,14 +597,7 @@ function gridInit(id){
517 return "<input type=file name='recommendImage' id='recommendImage_"+item.__index+"' value='"+item.src+"' />"; 597 return "<input type=file name='recommendImage' id='recommendImage_"+item.__index+"' value='"+item.src+"' />";
518 }}, 598 }},
519 {display:"链接", render:function(item){ 599 {display:"链接", render:function(item){
520 - return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />";  
521 - }},  
522 - {display:"APP展示", render:function(item){  
523 - if(item.isShowInApp == "Y"){  
524 - return "<input class='form-control checkBoxChange' type=checkBox name='isShowInApp' data-index='"+item.__index+"' checked />";  
525 - }else{  
526 - return "<input class='form-control checkBoxChange' type=checkBox name='isShowInApp' data-index='"+item.__index+"' />";  
527 - } 600 + return '<input class="form-control inputChange urlInput" type=text name="url" value="'+item.url+'" data-index="'+item.__index+'" />';
528 }}, 601 }},
529 {display:"操作", render:function(item){ 602 {display:"操作", render:function(item){
530 var htmlPic = "",i=item.__index; 603 var htmlPic = "",i=item.__index;
@@ -547,7 +620,13 @@ function gridInit(id){ @@ -547,7 +620,13 @@ function gridInit(id){
547 }} 620 }}
548 ] 621 ]
549 }); 622 });
550 - g.__rows=""||jsonClone.resources.recommend.data; 623 + if(curPlatform == "pc"){
  624 + $('.editorTitle').html("<div class='form-inline' style='margin-bottom: 10px'><label>标题名称编辑:</label><input class='form-control' type=text name='title' value='"+ jsonMain.resources.recommend.title +"' /></div> ");
  625 + g.__rows=""||jsonClone.resources.recommend.data;
  626 + }
  627 + if(curPlatform == "app"){
  628 + g.__rows=""||jsonClone.resources.recommend_APP.data;
  629 + }
551 g.init(g.__rows); 630 g.init(g.__rows);
552 break; 631 break;
553 632
@@ -566,7 +645,7 @@ function gridInit(id){ @@ -566,7 +645,7 @@ function gridInit(id){
566 return "<input type=file name='signboardImage' id='hotRecommendImage_"+item.__index+"' value='"+item.src+"' />"; 645 return "<input type=file name='signboardImage' id='hotRecommendImage_"+item.__index+"' value='"+item.src+"' />";
567 }}, 646 }},
568 {display:"链接", render:function(item){ 647 {display:"链接", render:function(item){
569 - return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />"; 648 + return '<input class="form-control inputChange urlInput" type=text name="url" value="'+item.url+'" data-index="'+item.__index+'" />';
570 }}, 649 }},
571 {display:"操作", render:function(item){ 650 {display:"操作", render:function(item){
572 var htmlPic = "",i=item.__index; 651 var htmlPic = "",i=item.__index;
@@ -646,7 +725,7 @@ function gridInit(id){ @@ -646,7 +725,7 @@ function gridInit(id){
646 if(item.__index == 0){ 725 if(item.__index == 0){
647 return "http://店铺商品列表页(默认)"; 726 return "http://店铺商品列表页(默认)";
648 }else{ 727 }else{
649 - return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />"; 728 + return '<input class="form-control inputChange urlInput" type=text name="url" value="'+item.url+'" data-index="'+item.__index+'" />';
650 } 729 }
651 }}, 730 }},
652 {display:"操作", render:function(item){ 731 {display:"操作", render:function(item){
@@ -694,7 +773,7 @@ function gridInit(id){ @@ -694,7 +773,7 @@ function gridInit(id){
694 if(item.__index == 0){ 773 if(item.__index == 0){
695 return "http://店铺商品列表页(默认)"; 774 return "http://店铺商品列表页(默认)";
696 }else{ 775 }else{
697 - return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />"; 776 + return '<input class="form-control inputChange urlInput" type=text name="url" value="'+item.url+'" data-index="'+item.__index+'" />';
698 } 777 }
699 }}, 778 }},
700 {display:"操作", render:function(item){ 779 {display:"操作", render:function(item){
@@ -719,8 +798,7 @@ function gridInit(id){ @@ -719,8 +798,7 @@ function gridInit(id){
719 798
720 //新品上架 799 //新品上架
721 case "editor-newProduct": 800 case "editor-newProduct":
722 - $("#"+id).html("<div id='editor-newProduct-grid' style='width: 500px; float: left'></div><div class='top20List' style='float: left;margin-left: 40px'></div> ");  
723 - //左侧已选商品 801 + $("#"+id).html("<div id='editor-newProduct-grid' style='width: 50%; float:left;padding-left: 20px'></div><div class='top20List' style='float:left; padding-left:10%'></div> ");
724 g = new common.grid({ 802 g = new common.grid({
725 hash: false, 803 hash: false,
726 el:"#editor-newProduct-grid", 804 el:"#editor-newProduct-grid",
@@ -739,20 +817,13 @@ function gridInit(id){ @@ -739,20 +817,13 @@ function gridInit(id){
739 ] 817 ]
740 }); 818 });
741 g.__rows=""||jsonClone.resources.newProducts.data; 819 g.__rows=""||jsonClone.resources.newProducts.data;
  820 + productTopDataShow(id, jsonMain.resources.allNewProducts); //右侧热销排名前20商品
742 g.init(g.__rows); 821 g.init(g.__rows);
743 - //右侧热销排名前20商品  
744 - if(jsonMain.resources.allNewProducts.data && jsonMain.resources.allNewProducts.data.length > 0){  
745 - $("#"+id+" .top20List").html(common.util.__template2($("#top20Products").html(),jsonMain.resources.allNewProducts));  
746 - productTopDataLink(g.__rows);  
747 - }else{  
748 - $("#"+id+" .top20List").html("<font color='red'>*&nbsp;&nbsp;最新上架20条加载失败,请重新加载页面!</font>");  
749 - }  
750 break; 822 break;
751 823
752 //人气单品 824 //人气单品
753 case "editor-hotProduct": 825 case "editor-hotProduct":
754 - $("#"+id).html("<div id='editor-hotProduct-grid' style='width: 500px; float: left'></div><div class='top20List' style='float: left;margin-left: 40px'></div> ");  
755 - //左侧已选商品 826 + $("#"+id).html("<div id='editor-hotProduct-grid' style='width: 50%; float:left;padding-left: 20px'></div><div class='top20List' style='float:left; padding-left:10%'></div> ");
756 g = new common.grid({ 827 g = new common.grid({
757 hash: false, 828 hash: false,
758 el:"#editor-hotProduct-grid", 829 el:"#editor-hotProduct-grid",
@@ -770,25 +841,13 @@ function gridInit(id){ @@ -770,25 +841,13 @@ function gridInit(id){
770 }} 841 }}
771 ] 842 ]
772 }); 843 });
773 - if(curPlatform == "shopWeb-pc"){ 844 + if(curPlatform == "pc"){
774 g.__rows=""||jsonClone.resources.hotProducts.data; 845 g.__rows=""||jsonClone.resources.hotProducts.data;
775 - //右侧热销排名前20商品  
776 - if(jsonMain.resources.allHotProducts.data && jsonMain.resources.allHotProducts.data.length > 0){  
777 - $("#"+id+" .top20List").html(common.util.__template2($("#top20Products").html(),jsonMain.resources.allHotProducts));  
778 - productTopDataLink(g.__rows);  
779 - }else{  
780 - $("#"+id+" .top20List").html("<font color='red'>*&nbsp;&nbsp;最新上架20条加载失败,请重新加载页面!</font>");  
781 - } 846 + productTopDataShow(id, jsonMain.resources.allHotProducts); //右侧热销排名前20商品
782 } 847 }
783 - if(curPlatform == "shopWeb-app"){ 848 + if(curPlatform == "app"){
784 g.__rows=""||jsonClone.resources.hotProducts_APP.data; 849 g.__rows=""||jsonClone.resources.hotProducts_APP.data;
785 - //右侧热销排名前20商品  
786 - if(jsonMain.resources.allHotProducts_APP.data && jsonMain.resources.allHotProducts_APP.data.length > 0){  
787 - $("#"+id+" .top20List").html(common.util.__template2($("#top20Products").html(),jsonMain.resources.allHotProducts_APP));  
788 - productTopDataLink(g.__rows);  
789 - }else{  
790 - $("#"+id+" .top20List").html("<font color='red'>*&nbsp;&nbsp;最新上架20条加载失败,请重新加载页面!</font>");  
791 - } 850 + productTopDataShow(id, jsonMain.resources.allHotProducts_APP); //右侧热销排名前20商品
792 } 851 }
793 g.init(g.__rows); 852 g.init(g.__rows);
794 break; 853 break;
@@ -800,29 +859,36 @@ function gridInit(id){ @@ -800,29 +859,36 @@ function gridInit(id){
800 //弹层表单确定后刷新json数据,status参数:1:确定,0:取消 859 //弹层表单确定后刷新json数据,status参数:1:确定,0:取消
801 function freshJson(id,data,status){ 860 function freshJson(id,data,status){
802 switch (id){ 861 switch (id){
  862 + case "editor-banner-base":
  863 + if(status == 1){
  864 + data[0].isShowShopName = $("input[name='isShowShopName']:checked").val();
  865 + cloneArr(data,jsonMain.resources.shopTopBanner_base.data);
  866 + }else if(status == 0){
  867 + cloneArr(jsonMain.resources.shopTopBanner_base.data,data);
  868 + }
  869 + break;
  870 +
803 case "editor-banner": 871 case "editor-banner":
804 if(status == 1){ 872 if(status == 1){
805 data[0].isShowShopName = $("input[name='isShowShopName']:checked").val(); 873 data[0].isShowShopName = $("input[name='isShowShopName']:checked").val();
806 - if(curPlatform == "shopWeb-app"){  
807 - jsonMain.resources.shopTopBanner_APP.isUsed = "Y"; // 用于提交审核时候校验app端是否维护店招  
808 - cloneArr(data,jsonMain.resources.shopTopBanner_APP.data);  
809 - }  
810 - if(curPlatform == "shopWeb-pc"){ 874 + if(curPlatform == "pc"){
811 cloneArr(data,jsonMain.resources.shopTopBanner.data); 875 cloneArr(data,jsonMain.resources.shopTopBanner.data);
812 - /* app端与pc端单独配置,不取pc端的大图了  
813 - if(jsonMain.resources.shopTopBanner_APP.isUsed == "N"){  
814 - cloneArr(data,jsonMain.resources.shopTopBanner_APP.data);  
815 - cloneArr(data,jsonClone.resources.shopTopBanner_APP.data);  
816 - }  
817 - */ 876 + if(jsonMain.resources.shopTopBanner_APP.isUsed == "N"){
  877 + cloneArr(data,jsonMain.resources.shopTopBanner_APP.data);
  878 + cloneArr(data,jsonClone.resources.shopTopBanner_APP.data);
  879 + }
818 } 880 }
819 - }else if(status == 0){  
820 - if(curPlatform == "shopWeb-app"){  
821 - cloneArr(jsonMain.resources.shopTopBanner_APP.data,data); 881 + if(curPlatform == "app"){
  882 + jsonMain.resources.shopTopBanner_APP.isUsed = "Y";
  883 + cloneArr(data,jsonMain.resources.shopTopBanner_APP.data);
822 } 884 }
823 - if(curPlatform == "shopWeb-pc"){ 885 + }else if(status == 0){
  886 + if(curPlatform == "pc"){
824 cloneArr(jsonMain.resources.shopTopBanner.data,data); 887 cloneArr(jsonMain.resources.shopTopBanner.data,data);
825 } 888 }
  889 + if(curPlatform == "app"){
  890 + cloneArr(jsonMain.resources.shopTopBanner_APP.data,data);
  891 + }
826 } 892 }
827 break; 893 break;
828 894
@@ -836,32 +902,51 @@ function freshJson(id,data,status){ @@ -836,32 +902,51 @@ function freshJson(id,data,status){
836 902
837 case "editor-largePic": 903 case "editor-largePic":
838 if(status == 1){ 904 if(status == 1){
839 - cloneArr(sortJson(data,1),jsonMain.resources.largeSlideImg.data); 905 + if(curPlatform == "pc"){
  906 + cloneArr(sortJson(data,1),jsonMain.resources.largeSlideImg.data);
  907 + if(jsonMain.resources.largeSlideImg_APP.isUsed == "N"){
  908 + cloneArr(sortJson(data,1),jsonMain.resources.largeSlideImg_APP.data);
  909 + cloneArr(sortJson(data,1),jsonClone.resources.largeSlideImg_APP.data);
  910 + removeUrlParam(id,jsonMain.resources.largeSlideImg_APP.data); //去除url
  911 + removeUrlParam(id,jsonClone.resources.largeSlideImg_APP.data);
  912 + }
  913 + }
  914 + if(curPlatform == "app"){
  915 + jsonMain.resources.largeSlideImg_APP.isUsed = "Y";
  916 + cloneArr(sortJson(data,1),jsonMain.resources.largeSlideImg_APP.data);
  917 + }
840 }else if(status == 0){ 918 }else if(status == 0){
841 - cloneArr(jsonMain.resources.largeSlideImg.data,data); 919 + if(curPlatform == "pc"){
  920 + cloneArr(jsonMain.resources.largeSlideImg.data,data);
  921 + }
  922 + if(curPlatform == "app"){
  923 + cloneArr(jsonMain.resources.largeSlideImg_APP.data,data);
  924 + }
842 } 925 }
843 break; 926 break;
844 927
845 case "editor-smallPic": 928 case "editor-smallPic":
846 if(status == 1){ 929 if(status == 1){
847 - if(curPlatform == "shopWeb-app"){  
848 - jsonMain.resources.oneRowTwoColImages_APP.isUsed = "Y";  
849 - cloneArr(sortJson(data,1),jsonMain.resources.oneRowTwoColImages_APP.data);  
850 - }  
851 - if(curPlatform == "shopWeb-pc"){ 930 + if(curPlatform == "pc"){
852 cloneArr(sortJson(data,1),jsonMain.resources.oneRowTwoColImages.data); 931 cloneArr(sortJson(data,1),jsonMain.resources.oneRowTwoColImages.data);
853 if(jsonMain.resources.oneRowTwoColImages_APP.isUsed == "N"){ 932 if(jsonMain.resources.oneRowTwoColImages_APP.isUsed == "N"){
854 cloneArr(sortJson(data,1),jsonMain.resources.oneRowTwoColImages_APP.data); 933 cloneArr(sortJson(data,1),jsonMain.resources.oneRowTwoColImages_APP.data);
855 cloneArr(sortJson(data,1),jsonClone.resources.oneRowTwoColImages_APP.data); 934 cloneArr(sortJson(data,1),jsonClone.resources.oneRowTwoColImages_APP.data);
  935 + removeUrlParam(id,jsonMain.resources.oneRowTwoColImages_APP.data); //去除url
  936 + removeUrlParam(id,jsonClone.resources.oneRowTwoColImages_APP.data);
856 } 937 }
857 } 938 }
858 - }else if(status == 0){  
859 - if(curPlatform == "shopWeb-app"){  
860 - cloneArr(jsonMain.resources.oneRowTwoColImages_APP.data,data); 939 + if(curPlatform == "app"){
  940 + jsonMain.resources.oneRowTwoColImages_APP.isUsed = "Y";
  941 + cloneArr(sortJson(data,1),jsonMain.resources.oneRowTwoColImages_APP.data);
861 } 942 }
862 - if(curPlatform == "shopWeb-pc"){ 943 + }else if(status == 0){
  944 + if(curPlatform == "pc"){
863 cloneArr(jsonMain.resources.oneRowTwoColImages.data,data); 945 cloneArr(jsonMain.resources.oneRowTwoColImages.data,data);
864 } 946 }
  947 + if(curPlatform == "app"){
  948 + cloneArr(jsonMain.resources.oneRowTwoColImages_APP.data,data);
  949 + }
865 } 950 }
866 break; 951 break;
867 952
@@ -875,10 +960,28 @@ function freshJson(id,data,status){ @@ -875,10 +960,28 @@ function freshJson(id,data,status){
875 960
876 case "editor-recommend": 961 case "editor-recommend":
877 if(status == 1){ 962 if(status == 1){
878 - jsonMain.resources.recommend.title = jsonClone.resources.recommend.title = $(".editorTitle input[name='title']").val();  
879 - cloneArr(sortJson(data,1),jsonMain.resources.recommend.data); 963 + if(curPlatform == "pc"){
  964 + var title = $(".editorTitle input[name='title']").val();
  965 + jsonMain.resources.recommend.title = jsonClone.resources.recommend.title = title;
  966 + cloneArr(sortJson(data,1),jsonMain.resources.recommend.data);
  967 + if(jsonMain.resources.recommend_APP.isUsed == "N"){
  968 + cloneArr(sortJson(data,1),jsonMain.resources.recommend_APP.data);
  969 + cloneArr(sortJson(data,1),jsonClone.resources.recommend_APP.data);
  970 + removeUrlParam(id,jsonMain.resources.recommend_APP.data); //去除url
  971 + removeUrlParam(id,jsonClone.resources.recommend_APP.data);
  972 + }
  973 + }
  974 + if(curPlatform == "app"){
  975 + jsonMain.resources.recommend_APP.isUsed = "Y";
  976 + cloneArr(sortJson(data,1),jsonMain.resources.recommend_APP.data);
  977 + }
880 }else if(status == 0){ 978 }else if(status == 0){
881 - cloneArr(jsonMain.resources.recommend.data,data); 979 + if(curPlatform == "pc"){
  980 + cloneArr(jsonMain.resources.recommend.data,data);
  981 + }
  982 + if(curPlatform == "app"){
  983 + cloneArr(jsonMain.resources.recommend_APP.data,data);
  984 + }
882 } 985 }
883 break; 986 break;
884 987
@@ -925,24 +1028,24 @@ function freshJson(id,data,status){ @@ -925,24 +1028,24 @@ function freshJson(id,data,status){
925 1028
926 case "editor-hotProduct": 1029 case "editor-hotProduct":
927 if(status == 1){ 1030 if(status == 1){
928 - if(curPlatform == "shopWeb-app"){  
929 - jsonMain.resources.hotProducts_APP.isUsed = "Y";  
930 - cloneArr(sortJson(data,1),jsonMain.resources.hotProducts_APP.data);  
931 - }  
932 - if(curPlatform == "shopWeb-pc"){ 1031 + if(curPlatform == "pc"){
933 cloneArr(sortJson(data,1),jsonMain.resources.hotProducts.data); 1032 cloneArr(sortJson(data,1),jsonMain.resources.hotProducts.data);
934 if(jsonMain.resources.hotProducts_APP.isUsed == "N"){ 1033 if(jsonMain.resources.hotProducts_APP.isUsed == "N"){
935 cloneArr(sortJson(data,1),jsonMain.resources.hotProducts_APP.data); 1034 cloneArr(sortJson(data,1),jsonMain.resources.hotProducts_APP.data);
936 cloneArr(sortJson(data,1),jsonClone.resources.hotProducts_APP.data); 1035 cloneArr(sortJson(data,1),jsonClone.resources.hotProducts_APP.data);
937 } 1036 }
938 } 1037 }
939 - }else if(status == 0){  
940 - if(curPlatform == "shopWeb-app"){  
941 - cloneArr(jsonMain.resources.hotProducts_APP.data,data); 1038 + if(curPlatform == "app"){
  1039 + jsonMain.resources.hotProducts_APP.isUsed = "Y";
  1040 + cloneArr(sortJson(data,1),jsonMain.resources.hotProducts_APP.data);
942 } 1041 }
943 - if(curPlatform == "shopWeb-pc"){ 1042 + }else if(status == 0){
  1043 + if(curPlatform == "pc"){
944 cloneArr(jsonMain.resources.hotProducts.data,data); 1044 cloneArr(jsonMain.resources.hotProducts.data,data);
945 } 1045 }
  1046 + if(curPlatform == "app"){
  1047 + cloneArr(jsonMain.resources.hotProducts_APP.data,data);
  1048 + }
946 } 1049 }
947 break; 1050 break;
948 1051
@@ -954,28 +1057,28 @@ function freshJson(id,data,status){ @@ -954,28 +1057,28 @@ function freshJson(id,data,status){
954 function editorTipInit(id){ 1057 function editorTipInit(id){
955 var tipHtml = ""; 1058 var tipHtml = "";
956 switch (id){ 1059 switch (id){
  1060 + case "editor-banner-base":
  1061 + tipHtml = "<span>提示:请上传像素1150*200的图片,图片大小不能超过500KB。</span>";
  1062 + break;
957 case "editor-banner": 1063 case "editor-banner":
958 - if(curPlatform == "shopWeb-pc"){  
959 - tipHtml = "<span>提示:请上传像素1150*150的图片,图片大小不能大于500KB。</span>"; 1064 + if(curPlatform == "pc"){
  1065 + tipHtml = "<span>提示:请上传像素1150*200的图片,图片大小不能超过500KB。</span>";
960 } 1066 }
961 - if(curPlatform == "shopWeb-app"){  
962 - tipHtml = "<span>提示:请上传像素640*200的图片,图片大小不能大于500KB。</span>"; 1067 + if(curPlatform == "app"){
  1068 + tipHtml = "<span>提示:请上传像素640*200的图片,图片大小不能超过500KB。</span>";
963 } 1069 }
964 break; 1070 break;
965 case "editor-nav": 1071 case "editor-nav":
966 tipHtml = "<span>提示:标题名称最多5个汉字。</span>"; 1072 tipHtml = "<span>提示:标题名称最多5个汉字。</span>";
967 break; 1073 break;
968 case "editor-largePic": 1074 case "editor-largePic":
969 - tipHtml = "<span>提示:请上传像素660*358的图片,图片大小不能大于500KB,该图片会适配到APP端。</span>";  
970 - break;  
971 - case "editor-largePic-app":  
972 - tipHtml = "<span>提示:由PC端适配,修改请到PC端修改。</span>"; 1075 + tipHtml = "<span>提示:请上传像素660*358的图片,图片大小不能超过500KB。</span>";
973 break; 1076 break;
974 case "editor-smallPic": 1077 case "editor-smallPic":
975 - if(curPlatform == "shopWeb-app"){  
976 - tipHtml = "<span>提示:请上传像素275*160的图片,图片大小不能大于500KB。</span>"; 1078 + if(curPlatform == "app"){
  1079 + tipHtml = "<span>提示:请上传像素275*160的图片,图片大小不能超过500KB。</span>";
977 }else{ 1080 }else{
978 - tipHtml = "<span>提示:请上传像素300*174的图片,图片大小不能大于500KB。</span>"; 1081 + tipHtml = "<span>提示:请上传像素300*174的图片,图片大小不能超过500KB。</span>";
979 } 1082 }
980 break; 1083 break;
981 case "editor-brand": 1084 case "editor-brand":
@@ -985,16 +1088,13 @@ function editorTipInit(id){ @@ -985,16 +1088,13 @@ function editorTipInit(id){
985 tipHtml = "<span>提示:【品牌一览】由PC端【品牌集合】适配,修改请到PC端【品牌集合】修改。</span>"; 1088 tipHtml = "<span>提示:【品牌一览】由PC端【品牌集合】适配,修改请到PC端【品牌集合】修改。</span>";
986 break; 1089 break;
987 case "editor-recommend": 1090 case "editor-recommend":
988 - tipHtml = "<span>提示:请上传像素150*150的图片,图片大小不能大于500KB,图片和标题会适配到APP的【热门品类】中。</span>";  
989 - break;  
990 - case "editor-recommend-app":  
991 - tipHtml = "<span>提示:【热门品类】由PC端【经典推荐】适配,修改请到PC端【经典推荐】修改。</span>"; 1091 + tipHtml = "<span>提示:请上传像素150*150的图片,图片大小不能超过500KB。</span>";
992 break; 1092 break;
993 case "editor-signboard": 1093 case "editor-signboard":
994 - tipHtml = "<span>提示:请上传像素160*240的图片,图片大小不能大于500KB。</span>"; 1094 + tipHtml = "<span>提示:请上传像素160*240的图片,图片大小不能超过500KB。</span>";
995 break; 1095 break;
996 case "editor-hotRecommend": 1096 case "editor-hotRecommend":
997 - tipHtml = "<span>提示:请上传像素160*240的图片,图片大小不能大于500KB。</span>"; 1097 + tipHtml = "<span>提示:请上传像素160*240的图片,图片大小不能超过500KB。</span>";
998 break; 1098 break;
999 case "editor-newGoodTab": 1099 case "editor-newGoodTab":
1000 tipHtml = "<span>提示:最多编辑5个标签,标题名称最多5个汉字。</span>"; 1100 tipHtml = "<span>提示:最多编辑5个标签,标题名称最多5个汉字。</span>";
@@ -1010,12 +1110,16 @@ function editorTipInit(id){ @@ -1010,12 +1110,16 @@ function editorTipInit(id){
1010 //弹出框编辑校验 1110 //弹出框编辑校验
1011 function editorCheck(id){ 1111 function editorCheck(id){
1012 switch (id){ 1112 switch (id){
  1113 + case "editor-nav":
  1114 + return checkUrlInput();
  1115 + break;
  1116 +
1013 case "editor-largePic": 1117 case "editor-largePic":
1014 - return (checkNumInput() && checkEndTime()); 1118 + return (checkNumInput() && checkEndTime() && checkUrlInput());
1015 break; 1119 break;
1016 1120
1017 case "editor-smallPic": 1121 case "editor-smallPic":
1018 - return (checkNumInput() && checkEndTime()); 1122 + return (checkNumInput() && checkEndTime() && checkUrlInput());
1019 break; 1123 break;
1020 1124
1021 case "editor-brand": 1125 case "editor-brand":
@@ -1024,39 +1128,38 @@ function editorCheck(id){ @@ -1024,39 +1128,38 @@ function editorCheck(id){
1024 1128
1025 case "editor-recommend": 1129 case "editor-recommend":
1026 var title = $(".editorTitle input[name='title']"); 1130 var title = $(".editorTitle input[name='title']");
1027 - if(title.val()){  
1028 - if(checkNumInput()){  
1029 - var nameList = $(".grid input[name='name']");  
1030 - for(var i=0; i<nameList.length; i++){  
1031 - if(!nameList.eq(i).val()){  
1032 - nameList.eq(i).focus().addClass("error");  
1033 - common.util.__tip("中文名不能为空!");  
1034 - return false;  
1035 - }  
1036 - }  
1037 - return true;  
1038 - }  
1039 - }else{ 1131 + if(title.length > 0 && title.val().trim() == ""){
1040 title.focus().addClass("error"); 1132 title.focus().addClass("error");
1041 common.util.__tip("模块标题不能为空!"); 1133 common.util.__tip("模块标题不能为空!");
1042 return false; 1134 return false;
1043 } 1135 }
  1136 + if(checkNumInput() && checkUrlInput()){
  1137 + var nameList = $(".grid input[name='name']");
  1138 + for(var i=0; i<nameList.length; i++){
  1139 + if(!nameList.eq(i).val()){
  1140 + nameList.eq(i).focus().addClass("error");
  1141 + common.util.__tip("中文名不能为空!");
  1142 + return false;
  1143 + }
  1144 + }
  1145 + return true;
  1146 + }
1044 break; 1147 break;
1045 1148
1046 case "editor-hotRecommend": 1149 case "editor-hotRecommend":
1047 - return checkNumInput(); 1150 + return (checkNumInput() && checkUrlInput());
1048 break; 1151 break;
1049 1152
1050 case "editor-signboard": 1153 case "editor-signboard":
1051 - return (checkNumInput() && checkEndTime()); 1154 + return (checkNumInput() && checkEndTime() && checkUrlInput());
1052 break; 1155 break;
1053 1156
1054 case "editor-newGoodTab": 1157 case "editor-newGoodTab":
1055 - return checkNumInput(); 1158 + return (checkNumInput() && checkUrlInput());
1056 break; 1159 break;
1057 1160
1058 case "editor-hotGoodTab": 1161 case "editor-hotGoodTab":
1059 - return checkNumInput(); 1162 + return (checkNumInput() && checkUrlInput());
1060 break; 1163 break;
1061 1164
1062 case "editor-newProduct": 1165 case "editor-newProduct":
@@ -1096,6 +1199,21 @@ function checkNumInput(){ @@ -1096,6 +1199,21 @@ function checkNumInput(){
1096 } 1199 }
1097 return true; 1200 return true;
1098 } 1201 }
  1202 +//url域名校验
  1203 +function checkUrlInput(){
  1204 + var urlList = $(".grid input[name='url']");
  1205 + for(var i=0; i<urlList.length; i++){
  1206 + var reg = new RegExp(".+\.yohobuy\.com.*","g");
  1207 + if(urlList.eq(i).val() != ""){
  1208 + if(!reg.test(urlList.eq(i).val())){
  1209 + urlList.eq(i).focus().select().addClass("error");
  1210 + common.util.__tip("Url一级域名错误!必须是.yohobuy.com");
  1211 + return false;
  1212 + }
  1213 + }
  1214 + }
  1215 + return true;
  1216 +}
1099 //结束时间校验 1217 //结束时间校验
1100 function checkEndTime(){ 1218 function checkEndTime(){
1101 var endTimeList = $(".grid input[name='endTime']"); 1219 var endTimeList = $(".grid input[name='endTime']");
@@ -1117,7 +1235,7 @@ function showEditorIconEvent(){ @@ -1117,7 +1235,7 @@ function showEditorIconEvent(){
1117 var editorModelId = $(this).attr("data-toggle"); 1235 var editorModelId = $(this).attr("data-toggle");
1118 var editorModelTitle = $(this).attr("data-title"); 1236 var editorModelTitle = $(this).attr("data-title");
1119 var editorIcon = ""; 1237 var editorIcon = "";
1120 - if(editorModelId == "editor-brand-app" || editorModelId == "editor-largePic-app" || editorModelId == "editor-recommend-app"){ 1238 + if(editorModelId == "editor-brand-app"){
1121 editorIcon += "<div class='editorBorder' style='border: 5px solid #ff69b4'></div>" 1239 editorIcon += "<div class='editorBorder' style='border: 5px solid #ff69b4'></div>"
1122 }else{ 1240 }else{
1123 editorIcon += "<div class='editorBorder'></div>" 1241 editorIcon += "<div class='editorBorder'></div>"
@@ -1172,7 +1290,7 @@ function untilEditorEvent(id){ @@ -1172,7 +1290,7 @@ function untilEditorEvent(id){
1172 } 1290 }
1173 }); 1291 });
1174 $("#"+id+" nav").hide(); 1292 $("#"+id+" nav").hide();
1175 - $(".modal-dialog").css("width","960px"); 1293 + $(".modal-dialog .modal-header .close").hide();
1176 $(".modal-dialog .modal-body .editor-dialog").css("overflow-y","auto"); 1294 $(".modal-dialog .modal-body .editor-dialog").css("overflow-y","auto");
1177 $(".modal-dialog .modal-body .editor-dialog").css("overflow-x","hidden"); 1295 $(".modal-dialog .modal-body .editor-dialog").css("overflow-x","hidden");
1178 } 1296 }
@@ -1183,7 +1301,7 @@ function resourcesHtmlInit(item,resName){ @@ -1183,7 +1301,7 @@ function resourcesHtmlInit(item,resName){
1183 for(var i=0; i<picList.length; i++){ 1301 for(var i=0; i<picList.length; i++){
1184 htmlPic += "<div class='row'>" + 1302 htmlPic += "<div class='row'>" +
1185 "<div class='col-sm-2'><input type=file name='"+ resName +"Image' id='"+ resName +"Image_"+item.__index+"_"+i+"' value='"+picList[i].src+"' /></div>" + 1303 "<div class='col-sm-2'><input type=file name='"+ resName +"Image' id='"+ resName +"Image_"+item.__index+"_"+i+"' value='"+picList[i].src+"' /></div>" +
1186 - "<div class='col-sm-3'><input type=text class='form-control inputChange' name='url' value='"+ picList[i].url +"' data-index='"+ item.__index +"_"+ i +"' /></div>" + 1304 + '<div class="col-sm-3"><input type=text class="form-control inputChange urlInput" name="url" value="'+ picList[i].url +'" data-index="'+ item.__index +"_"+ i +'" /></div>' +
1187 "<div class='col-sm-2'>"; 1305 "<div class='col-sm-2'>";
1188 if(i>0){ 1306 if(i>0){
1189 htmlPic += "<input type=text class='form-control' disabled jsaction='time:end:endTime_"+item.__index+"_"+ i +"' id='startTime_"+item.__index+"_"+ i +"' name='startTime' value='"+ picList[i].startTime +"' />" + 1307 htmlPic += "<input type=text class='form-control' disabled jsaction='time:end:endTime_"+item.__index+"_"+ i +"' id='startTime_"+item.__index+"_"+ i +"' name='startTime' value='"+ picList[i].startTime +"' />" +
@@ -1194,7 +1312,7 @@ function resourcesHtmlInit(item,resName){ @@ -1194,7 +1312,7 @@ function resourcesHtmlInit(item,resName){
1194 htmlPic += "</div><div class='col-sm-2'>" + 1312 htmlPic += "</div><div class='col-sm-2'>" +
1195 "<input type=text class='form-control inputChange' style='background-color:#fff' readOnly='true' jsaction='time:start:startTime_"+item.__index+"_"+ i +"' id='endTime_"+item.__index+"_"+ i +"' name='endTime' value='"+ picList[i].endTime +"' data-index='"+ item.__index +"_"+ i +"' /></div>" + 1313 "<input type=text class='form-control inputChange' style='background-color:#fff' readOnly='true' jsaction='time:start:startTime_"+item.__index+"_"+ i +"' id='endTime_"+item.__index+"_"+ i +"' name='endTime' value='"+ picList[i].endTime +"' data-index='"+ item.__index +"_"+ i +"' /></div>" +
1196 "<div class='col-sm-1'><span class='publishStatus' style='white-space: nowrap; line-height: 40px'>"+ checkdate(picList[i].startTime,picList[i].endTime) +"</span></div>" + 1314 "<div class='col-sm-1'><span class='publishStatus' style='white-space: nowrap; line-height: 40px'>"+ checkdate(picList[i].startTime,picList[i].endTime) +"</span></div>" +
1197 - "<div class='col-sm-2'>"; 1315 + "<div class='col-sm-2' style='line-height: 40px'>";
1198 if(i == (picList.length-1) && picList.length > 1){ 1316 if(i == (picList.length-1) && picList.length > 1){
1199 htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+ item.__index +"_"+ i +"' /><br>"; 1317 htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+ item.__index +"_"+ i +"' /><br>";
1200 htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+ item.__index +"_"+ i +"' />"; 1318 htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+ item.__index +"_"+ i +"' />";
@@ -1209,6 +1327,15 @@ function resourcesHtmlInit(item,resName){ @@ -1209,6 +1327,15 @@ function resourcesHtmlInit(item,resName){
1209 } 1327 }
1210 return htmlPic; 1328 return htmlPic;
1211 } 1329 }
  1330 +//展示最新,最热排名前20条
  1331 +function productTopDataShow(id, products){
  1332 + if(products.data && products.data.length > 0){
  1333 + $("#"+id+" .top20List").html(common.util.__template2($("#top20Products").html(),products));
  1334 + productTopDataLink(g.__rows);
  1335 + }else{
  1336 + $("#"+id+" .top20List").html("<font color='red'>*&nbsp;&nbsp;最新上架20条加载失败,请重新加载页面!</font>");
  1337 + }
  1338 +}
1212 //top20商品根据以展示商品自动勾选 1339 //top20商品根据以展示商品自动勾选
1213 function productTopDataLink(productList){ 1340 function productTopDataLink(productList){
1214 $(".top20List li").removeClass("selected"); 1341 $(".top20List li").removeClass("selected");
@@ -1287,50 +1414,52 @@ function checkdate(startDate,endDate){ @@ -1287,50 +1414,52 @@ function checkdate(startDate,endDate){
1287 } 1414 }
1288 return true; 1415 return true;
1289 } 1416 }
  1417 +//去除json中的url参数
  1418 +function removeUrlParam(id, data){
  1419 + if(id == "editor-largePic" || id == "editor-smallPic"){
  1420 + for(var i=0; i<data.length; i++){
  1421 + var data2 = data[i].data;
  1422 + for(var j=0; j<data2.length; j++){
  1423 + data2[j].url = "";
  1424 + }
  1425 + }
  1426 + }
  1427 + if(id == "editor-recommend"){
  1428 + for(var i=0; i<data.length; i++){
  1429 + data[i].url = "";
  1430 + }
  1431 + }
  1432 +}
1290 1433
1291 /********************事件绑定*********************/ 1434 /********************事件绑定*********************/
1292 1435
1293 -//pc跟app的tab选项事件 1436 +//基础模板,经典模板切换
1294 $(document).on("click",".tabheader .nav-tabs li",function(){ 1437 $(document).on("click",".tabheader .nav-tabs li",function(){
1295 $(this).addClass('active').siblings('li').removeClass('active'); 1438 $(this).addClass('active').siblings('li').removeClass('active');
1296 - curPlatform = $(this).attr("data-toggle");  
1297 - if(curPlatform == "shopWeb-app"){  
1298 - $(".moduleTypeView").hide();  
1299 - }else{  
1300 - $(".moduleTypeView").show();  
1301 - } 1439 + curTemplateType = $(this).attr("data-toggle");
1302 showMain(); 1440 showMain();
1303 }) 1441 })
1304 -//基础模板,经典模板切换 1442 +//pc,app切换
1305 $(document).on("click","input[name=brandLevel]",function(){ 1443 $(document).on("click","input[name=brandLevel]",function(){
1306 - curTemplateType = $("input[name=brandLevel]:checked").val(); 1444 + curPlatform = $("input[name=brandLevel]:checked").val();
1307 showMain(); 1445 showMain();
1308 }) 1446 })
1309 -//选择使用模板  
1310 -$(document).on("change","#templateSelect",function(){  
1311 - jsonMain.templateType = $(this).val();  
1312 - $(this).removeClass("error");  
1313 -})  
1314 //暂存模板 1447 //暂存模板
1315 $(document).on("click","#saveModule",function(){ 1448 $(document).on("click","#saveModule",function(){
1316 saveDecoration(100); 1449 saveDecoration(100);
1317 }) 1450 })
1318 //提交审核 1451 //提交审核
1319 $(document).on("click","#submitModule",function(){ 1452 $(document).on("click","#submitModule",function(){
1320 - if(jsonMain.resources.shopTopBanner.data[0].shopSrc == defaultSrc){  
1321 - common.util.__tip("PC端没有维护顶部banner!");  
1322 - return;  
1323 - }  
1324 - if(jsonMain.resources.shopTopBanner_APP.isUsed == "N"){  
1325 - common.util.__tip("APP端没有维护顶部banner!");  
1326 - return;  
1327 - }  
1328 - if(jsonMain.templateType == "0"){  
1329 - common.util.__tip("请选择展示使用模板!");  
1330 - $("#templateSelect").focus().addClass("error");  
1331 - return;  
1332 - }  
1333 - saveDecoration(200); 1453 + jsonMain.templateType = curTemplateType;
  1454 + var templateName = curTemplateType=='2'?"经典模板":"基础模板";
  1455 + common.dialog.confirm(
  1456 + "提交审核确认",
  1457 + "你确认使用<strong style='color:#5cb85c'>"+ templateName + "</strong>,并提交审核么?审核过程中,店铺装修将无法修改!",
  1458 + function(){
  1459 + saveDecoration(200);
  1460 + },
  1461 + function(){}
  1462 + )
1334 }) 1463 })
1335 //审核通过 1464 //审核通过
1336 $(document).on("click","#checkOk",function(){ 1465 $(document).on("click","#checkOk",function(){
@@ -1437,16 +1566,6 @@ $(document).on("change",".inputChange",function(){ @@ -1437,16 +1566,6 @@ $(document).on("change",".inputChange",function(){
1437 } 1566 }
1438 $(this).removeClass("error"); 1567 $(this).removeClass("error");
1439 }); 1568 });
1440 -//checkBox change同时更新json  
1441 -$(document).on("change",".checkBoxChange",function(){  
1442 - var _index = $(this).attr("data-index");  
1443 - var _name = $(this).attr("name");  
1444 - if($(this).is(':checked')){  
1445 - g.__rows[_index][_name] = "Y";  
1446 - }else{  
1447 - g.__rows[_index][_name] = "N";  
1448 - }  
1449 -});  
1450 //选择Top20 1569 //选择Top20
1451 $(document).on("click",".topAdd",function(){ 1570 $(document).on("click",".topAdd",function(){
1452 if($(this).hasClass("selected")){ 1571 if($(this).hasClass("selected")){
@@ -1481,4 +1600,4 @@ $(document).on("click",".topAdd",function(){ @@ -1481,4 +1600,4 @@ $(document).on("click",".topAdd",function(){
1481 $(".topTip span").text("商品数量已满8个,无法继续添加商品!"); 1600 $(".topTip span").text("商品数量已满8个,无法继续添加商品!");
1482 } 1601 }
1483 } 1602 }
1484 -}); 1603 +});
1 -<div class="tabheader">  
2 - <ul class="nav nav-tabs">  
3 - <li data-toggle="shopWeb-pc" class="active"><a href="javascript:">店铺装修(PC端)</a></li>  
4 - <li data-toggle="shopWeb-app"><a href="javascript:">店铺装修(移动端)</a></li>  
5 - </ul>  
6 -</div> 1 +
7 2
8 <div class="pageheader"> 3 <div class="pageheader">
9 <div class="media"> 4 <div class="media">
10 - <div class="media-body" style="display: block;">  
11 - <div class="panel-body">  
12 - <div class="col-sm-3">  
13 - <h4>选择模板</h4>  
14 - </div>  
15 - <div class="col-sm-3">  
16 - <div class="moduleTypeView">  
17 - <label class="radio-inline"><input type="radio" name="brandLevel" value="1">基础模板</label>  
18 - <label class="radio-inline"><input type="radio" name="brandLevel" value="2">经典模板</label>  
19 - </div>  
20 - </div>  
21 - <div class="col-sm-3">  
22 - <div class="moduleTypeSelect" style="display: none; margin-top: -10px">  
23 - <label>PC端使用模板:</label>  
24 - <select id="templateSelect" style="width: 120px; display: inline-block" class="form-control">  
25 - <option value="0" selected="selected">--选择模板--</option>  
26 - <option value="1">基础模板</option>  
27 - <option value="2">经典模板</option>  
28 - </select> 5 + <div class="pageicon pull-left">
  6 + <i class="fa fa-th-list"></i>
  7 + </div>
  8 + <div class="media-body" style="display: block">
  9 + <ul class="breadcrumb">
  10 + <li><a href="javascript:"><i class="glyphicon glyphicon-home"></i></a></li>
  11 + <li><a href="javascript:">店铺装修</a></li>
  12 + <li>店铺装修模板</li>
  13 + </ul>
  14 +
  15 + <div class="tabheader" style="margin: 10px 0 20px">
  16 + <ul class="nav nav-tabs">
  17 + <li data-toggle="1"><a href="javascript:">基础模板</a></li>
  18 + <li data-toggle="2"><a href="javascript:">经典模板</a></li>
  19 + <div class="clearfix"></div>
  20 + </ul>
  21 + </div>
  22 +
  23 + <div style="margin-bottom: 10px">
  24 + <div class="col-sm-4"></div>
  25 + <div class="col-sm-4">
  26 + <div class="moduleTypeView" style="text-align: center">
  27 + <label class="radio-inline"><input type="radio" name="brandLevel" value="pc">PC端</label>
  28 + <label class="radio-inline" style="margin-left: 30px;"><input type="radio" name="brandLevel" value="app">APP端</label>
29 </div> 29 </div>
30 </div> 30 </div>
31 - <div id="operations" class="col-sm-3"> 31 + <div id="operations" class="col-sm-4">
32 <div class="moduleView" style="display: none; text-align: right; margin-top: -10px"> 32 <div class="moduleView" style="display: none; text-align: right; margin-top: -10px">
33 <input type="button" class="btn btn-default " value="返回" onclick="history.go(-1)"> 33 <input type="button" class="btn btn-default " value="返回" onclick="history.go(-1)">
34 </div> 34 </div>
@@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
43 <input type="button" class="btn btn-default " value="返回" onclick="history.go(-1)"> 43 <input type="button" class="btn btn-default " value="返回" onclick="history.go(-1)">
44 </div> 44 </div>
45 </div> 45 </div>
  46 + <div class="clearfix"></div>
46 </div> 47 </div>
47 </div> 48 </div>
48 </div> 49 </div>
@@ -51,13 +52,13 @@ @@ -51,13 +52,13 @@
51 <div id="main" class="contentpanel"></div> 52 <div id="main" class="contentpanel"></div>
52 53
53 <!--pc端店铺基础模板--> 54 <!--pc端店铺基础模板-->
54 -<script type="text/template" id="shopWeb-pc-1"> 55 +<script type="text/template" id="1-pc">
55 56
56 <div class="model-wrap contentpanel-pc"> 57 <div class="model-wrap contentpanel-pc">
57 <!--banner--> 58 <!--banner-->
58 - <div class="model-banner model-editor" data-toggle="editor-banner" data-title="顶部图片编辑">  
59 - <img src="[[resources.shopTopBanner.data[0].shopSrc]]">  
60 - [[if resources.shopTopBanner.data[0].isShowShopName == "Y"]] 59 + <div class="model-banner model-editor" data-toggle="editor-banner-base" data-title="顶部图片编辑">
  60 + <img src="[[resources.shopTopBanner_base.data[0].shopSrc]]">
  61 + [[if resources.shopTopBanner_base.data[0].isShowShopName == "Y"]]
61 <h1>[[shopName]]</h1> 62 <h1>[[shopName]]</h1>
62 [[/if]] 63 [[/if]]
63 </div> 64 </div>
@@ -86,7 +87,7 @@ @@ -86,7 +87,7 @@
86 </script> 87 </script>
87 88
88 <!--pc端店铺经典模板--> 89 <!--pc端店铺经典模板-->
89 -<script type="text/template" id="shopWeb-pc-2"> 90 +<script type="text/template" id="2-pc">
90 91
91 <div class="model-wrap contentpanel-pc"> 92 <div class="model-wrap contentpanel-pc">
92 <!--banner--> 93 <!--banner-->
@@ -161,8 +162,10 @@ @@ -161,8 +162,10 @@
161 162
162 <!--右侧main--> 163 <!--右侧main-->
163 <div class="model-main-right"> 164 <div class="model-main-right">
164 - <!--slide-->  
165 - <div class="model-slide model-editor" data-toggle="editor-largePic" data-title="资源位大图编辑"><img src="[[resources.largeSlideImg.data[0].data[0].src]]"></div> 165 + <!--资源位大图-->
  166 + <div class="model-slide model-editor" data-toggle="editor-largePic" data-title="资源位大图编辑">
  167 + <img src="[[resources.largeSlideImg.data[0].data[0].src]]">
  168 + </div>
166 <!--资源位小图--> 169 <!--资源位小图-->
167 <div class="model-sourcePic"> 170 <div class="model-sourcePic">
168 <ul class="model-editor" data-toggle="editor-smallPic" data-title="资源位小图编辑"> 171 <ul class="model-editor" data-toggle="editor-smallPic" data-title="资源位小图编辑">
@@ -251,7 +254,7 @@ @@ -251,7 +254,7 @@
251 </script> 254 </script>
252 255
253 <!--app端店铺模板--> 256 <!--app端店铺模板-->
254 -<script type="text/template" id="shopWeb-app"> 257 +<script type="text/template" id="2-app">
255 <div class="model-wrap contentpanel-app"> 258 <div class="model-wrap contentpanel-app">
256 <!--banner--> 259 <!--banner-->
257 <div class="model-banner model-editor" data-toggle="editor-banner" data-title="顶部图片编辑"> 260 <div class="model-banner model-editor" data-toggle="editor-banner" data-title="顶部图片编辑">
@@ -283,9 +286,11 @@ @@ -283,9 +286,11 @@
283 <div class="clear"></div> 286 <div class="clear"></div>
284 </ul> 287 </ul>
285 </div> 288 </div>
286 - <!--大图-->  
287 - <div class="largePic model-editor" data-toggle="editor-largePic-app" data-title="资源位大图编辑"><a href="javascript:"><img src="[[resources.largeSlideImg.data[0].data[0].src]]"></a></div>  
288 - <!--小图--> 289 + <!--资源位大图-->
  290 + <div class="largePic model-editor" data-toggle="editor-largePic" data-title="资源位大图编辑">
  291 + <img src="[[resources.largeSlideImg_APP.data[0].data[0].src]]">
  292 + </div>
  293 + <!--资源位小图-->
289 <div class="model-smallPic model-editor" data-toggle="editor-smallPic" data-title="资源位小图编辑"> 294 <div class="model-smallPic model-editor" data-toggle="editor-smallPic" data-title="资源位小图编辑">
290 <ul> 295 <ul>
291 [[each resources.oneRowTwoColImages_APP.data as item _index]] 296 [[each resources.oneRowTwoColImages_APP.data as item _index]]
@@ -297,12 +302,10 @@ @@ -297,12 +302,10 @@
297 <!--热门品类--> 302 <!--热门品类-->
298 <div class="sortList"> 303 <div class="sortList">
299 <span>热门品类</span> 304 <span>热门品类</span>
300 - <div class="sortListDetail model-editor" data-toggle="editor-recommend-app" data-title="热门品类编辑"> 305 + <div class="sortListDetail model-editor" data-toggle="editor-recommend" data-title="热门品类编辑">
301 <ul> 306 <ul>
302 - [[each resources.recommend.data as item _index]]  
303 - [[if item.isShowInApp == "Y"]] 307 + [[each resources.recommend_APP.data as item _index]]
304 <li><img src="[[item.src]]"><a href="[[item.url]]">[[item.name]]</a></li> 308 <li><img src="[[item.src]]"><a href="[[item.url]]">[[item.name]]</a></li>
305 - [[/if]]  
306 [[/each]] 309 [[/each]]
307 </ul> 310 </ul>
308 <div class="clear"></div> 311 <div class="clear"></div>
@@ -341,7 +344,8 @@ @@ -341,7 +344,8 @@
341 <div class="topListDetail"> 344 <div class="topListDetail">
342 <ul> 345 <ul>
343 [[each data as item _index]] 346 [[each data as item _index]]
344 - <li class="topAdd" data-productId="[[item.productId]]" data-productName="[[item.productName]]" data-productPrice="[[item.salesPrice]]" data-productSkn="[[item.productSkn]]"> 347 + <li class="topAdd" data-productId="[[item.productId]]" data-productName="[[item.productName]]"
  348 + data-productPrice="[[item.salesPrice]]" data-productSkn="[[item.productSkn]]" data-cnAlphabet="[[item.cnAlphabet]]" data-goodsId ="[[item.goodsId]]">
345 <a href="javascript:"><img src="[[item.src]]"><b></b><span>top[[_index+1]]</span><i></i></a> 349 <a href="javascript:"><img src="[[item.src]]"><b></b><span>top[[_index+1]]</span><i></i></a>
346 </li> 350 </li>
347 [[/each]] 351 [[/each]]
@@ -352,5 +356,4 @@ @@ -352,5 +356,4 @@
352 <i>*&nbsp;&nbsp;</i><span></span> 356 <i>*&nbsp;&nbsp;</i><span></span>
353 </div> 357 </div>
354 </div> 358 </div>
355 -</script>  
356 - 359 +</script>