...
|
...
|
@@ -3,7 +3,7 @@ var $ = require('jquery'), |
|
|
|
|
|
var ZeroClipboard = require("../../../common/util/ZeroClipboard.min");
|
|
|
ZeroClipboard.config({swfPath: "http://cdn.yoho.cn/yohobuy-portal/assets/images/ZeroClipboard.swf"});
|
|
|
|
|
|
var tabTree;
|
|
|
var g = new common.grid({
|
|
|
el: "#product-pool",
|
|
|
hash: false,
|
...
|
...
|
@@ -50,13 +50,7 @@ var Bll = { |
|
|
new common.dialog({
|
|
|
title: "商品池详情",
|
|
|
width: "80%",
|
|
|
content: '<div class="addSkn form-inline"><div class="form-group"?>' +
|
|
|
'<label style="margin-right: 10px; font-size: 16px; font-weight: bold">添加SKN到商品池:</label>' +
|
|
|
'<input type="text" id="addSknText" class="form-control" placeholder="输入SKN">' +
|
|
|
'<input type="hidden" id="addSknType" value="'+obj.producttype+'">' +
|
|
|
'<input type="hidden" id="addSknPoolId" value="'+obj.id+'">' +
|
|
|
'<a id="addSknBtn" class="btn btn-info" style="margin-left: 15px"><i class="fa fa-plus"></i> 添加</a></div></div>' +
|
|
|
'<div id="faGrid" style="overflow:auto; margin-top: 15px"></div>',
|
|
|
content: common.util.__template2($("#detailPoolTemplate").html(), obj),
|
|
|
button: [{
|
|
|
value: "确认", css:"btn-primary",
|
|
|
callback: function () {//局部刷新列表SKN个数
|
...
|
...
|
@@ -65,8 +59,21 @@ var Bll = { |
|
|
}]
|
|
|
});
|
|
|
$('.modal-dialog .close').hide();
|
|
|
tabTree = new common.tabTree("#sortTree");
|
|
|
tabTree.init();
|
|
|
|
|
|
$("body").bind("click", function(){
|
|
|
tabTree.reset();
|
|
|
});
|
|
|
|
|
|
grid.options.parms = function () {return {id: obj.id}};
|
|
|
new common.dropDown({
|
|
|
el: '#brandId',
|
|
|
ajax: 'brand',
|
|
|
hash: true
|
|
|
});
|
|
|
grid.options.parms = function () {return {id: obj.id,
|
|
|
productSkn:common.util.__input('productSkn')
|
|
|
}};
|
|
|
grid.init('/market/productPool/queryProductPoolDetailPage');
|
|
|
},
|
|
|
|
...
|
...
|
@@ -119,6 +126,45 @@ var Bll = { |
|
|
});
|
|
|
},
|
|
|
|
|
|
//批量上传
|
|
|
batchAddPool: function (type,url,obj) {
|
|
|
common.dialog.confirm("批量添加SKN",
|
|
|
common.util.__template2($("#batchTemplate").html(),obj),
|
|
|
function () {
|
|
|
common.util.__ajax({
|
|
|
url: url,
|
|
|
data: {
|
|
|
id: common.util.__input('addSknPoolId'),
|
|
|
producttype: common.util.__input('addSknType'),
|
|
|
productSkns: $("#sknVal2").val().replace("[", "").replace("]", "")
|
|
|
}
|
|
|
}, function (res) {//局部刷新商品池名称,说明
|
|
|
if (res.code == 200) {
|
|
|
grid.init('/market/productPool/queryProductPoolDetailPage');
|
|
|
} else {
|
|
|
common.util.__tip(res.message);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
);
|
|
|
//上传文件
|
|
|
common.edit.ajaxfileupload("#batchProductSkn", {
|
|
|
params: {
|
|
|
type: "productPool",
|
|
|
__type: "batch-import"
|
|
|
},
|
|
|
onComplete: function (res) {
|
|
|
if (res.code == 200) {
|
|
|
common.util.__tip(res.message, 'success');
|
|
|
$("#sknVal2").val(JSON.stringify(res.data.productSkn));
|
|
|
$("#bathcPath").val($("#batchProductSkn").val());
|
|
|
} else {
|
|
|
common.util.__tip(res.message);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
|
|
|
//清空商品池
|
|
|
emptyPool: function (obj,index) {
|
|
|
common.dialog.confirm("清空商品池确认", "确认清空商品池:<font color='red'>【"+obj.poolName+"】</font>么?", function () {
|
...
|
...
|
@@ -180,6 +226,18 @@ $(document).on("click", "#editPool", function () { |
|
|
Bll.editPool(1, "/market/productPool/updateProductPool", item, index);
|
|
|
});
|
|
|
|
|
|
//批量添加商品池
|
|
|
$(document).on("click", "#batchAddPool", function () {
|
|
|
var item = function () {
|
|
|
return {
|
|
|
/*id: 166,
|
|
|
producttype: 1*/
|
|
|
};
|
|
|
};
|
|
|
Bll.batchAddPool(1, "/market/productPool/batchAddProductPool", item);
|
|
|
});
|
|
|
|
|
|
|
|
|
//清空商品池
|
|
|
$(document).on("click", "#emptyPool", function () {
|
|
|
var index = $(this).data("index");
|
...
|
...
|
@@ -234,6 +292,44 @@ $(document).on("click", "#addSknBtn", function () { |
|
|
}
|
|
|
});
|
|
|
|
|
|
//查询商品池
|
|
|
$(document).on("click", "#queryBtn", function () {
|
|
|
if(isNaN($('#productSkn').val())){
|
|
|
common.util.__tip("SKN必须是数字格式!");
|
|
|
return false;
|
|
|
}
|
|
|
if(($('#productSkn').val().length>10)){
|
|
|
common.util.__tip("SKN过长!");
|
|
|
return false;
|
|
|
}
|
|
|
grid.options.parms = function () {return {
|
|
|
id:common.util.__input('addSknPoolId'),
|
|
|
productSkn:common.util.__input('productSkn'),
|
|
|
maxSortId: tabTree.selected[0] ? tabTree.selected[0].id : "",
|
|
|
middleSortId: tabTree.selected[1] ? tabTree.selected[1].id : "",
|
|
|
smallSortId: tabTree.selected[2] ? tabTree.selected[2].id : "",
|
|
|
brandId: common.util.__input("brandId"),
|
|
|
}};
|
|
|
grid.init('/market/productPool/queryProductPoolDetailPage');
|
|
|
});
|
|
|
//查询全部商品池
|
|
|
$(document).on("click", "#queryAllBtn", function () {
|
|
|
$('#productSkn').val('');
|
|
|
$("#brandId").val("-1");
|
|
|
new common.dropDown({
|
|
|
el: '#brandId',
|
|
|
ajax: 'brand',
|
|
|
hash: true
|
|
|
});
|
|
|
tabTree = new common.tabTree("#sortTree");
|
|
|
tabTree.init();
|
|
|
|
|
|
grid.options.parms = function () {return {
|
|
|
id:common.util.__input('addSknPoolId'),
|
|
|
}};
|
|
|
grid.init('/market/productPool/queryProductPoolDetailPage');
|
|
|
});
|
|
|
|
|
|
//删除详情商品
|
|
|
$(document).on("click", ".delbtn", function () {
|
|
|
var item = grid.rows[$(this).data("index")];
|
...
|
...
|
|