Authored by weiqingting

Merge branch 'yohobuy_portak_dev_v4.8_20160620' of http://git.yoho.cn/fe/yohobuy…

…-portal-fe2 into yohobuy_portak_dev_v4.8_20160620
module.exports=function(app) {
/**/
app.get("/erpproduct/sortsize/index","baserule.CateSize","porattr_queryProductSortListByConf",function(pros){
this.$extend={
moduleName:'商品基础规则',
pageName:'品类关联尺码列表',
data:pros.data
}
})
module.exports = function (app) {
/**/
app.get("/erpproduct/sortsize/index", "baserule.CateSize", "porattr_queryProductSortListByConf", function (pros) {
this.$extend = {
moduleName: '商品基础规则',
pageName: '品类关联尺码列表',
data: pros.data
}
});
app.post("/erpproduct/sortsize/ajax/index","catesize_querySizeListBySortId");
/*添加尺码接口【验证通过】*/
app.post("/erpproduct/sortsize/ajax/add","catesize_addSortSize");
/*删除单个品类尺码接口【待验证】*/
app.post("/erpproduct/sortsize/ajax/delete","catesize_deleteSortSize");
/*修改品类尺码排序接口*/
app.post("/product/updateSortSize","catesize_updateSortSize");
app.post("/erpproduct/sortsize/ajax/index", "catesize_querySizeListBySortId");
/*添加尺码接口【验证通过】*/
app.post("/erpproduct/sortsize/ajax/add", "catesize_addSortSize");
/*删除单个品类尺码接口【待验证】*/
app.post("/erpproduct/sortsize/ajax/delete", "catesize_deleteSortSize");
/*修改品类尺码排序接口*/
app.post("/product/updateSortSize", "catesize_updateSortSize");
//************************品类尺码属性管理*****************************
/*尺码模糊查询【验证通过】*/
app.post("/erpproduct/sortsize/ajax/automatic", "catesize_querySizeByNameForSelect");
app.get("/erpproduct/sortattribute/index","baserule.CateSizeAttr","porattr_queryProductSortListByConf",function(pros){
this.$extend={
moduleName:'商品基础规则',
pageName:'品类尺码属性',
data:pros.data
}
});
/*获取品类关联尺码属性列表【验证通过】*/
app.post("/erpproduct/sortattribute/ajax/index","catesize_queryList");
/*添加品类关联尺码属性接口【待验证】*/
app.post("/erpproduct/sortattribute/ajax/add","catesize_add");
/*删除品类关联尺码属性接口【待验证】*/
app.post("/erpproduct/sortattribute/ajax/delete","catesize_delete");
/*修改品类关联尺码属性接口【待验证】*/
app.post("/sortAttribute/updateOrderBy","catesize_updateOrderBy");
}
\ No newline at end of file
//************************品类尺码属性管理*****************************
app.get("/erpproduct/sortattribute/index", "baserule.CateSizeAttr", "porattr_queryProductSortListByConf", function (pros) {
this.$extend = {
moduleName: '商品基础规则',
pageName: '品类尺码属性',
data: pros.data
}
});
/*获取品类关联尺码属性列表【验证通过】*/
app.post("/erpproduct/sortattribute/ajax/index", "catesize_queryList");
/*添加品类关联尺码属性接口【待验证】*/
app.post("/erpproduct/sortattribute/ajax/add", "catesize_add");
/*删除品类关联尺码属性接口【待验证】*/
app.post("/erpproduct/sortattribute/ajax/delete", "catesize_delete");
/*修改品类关联尺码属性接口【待验证】*/
app.post("/sortAttribute/updateOrderBy", "catesize_updateOrderBy");
/*修改品类关联尺码属性接口【待验证】*/
app.post("/erpproduct/sortattribute/ajax/automatic", "catesize_querySizeAttributesByName");
};
\ No newline at end of file
... ...
module.exports={
namespace:"catesize",
apis:{
querySizeListBySortId:{
title:'querySizeListBySortId',
url: '/product/querySizeListBySortId',
params: [
{name: "sortId", type: "number"}
]
module.exports = {
namespace: "catesize",
apis: {
querySizeListBySortId: {
title: 'querySizeListBySortId',
url: '/product/querySizeListBySortId',
params: [
{name: "sortId", type: "number"}
]
},
addSortSize:{
title:'添加尺码接口【验证通过】',
url: '/product/addSortSize',
params: [
{name: "sortId", type: "number"},
{name: "sizeId", type: "number"},
{name: "orderBy", type: "number"}
]
addSortSize: {
title: '添加尺码接口【验证通过】',
url: '/product/addSortSize',
params: [
{name: "sortId", type: "number"},
{name: "sizeId", type: "number"},
{name: "orderBy", type: "number"}
]
},
deleteSortSize:{
title:'删除单个品类尺码接口【待验证】',
url: '/product/deleteSortSize',
params: [
{name: "sortId", type: "number"},
{name: "sizeId", type: "number"}
]
deleteSortSize: {
title: '删除单个品类尺码接口【待验证】',
url: '/product/deleteSortSize',
params: [
{name: "sortId", type: "number"},
{name: "sizeId", type: "number"}
]
},
updateSortSize:{
title:'修改品类尺码排序接口',
url: '/product/updateSortSize',
params: [
{name: "sortId", type: "number"},
{name: "sizeId", type: "number"},
{name: "orderBy", type: "number"}
]
updateSortSize: {
title: '修改品类尺码排序接口',
url: '/product/updateSortSize',
params: [
{name: "sortId", type: "number"},
{name: "sizeId", type: "number"},
{name: "orderBy", type: "number"}
]
},
querySizeByNameForSelect: {
title: '尺码模糊查询【验证通过】',
url: '/product/querySizeByNameForSelect',
params: [
{name: "idName", type: "String"},
{name: "sortId", type: "Number"}
]
},
/**********************品类尺码属性管理*****************************/
queryList:{
title:'获取品类关联尺码属性列表【验证通过】',
url: '/sortAttribute/queryList',
params: [
{name: "page", type: "number"},
{name: "size", type: "number"},
{name: "sortId", type: "number"}
]
queryList: {
title: '获取品类关联尺码属性列表【验证通过】',
url: '/sortAttribute/queryList',
params: [
{name: "page", type: "number"},
{name: "size", type: "number"},
{name: "sortId", type: "number"}
]
},
add: {
title: '添加品类关联尺码属性接口【待验证】',
url: '/sortAttribute/add',
params: [
{name: "sortId", type: "number"},
{name: "attributeId", type: "number"},
{name: "orderBy", type: "number"}
]
},
add:{
title:'添加品类关联尺码属性接口【待验证】',
url: '/sortAttribute/add',
params: [
{name: "sortId", type: "number"},
{name: "attributeId", type: "number"},
{name: "orderBy", type: "number"}
]
delete: {
title: '删除品类关联尺码属性接口【待验证】',
url: '/sortAttribute/delete',
params: [
{name: "sortId", type: "number"},
{name: "attributeId", type: "number"}
]
},
delete:{
title:'删除品类关联尺码属性接口【待验证】',
url: '/sortAttribute/delete',
params: [
{name: "sortId", type: "number"},
{name: "attributeId", type: "number"}
]
updateOrderBy: {
title: '修改品类关联尺码属性接口【待验证】',
url: '/sortAttribute/updateOrderBy',
params: [
{name: "sortId", type: "number"},
{name: "attributeId", type: "number"},
{name: "orderBy", type: "number"}
]
},
updateOrderBy:{
title:'修改品类关联尺码属性接口【待验证】',
url: '/sortAttribute/updateOrderBy',
params: [
{name: "sortId", type: "number"},
{name: "attributeId", type: "number"},
{name: "orderBy", type: "number"}
]
querySizeAttributesByName: {
title: '尺码属性搜素',
url: '/product/querySizeAttributesByName',
params: [
{name: "idName", type: "String"},
{name: "sortId", type: "Number"}
]
}
}
}
\ No newline at end of file
};
\ No newline at end of file
... ...
... ... @@ -44,7 +44,6 @@
<input type="text" value="[[sortName]]" class="form-control observe" required data-field="sortName" readonly/>
</div>
</div>
[[if name=="尺码"]]
<div class="form-group">
<label class="col-sm-2 control-label">[[name]]<i class="red">*</i></label>
[[if __state=='update']]
... ... @@ -57,21 +56,6 @@
</div>
[[/if]]
</div>
[[/if]]
[[if name=="尺码属性"]]
<div class="form-group">
<label class="col-sm-2 control-label">[[name]]<i class="red">*</i></label>
[[if __state=='update']]
<div class="col-sm-6">
<input type="text" value="[[attributeName]]" class="form-control" readonly/>
</div>
[[else]]
<div class="col-sm-6" id="attri-content">
</div>
[[/if]]
</div>
[[/if]]
<div class="form-group">
<label class="col-sm-2 control-label">排序<i class="red">*</i></label>
... ... @@ -91,13 +75,4 @@
[[/each]]
</select>
</script>
<script type="text/template" id="search-attri">
<select id="choose-attri" title="" class="select2-offscreen form-control" required placehoder="尺码属性">
<option value="">选择尺码属性</option>
[[each data as item index]]
<option value="[[item.id]]">[[item.text]]</option>
[[/each]]
</select>
</script>
<%include '../../common/views/__ui/footer'%>
\ No newline at end of file
... ...
... ... @@ -7,14 +7,15 @@
<div class="panel-body">
<div class="pannel-scroll">
<ul class="list-group">
<%if data%>
<%each data as item%>
<li class="list-group-item level<%item.sortLevel%> <%if item.child%>hidden<%/if%>" data-parent="<%item.parentId%>" data-val="<%item.id%>" data-status="close">
<%if data%>
<%each data as item%>
<li class="list-group-item level<%item.sortLevel%> <%if item.child%>hidden<%/if%>"
data-parent="<%item.parentId%>" data-val="<%item.id%>" data-status="close">
<span class="icon expand-icon glyphicon glyphicon-plus"></span>
<%item.sortName%>
</li>
<%/each%>
<%/if%>
<%/each%>
<%/if%>
</ul>
</div>
</div>
... ... @@ -28,7 +29,7 @@
</button>
</div>
</div>
<div id="basicTable" class="table-responsive">
<div id="basicTable" class="table-responsive">
</div>
</div>
</div>
... ... @@ -41,24 +42,10 @@
<label class="col-sm-2 control-label">当前分类<i class="red">*</i></label>
<div class="col-sm-6">
<input type="text" value="[[sortName]]" class="form-control observe" required data-field="sortName" readonly/>
<input type="text" value="[[sortName]]" class="form-control observe" required data-field="sortName"
readonly/>
</div>
</div>
[[if name=="尺码"]]
<div class="form-group">
<label class="col-sm-2 control-label">[[name]]<i class="red">*</i></label>
[[if __state=='update']]
<div class="col-sm-6">
<input type="text" value="[[sizeName]]" class="form-control observe" data-field="sizeName" readonly/>
</div>
[[else]]
<div class="col-sm-6" id="sort-content">
</div>
[[/if]]
</div>
[[/if]]
[[if name=="尺码属性"]]
<div class="form-group">
<label class="col-sm-2 control-label">[[name]]<i class="red">*</i></label>
[[if __state=='update']]
... ... @@ -71,7 +58,6 @@
</div>
[[/if]]
</div>
[[/if]]
<div class="form-group">
<label class="col-sm-2 control-label">排序<i class="red">*</i></label>
... ... @@ -83,14 +69,6 @@
</div>
</script>
<script type="text/template" id="search-sort">
<select id="choose-sort" title="" class="select2-offscreen form-control" required placehoder="尺码">
<option value="">选择尺码</option>
[[each data as item index]]
<option value="[[item.id]]">[[item.text]]</option>
[[/each]]
</select>
</script>
<script type="text/template" id="search-attri">
<select id="choose-attri" title="" class="select2-offscreen form-control" required placehoder="尺码属性">
<option value="">选择尺码属性</option>
... ...
... ... @@ -61,7 +61,7 @@
</div>
<div class="row show-grid">
<div id="baseTable"></div>
<input type="hidden" id="shopRelationList" value="<%data.shopRelationList%>" />
<input type="hidden" id="shopRelationList" value='<%data.shopRelationList%>' />
</div>
<div style="text-align: center">
<%if btn%>
... ...
... ... @@ -62,7 +62,7 @@ var Bll = {
"sortId": window.sortid ? window.sortid : ""
}
}, function (res) {
Bll.orderBys=[];
Bll.orderBys = [];
if (res.data && res.data.list) {
var list = res.data.list;
list.forEach(function (x) {
... ... @@ -100,16 +100,16 @@ var Bll = {
{
value: "保存",
callback: function () {
var flag=true;
if(Bll.orderBys.length>0){
for(var i=0;i<Bll.orderBys.length;i++){
if(Bll.orderBys[i]==Bll.module.orderBy){
flag=false;
var flag = true;
if (Bll.orderBys.length > 0) {
for (var i = 0; i < Bll.orderBys.length; i++) {
if (Bll.orderBys[i] == Bll.module.orderBy) {
flag = false;
common.util.__tip("排序值不可重复", "warning");
}
}
}
if (edit.validate()&&flag) {
if (edit.validate() && flag) {
common.util.__ajax({
url: url,
data: Bll.module
... ... @@ -164,6 +164,7 @@ $(document).on("click", ".editBtn", function () {
var item = g.rows[$(this).data("index")];
item = $.extend(true, {}, item);
item.__state = "update";
item.name = "尺码";
Bll.toast("修改", item, "/product/updateSortSize");
});
... ...
/**
* 创建供应商
*/
'use strict';
var $ = require('jquery'),
common = require('../../common/common');
var sortmenu = require('../../common/sortmenu');
sortmenu.init(function () {
g.init('/erpproduct/sortattribute/ajax/index');
});
var g = new common.grid({
el: "#basicTable",
parms: function () {
return {
sortId: window.sortid ? window.sortid : "",
sortId: window.sortid ? window.sortid : ""
};
},
columns: [
... ... @@ -21,18 +23,19 @@ var g = new common.grid({
{display: "尺码属性名", name: "attributeName"},
{display: "排序", name: "orderBy"},
{
display: "操作", name: 'id', render: function (item) {
if (window.sortid == item.sortId)
return '<a data-index="' + item.__index + '" href="javascript:void(0)" class="btn btn-success btn-xs delbtn">删除</a>';
display: "操作", render: function (item) {
var htmlArr = [];
// 子类目不能删除父类目所创建的属性
if (window.sortid == item.sortId) {
htmlArr.push('<a data-index="' + item.__index + '" href="javascript:void(0)" class="btn btn-success btn-xs delbtn">删除</a>')
htmlArr.push('<a data-index="' + item.__index + '" href="javascript:void(0)" class="btn btn-primary btn-xs editBtn">修改</a>')
}
return htmlArr.join("");
}
}
]
});
sortmenu.init(function () {
g.init('/erpproduct/sortattribute/ajax/index');
});
/**
* 验证
... ... @@ -46,6 +49,25 @@ var edit = new common.edit2(".modal-body");
var Bll = {
module: null,
attri: [],
orderBys: [],
getOrderBy: function () {
common.util.__ajax({
url: '/erpproduct/sortattribute/ajax/index',
data: {
"sortId": window.sortid ? window.sortid : ""
}
}, function (res) {
Bll.orderBys = [];
if (res.data && res.data.list) {
var list = res.data.list;
list.forEach(function (x) {
if (x.orderBy != 0) {
Bll.orderBys.push(x.orderBy);
}
})
}
}, true);
},
dropDown: function () {
common.util.__ajax({
url: '/erpproduct/sortattribute/ajax/automatic',
... ... @@ -60,31 +82,35 @@ var Bll = {
},
//弹框
toast: function (hint, module, url) {
if (module.__state == 'add') {
Bll.module = module;
Bll.getOrderBy();
if (Bll.module.__state == 'add') {
Bll.dropDown();
}
Bll.module = module;
var d = new common.dialog({
title: hint + "尺码",
title: hint + "尺码属性",
content: common.util.__template2($("#template").html(), Bll.module),
width: '30%',
button: [
{
value: "保存",
callback: function () {
console.log("保存数据", Bll.module);
if (edit.validate()) {
var flag = true;
if (Bll.orderBys.length > 0) {
for (var i = 0; i < Bll.orderBys.length; i++) {
if (Bll.orderBys[i] == Bll.module.orderBy) {
flag = false;
common.util.__tip("排序值不可重复", "warning");
}
}
}
if (edit.validate() && flag) {
common.util.__ajax({
url: url,
data: Bll.module
}, function (res) {
if (res.code == '200') {
g.reload();
d.close();
}
else {
common.util.__tip(res.message, "warning");
}
}, function () {
g.reload();
d.close();
});
}
return false;
... ... @@ -116,14 +142,24 @@ $(document).on("change", ".observe", function () {
$(document).on("click", "#btn-add", function () {
var item = {
__state: "add",
name:"尺码属性",
name: "尺码属性",
sortName: window.sortname,
sortId: window.sortid,
attributeName: "",
attributeId: "",
orderBy: 0
};
Bll.toast("新增", item, '/erpproduct/sortsize/ajax/add');
Bll.toast("新增", item, '/erpproduct/sortattribute/ajax/add');
});
/**
* 修改
*/
$(document).on("click", ".editBtn", function () {
var item = g.rows[$(this).data("index")];
item = $.extend(true, {}, item);
item.__state = "update";
item.name = "尺码属性";
Bll.toast("修改", item, "/sortAttribute/updateOrderBy");
});
/**
* 删除
... ...