Authored by lijian

Merge branch 'hotfix-商品参数' of http://git.yoho.cn/fe/yohobuy-portal-fe2 into hotfix-商品参数

# Conflicts:
#	code/apps/baserule/controllers/productParm.js
... ... @@ -12,14 +12,16 @@ module.exports=function(app) {
app.post("/erpproduct/standard/del","productparm_del");
app.post("/erpproduct/standard/update","productparm_update");
app.post("/erpproduct/standard/add","productparm_add");
/* /!*添加*!/
app.post("/erpproduct/standardSort/add","productparm_add");
/!*修改*!/
app.post("/erpproduct/standardSort/update","productparm_update");
*/
/*参数类别列表*/
app.post("/erpproduct/standardSort/list","standardSort_list");
/*参数类别添加*/
app.post("/erpproduct/standardSort/add","standardSort_add");
/*参数类别修改*/
app.post("/erpproduct/standardSort/update","standardSort_update");
/*参数类别删除*/
app.post("/erpproduct/standardSort/update","standardSort_del");
/*商品参数类别*/
app.get("/erpproduct/standardSort/index","baserule.standardSort.Index",function(){
this.$extend={
... ...
module.exports={
namespace:"standardSort",
apis:{
list:{
title:'查询产品参数列表',
url: '/standardSort/getAllStandardSortBySortId',
params: [
{name: 'sortId', type: 'Number'}
]
},
add:{
title:'增加',
url: '/standardSort/addStandardSort',
params:[
{name: 'sortId', type: 'Number'},
{name: 'standardSortName', type: 'String'},
{name: 'orderBy', type: 'Number'}
]
},
update:{
title:'修改',
url: '/standardSort/updateStandardSort',
params:[
{name: 'id', type: 'Number'},
{name: 'standardSortName', type: 'String'},
{name: 'orderBy', type: 'Number'}
]
},
del:{
title:'删除',
url: '/standardSort/delStandardSort',
params:[
{name: 'id', type: 'Number'}
]
}
}
}
\ No newline at end of file
... ...
... ... @@ -8,17 +8,12 @@
<div id="sortTree"></div>
</div>
<div class="panel-col">
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
<a id="all-btn" href="" class="btn btn-info">全部</a>
<a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
</div>
<div class="panel-col">
<a id="onshelve" href="javascript:;" class="btn btn-success" >上架</a>
<a id="offshelve" href="javascript:;" class="btn btn-danger">下架</a>
</div>
<div class="panel-col2" style="width:40%;">
<a id="export-btn" href="javascript:;" class="btn btn-primary large">导出</a>
<a id="import-btn" href="/goods/netsale/batch" class="btn btn-primary large">批量( 排序、款型系列、上下架 )</a>
<a id="onshelve" href="javascript:;" class="btn btn-success" >添加产品参数类别</a>
</div>
</div>
</div>
</div>
... ... @@ -31,7 +26,7 @@
</div>
<script type="text/template" id="onshelve-template">
<script type="text/template" id="add-template">
<form class="shelve-form form-horizontal form-bordered">
<div class="panel panel-default">
<div class="panel-body nopadding">
... ... @@ -57,7 +52,7 @@
</form>
</script>
<script type="text/template" id="offshelve-template">
<script type="text/template" id="update-template">
<form class="shelve-form form-horizontal form-bordered">
<div class="panel panel-default">
<div class="panel-body nopadding">
... ...
var $ = require('jquery'),
common = require('../../../common/common');
var tabTree = new common.tabTree("#sortTree");
tabTree.init();
new common.dropDown({
el: '#stortTypeId',
ajax: 'queryStortType',
hash: true,
params:function(){
return {sortId: smallSortId};
}
});
var smallSortId=tabTree.selected[2] ? tabTree.selected[2].id : "";
var g = new common.grid({
el: "#basicTable",
usepagesize:true,
parms: function () {
return {
sortId: tabTree.selected[2] ? tabTree.selected[2].id : "",
sortName: tabTree.selected[2] ? tabTree.selected[2].sortName : ""
};
},
columns: [ {
display: 'ID',
name: 'id',
}, {
display: '类别名称',
render: function(item) {
return item.standardSortName;
}
}, {
display: '所属分类',
render: function(item) {
var parmList = getAllSortName();
return appendAllSortName(parmList);
}
},{
display: '排序',
name: 'orderBy'
}, {
display: '操作',
render: function(items) {
var HtmArr = [];
HtmArr.push('<a data-index="'+ items.__index+ '" href="JavaScript:;" class="btn btn-info btn-xs edit-class-btn">编辑</a>');
HtmArr.push('<a data-index="' + items.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs del-standardSort">删除</a>');
return HtmArr.join('');
}
}]
});
g.init("/erpproduct/standardSort/list");
//筛选
$("#filter-btn").click(function () {
g.reload(1);
});
//删除
$('tbody').on('click', '.del-standardSort', function() {
var item=g.rows[$(this).data("index")];
common.dialog.confirm("温馨提示", "你确定要删除吗?", function () {
common.util.__ajax({
url:'/erpproduct/standardSort/del',
data:{id:item.id}
},function(){
g.reload();
});
});
});
var getAllSortName = function(){
var sortNames = [];
for (var i = 0; i < 3; i++) {
if(tabTree.selected[i]){
sortNames.push(tabTree.selected[i].sortName);
}
}
return sortNames;
};
var appendAllSortName = function(allSorts){
if(allSorts === 'undefined' || allSorts.length === 0){
return '';
}
var sortName="";
for (var i = 0;i < allSorts.length; i++) {
sortName = sortName + allSorts[i]+"/";
}
return sortName.substr(0,sortName.lastIndexOf("/"));
}
$(document).on('click', '.edit-class-btn', function () {
var item = g.rows[$(this).data("index")];
var sortName="";
if(tabTree.selected[0]){
sortName=sortName+tabTree.selected[0].sortName+"/";
}
if(tabTree.selected[1]){
sortName=sortName+tabTree.selected[1].sortName+"/";
}
if(tabTree.selected[2]){
sortName=sortName+tabTree.selected[2].sortName;
}
var standardSort = {
id: item.id,
sortId: item.sortId,
standardName: item.standardSortName,
orderBy: item.orderBy
};
common.dialog.confirm("修改参数",
common.util.__template($("#template").html(),standardSort)
, function () {
common.util.__ajax({
url: '/erpproduct/standardSort/update',
data: (function () {
var input = $('#standardSortName').val();
if (input === '' || $.trim(input) === '')return "参数名称不能为空";
return {
id: item.id,
standardSortName: $("#standardSortName").val(),
orderBy: $("#orderBy").val(),
sortId: $("#sortId").val()
};
})()
}, function () {
g.reload();
});
});
});
... ...