Authored by weiqingting

商品参数

... ... @@ -241,13 +241,9 @@ $('#editProductName').on('click', function() {
// });
/*陈超*/
var ag = new common.grid({
el: "#attributeTable",
columns: [{
var common_columns=[{
display: "名称",
width:'10%',
name: "attributeName",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
... ... @@ -258,13 +254,16 @@ var ag = new common.grid({
}
return arr.join('');
}
}, {
}]
/*陈超*/
var ag = new common.grid({
el: "#attributeTable",
columns: common_columns.concat([{
display: "属性",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
// item.attributeValues=item.attributeValues.split(',').map(function(elem, index, arr){
// return {name:elem}
// });
var attrs = NETSALEDATA.productStandardRelationBoList;
if (attrs) {
... ... @@ -276,13 +275,10 @@ var ag = new common.grid({
}
}
// item.attributeValues={name:};
item.__name="attributeTable";
return common.util.__template2($("#template33").html(), item);
}
}, {
display: "备注",
name: "remark"
}],
}]),
complete: function() {
ag.__edit.init();
}
... ... @@ -305,26 +301,11 @@ common.util.__ajax({
console.log("attributeProValuesBosOne", NETSALEDATA.attributeProValuesBosOne);
var ag2 = new common.grid({
el: "#goodsParamWrap",
columns: [{
display: "名称",
name: "attributeName",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
var arr = [];
arr.push(item.attributeName);
if (item.required) {
arr.push("<span class='red'>*</span>");
}
return arr.join('');
}
}, {
columns: common_columns.concat([{
display: "属性",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
item.id = item.parameterMakeId;
// item.attributeValues=item.attributeValues.split(',').map(function(elem, index, arr){
// return {name:elem}
// });
var attrs = NETSALEDATA.attributeProValuesBosOne;
if (attrs) {
for (var i in attrs) {
... ... @@ -334,14 +315,10 @@ var ag2 = new common.grid({
}
}
}
// item.attributeValues={name:};
item.__name="goodsParamWrap";
return common.util.__template2($("#template33").html(), item);
}
}, {
display: "备注",
name: "remark"
}],
}]),
complete: function() {
ag2.__edit.init();
}
... ... @@ -360,19 +337,64 @@ common.util.__ajax({
ag2.init(res.data);
}, true);
// console.log(basicInfo);
var ag3 = new common.grid({
el: "#goodsParamWrap2",
columns: common_columns.concat([{
display: "属性",
render: function(item) {
item.required = item.isMust == "Y" ? "required" : "";
item.id = item.parameterMakeId;
var attrs = NETSALEDATA.specialAttrBo;
if (attrs&&attrs.materialList) {
var _arr=[];
for (var i in attrs.materialList) {
_arr.push(attrs.materialList[i].id);
}
item.__val = _arr.join('|');
}
item.__name="goodsParamWrap2";
return common.util.__template2($("#template33").html(), item);
}
}]),
complete: function() {
ag3.__edit.init();
}
});
ag3.__edit = new common.edit("#goodsParamWrap2");
common.util.__ajax({
url: '/base/goods/queryMaterialList',
data: {
categoryId: basicInfo.maxSortId
}
}, function(res) {
console.log("接口queryMaterialList",res.data);
ag3.init([res.data]);
}, true);
$(document).on("change", "#goodsParamWrap .attr_input", function() {
var item = ag2.rows[$(this).data("index")];
item.val = $(this).val();
});
$(document).on("change", "#goodsParamWrap .attr_checkobx_class", function() {
var item = ag2.rows[$(this).data("index")];
item.val = $("#attr_" + $(this).data("index")).val().replace(/\|/g, ',');
})
$(document).on("change", "#attributeTable .attr_input", function() {
var item = ag.rows[$(this).data("index")];
item.val = $(this).val();
});
$(document).on("change", "#goodsParamWrap .attr_checkobx_class", function() {
var item = ag2.rows[$(this).data("index")];
item.val = $("#goodsParamWrap_attr_" + $(this).data("index")).val().replace(/\|/g, ',');
})
$(document).on("change", "#goodsParamWrap2 .attr_checkobx_class", function() {
var item = ag3.rows[$(this).data("index")];
item.val = $("#goodsParamWrap2_attr_" + $(this).data("index")).val().replace(/\|/g, ',');
})
/*保存*/
GOLABDATA.on("TYgoodsParams", function() {
... ... @@ -381,7 +403,10 @@ GOLABDATA.on("TYgoodsParams", function() {
return ag.__edit.errMessage;
}
if (!ag2.__edit.validate(true)) {
return ag.__edit.errMessage;
return ag2.__edit.errMessage;
}
if (!ag3.__edit.validate(true)) {
return ag3.__edit.errMessage;
}
var productStandardRelationStr = [];
... ... @@ -421,8 +446,14 @@ GOLABDATA.on("TYgoodsParams", function() {
}
}
data.attributeProValuesOne = JSON.stringify(goodsParamArr);
data.productMaterial="";
if (ag3.rows.length > 0) {
data.productMaterial=ag3.rows[0].val;
}
data.productSkn = $('#productSkn').val();
console.log(data);
console.log("data",data);
return data;
});
... ...
... ... @@ -17,10 +17,10 @@ var config = {
// domain:'http://172.16.6.240:8088/platform',// 王书生
// domain: 'http://172.16.6.124:8088/platform',//陈超
//http://172.16.6.124:8088/platform/product/queryAllProductAttr
//domain: 'http://172.16.6.227:8088/platform', //玛丽
domain: 'http://172.16.6.227:8088/platform', //玛丽
// domain: 'http://192.168.102.202:8088/platform',
//domain:'http://172.16.6.197:8080/yohobuy-platform-web',//葛超
domain: 'http://192.168.102.202:8088/platform',
// domain: 'http://192.168.102.202:8088/platform',
// domain: 'http://192.168.102.202:8088/platform',
//domain:'http://172.16.9.8:8080/yohobuy-platform-web',//葛超
// domain: 'http://192.168.102.202:8088/platform',
... ...
... ... @@ -166,7 +166,8 @@ exports.res = [{ //基础商品列表
url: '/productColor/queryProductColors',
data: {
pageTitle: "创建基础商品",
action: "/base/goods/ajax/add"
action: "/base/goods/ajax/add",
btnText:"提交审核"
},
src: '/basegoods/edit'
}, { //添加接口
... ... @@ -265,7 +266,8 @@ exports.res = [{ //基础商品列表
src: '/basegoods/edit',
data: {
pageTitle: "修改基础商品",
action: "/base/goods/ajax/update"
action: "/base/goods/ajax/update",
btnText:"保存"
}
}, { //删除
route: '/base/goods/ajax/delete',
... ... @@ -493,6 +495,15 @@ exports.res = [{ //基础商品列表
}
]
}, {
route: '/base/goods/queryMaterialList',
method: 'POST',
url: '/product/queryMaterialList',
params: [{
name: 'categoryId',
type: 'Number'
}
]
},{
route: '/goods/query/querySortBySmallSort',
method: 'POST',
url: '/product/querySortBySmallSort',
... ...
... ... @@ -334,6 +334,9 @@ exports.res = [{
}, {
name: 'productStandardRelationStr',
type: 'string'
},{
name: 'productMaterial',
type: 'string'
}]
}, {
//网销信息 -> 保存基本信息接口
... ... @@ -702,5 +705,4 @@ exports.res = [{
type: 'Number'
}]
}
];
\ No newline at end of file
... ...
... ... @@ -82,5 +82,8 @@ exports.res = [{
}, {
name: 'productStandardRelationStr',
type: 'string'
},{
name: 'productMaterial',
type: 'string'
}]
}];
\ No newline at end of file
... ...
... ... @@ -64,7 +64,7 @@
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<a class="btn btn-default" href="/supplier/baseproduct/index">取消</a>
<button type="submit" class="btn btn-success mr5" data-loading-text="保存中..." id="btnReview">保存</button>
<button type="submit" class="btn btn-success mr5" data-loading-text="保存中..." id="btnReview">{{btnText}}</button>
</div>
</div>
</div>
... ...
... ... @@ -6,10 +6,15 @@
</div>
<h2 class="panel-title">商品参数</h2>
</div>
<div class="panel-body">
<div id="attributeTable" class="panel-body nopadding">
</div>
<div id="goodsParamWrap" class="panel-body nopadding">
</div>
<div id="attributeTable" class="panel-body nopadding">
<div id="goodsParamWrap2" class="panel-body nopadding">
</div>
</div>
<div class="panel-footer" id="goodsParams-footer">
<a href="javascript:;" class="btn btn-primary" id="propertySave">保存</a>
</div>
... ... @@ -67,17 +72,17 @@
[[if inputType=='checkbox']]
[[each idNameList as item index ]]
<label class="radio-inline">
<input type="checkbox" name="attr_[[__index]]" data-index=[[__index]] class="attr_checkobx_class" value="[[item.id]]">[[item.text]]</label>
<input type="checkbox" name="[[__name]]_attr_[[__index]]" data-index=[[__index]] class="attr_checkobx_class" value="[[item.id]]">[[item.text]]</label>
[[/each]]
<input type="hidden" id="attr_[[__index]]" value="[[__val||'']]" [[required]] for="checkbox" placeholder="[[attributeName]]"/>
<input type="hidden" id="[[__name]]_attr_[[__index]]" value="[[__val||'']]" [[required]] for="checkbox" placeholder="[[attributeName]]"/>
[[/if]]
[[if inputType=='radio']]
[[each idNameList as item index ]]
<label class="radio-inline">
<input type="radio" name="attr_[[__index]]" data-index=[[__index]] class="attr_input" value="[[item.id]]">[[item.text]]</label>
<input type="radio" name="[[__name]]_attr_[[__index]]" data-index=[[__index]] class="attr_input" value="[[item.id]]">[[item.text]]</label>
[[/each]]
<input type="hidden" id="attr_[[__index]]" data-index='[[__index]]' value="[[__val||'']]" [[required]] for="radio" placeholder="[[attributeName]]" />
<input type="hidden" id="[[__name]]_attr_[[__index]]" data-index='[[__index]]' value="[[__val||'']]" [[required]] for="radio" placeholder="[[attributeName]]" />
[[/if]]
[[if inputType=='select']]
... ...