...
|
...
|
@@ -14,6 +14,7 @@ webpackJsonp([13],[ |
|
|
var curTemplateType = "2"; //当前模板类型 1:基础模板,2:经典模板
|
|
|
var shopType = 1; //店铺类型 1:单品牌,2:多品牌
|
|
|
var shopOperate = 'view'; //操作 editor:可编辑, view:查看不可编辑
|
|
|
var shopCategory = []; //店铺下所有的销售类目
|
|
|
var defaultSrc = "http://img01.yohoboys.com/staticimg/2016/05/19/15/01091c21f2317a64f123f1649fbbccf7ba.png"; //初始化默认图片路径
|
|
|
var ENUM = {
|
|
|
"editor-largePic":{"src": "", "url": "", "startTime": "", "endTime": "", "publishStatus": 0},
|
...
|
...
|
@@ -300,6 +301,7 @@ webpackJsonp([13],[ |
|
|
|
|
|
//最新上架,最热商品接口
|
|
|
if(shopOperate == 'editor'){
|
|
|
findShopCategory();
|
|
|
if(!jsonMain.resources.allNewProducts.data || jsonMain.resources.allNewProducts.data.length < 1){
|
|
|
findTopNewProducts();
|
|
|
}
|
...
|
...
|
@@ -314,6 +316,20 @@ webpackJsonp([13],[ |
|
|
showMain();
|
|
|
},true);
|
|
|
}
|
|
|
//Ajax查询店铺下销售类目
|
|
|
function findShopCategory() {
|
|
|
common.util.__ajax({
|
|
|
url:'/shops/shopCategory/list',
|
|
|
data: {
|
|
|
shopId: jsonMain.shopsId
|
|
|
}
|
|
|
},function(rs){
|
|
|
console.log(rs);
|
|
|
if(rs.data){
|
|
|
shopCategory = rs.data;
|
|
|
}
|
|
|
},true);
|
|
|
}
|
|
|
//Ajax最新上架商品
|
|
|
function findTopNewProducts(){
|
|
|
common.util.__ajax({
|
...
|
...
|
@@ -509,7 +525,14 @@ webpackJsonp([13],[ |
|
|
return "<input class='form-control inputChange' type=text name='name' value='"+item.name+"' data-index='"+item.__index+"' maxlength='5' />";
|
|
|
}},
|
|
|
{display:"链接", render:function(item){
|
|
|
return "<input class='form-control inputChange urlInput' type=text name='url' value='"+(item.url).replace(/'/g,'\"')+"' data-index='"+item.__index+"' />";
|
|
|
// return "<input class='form-control inputChange urlInput' type=text name='url' value='"+(item.url).replace(/'/g,'\"')+"' data-index='"+item.__index+"' />";
|
|
|
if(item.url != ''){
|
|
|
item.linkType = item.linkType || '0';
|
|
|
}else{
|
|
|
item.linkType = item.linkType || '1';
|
|
|
}
|
|
|
item.categoryId = item.categoryId || '-1';
|
|
|
return common.util.__template2($("#link").html(),{data:item, categoryList:shopCategory, index:item.__index});
|
|
|
}}
|
|
|
]
|
|
|
});
|
...
|
...
|
@@ -744,10 +767,21 @@ webpackJsonp([13],[ |
|
|
}
|
|
|
}},
|
|
|
{display:"链接", render:function(item){
|
|
|
// if(item.__index == 0){
|
|
|
// return "http://店铺商品列表页(默认)";
|
|
|
// }else{
|
|
|
// return "<input class='form-control inputChange urlInput' type=text name='url' value='"+(item.url).replace(/'/g,'\"')+"' data-index='"+item.__index+"' />";
|
|
|
// }
|
|
|
if(item.__index == 0){
|
|
|
return "http://店铺商品列表页(默认)";
|
|
|
}else{
|
|
|
return "<input class='form-control inputChange urlInput' type=text name='url' value='"+(item.url).replace(/'/g,'\"')+"' data-index='"+item.__index+"' />";
|
|
|
if(item.url != ''){
|
|
|
item.linkType = item.linkType || '0';
|
|
|
}else{
|
|
|
item.linkType = item.linkType || '1';
|
|
|
}
|
|
|
item.categoryId = item.categoryId || '-1';
|
|
|
return common.util.__template2($("#link").html(),{data:item, categoryList:shopCategory, index:item.__index});
|
|
|
}
|
|
|
}},
|
|
|
{display:"操作", render:function(item){
|
...
|
...
|
@@ -792,10 +826,21 @@ webpackJsonp([13],[ |
|
|
}
|
|
|
}},
|
|
|
{display:"链接", render:function(item){
|
|
|
// if(item.__index == 0){
|
|
|
// return "http://店铺商品列表页(默认)";
|
|
|
// }else{
|
|
|
// return "<input class='form-control inputChange urlInput' type=text name='url' value='"+(item.url).replace(/'/g,'\"')+"' data-index='"+item.__index+"' />";
|
|
|
// }
|
|
|
if(item.__index == 0){
|
|
|
return "http://店铺商品列表页(默认)";
|
|
|
}else{
|
|
|
return "<input class='form-control inputChange urlInput' type=text name='url' value='"+(item.url).replace(/'/g,'\"')+"' data-index='"+item.__index+"' />";
|
|
|
if(item.url != ''){
|
|
|
item.linkType = item.linkType || '0';
|
|
|
}else{
|
|
|
item.linkType = item.linkType || '1';
|
|
|
}
|
|
|
item.categoryId = item.categoryId || '-1';
|
|
|
return common.util.__template2($("#link").html(),{data:item, categoryList:shopCategory, index:item.__index});
|
|
|
}
|
|
|
}},
|
|
|
{display:"操作", render:function(item){
|
...
|
...
|
@@ -1385,24 +1430,105 @@ webpackJsonp([13],[ |
|
|
}
|
|
|
//资源位图片代码生成器
|
|
|
function resourcesHtmlInit(item,resName){
|
|
|
var picList = item.data,
|
|
|
// var picList = item.data,
|
|
|
// htmlPic = "";
|
|
|
// for(var i=0; i<picList.length; i++){
|
|
|
// picList[i].url=picList[i].url.replace(/'/g,'\"'); // 字符串里面双引号转换成单引号
|
|
|
// 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 urlInput' name='url' value='"+picList[i].url+"' 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 class='publishStatus' style='white-space: nowrap; line-height: 40px'>"+ checkdate(picList[i].startTime,picList[i].endTime) +"</span></div>" +
|
|
|
// "<div class='col-sm-2' style='line-height: 40px'>";
|
|
|
// if(i == (picList.length-1) && picList.length > 1){
|
|
|
// htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+ item.__index +"_"+ i +"' /><br>";
|
|
|
// htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+ item.__index +"_"+ i +"' />";
|
|
|
// }
|
|
|
// if(i < (picList.length-1) && picList.length > 1){
|
|
|
// htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+ item.__index +"_"+ i +"' />";
|
|
|
// }
|
|
|
// if(i == (picList.length-1) && picList.length == 1){
|
|
|
// htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' value='添加一条' data-index='"+ item.__index +"_"+ i +"' />";
|
|
|
// }
|
|
|
// htmlPic += "</div></div>";
|
|
|
// }
|
|
|
// return htmlPic;
|
|
|
var picList = item.data,
|
|
|
htmlPic = "";
|
|
|
for(var i=0; i<picList.length; i++){
|
|
|
picList[i].url=picList[i].url.replace(/'/g,'\"'); // 字符串里面双引号转换成单引号
|
|
|
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 urlInput' name='url' value='"+picList[i].url+"' data-index='"+item.__index+"_"+i+"' /></div>" +
|
|
|
"<div class='col-sm-2'>";
|
|
|
//picList[i].url=picList[i].url.replace(/'/g,'\"'); // 字符串里面单引号转换成双引号
|
|
|
if(i == 0){
|
|
|
htmlPic += "<div class='row' style='padding: 10px 0'>";
|
|
|
}else{
|
|
|
htmlPic += "<div class='row' style='padding: 10px 0; border-top: 1px solid #dddddd'>";
|
|
|
}
|
|
|
|
|
|
//图片,大图资源位,小图资源位,水牌图片尺寸校验——fileType参数
|
|
|
htmlPic += "<div class='col-sm-2'>";
|
|
|
if(curPlatform == "pc"){
|
|
|
if(curDialogId == "editor-largePic"){//经典模板pc大图资源位
|
|
|
htmlPic += "<input type=file fileType='6' name='"+ resName +"Image' id='"+ resName +"Image_"+item.__index+"_"+i+"' value='"+picList[i].src+"' />";
|
|
|
}
|
|
|
if(curDialogId == "editor-smallPic"){//经典模板pc小图资源位
|
|
|
htmlPic += "<input type=file fileType='7' name='"+ resName +"Image' id='"+ resName +"Image_"+item.__index+"_"+i+"' value='"+picList[i].src+"' />";
|
|
|
}
|
|
|
if(curDialogId == "editor-signboard"){//基础模板水牌
|
|
|
htmlPic += "<input type=file fileType='3' name='"+ resName +"Image' id='"+ resName +"Image_"+item.__index+"_"+i+"' value='"+picList[i].src+"' />";
|
|
|
}
|
|
|
}
|
|
|
if(curPlatform == "app"){
|
|
|
if(curDialogId == "editor-largePic"){//经典模板app大图资源位
|
|
|
htmlPic += "<input type=file fileType='11' name='"+ resName +"Image' id='"+ resName +"Image_"+item.__index+"_"+i+"' value='"+picList[i].src+"' />";
|
|
|
}
|
|
|
if(curDialogId == "editor-smallPic"){//经典模板app小图资源位
|
|
|
htmlPic += "<input type=file fileType='12' name='"+ resName +"Image' id='"+ resName +"Image_"+item.__index+"_"+i+"' value='"+picList[i].src+"' />";
|
|
|
}
|
|
|
}
|
|
|
htmlPic += "</div>";
|
|
|
|
|
|
//url&销售类目
|
|
|
console.log(picList[i].url);
|
|
|
if(picList[i].url != ''){
|
|
|
picList[i].linkType = picList[i].linkType || '0';
|
|
|
}else{
|
|
|
picList[i].linkType = picList[i].linkType || '1';
|
|
|
}
|
|
|
picList[i].categoryId = picList[i].categoryId || '-1';
|
|
|
|
|
|
htmlPic += "<div class='col-sm-3'>";
|
|
|
|
|
|
htmlPic += common.util.__template2($("#link").html(),{data:picList[i], categoryList:shopCategory, index:item.__index+'_'+i});
|
|
|
|
|
|
htmlPic += "</div>";
|
|
|
|
|
|
//开始时间
|
|
|
htmlPic += "<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>";
|
|
|
"<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 class='publishStatus' style='white-space: nowrap; line-height: 40px'>"+ checkdate(picList[i].startTime,picList[i].endTime) +"</span></div>" +
|
|
|
"<div class='col-sm-2' style='line-height: 40px'>";
|
|
|
htmlPic += "</div>";
|
|
|
|
|
|
//结束时间
|
|
|
htmlPic += "<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>";
|
|
|
|
|
|
//状态
|
|
|
htmlPic += "<div class='col-sm-1'><span class='publishStatus' style='white-space: nowrap; line-height: 40px'>"+ checkdate(picList[i].startTime,picList[i].endTime) +"</span></div>";
|
|
|
|
|
|
//操作
|
|
|
htmlPic += "<div class='col-sm-2' style='line-height: 40px'>";
|
|
|
if(i == (picList.length-1) && picList.length > 1){
|
|
|
htmlPic += "<input type=button class='btn btn-danger btn-xs deleteBtn' value='删除' data-index='"+ item.__index +"_"+ i +"' /><br>";
|
|
|
htmlPic += "<input type=button class='btn btn-info btn-xs addBtn' style='margin-top: 10px' value='添加一条' data-index='"+ item.__index +"_"+ i +"' />";
|
...
|
...
|
@@ -1581,6 +1707,28 @@ webpackJsonp([13],[ |
|
|
function(){}
|
|
|
);
|
|
|
})
|
|
|
//销售类目&自定义切换
|
|
|
$(document).on("change", ".linkSelect", function () {
|
|
|
if($(this).val() == 0){ //自定义
|
|
|
$(this).next('.link_url').show().next('.link_category').hide();
|
|
|
}else{ //销售类目
|
|
|
$(this).next('.link_url').hide().next('.link_category').show();
|
|
|
}
|
|
|
});
|
|
|
//选择销售类目时,监听id跟名称
|
|
|
$(document).on("change", ".categoryChange", function () {
|
|
|
var _index = $(this).attr("data-index");
|
|
|
var indexList = _index.split("_");
|
|
|
var categoryName = this.options[this.selectedIndex].text;
|
|
|
|
|
|
if(indexList.length > 1){
|
|
|
(g.__rows[indexList[0]].data)[indexList[1]].categoryId = $(this).val();
|
|
|
(g.__rows[indexList[0]].data)[indexList[1]].categoryName = categoryName;
|
|
|
}else{
|
|
|
g.__rows[indexList[0]].categoryId = $(this).val();
|
|
|
g.__rows[indexList[0]].categoryName = categoryName;
|
|
|
}
|
|
|
});
|
|
|
//删除
|
|
|
$(document).on("click",".deleteBtn",function(){
|
|
|
var _index = $(this).data("index")+"";
|
...
|
...
|
|