Authored by lijian

商品池优化

... ... @@ -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,12 +67,14 @@
<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">
... ... @@ -81,4 +84,27 @@
</div>
</div>
</div>
</script>
<script type="text/template" id="batchTemplate">
<label class="col-sm-3 control-label">上传:</label>
<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">
* 要导入的数据类型必须和所选类型相同。<br>
&nbsp;&nbsp;EXCEL文件只有一列。
</div>
</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,
... ... @@ -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")];
... ...