...
|
...
|
@@ -4,6 +4,10 @@ |
|
|
*/
|
|
|
var $ = require('jquery');
|
|
|
var common = require('../common/common');
|
|
|
//日期插件
|
|
|
$('.hasDatepicker').fdatepicker({
|
|
|
format: 'yyyy-mm-dd'
|
|
|
});
|
|
|
/**
|
|
|
* 列表显示数据
|
|
|
* @type {common.grid}
|
...
|
...
|
@@ -17,18 +21,18 @@ var g = new common.grid({ |
|
|
productSkn: common.util.__input('content-filter1'),
|
|
|
productSkc: common.util.__input('content-filter2'),
|
|
|
productSku: common.util.__input('content-filter3'),
|
|
|
startTime: common.util.__input('startTime'),
|
|
|
endTime: common.util.__input('endTime')
|
|
|
startTime: common.util.__input('starttime'),
|
|
|
endTime: common.util.__input('endtime')
|
|
|
};
|
|
|
},
|
|
|
//列表显示
|
|
|
columns: [
|
|
|
{display: "SKN", name: "productSkn"},
|
|
|
{
|
|
|
display: "最后上传时间", name: "lastAddTime",
|
|
|
display: "最后上传时间", name: "updateTime",
|
|
|
render: function (item) {
|
|
|
var t = new Date(item.lastAddTime * 1000);
|
|
|
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
|
|
|
var t = new Date(item.updateTime * 1000);
|
|
|
var formatted = common.util.__dateFormat(t, "yyyy-MM-dd ");
|
|
|
return "<p>" + formatted + "</p>";
|
|
|
}
|
|
|
},
|
...
|
...
|
@@ -50,8 +54,7 @@ var g = new common.grid({ |
|
|
{
|
|
|
display: "操作", name: "", render: function (item) {
|
|
|
var arr = [];
|
|
|
arr.push('<a class="btn btn-info update" data-index="' + item.__index + '">修改</a>');
|
|
|
arr.push('<a class="btn btn-danger delete" data-index="' + item.__index + '">删除</a>');
|
|
|
arr.push('<a class="btn btn-info update" data-index="' + item.__index + '">编辑</a>');
|
|
|
return arr.join('');
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -64,16 +67,18 @@ var Bll = { |
|
|
var a = common.dialog.confirm(hint,
|
|
|
common.util.__template2($("#template1").html(), item),
|
|
|
function () {
|
|
|
|
|
|
console.log("JSON.stringify(pictureBoList)", typeof(JSON.stringify(pictureBoList)));
|
|
|
common.util.__ajax({
|
|
|
url: url,
|
|
|
data: {
|
|
|
productSku: parseInt($("#Sku").val()),
|
|
|
productPhotoAddBoList: JSON.stringify(pictureBoList)
|
|
|
productPhotoAddStrList: JSON.stringify(pictureBoList)
|
|
|
}
|
|
|
}, function (res) {
|
|
|
g.reload();
|
|
|
//a.close();
|
|
|
if(res.code=='200'){
|
|
|
g.reload();
|
|
|
a.close();
|
|
|
}
|
|
|
});
|
|
|
return false;
|
|
|
});
|
...
|
...
|
@@ -85,15 +90,15 @@ var Bll = { |
|
|
valid_extensions: ['png', 'jpg', 'jpeg'],
|
|
|
onComplete: function (response) {
|
|
|
if (response.status && response.code == 200) {
|
|
|
var item = pictureBoList || [];
|
|
|
console.log("response",response);
|
|
|
var data = {
|
|
|
"fileName": response.data
|
|
|
"fileName": response.data,
|
|
|
"originalName": "1035027.jpg"
|
|
|
};
|
|
|
item.push(data);
|
|
|
console.log(JSON.stringify(pictureBoList))
|
|
|
pictureBoList.push(data);
|
|
|
$("#addPic").html(common.util.__template2($("#template2").html(),
|
|
|
{
|
|
|
pictureBoList: item
|
|
|
pictureBoList: pictureBoList
|
|
|
}
|
|
|
));
|
|
|
}
|
...
|
...
|
@@ -102,6 +107,13 @@ var Bll = { |
|
|
}
|
|
|
}
|
|
|
});
|
|
|
$(document).on('click', '.remove-item-btn', function () {
|
|
|
var index = $(this).parents(".cover-image-item").index();
|
|
|
//界面删除
|
|
|
$(this).parents('.cover-image-item').remove();
|
|
|
//数组中删除
|
|
|
pictureBoList.splice(index, 1);
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
//上传图片--点击事件
|
...
|
...
|
@@ -115,12 +127,36 @@ $('#upload-btn').on('click', function () { |
|
|
$(document).on('click', '#filter-btn', function () {
|
|
|
g.reload(1);
|
|
|
});
|
|
|
//封面图删除
|
|
|
$(document).on('click', '.remove-item-btn', function() {
|
|
|
//界面删除
|
|
|
$(this).parents('.cover-image-item').remove();
|
|
|
//TODO 数组中删除
|
|
|
////删除单张图
|
|
|
|
|
|
|
|
|
//编辑
|
|
|
$(document).on('click', '.update', function () {
|
|
|
var ids = [];
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
var pics = item.pictureBoList || [];
|
|
|
$(document).on('click', '.remove-item-btn', function () {
|
|
|
var index = $(this).parents(".cover-image-item").index();
|
|
|
//界面删除
|
|
|
$(this).parents('.cover-image-item').remove();
|
|
|
ids.push(pics[index].id);
|
|
|
pics.splice(index, 1);
|
|
|
console.log("ids",ids);
|
|
|
});
|
|
|
var b = common.dialog.confirm("编辑", common.util.__template2($("#template3").html(), item),
|
|
|
function () {
|
|
|
common.util.__ajax({
|
|
|
url: "/shotManage/proPhoto/update",
|
|
|
data: {
|
|
|
productSkn: item.productSkn,
|
|
|
ids: JSON.stringify(ids)
|
|
|
}
|
|
|
}, function (res) {
|
|
|
ids=[];
|
|
|
g.reload();
|
|
|
});
|
|
|
|
|
|
})
|
|
|
});
|
|
|
|
|
|
|
...
|
...
|
|