...
|
...
|
@@ -106,13 +106,13 @@ function getParams(){ |
|
|
shopOperate = paramList[4];
|
|
|
}
|
|
|
if(shopOperate == 'editor'){
|
|
|
$(".moduleTypeSelect").show();
|
|
|
$(".moduleTypeSelect").show().find("#templateSelect").removeAttr("disabled");
|
|
|
$(".moduleSubmite").show().siblings().hide();
|
|
|
}else if(shopOperate == 'view'){
|
|
|
$(".moduleTypeSelect").hide();
|
|
|
$(".moduleView").show().siblings().hide();
|
|
|
}else if(shopOperate == 'check'){
|
|
|
$(".moduleTypeSelect").hide();
|
|
|
$(".moduleTypeSelect").show().find("#templateSelect").attr("disabled","disabled");
|
|
|
$(".moduleCheck").show().siblings().hide();
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -142,11 +142,14 @@ function editorIconEvent(title,id){ |
|
|
title,
|
|
|
"<div class='editorTitle'></div><div class='editor-dialog' id='"+ id +"'></div><div class='editorTip'></div> ",
|
|
|
function(){
|
|
|
if(!(curDialogId == "editor-largePic-app" || curDialogId == "editor-recommend-app" || curDialogId == "editor-brand-app")){
|
|
|
freshJson(id, g.__rows, 1);
|
|
|
if(editorCheck(id)){
|
|
|
if(!(curDialogId == "editor-largePic-app" || curDialogId == "editor-recommend-app" || curDialogId == "editor-brand-app")){
|
|
|
freshJson(id, g.__rows, 1);
|
|
|
}
|
|
|
showMain();
|
|
|
}else{
|
|
|
return false;
|
|
|
}
|
|
|
showMain();
|
|
|
//return false;
|
|
|
},
|
|
|
function(){
|
|
|
if(!(curDialogId == "editor-largePic-app" || curDialogId == "editor-recommend-app" || curDialogId == "editor-brand-app")){
|
...
|
...
|
@@ -154,7 +157,6 @@ function editorIconEvent(title,id){ |
|
|
}
|
|
|
}
|
|
|
);
|
|
|
|
|
|
gridInit(id);
|
|
|
untilEditorEvent(id);
|
|
|
editorTipInit(id);
|
...
|
...
|
@@ -202,7 +204,6 @@ function findTopNewProducts(){ |
|
|
"size": 20
|
|
|
}
|
|
|
},function(rs){
|
|
|
console.log(rs.data);
|
|
|
topNewProducts = rs.data;
|
|
|
},true);
|
|
|
}
|
...
|
...
|
@@ -239,125 +240,26 @@ function saveDecoration(submitStatus){ |
|
|
});
|
|
|
}
|
|
|
//Ajax审核
|
|
|
function checkDecoration(checkStatus){
|
|
|
common.util.__ajax({
|
|
|
url:'/store/shop-decoration-check',
|
|
|
data: {
|
|
|
"id": _id,
|
|
|
"checkStatus": checkStatus
|
|
|
}
|
|
|
},function(rs){});
|
|
|
}
|
|
|
|
|
|
/********************事件绑定*********************/
|
|
|
|
|
|
//pc跟app的tab选项事件
|
|
|
$(document).on("click",".tabheader .nav-tabs li",function(){
|
|
|
$(this).addClass('active').siblings('li').removeClass('active');
|
|
|
curPlatform = $(this).attr("data-toggle");
|
|
|
if(curPlatform == "shopWeb-app"){
|
|
|
$(".moduleTypeView").hide();
|
|
|
}else{
|
|
|
$(".moduleTypeView").show();
|
|
|
}
|
|
|
showMain();
|
|
|
})
|
|
|
//基础模板,经典模板切换
|
|
|
$(document).on("click","input[name=brandLevel]",function(){
|
|
|
curTemplateType = $("input[name=brandLevel]:checked").val();
|
|
|
showMain();
|
|
|
})
|
|
|
//选择使用模板
|
|
|
$(document).on("change","#templateSelect",function(){
|
|
|
jsonMain.templateName = $(this).val();
|
|
|
})
|
|
|
//暂存模板
|
|
|
$(document).on("click","#saveModule",function(){
|
|
|
if(jsonMain.templateName == "0"){
|
|
|
alert("请选择展示使用模板!");
|
|
|
return;
|
|
|
}
|
|
|
saveDecoration(100);
|
|
|
})
|
|
|
//提交审核
|
|
|
$(document).on("click","#submitModule",function(){
|
|
|
if(jsonMain.templateName == "0"){
|
|
|
alert("请选择展示使用模板!");
|
|
|
return;
|
|
|
}
|
|
|
saveDecoration(200);
|
|
|
})
|
|
|
//审核通过
|
|
|
$(document).on("click","#checkOk",function(){
|
|
|
checkDecoration(300);
|
|
|
})
|
|
|
//驳回
|
|
|
$(document).on("click","#checkNo",function(){
|
|
|
checkDecoration(900);
|
|
|
})
|
|
|
//删除
|
|
|
$(document).on("click",".deleteBtn",function(){
|
|
|
var _index = $(this).data("index")+"";
|
|
|
var indexList = _index.split("_");
|
|
|
|
|
|
if(indexList.length > 1){
|
|
|
[].splice.call(g.__rows[indexList[0]].data,indexList[1],1);
|
|
|
}else{
|
|
|
[].splice.call(g.__rows,indexList[0],1);
|
|
|
}
|
|
|
g.init(g.__rows);
|
|
|
untilEditorEvent(curDialogId);
|
|
|
|
|
|
if(curDialogId == "editor-newProduct" || curDialogId == "editor-hotProduct"){
|
|
|
productTopDataLink(g.__rows);
|
|
|
}
|
|
|
});
|
|
|
//添加一条
|
|
|
$(document).on("click",".addBtn",function(){
|
|
|
var _index = $(this).data("index")+"";
|
|
|
var indexList = _index.split("_");
|
|
|
|
|
|
if(indexList.length > 1){
|
|
|
g.__rows[indexList[0]].data.push($.extend({},ENUM[curDialogId]));
|
|
|
}else{
|
|
|
g.__rows.push($.extend({},ENUM[curDialogId]));
|
|
|
}
|
|
|
g.init(g.__rows);
|
|
|
untilEditorEvent(curDialogId);
|
|
|
});
|
|
|
//input change同时更新json
|
|
|
$(document).on("change",".inputChange",function(){
|
|
|
var _index = $(this).attr("data-index");
|
|
|
var indexList = _index.split("_");
|
|
|
var _name = $(this).attr("name");
|
|
|
|
|
|
if(indexList.length > 1){
|
|
|
(g.__rows[indexList[0]].data)[indexList[1]][_name] = $(this).val();
|
|
|
}else{
|
|
|
g.__rows[indexList[0]][_name] = $(this).val();
|
|
|
}
|
|
|
});
|
|
|
//选择Top20
|
|
|
$(document).on("click",".topAdd",function(){
|
|
|
if(g.__rows.length < 8){
|
|
|
if(!$(this).hasClass("selected")){
|
|
|
$(this).addClass("selected");
|
|
|
var item = $.extend({},ENUM[curDialogId]);
|
|
|
item.src = $(this).find('img').attr("src");
|
|
|
item.productId = $(this).attr("data-productId");
|
|
|
item.productName = $(this).attr("data-productName");
|
|
|
item.productPrice = $(this).attr("data-productPrice");
|
|
|
|
|
|
g.__rows.push(item);
|
|
|
g.init(g.__rows);
|
|
|
untilEditorEvent(curDialogId);
|
|
|
|
|
|
$(".topTip span").text("已经勾选"+ g.__rows.length +"件,最多勾选8件商品!");
|
|
|
}
|
|
|
function checkDecoration(checkStatus,comment){
|
|
|
if(comment){
|
|
|
common.util.__ajax({
|
|
|
url:'/store/shop-decoration-check',
|
|
|
data: {
|
|
|
"id": _id,
|
|
|
"checkStatus": checkStatus,
|
|
|
"comment": comment
|
|
|
}
|
|
|
},function(rs){});
|
|
|
}else{
|
|
|
$(".topTip span").text("商品数量已满8个,无法继续添加商品!");
|
|
|
common.util.__ajax({
|
|
|
url:'/store/shop-decoration-check',
|
|
|
data: {
|
|
|
"id": _id,
|
|
|
"checkStatus": checkStatus
|
|
|
}
|
|
|
},function(rs){});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/********************工具类*********************/
|
|
|
|
...
|
...
|
@@ -458,6 +360,7 @@ function gridInit(id){ |
|
|
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:"名称", render:function(item){
|
...
|
...
|
@@ -467,11 +370,18 @@ function gridInit(id){ |
|
|
return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />";
|
|
|
}},
|
|
|
{display:"操作", render:function(item){
|
|
|
var html = "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
if(item.__index == g.__rows.length-1){
|
|
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
var htmlPic = "",i=item.__index;
|
|
|
if(i == (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
return html;
|
|
|
if(i < (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
if(i == (g.__rows.length-1) && g.__rows.length == 1){
|
|
|
htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
return htmlPic;
|
|
|
}}
|
|
|
]
|
|
|
});
|
...
|
...
|
@@ -486,6 +396,7 @@ function gridInit(id){ |
|
|
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:"名称", render:function(item){
|
...
|
...
|
@@ -500,17 +411,24 @@ function gridInit(id){ |
|
|
}},
|
|
|
{display:"APP展示", render:function(item){
|
|
|
if(item.isShowInApp == "Y"){
|
|
|
return "<input class='form-control' type=checkBox name='isShowInApp' value='"+item.isShowInApp+"' checked />";
|
|
|
return "<input class='form-control checkBoxChange' type=checkBox name='isShowInApp' data-index='"+item.__index+"' checked />";
|
|
|
}else{
|
|
|
return "<input class='form-control' type=checkBox name='isShowInApp' value='"+item.isShowInApp+"' />";
|
|
|
return "<input class='form-control checkBoxChange' type=checkBox name='isShowInApp' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
}},
|
|
|
{display:"操作", render:function(item){
|
|
|
var html = "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
if(item.__index == g.__rows.length-1){
|
|
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
var htmlPic = "",i=item.__index;
|
|
|
if(i == (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
return html;
|
|
|
if(i < (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
if(i == (g.__rows.length-1) && g.__rows.length == 1){
|
|
|
htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
return htmlPic;
|
|
|
}}
|
|
|
]
|
|
|
});
|
...
|
...
|
@@ -525,6 +443,7 @@ function gridInit(id){ |
|
|
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:"图片", render:function(item){
|
...
|
...
|
@@ -534,11 +453,18 @@ function gridInit(id){ |
|
|
return "<input class='form-control inputChange' type=text name='url' value='"+item.url+"' data-index='"+item.__index+"' />";
|
|
|
}},
|
|
|
{display:"操作", render:function(item){
|
|
|
var html = "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
if(item.__index == g.__rows.length-1){
|
|
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
var htmlPic = "",i=item.__index;
|
|
|
if(i == (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
return html;
|
|
|
if(i < (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
if(i == (g.__rows.length-1) && g.__rows.length == 1){
|
|
|
htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
return htmlPic;
|
|
|
}}
|
|
|
]
|
|
|
});
|
...
|
...
|
@@ -552,6 +478,7 @@ function gridInit(id){ |
|
|
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:"图片", render:function(item){
|
...
|
...
|
@@ -570,11 +497,18 @@ function gridInit(id){ |
|
|
return "<span style='white-space: nowrap'>" + (item.publishStatus==0?"未发布":"已发布") + "</span>";
|
|
|
}},
|
|
|
{display:"操作", render:function(item){
|
|
|
var html = "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
if(item.__index == g.__rows.length-1){
|
|
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
var htmlPic = "",i=item.__index;
|
|
|
if(i == (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
return html;
|
|
|
if(i < (g.__rows.length-1) && g.__rows.length > 1){
|
|
|
htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
if(i == (g.__rows.length-1) && g.__rows.length == 1){
|
|
|
htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
return htmlPic;
|
|
|
}}
|
|
|
]
|
|
|
});
|
...
|
...
|
@@ -591,6 +525,7 @@ function gridInit(id){ |
|
|
if(item.__index == 0){
|
|
|
return item.position;
|
|
|
}else{
|
|
|
item.position=item.position || (item.__index);
|
|
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
}},
|
...
|
...
|
@@ -611,11 +546,11 @@ function gridInit(id){ |
|
|
{display:"操作", render:function(item){
|
|
|
var html = "";
|
|
|
if(item.__index == 0 && g.__rows.length == 1){
|
|
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
html += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}else{
|
|
|
if(g.__rows.length > 1 && item.__index > 0){
|
|
|
html += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
if(g.__rows.length > 1 && item.__index == g.__rows.length - 1){
|
|
|
if(g.__rows.length > 1 && g.__rows.length < 5 && item.__index == g.__rows.length - 1){
|
|
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -637,6 +572,7 @@ function gridInit(id){ |
|
|
if(item.__index == 0){
|
|
|
return item.position;
|
|
|
}else{
|
|
|
item.position=item.position || (item.__index);
|
|
|
return "<input class='form-control numInput inputChange' type=text name='position' value='"+item.position+"' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
}},
|
...
|
...
|
@@ -657,11 +593,11 @@ function gridInit(id){ |
|
|
{display:"操作", render:function(item){
|
|
|
var html = "";
|
|
|
if(item.__index == 0 && g.__rows.length == 1){
|
|
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
html += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}else{
|
|
|
if(g.__rows.length > 1 && item.__index > 0){
|
|
|
html += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+item.__index+"' /><br>";
|
|
|
if(g.__rows.length > 1 && item.__index == g.__rows.length - 1){
|
|
|
if(g.__rows.length > 1 && g.__rows.length < 5 && item.__index == g.__rows.length - 1){
|
|
|
html += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+item.__index+"' />";
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -683,6 +619,7 @@ function gridInit(id){ |
|
|
el:"#editor-newProduct-grid",
|
|
|
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:"图片", render:function(item){
|
...
|
...
|
@@ -708,6 +645,7 @@ function gridInit(id){ |
|
|
el:"#editor-hotProduct-grid",
|
|
|
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:"图片", render:function(item){
|
...
|
...
|
@@ -877,10 +815,10 @@ function editorTipInit(id){ |
|
|
tipHtml = "<span>提示:请上传像素160*240的图片。</span>";
|
|
|
break;
|
|
|
case "editor-newGoodTab":
|
|
|
tipHtml = "<span>提示:标题名称最多5个汉字。</span>";
|
|
|
tipHtml = "<span>提示:最多编辑5个标签,标题名称最多5个汉字。</span>";
|
|
|
break;
|
|
|
case "editor-hotGoodTab":
|
|
|
tipHtml = "<span>提示:标题名称最多5个汉字。</span>";
|
|
|
tipHtml = "<span>提示:最多编辑5个标签,标题名称最多5个汉字。</span>";
|
|
|
break;
|
|
|
default :
|
|
|
break;
|
...
|
...
|
@@ -890,66 +828,104 @@ function editorTipInit(id){ |
|
|
//弹出框编辑校验
|
|
|
function editorCheck(id){
|
|
|
switch (id){
|
|
|
case "editor-banner":
|
|
|
return true;
|
|
|
break;
|
|
|
|
|
|
case "editor-nav":
|
|
|
return true;
|
|
|
break;
|
|
|
|
|
|
case "editor-largePic":
|
|
|
return true;
|
|
|
return (checkNumInput() && checkEndTime());
|
|
|
break;
|
|
|
|
|
|
case "editor-smallPic":
|
|
|
return true;
|
|
|
return (checkNumInput() && checkEndTime());
|
|
|
break;
|
|
|
|
|
|
case "editor-brand":
|
|
|
return true;
|
|
|
return checkNumInput();
|
|
|
break;
|
|
|
|
|
|
case "editor-recommend":
|
|
|
return true;
|
|
|
var title = $(".editorTitle input[name='title']");
|
|
|
if(title.val()){
|
|
|
if(checkNumInput()){
|
|
|
var nameList = $(".grid input[name='name']");
|
|
|
for(var i=0; i<nameList.length; i++){
|
|
|
if(!nameList.eq(i).val()){
|
|
|
nameList.eq(i).focus().addClass("error");
|
|
|
common.util.__tip("中文名不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
}else{
|
|
|
title.focus().addClass("error");
|
|
|
common.util.__tip("模块标题不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case "editor-hotRecommend":
|
|
|
return true;
|
|
|
return checkNumInput();
|
|
|
break;
|
|
|
|
|
|
case "editor-signboard":
|
|
|
var endTimeList = $(".grid input[name='endTime']");
|
|
|
for(var i=0; i<endTimeList.length; i++){
|
|
|
if(!endTimeList.eq(i).val()){
|
|
|
alert("结束时间为空!");
|
|
|
endTimeList.eq(i).focus();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
return (checkNumInput() && checkEndTime());
|
|
|
break;
|
|
|
|
|
|
case "editor-newGoodTab":
|
|
|
return true;
|
|
|
return checkNumInput();
|
|
|
break;
|
|
|
|
|
|
case "editor-hotGoodTab":
|
|
|
return true;
|
|
|
return checkNumInput();
|
|
|
break;
|
|
|
|
|
|
case "editor-newProduct":
|
|
|
return true;
|
|
|
return checkNumInput();
|
|
|
break;
|
|
|
|
|
|
case "editor-hotProduct":
|
|
|
return true;
|
|
|
return checkNumInput();
|
|
|
break;
|
|
|
|
|
|
default :
|
|
|
return true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
//排序序号校验
|
|
|
function checkNumInput(){
|
|
|
var positionList = $(".grid input[name='position']");
|
|
|
for(var i=0; i<positionList.length; i++){
|
|
|
if(positionList.eq(i).val()){
|
|
|
if(!isNaN(positionList.eq(i).val())){
|
|
|
if(positionList.eq(i).val() <= 0){
|
|
|
positionList.eq(i).focus().select().addClass("error");
|
|
|
common.util.__tip("排序数字请大于0!");
|
|
|
return false;
|
|
|
}
|
|
|
}else{
|
|
|
positionList.eq(i).focus().select().addClass("error");
|
|
|
common.util.__tip("排序必须为数字!");
|
|
|
return false;
|
|
|
}
|
|
|
}else{
|
|
|
positionList.eq(i).focus().addClass("error");
|
|
|
common.util.__tip("排序不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
//结束时间校验
|
|
|
function checkEndTime(){
|
|
|
var endTimeList = $(".grid input[name='endTime']");
|
|
|
for(var i=0; i<endTimeList.length; i++){
|
|
|
if(!endTimeList.eq(i).val()){
|
|
|
endTimeList.eq(i).focus().addClass("error");
|
|
|
common.util.__tip("结束时间不能为空!");
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
//编辑动画事件
|
|
|
function showEditorIconEvent(){
|
|
|
if(shopOperate == 'editor'){
|
...
|
...
|
@@ -1080,4 +1056,147 @@ function cloneArr(arr1,arr2){ |
|
|
arr2.push($.extend(true,{},arr1[i]));
|
|
|
}
|
|
|
return arr2;
|
|
|
} |
|
|
\ No newline at end of file |
|
|
}
|
|
|
|
|
|
/********************事件绑定*********************/
|
|
|
|
|
|
//pc跟app的tab选项事件
|
|
|
$(document).on("click",".tabheader .nav-tabs li",function(){
|
|
|
$(this).addClass('active').siblings('li').removeClass('active');
|
|
|
curPlatform = $(this).attr("data-toggle");
|
|
|
if(curPlatform == "shopWeb-app"){
|
|
|
$(".moduleTypeView").hide();
|
|
|
}else{
|
|
|
$(".moduleTypeView").show();
|
|
|
}
|
|
|
showMain();
|
|
|
})
|
|
|
//基础模板,经典模板切换
|
|
|
$(document).on("click","input[name=brandLevel]",function(){
|
|
|
curTemplateType = $("input[name=brandLevel]:checked").val();
|
|
|
showMain();
|
|
|
})
|
|
|
//选择使用模板
|
|
|
$(document).on("change","#templateSelect",function(){
|
|
|
jsonMain.templateName = $(this).val();
|
|
|
})
|
|
|
//暂存模板
|
|
|
$(document).on("click","#saveModule",function(){
|
|
|
if(jsonMain.templateName == "0"){
|
|
|
common.util.__tip("请选择展示使用模板!");
|
|
|
return;
|
|
|
}
|
|
|
saveDecoration(100);
|
|
|
})
|
|
|
//提交审核
|
|
|
$(document).on("click","#submitModule",function(){
|
|
|
if(jsonMain.templateName == "0"){
|
|
|
common.util.__tip("请选择展示使用模板!");
|
|
|
return;
|
|
|
}
|
|
|
saveDecoration(200);
|
|
|
})
|
|
|
//审核通过
|
|
|
$(document).on("click","#checkOk",function(){
|
|
|
common.dialog.confirm(
|
|
|
"审核确认",
|
|
|
"你确认<strong style='color:#5cb85c'>审核通过</strong>么?",
|
|
|
function(){
|
|
|
checkDecoration(300);
|
|
|
},
|
|
|
function(){}
|
|
|
);
|
|
|
})
|
|
|
//驳回
|
|
|
$(document).on("click","#checkNo",function(){
|
|
|
common.dialog.confirm(
|
|
|
"审核驳回",
|
|
|
"你确认<strong style='color:#d9534f'>审核驳回</strong>么?如果确认,<strong style='color: #f0ad4e'>请填写驳回理由!</strong>" +
|
|
|
"<textarea id='checkComment' class='form-control' rows='3' style='margin: 10px 0'></textarea>" +
|
|
|
"<div class='editorTip' style='display: none'><span>提示:请填写驳回理由!</span></div>",
|
|
|
function(){
|
|
|
var comment = $("#checkComment").val();
|
|
|
if(comment){
|
|
|
checkDecoration(900,comment);
|
|
|
}else{
|
|
|
$(".editorTip").show();
|
|
|
return false;
|
|
|
}
|
|
|
},
|
|
|
function(){}
|
|
|
);
|
|
|
})
|
|
|
//删除
|
|
|
$(document).on("click",".deleteBtn",function(){
|
|
|
var _index = $(this).data("index")+"";
|
|
|
var indexList = _index.split("_");
|
|
|
|
|
|
if(indexList.length > 1){
|
|
|
[].splice.call(g.__rows[indexList[0]].data,indexList[1],1);
|
|
|
}else{
|
|
|
[].splice.call(g.__rows,indexList[0],1);
|
|
|
}
|
|
|
g.init(g.__rows);
|
|
|
untilEditorEvent(curDialogId);
|
|
|
|
|
|
if(curDialogId == "editor-newProduct" || curDialogId == "editor-hotProduct"){
|
|
|
productTopDataLink(g.__rows);
|
|
|
}
|
|
|
});
|
|
|
//添加一条
|
|
|
$(document).on("click",".addBtn",function(){
|
|
|
var _index = $(this).data("index")+"";
|
|
|
var indexList = _index.split("_");
|
|
|
|
|
|
if(indexList.length > 1){
|
|
|
g.__rows[indexList[0]].data.push($.extend({},ENUM[curDialogId]));
|
|
|
}else{
|
|
|
g.__rows.push($.extend({},ENUM[curDialogId]));
|
|
|
}
|
|
|
g.init(g.__rows);
|
|
|
untilEditorEvent(curDialogId);
|
|
|
});
|
|
|
//input change同时更新json
|
|
|
$(document).on("change",".inputChange",function(){
|
|
|
var _index = $(this).attr("data-index");
|
|
|
var indexList = _index.split("_");
|
|
|
var _name = $(this).attr("name");
|
|
|
|
|
|
if(indexList.length > 1){
|
|
|
(g.__rows[indexList[0]].data)[indexList[1]][_name] = $(this).val();
|
|
|
}else{
|
|
|
g.__rows[indexList[0]][_name] = $(this).val();
|
|
|
}
|
|
|
$(this).removeClass("error");
|
|
|
});
|
|
|
//checkBox change同时更新json
|
|
|
$(document).on("change",".checkBoxChange",function(){
|
|
|
var _index = $(this).attr("data-index");
|
|
|
var _name = $(this).attr("name");
|
|
|
if($(this).is(':checked')){
|
|
|
g.__rows[_index][_name] = "Y";
|
|
|
}else{
|
|
|
g.__rows[_index][_name] = "N";
|
|
|
}
|
|
|
});
|
|
|
//选择Top20
|
|
|
$(document).on("click",".topAdd",function(){
|
|
|
if(g.__rows.length < 8){
|
|
|
if(!$(this).hasClass("selected")){
|
|
|
$(this).addClass("selected");
|
|
|
var item = $.extend({},ENUM[curDialogId]);
|
|
|
item.src = $(this).find('img').attr("src");
|
|
|
item.productId = $(this).attr("data-productId");
|
|
|
item.productName = $(this).attr("data-productName");
|
|
|
item.productPrice = $(this).attr("data-productPrice");
|
|
|
|
|
|
g.__rows.push(item);
|
|
|
g.init(g.__rows);
|
|
|
untilEditorEvent(curDialogId);
|
|
|
|
|
|
$(".topTip span").text("已经勾选"+ g.__rows.length +"件,最多勾选8件商品!");
|
|
|
}
|
|
|
}else{
|
|
|
$(".topTip span").text("商品数量已满8个,无法继续添加商品!");
|
|
|
}
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|