Authored by 马力

Merge branch 'dev_商品池功能优化' into grey

... ... @@ -35,6 +35,7 @@ module.exports = function (app) {
//详情添加SKN
app.post("/market/productPool/addProductPoolDetailBo", "ProductPool_addProductPoolDetailBo");
//详情批量添加SKN
app.post("/market/productPool/batchAddProductPool", "ProductPool_batchAddProductPool");
};
\ No newline at end of file
... ...
... ... @@ -56,6 +56,11 @@ module.exports = {
url: '/pool/queryProductPoolDetailPage',
params: {
id: {type: Number},
productSkn:{type: Number},
maxSortId:{type: Number},
middleSortId:{type: Number},
smallSortId:{type: Number},
brandId:{type: Number},
page: {type: Number},
size: {type: Number,default:10}
}
... ... @@ -76,7 +81,16 @@ module.exports = {
productskn: {type: Number},
producttype: {type: Number}
}
},
batchAddProductPool: {
title: "批量添加SKN",
url: '/pool/batchAddProductPool',
params: {
activityid: {type: Number},
id: {type: Number},
producttype: {type: Number},
productSkns: {type: String}
}
}
}
};
\ No newline at end of file
... ...
... ... @@ -10,10 +10,11 @@
<div class="panel-body">
<div class="row">
<div class="panel-col">
<input type="text" class="form-control" id="search-id" placeholder="输入编号" onkeyup="this.value=this.value.replace(/\D/gi,'')" />
<input type="text" class="form-control" id="search-id" placeholder="输入编号"
onkeyup="this.value=this.value.replace(/\D/gi,'')"/>
</div>
<div class="panel-col">
<input type="text" class="form-control" id="search-name" placeholder="输入名称" />
<input type="text" class="form-control" id="search-name" placeholder="输入名称"/>
</div>
<div class="panel-col">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
... ... @@ -31,12 +32,12 @@
<script type="text/template" id="template">
<div class="form-horizontal" id="productEdit">
<input type="hidden" value="[[id]]" id="id" />
<input type="hidden" value="[[id]]" id="id"/>
<div class="form-group">
<label for="poolName" class="col-sm-3 control-label">商品池名称:</label>
<div class="col-sm-5">
<input type="text" id="poolName" value="[[poolName]]" class="form-control" />
<input type="text" id="poolName" value="[[poolName]]" class="form-control"/>
</div>
<div class="col-sm-2"><label style="color: #ff0000; line-height: 40px"> * 必填</label></div>
</div>
... ... @@ -44,14 +45,14 @@
<div class="form-group">
<label for="comment" class="col-sm-3 control-label">说明:</label>
<div class="col-sm-5">
<input type="text" id="comment" value="[[comment]]" class="form-control" />
<input type="text" id="comment" value="[[comment]]" class="form-control"/>
</div>
</div>
<div class="form-group">
<label for="producttype" class="col-sm-3 control-label">商品:</label>
<div class="col-sm-5">
<select id="producttype" class="form-control" >
<select id="producttype" class="form-control">
<option value="-1">-- 请选择添加商品类型 --</option>
<option value="1">SKN</option>
<option value="2" disabled>SKU(暂不支持)</option>
... ... @@ -66,19 +67,90 @@
<div class="col-sm-9">
<div class="row">
<div class="col-sm-7">
<input id="path" class="form-control" type="text" disabled="disabled" style="cursor:default; width: 218px">
<input id="path" class="form-control" type="text" disabled="disabled"
style="cursor:default; width: 218px">
</div>
<div class="col-sm-4" style="position: relative; padding-left: 0;">
<input id="productSkn" name="productSkn" class="btn btn-default excel-upload" type="file" style="position: absolute; top: 0;left: 10px; height:37px">
<input id="productSkn" name="productSkn" class="btn btn-default excel-upload" type="file"
style="position: absolute; top: 0;left: 10px; height:37px">
<div class="file-name btn btn-info">请选择文件</div>
<input type="hidden" id="sknVal" />
<input type="hidden" id="sknVal"/>
</div>
</div>
<div style="margin: 10px 0 0; color:#f0ad4e">
* 要导入的数据类型必须和所选类型相同。<br>
&nbsp;&nbsp;EXCEL文件只有一列。
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2<a href="/ajax/link/productpool" style="margin: 0; text-decoration: underline">下载样例.xlsx</a>
</div>
</div>
</div>
</div>
</script>
<script type="text/template" id="batchTemplate">
<div class="panel panel-default">
<div class="panel-body">
<div class="form-group">
<div class="col-sm-9">
<div class="row">
<div class="col-sm-7">
<input id="bathcPath" class="form-control" type="text" disabled="disabled"
style="cursor:default; width: 218px">
</div>
<div class="col-sm-4" style="position: relative; padding-left: 0;">
<input id="batchProductSkn" name="productSkn" class="btn btn-default excel-upload"
type="file"
style="position: absolute; top: 0;left: 10px; height:37px">
<div class="file-name btn btn-info">请选择文件</div>
<input type="hidden" id="sknVal2"/>
</div>
</div>
<div style="margin: 10px 0 0; color:#f0ad4e">
1、上传文件必须是<span style="color:red;">.xlsx</span>文件<br>
2<a href="/ajax/link/productpool" style="margin: 0; text-decoration: underline">下载样例.xlsx</a>
</div>
</div>
</div>
</div>
</div>
</script>
<script type="text/template" id="detailPoolTemplate">
<div class="form-group">
<label class="col-sm-2 control-label">添加SKN到商品池: </label>
<div class="col-sm-3">
<input type="text" id="addSknText" class="form-control input-form" placeholder="输入SKN">
<input type="hidden" id="addSknType" value="[[producttype]]">
<input type="hidden" id="addSknPoolId" value="[[id]]">
</div>
<div class="col-sm-1">
<a href="javascript:;" id="addSknBtn" class="btn btn-info">+添加</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-2">
<input type="text" id="productSkn" class="form-control input-form" placeholder="查询SKN">
</div>
<div class="col-sm-2">
<select name="brandId" id="brandId" class="form-control">
<option value="-1">请选择品牌</option>
</select>
</div>
<div class="col-sm-3">
<div id="sortTree" class="form-control height40" style="border: 0px; padding: 0px;"></div>
</div>
<div class="panel-col">
<a href="javascript:;" id="queryBtn" class="btn btn-info">查询</a>
<a href="javascript:;"id="queryAllBtn" class="btn btn-info">全部</a>
</div>
<div class="col-sm-2">
<a href="javascript:;" id="batchAddPool" class="btn btn-primary">批量导入</a>
</div>
</div>
<div id="faGrid"></div>
</script>
\ No newline at end of file
... ...
... ... @@ -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")];
... ...