...
|
...
|
@@ -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,
|
...
|
...
|
@@ -56,6 +56,12 @@ var Bll = { |
|
|
'<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 class="queryskn form-inline"><div class="form-group"?>' +
|
|
|
'<input type="text" id="productSkn" class="form-control" placeholder="查询SKN" />' +
|
|
|
' <div id="sortTree" class="form-control height40" style="border: 0px; padding: 0px;"></div>'+
|
|
|
'<div ><select name="brandId" id="brandId" class="form-control"> <option value="-1">请选择品牌</option> </select></div>'+
|
|
|
'<div ><a id="queryBtn" class="btn btn-info" style="margin-left: 15px"> 查询</a></div></div></div>'+
|
|
|
'<a id="batchAddPool" class="btn btn-xs btn-primary" >批量上传</a>' +
|
|
|
'<div id="faGrid" style="overflow:auto; margin-top: 15px"></div>',
|
|
|
button: [{
|
|
|
value: "确认", css:"btn-primary",
|
...
|
...
|
@@ -65,8 +71,17 @@ var Bll = { |
|
|
}]
|
|
|
});
|
|
|
$('.modal-dialog .close').hide();
|
|
|
tabTree = new common.tabTree("#sortTree");
|
|
|
tabTree.init();
|
|
|
|
|
|
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 +134,50 @@ var Bll = { |
|
|
});
|
|
|
},
|
|
|
|
|
|
//批量上传
|
|
|
batchAddPool: function (type,url,obj,index) {
|
|
|
common.dialog.confirm("批量上传",
|
|
|
common.util.__template2($("#batchTemplate").html(),obj),
|
|
|
function () {
|
|
|
if(checkPool()){
|
|
|
common.util.__ajax({
|
|
|
url: url,
|
|
|
data: {
|
|
|
id: $("#addSknPoolId").val(),
|
|
|
producttype: $("#addSknType").val(),
|
|
|
productSkns: $("#sknVal2").val().replace("[", "").replace("]", "")
|
|
|
}
|
|
|
}, function () {//局部刷新商品池名称,说明
|
|
|
if(type == 0){
|
|
|
g.reload(1);
|
|
|
}else{
|
|
|
}
|
|
|
});
|
|
|
}else{
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
if(type != 0) $("#producttype").val(obj.producttype);
|
|
|
|
|
|
//上传文件
|
|
|
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 +239,20 @@ $(document).on("click", "#editPool", function () { |
|
|
Bll.editPool(1, "/market/productPool/updateProductPool", item, index);
|
|
|
});
|
|
|
|
|
|
//批量添加商品池
|
|
|
$(document).on("click", "#batchAddPool", function () {
|
|
|
var index = null;
|
|
|
var item = function () {
|
|
|
return {
|
|
|
id: 166,
|
|
|
producttype: 1
|
|
|
};
|
|
|
};
|
|
|
|
|
|
Bll.batchAddPool(1, "/market/productPool/updateProductPool", item, index);
|
|
|
});
|
|
|
|
|
|
|
|
|
//清空商品池
|
|
|
$(document).on("click", "#emptyPool", function () {
|
|
|
var index = $(this).data("index");
|
...
|
...
|
@@ -234,6 +307,22 @@ $(document).on("click", "#addSknBtn", function () { |
|
|
}
|
|
|
});
|
|
|
|
|
|
//查询商品池
|
|
|
$(document).on("click", "#queryBtn", function () {
|
|
|
if($('#productSkn').val().length > 0){
|
|
|
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');
|
|
|
}else{
|
|
|
common.util.__tip("请输入要加入商品池的SKN!");
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//删除详情商品
|
|
|
$(document).on("click", ".delbtn", function () {
|
|
|
var item = grid.rows[$(this).data("index")];
|
...
|
...
|
|