...
|
...
|
@@ -61,6 +61,7 @@ if(!mainData.resources || $.isEmptyObject(mainData.resources)){ |
|
|
}
|
|
|
console.log(mainData);
|
|
|
|
|
|
//弹层编辑主配置
|
|
|
var ENUM = {
|
|
|
shopTopBanner:{
|
|
|
title:"PC顶部banner图片编辑",
|
...
|
...
|
@@ -72,22 +73,28 @@ var ENUM = { |
|
|
title:"APP顶部banner图片编辑",
|
|
|
template:"shopTopBanner_app",
|
|
|
data:"shopTopBanner_app",
|
|
|
tip:""
|
|
|
tip:"请上传像素750*468的图片,上传图片大小不能超过500KB"
|
|
|
},
|
|
|
navigationBar:{
|
|
|
title:"导航栏编辑",
|
|
|
template:"navigationBar",
|
|
|
data:"navigationBar"
|
|
|
data:"navigationBar",
|
|
|
validate: ['url'],
|
|
|
tip:"标题名称最多五个汉字"
|
|
|
},
|
|
|
largeSlideImg:{
|
|
|
title:"资源位大图编辑",
|
|
|
template:"resourceImg",
|
|
|
data:"largeSlideImg"
|
|
|
data:"largeSlideImg",
|
|
|
validate: ['url'],
|
|
|
tip:"请上传像素375*400的图片,上传图片大小不能超过500KB"
|
|
|
},
|
|
|
oneRowTwoColImages:{
|
|
|
title:"资源位小图编辑",
|
|
|
template:"resourceImg",
|
|
|
data:"oneRowTwoColImages"
|
|
|
data:"oneRowTwoColImages",
|
|
|
validate: ['url'],
|
|
|
tip:"请上传像素360*190的图片,上传图片大小不能超过500KB"
|
|
|
},
|
|
|
newProducts:{
|
|
|
title:"新品上架商品编辑",
|
...
|
...
|
@@ -141,7 +148,6 @@ var g2 = new common.grid({ |
|
|
{display: "名称", name: "productName"},
|
|
|
{display: "销售价", name: "salesPrice"},
|
|
|
{display: "操作", render: function (item) {
|
|
|
|
|
|
return '<a href="javascript:" class="btn btn-warning btn-xs cancelProduct" data-index="'+item.__index+'">取消选择</a>';
|
|
|
}}
|
|
|
]
|
...
|
...
|
@@ -182,14 +188,25 @@ var Bll = { |
|
|
curSelectedSkn.length = 0;
|
|
|
}},
|
|
|
{value:"确认", css:"btn-info", callback:function(){
|
|
|
//如果是新品上架或者人气单品,需要对已选商品倒序排序
|
|
|
if(ENUM[id].template == "products"){
|
|
|
curDialogData.data = sortArry(curDialogData.data, 1);
|
|
|
var checkResult = true;
|
|
|
if(ENUM[id].validate && ENUM[id].validate.length > 0){
|
|
|
$.each(ENUM[id].validate, function (index, item) {
|
|
|
checkResult = (checkResult && checkFunction[item].call(null));
|
|
|
if(!checkResult) return false;
|
|
|
})
|
|
|
}
|
|
|
if(checkResult){
|
|
|
//如果是新品上架或者人气单品,需要对已选商品倒序排序
|
|
|
if(ENUM[id].template == "products"){
|
|
|
curDialogData.data = sortArry(curDialogData.data, 1);
|
|
|
}
|
|
|
mainData.resources[ENUM[id].data] = curDialogData;
|
|
|
curDialogData = null;
|
|
|
curSelectedSkn.length = 0;
|
|
|
Bll._templateRender();
|
|
|
}else{
|
|
|
return false;
|
|
|
}
|
|
|
mainData.resources[ENUM[id].data] = curDialogData;
|
|
|
curDialogData = null;
|
|
|
curSelectedSkn.length = 0;
|
|
|
Bll._templateRender();
|
|
|
}}
|
|
|
]
|
|
|
};
|
...
|
...
|
@@ -233,16 +250,42 @@ var Bll = { |
|
|
//绑定可编辑动画
|
|
|
_canEditEvent: function () {
|
|
|
if(operation == 1){
|
|
|
$("#main .canEdit").hover(
|
|
|
function () {
|
|
|
$(this).append("<div class='editBorder'></div><a class='editIcon' href='javascript:'>编辑</a>");
|
|
|
},
|
|
|
function () {
|
|
|
$(".editIcon").remove();
|
|
|
$(".editBorder").remove();
|
|
|
$("#main .canEdit").hover(function () {
|
|
|
$(this).append("<div class='editBorder'></div><a class='editIcon' href='javascript:'>编辑</a>");
|
|
|
}, function () {
|
|
|
$(".editIcon").remove();
|
|
|
$(".editBorder").remove();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//校验方法
|
|
|
var checkFunction = {
|
|
|
name: function () {
|
|
|
var nameList = $(".editorMain input[name='name']");
|
|
|
for(var i=0; i<nameList.length; i++){
|
|
|
var value = $(nameList[i]).val();
|
|
|
if(value == ""){
|
|
|
common.util.__tip("名称为空!");
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
},
|
|
|
url: function () {
|
|
|
var urlList = $(".editorMain input[name='url']");
|
|
|
for(var i=0; i<urlList.length; i++){
|
|
|
var reg = new RegExp(".+\.yoho[^.]*\.(com|cn).*","g");
|
|
|
var value = $(urlList[i]).val();
|
|
|
if(value != ""){
|
|
|
if(!reg.test(value)){
|
|
|
common.util.__tip("Url必须包含yohobuy或者yoho,域名格式为com或者cn!");
|
|
|
return false;
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
@@ -255,15 +298,18 @@ $(document).on("click", "input[name='Platform']", function(){ |
|
|
curPlatform = $("input[name='Platform']:checked").val();
|
|
|
Bll._templateRender();
|
|
|
});
|
|
|
|
|
|
//编辑触发弹层
|
|
|
$(document).on("click", ".editIcon", function () {
|
|
|
var dialogId = $(this).parent('.canEdit').data("dialogid");
|
|
|
Bll.openDialog(dialogId);
|
|
|
});
|
|
|
|
|
|
//通过skn查询
|
|
|
$(document).on("click", "#filterSkn", function(){
|
|
|
g1.reload();
|
|
|
});
|
|
|
|
|
|
//input监听绑定json
|
|
|
$(document).on("change", ".observe", function () {
|
|
|
var value = $(this).val();
|
...
|
...
|
@@ -272,6 +318,7 @@ $(document).on("change", ".observe", function () { |
|
|
obj[name] = value;
|
|
|
});
|
|
|
});
|
|
|
|
|
|
//全部&已选tab切换
|
|
|
$(document).on("click", ".productsTabs .nav-tabs li", function () {
|
|
|
if($(this).hasClass("active")) return false;
|
...
|
...
|
@@ -289,6 +336,7 @@ $(document).on("click", ".productsTabs .nav-tabs li", function () { |
|
|
g2.init(curDialogData.data);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//选择商品
|
|
|
$(document).on("click", ".selectProduct", function () {
|
|
|
var index = $(this).data("index");
|
...
|
...
|
@@ -307,6 +355,7 @@ $(document).on("click", ".selectProduct", function () { |
|
|
$('.selectedProductsNum').text(curDialogData.data.length);
|
|
|
$(this).parent().html('<a href="javascript:" class="btn btn-warning btn-xs cancelProduct2" data-index="'+index+'">取消选择</a>');
|
|
|
});
|
|
|
|
|
|
//在已选商品中,取消选择商品
|
|
|
$(document).on("click", ".cancelProduct", function () {
|
|
|
var index = $(this).data("index");
|
...
|
...
|
@@ -315,6 +364,7 @@ $(document).on("click", ".cancelProduct", function () { |
|
|
$('.selectedProductsNum').text(curDialogData.data.length);
|
|
|
g2.init(curDialogData.data);
|
|
|
});
|
|
|
|
|
|
//在全部商品中,取消选择商品
|
|
|
$(document).on("click", ".cancelProduct2", function () {
|
|
|
var index = $(this).data("index");
|
...
|
...
|
@@ -322,11 +372,13 @@ $(document).on("click", ".cancelProduct2", function () { |
|
|
if(item.productSkn == g1.rows[index].productSkn){
|
|
|
[].splice.call(curDialogData.data, _index, 1);
|
|
|
[].splice.call(curSelectedSkn, _index, 1);
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
$('.selectedProductsNum').text(curDialogData.data.length);
|
|
|
$(this).parent().html('<a href="javascript:" class="btn btn-success btn-xs selectProduct" data-index="'+index+'">选择</a>');
|
|
|
});
|
|
|
|
|
|
//暂存 submitStatus=100
|
|
|
$(document).on("click", "#saveDecoration", function () {
|
|
|
console.log(mainData);
|
...
|
...
|
@@ -344,6 +396,7 @@ $(document).on("click", "#saveDecoration", function () { |
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
//提交审核 submitStatus=200
|
|
|
$(document).on("click", "#submitDecoration", function () {
|
|
|
common.util.__ajax({
|
...
|
...
|
@@ -360,6 +413,7 @@ $(document).on("click", "#submitDecoration", function () { |
|
|
}, 1000);
|
|
|
},true);
|
|
|
});
|
|
|
|
|
|
//审核通过 blkCheckStatus=300
|
|
|
$(document).on("click", "#checkOk", function () {
|
|
|
common.dialog.confirm(
|
...
|
...
|
@@ -382,6 +436,7 @@ $(document).on("click", "#checkOk", function () { |
|
|
function(){}
|
|
|
);
|
|
|
});
|
|
|
|
|
|
//驳回 blkCheckStatus=900
|
|
|
$(document).on("click","#checkNo",function(){
|
|
|
common.dialog.confirm(
|
...
|
...
|
|