...
|
...
|
@@ -11,6 +11,7 @@ var shopType = 1; //店铺类型 1:单品牌,2:多品牌 |
|
|
var shopOperate = 'view'; //操作 editor:可编辑, view:查看不可编辑
|
|
|
var ENUM = {
|
|
|
"editor-largePic":{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0},
|
|
|
"editor-largePic2":{"position":"", "data":[{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0}]},
|
|
|
"editor-smallPic":{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0},
|
|
|
"editor-brand":{"position":"", "name":"", "url":""},
|
|
|
"editor-recommend": {"position":"", "name":"", "enName":"", "src":"", "url":"","isShowInApp":"Y"},
|
...
|
...
|
@@ -24,7 +25,7 @@ var ENUM = { |
|
|
var resourcesNew = {
|
|
|
"shopTopBanner":{
|
|
|
"id":"",
|
|
|
"data": [{"shopSrc": "","shopSrc0":"", "detailSrc": "", "isShowShopName": "Y"}]
|
|
|
"data": [{"shopSrc0":"","detailSrc0": "", "isShowShopName0": "Y", "shopSrc": "", "detailSrc": "", "isShowShopName": "Y"}]
|
|
|
},
|
|
|
"navigationBar":{
|
|
|
"id":"",
|
...
|
...
|
@@ -33,10 +34,6 @@ var resourcesNew = { |
|
|
"largeSlideImg":{
|
|
|
"id":"",
|
|
|
"data": [
|
|
|
{"position": 5, "data":[{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0}]},
|
|
|
{"position": 4, "data":[{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0}]},
|
|
|
{"position": 3, "data":[{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0}]},
|
|
|
{"position": 2, "data":[{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0}]},
|
|
|
{"position": 1, "data":[{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0}]}
|
|
|
]
|
|
|
},
|
...
|
...
|
@@ -127,6 +124,12 @@ function showMain(){ |
|
|
}else if(shopType == 1){
|
|
|
$(".model-brand").hide();
|
|
|
}
|
|
|
//标签长度样式自适应
|
|
|
$.each($(".contentpanel-pc .model-showTitle .showTab"),function(){
|
|
|
if($(this).width() > 280){
|
|
|
$(this).css("right",(280-($(this).width()))+"px");
|
|
|
}
|
|
|
})
|
|
|
showEditorIconEvent();
|
|
|
}
|
|
|
//弹窗编辑主流程
|
...
|
...
|
@@ -141,6 +144,7 @@ function editorIconEvent(title,id){ |
|
|
if(!(curDialogId == "editor-largePic-app" || curDialogId == "editor-recommend-app" || curDialogId == "editor-brand-app")){
|
|
|
freshJson(id, g.__rows, 1);
|
|
|
}
|
|
|
console.log(g.__rows);
|
|
|
showMain();
|
|
|
}else{
|
|
|
return false;
|
...
|
...
|
@@ -170,20 +174,25 @@ function findDecoration(){ |
|
|
}
|
|
|
},
|
|
|
function(rs) {
|
|
|
console.log(rs.data);
|
|
|
console.log(rs);
|
|
|
if(rs.data){
|
|
|
jsonMain = rs.data;
|
|
|
}
|
|
|
if(jsonMain.templateName){
|
|
|
curTemplateType = jsonMain.templateName;
|
|
|
}
|
|
|
//没有装修信息,初始化装修信息
|
|
|
if($.isEmptyObject(jsonMain.resources)){
|
|
|
jsonMain.resources = $.extend(true,{},resourcesNew);
|
|
|
}
|
|
|
//装修信息中品牌内容为空,初始化品牌
|
|
|
if(jsonMain.resources.brandBrowse.data.length < 1 && jsonMain.brandList){
|
|
|
cloneArr(jsonMain.brandList,jsonMain.resources.brandBrowse.data);
|
|
|
if(jsonMain.brandList){
|
|
|
if(jsonMain.resources.brandBrowse.data.length < 1){
|
|
|
cloneArr(jsonMain.brandList,jsonMain.resources.brandBrowse.data);
|
|
|
}
|
|
|
}else{
|
|
|
common.util.__tip("店铺没有品牌,无法装修,请返回添加品牌!");
|
|
|
return;
|
|
|
}
|
|
|
if(jsonMain.templateName){
|
|
|
curTemplateType = jsonMain.templateName;
|
|
|
}
|
|
|
//装修json克隆
|
|
|
jsonClone = $.extend(true,{},jsonMain);
|
...
|
...
|
@@ -247,7 +256,7 @@ function saveDecoration(submitStatus){ |
|
|
}
|
|
|
//Ajax审核,审核通过:300,驳回:900
|
|
|
function checkDecoration(checkStatus,comment){
|
|
|
if(comment){
|
|
|
if(comment){ //驳回
|
|
|
common.util.__ajax({
|
|
|
url:'/store/shop-decoration-check',
|
|
|
data: {
|
...
|
...
|
@@ -256,12 +265,12 @@ function checkDecoration(checkStatus,comment){ |
|
|
"comment": comment
|
|
|
}
|
|
|
},function(rs){
|
|
|
common.util.__tip("审核通过成功!","success");
|
|
|
common.util.__tip("审核驳回成功!","success");
|
|
|
setTimeout(function() {
|
|
|
location.href="/supplier/check/index";
|
|
|
}, 1000);
|
|
|
},true);
|
|
|
}else{
|
|
|
}else{ //通过
|
|
|
common.util.__ajax({
|
|
|
url:'/store/shop-decoration-check',
|
|
|
data: {
|
...
|
...
|
@@ -269,7 +278,7 @@ function checkDecoration(checkStatus,comment){ |
|
|
"checkStatus": checkStatus
|
|
|
}
|
|
|
},function(rs){
|
|
|
common.util.__tip("审核驳回成功!","success");
|
|
|
common.util.__tip("审核通过成功!","success");
|
|
|
setTimeout(function() {
|
|
|
location.href="/supplier/check/index";
|
|
|
}, 1000);
|
...
|
...
|
@@ -289,11 +298,7 @@ function gridInit(id){ |
|
|
el:"#"+id,
|
|
|
columns:[
|
|
|
{display:"店铺banner图片", render:function(item){
|
|
|
if(curTemplateType == "2"){
|
|
|
return "<input type=file name='shopBannerImage' id='shopBannerImage_"+item.__index+"' value='"+item.shopSrc+"' />";
|
|
|
}else{
|
|
|
return "<input type=file name='shopBannerImage' id='shopBannerImage_"+item.__index+"' value='"+item.shopSrc0+"' />";
|
|
|
}
|
|
|
return "<input type=file name='shopBannerImage' id='shopBannerImage_"+item.__index+"' value='"+item.shopSrc+"' />";
|
|
|
}},
|
|
|
{display:"是否显示店铺名称", render:function(item){
|
|
|
if(item.isShowShopName == "Y"){
|
...
|
...
|
@@ -336,20 +341,26 @@ function gridInit(id){ |
|
|
|
|
|
//店铺大图资源位
|
|
|
case "editor-largePic":
|
|
|
$('.editorTitle').html("<a href='javascript:' class='btn btn-success addBtn2' style='margin-right: 20px'><i class='fa fa-plus'></i> 添加资源大图</a><span class='largePicAddTip'></span>").css("margin-bottom","10px");
|
|
|
g = new common.grid({
|
|
|
hash: false,
|
|
|
el:"#"+id,
|
|
|
columns:[
|
|
|
{display:"排序", render:function(item){
|
|
|
item.position=item.position || (item.__index+1);
|
|
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
|
|
}},
|
|
|
{
|
|
|
display:"<div class='row'><div class='col-sm-2'>图片</div><div class='col-sm-3'>链接</div><div class='col-sm-2'>开始时间</div><div class='col-sm-2'>结束时间</div> " +
|
|
|
{display:"<div class='row'><div class='col-sm-2'>图片</div><div class='col-sm-3'>链接</div><div class='col-sm-2'>开始时间</div><div class='col-sm-2'>结束时间</div> " +
|
|
|
"<div class='col-sm-1'>状态</div><div class='col-sm-2'>操作</div></div>",
|
|
|
render: function (item) {
|
|
|
return resourcesHtmlInit(item,"largePic");
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{display:"操作", render:function(item){
|
|
|
if(g.__rows.length > 1){
|
|
|
return "<input type=button class='btn btn-warning btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
}}
|
|
|
]
|
|
|
});
|
|
|
g.__rows=""||jsonClone.resources.largeSlideImg.data;
|
...
|
...
|
@@ -511,10 +522,10 @@ function gridInit(id){ |
|
|
return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />";
|
|
|
}},
|
|
|
{display:"开始时间", render:function(item){
|
|
|
return "<input type=text class='form-control inputChange' readOnly='true' jsaction='time:end:endTime_"+item.__index+"' id='startTime_"+item.__index+"' name='startTime' value='"+item.startTime+"' data-index='"+item.__index+"' />";
|
|
|
return "<input type=text class='form-control inputChange' style='background-color:#fff' readOnly='true' jsaction='time:end:endTime_"+item.__index+"' id='startTime_"+item.__index+"' name='startTime' value='"+item.startTime+"' data-index='"+item.__index+"' />";
|
|
|
}},
|
|
|
{display:"结束时间", render:function(item){
|
|
|
return "<input type=text class='form-control inputChange' readOnly='true' jsaction='time:start:startTime_"+item.__index+"' id='endTime_"+item.__index+"' name='endTime' value='"+item.endTime+"' data-index='"+item.__index+"' />";
|
|
|
return "<input type=text class='form-control inputChange' style='background-color:#fff' readOnly='true' jsaction='time:start:startTime_"+item.__index+"' id='endTime_"+item.__index+"' name='endTime' value='"+item.endTime+"' data-index='"+item.__index+"' />";
|
|
|
}},
|
|
|
{display:"状态", render:function(item){
|
|
|
return "<span style='white-space: nowrap'>" + (item.publishStatus==0?"未发布":"已发布") + "</span>";
|
...
|
...
|
@@ -990,11 +1001,7 @@ function untilEditorEvent(id){ |
|
|
e.on("callback",function(obj){
|
|
|
if(/^file_onComplete_shopBannerImage_/.test(obj.key)){
|
|
|
var _index = obj.key.replace(/^file_onComplete_shopBannerImage_/,'');
|
|
|
if(curTemplateType == "2"){
|
|
|
g.__rows[_index].shopSrc = obj.data;
|
|
|
}else{
|
|
|
g.__rows[_index].shopSrc0 = obj.data;
|
|
|
}
|
|
|
g.__rows[_index].shopSrc = obj.data;
|
|
|
}
|
|
|
if(/^file_onComplete_DetailbannerImage_/.test(obj.key)){
|
|
|
var _index = obj.key.replace(/^file_onComplete_DetailbannerImage_/,'');
|
...
|
...
|
@@ -1020,8 +1027,7 @@ function untilEditorEvent(id){ |
|
|
}
|
|
|
});
|
|
|
$("#"+id+" nav").hide();
|
|
|
$(".modal-dialog").css("width","900px");
|
|
|
$(".modal-dialog .modal-body .editor-dialog").css("max-height",($(window).height()-300) + "px");
|
|
|
$(".modal-dialog").css("width","960px");
|
|
|
$(".modal-dialog .modal-body .editor-dialog").css("overflow-y","auto");
|
|
|
$(".modal-dialog .modal-body .editor-dialog").css("overflow-x","hidden");
|
|
|
}
|
...
|
...
|
@@ -1033,10 +1039,15 @@ function resourcesHtmlInit(item,resName){ |
|
|
htmlPic += "<div class='row'>" +
|
|
|
"<div class='col-sm-2'><input type=file name='"+ resName +"Image' id='"+ resName +"Image_"+item.__index+"_"+i+"' value='"+picList[i].src+"' /></div>" +
|
|
|
"<div class='col-sm-3'><input type=text class='form-control inputChange' name='url' value='"+ picList[i].url +"' data-index='"+ item.__index +"_"+ i +"' /></div>" +
|
|
|
"<div class='col-sm-2'>" +
|
|
|
"<input type=text class='form-control inputChange' readOnly='true' jsaction='time:end:endTime_"+item.__index+"_"+ i +"' id='startTime_"+item.__index+"_"+ i +"' name='startTime' value='"+ picList[i].startTime +"' data-index='"+ item.__index +"_"+ i +"' /></div>" +
|
|
|
"<div class='col-sm-2'>" +
|
|
|
"<input type=text class='form-control inputChange' 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>" +
|
|
|
"<div class='col-sm-2'>";
|
|
|
if(i>0){
|
|
|
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 +"' />" +
|
|
|
"<span style='color: #999; font-size: 12px'>*上一条结束时间</span>";
|
|
|
}else{
|
|
|
htmlPic += "<input type=text class='form-control inputChange' style='background-color:#fff' readOnly='true' jsaction='time:end:endTime_"+item.__index+"_"+ i +"' id='startTime_"+item.__index+"_"+ i +"' name='startTime' value='"+ picList[i].startTime +"' data-index='"+ item.__index +"_"+ i +"' />";
|
|
|
}
|
|
|
htmlPic += "</div><div class='col-sm-2'>" +
|
|
|
"<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>" +
|
|
|
"<div class='col-sm-1'><span style='white-space: nowrap;'>"+ (picList[i].publishStatus==0?"未发布":"已发布") +"</span></div>" +
|
|
|
"<div class='col-sm-2'>";
|
|
|
if(i == (picList.length-1) && picList.length > 1){
|
...
|
...
|
@@ -1189,12 +1200,28 @@ $(document).on("click",".addBtn",function(){ |
|
|
|
|
|
if(indexList.length > 1){
|
|
|
g.__rows[indexList[0]].data.push($.extend({},ENUM[curDialogId]));
|
|
|
if(curDialogId == "editor-largePic" || curDialogId == "editor-smallPic"){
|
|
|
(g.__rows[indexList[0]].data)[(parseInt(indexList[1]) + 1)].startTime = (g.__rows[indexList[0]].data)[indexList[1]].endTime;
|
|
|
}
|
|
|
}else{
|
|
|
g.__rows.push($.extend({},ENUM[curDialogId]));
|
|
|
}
|
|
|
g.init(g.__rows);
|
|
|
untilEditorEvent(curDialogId);
|
|
|
});
|
|
|
//资源位大图添加一条资源位
|
|
|
$(document).on("click",".addBtn2",function(){
|
|
|
if(g.__rows.length > 4){
|
|
|
$(".largePicAddTip").text("* 最多只能添加5个资源位大图!").css("color","#ff0000");
|
|
|
return;
|
|
|
}else{
|
|
|
$(".largePicAddTip").empty();
|
|
|
g.__rows.push($.extend(true,{},ENUM["editor-largePic2"]));
|
|
|
g.init(g.__rows);
|
|
|
untilEditorEvent(curDialogId);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
//input change同时更新json
|
|
|
$(document).on("change",".inputChange",function(){
|
|
|
var _index = $(this).attr("data-index");
|
...
|
...
|
@@ -1206,6 +1233,14 @@ $(document).on("change",".inputChange",function(){ |
|
|
}else{
|
|
|
g.__rows[indexList[0]][_name] = $(this).val();
|
|
|
}
|
|
|
if(curDialogId == "editor-largePic" || curDialogId == "editor-smallPic"){
|
|
|
if($(this).attr("name") == "endTime"){
|
|
|
if(g.__rows[indexList[0]].data.length - 1 > indexList[1]){
|
|
|
$(this).parents(".row").next().children().find("input[name='startTime']").val($(this).val());
|
|
|
(g.__rows[indexList[0]].data)[(parseInt(indexList[1]) + 1)].startTime = $(this).val();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$(this).removeClass("error");
|
|
|
});
|
|
|
//checkBox change同时更新json
|
...
|
...
|
|