Authored by weiqingting

商品参数

@@ -241,13 +241,9 @@ $('#editProductName').on('click', function() { @@ -241,13 +241,9 @@ $('#editProductName').on('click', function() {
241 // }); 241 // });
242 242
243 243
244 -  
245 -/*陈超*/  
246 -  
247 -var ag = new common.grid({  
248 - el: "#attributeTable",  
249 - columns: [{ 244 +var common_columns=[{
250 display: "名称", 245 display: "名称",
  246 + width:'10%',
251 name: "attributeName", 247 name: "attributeName",
252 render: function(item) { 248 render: function(item) {
253 item.required = item.isMust == "Y" ? "required" : ""; 249 item.required = item.isMust == "Y" ? "required" : "";
@@ -258,13 +254,16 @@ var ag = new common.grid({ @@ -258,13 +254,16 @@ var ag = new common.grid({
258 } 254 }
259 return arr.join(''); 255 return arr.join('');
260 } 256 }
261 - }, { 257 + }]
  258 +
  259 +/*陈超*/
  260 +
  261 +var ag = new common.grid({
  262 + el: "#attributeTable",
  263 + columns: common_columns.concat([{
262 display: "属性", 264 display: "属性",
263 render: function(item) { 265 render: function(item) {
264 item.required = item.isMust == "Y" ? "required" : ""; 266 item.required = item.isMust == "Y" ? "required" : "";
265 - // item.attributeValues=item.attributeValues.split(',').map(function(elem, index, arr){  
266 - // return {name:elem}  
267 - // });  
268 267
269 var attrs = NETSALEDATA.productStandardRelationBoList; 268 var attrs = NETSALEDATA.productStandardRelationBoList;
270 if (attrs) { 269 if (attrs) {
@@ -276,13 +275,10 @@ var ag = new common.grid({ @@ -276,13 +275,10 @@ var ag = new common.grid({
276 } 275 }
277 } 276 }
278 277
279 - // item.attributeValues={name:}; 278 + item.__name="attributeTable";
280 return common.util.__template2($("#template33").html(), item); 279 return common.util.__template2($("#template33").html(), item);
281 } 280 }
282 - }, {  
283 - display: "备注",  
284 - name: "remark"  
285 - }], 281 + }]),
286 complete: function() { 282 complete: function() {
287 ag.__edit.init(); 283 ag.__edit.init();
288 } 284 }
@@ -305,26 +301,11 @@ common.util.__ajax({ @@ -305,26 +301,11 @@ common.util.__ajax({
305 console.log("attributeProValuesBosOne", NETSALEDATA.attributeProValuesBosOne); 301 console.log("attributeProValuesBosOne", NETSALEDATA.attributeProValuesBosOne);
306 var ag2 = new common.grid({ 302 var ag2 = new common.grid({
307 el: "#goodsParamWrap", 303 el: "#goodsParamWrap",
308 - columns: [{  
309 - display: "名称",  
310 - name: "attributeName",  
311 - render: function(item) {  
312 - item.required = item.isMust == "Y" ? "required" : "";  
313 - var arr = [];  
314 - arr.push(item.attributeName);  
315 - if (item.required) {  
316 - arr.push("<span class='red'>*</span>");  
317 - }  
318 - return arr.join('');  
319 - }  
320 - }, { 304 + columns: common_columns.concat([{
321 display: "属性", 305 display: "属性",
322 render: function(item) { 306 render: function(item) {
323 item.required = item.isMust == "Y" ? "required" : ""; 307 item.required = item.isMust == "Y" ? "required" : "";
324 item.id = item.parameterMakeId; 308 item.id = item.parameterMakeId;
325 - // item.attributeValues=item.attributeValues.split(',').map(function(elem, index, arr){  
326 - // return {name:elem}  
327 - // });  
328 var attrs = NETSALEDATA.attributeProValuesBosOne; 309 var attrs = NETSALEDATA.attributeProValuesBosOne;
329 if (attrs) { 310 if (attrs) {
330 for (var i in attrs) { 311 for (var i in attrs) {
@@ -334,14 +315,10 @@ var ag2 = new common.grid({ @@ -334,14 +315,10 @@ var ag2 = new common.grid({
334 } 315 }
335 } 316 }
336 } 317 }
337 -  
338 - // item.attributeValues={name:}; 318 + item.__name="goodsParamWrap";
339 return common.util.__template2($("#template33").html(), item); 319 return common.util.__template2($("#template33").html(), item);
340 } 320 }
341 - }, {  
342 - display: "备注",  
343 - name: "remark"  
344 - }], 321 + }]),
345 complete: function() { 322 complete: function() {
346 ag2.__edit.init(); 323 ag2.__edit.init();
347 } 324 }
@@ -360,19 +337,64 @@ common.util.__ajax({ @@ -360,19 +337,64 @@ common.util.__ajax({
360 ag2.init(res.data); 337 ag2.init(res.data);
361 }, true); 338 }, true);
362 339
  340 +// console.log(basicInfo);
  341 +
  342 +var ag3 = new common.grid({
  343 + el: "#goodsParamWrap2",
  344 + columns: common_columns.concat([{
  345 + display: "属性",
  346 + render: function(item) {
  347 + item.required = item.isMust == "Y" ? "required" : "";
  348 + item.id = item.parameterMakeId;
  349 + var attrs = NETSALEDATA.specialAttrBo;
  350 + if (attrs&&attrs.materialList) {
  351 + var _arr=[];
  352 + for (var i in attrs.materialList) {
  353 + _arr.push(attrs.materialList[i].id);
  354 + }
  355 + item.__val = _arr.join('|');
  356 + }
  357 +
  358 + item.__name="goodsParamWrap2";
  359 + return common.util.__template2($("#template33").html(), item);
  360 + }
  361 + }]),
  362 + complete: function() {
  363 + ag3.__edit.init();
  364 + }
  365 +});
  366 +ag3.__edit = new common.edit("#goodsParamWrap2");
  367 +common.util.__ajax({
  368 + url: '/base/goods/queryMaterialList',
  369 + data: {
  370 + categoryId: basicInfo.maxSortId
  371 + }
  372 +}, function(res) {
  373 + console.log("接口queryMaterialList",res.data);
  374 + ag3.init([res.data]);
  375 +}, true);
  376 +
  377 +
363 $(document).on("change", "#goodsParamWrap .attr_input", function() { 378 $(document).on("change", "#goodsParamWrap .attr_input", function() {
364 var item = ag2.rows[$(this).data("index")]; 379 var item = ag2.rows[$(this).data("index")];
365 item.val = $(this).val(); 380 item.val = $(this).val();
366 }); 381 });
367 -$(document).on("change", "#goodsParamWrap .attr_checkobx_class", function() {  
368 - var item = ag2.rows[$(this).data("index")];  
369 - item.val = $("#attr_" + $(this).data("index")).val().replace(/\|/g, ',');  
370 -}) 382 +
371 $(document).on("change", "#attributeTable .attr_input", function() { 383 $(document).on("change", "#attributeTable .attr_input", function() {
372 var item = ag.rows[$(this).data("index")]; 384 var item = ag.rows[$(this).data("index")];
373 item.val = $(this).val(); 385 item.val = $(this).val();
374 }); 386 });
375 387
  388 +$(document).on("change", "#goodsParamWrap .attr_checkobx_class", function() {
  389 + var item = ag2.rows[$(this).data("index")];
  390 + item.val = $("#goodsParamWrap_attr_" + $(this).data("index")).val().replace(/\|/g, ',');
  391 +})
  392 +
  393 +$(document).on("change", "#goodsParamWrap2 .attr_checkobx_class", function() {
  394 + var item = ag3.rows[$(this).data("index")];
  395 + item.val = $("#goodsParamWrap2_attr_" + $(this).data("index")).val().replace(/\|/g, ',');
  396 +})
  397 +
376 398
377 /*保存*/ 399 /*保存*/
378 GOLABDATA.on("TYgoodsParams", function() { 400 GOLABDATA.on("TYgoodsParams", function() {
@@ -381,7 +403,10 @@ GOLABDATA.on("TYgoodsParams", function() { @@ -381,7 +403,10 @@ GOLABDATA.on("TYgoodsParams", function() {
381 return ag.__edit.errMessage; 403 return ag.__edit.errMessage;
382 } 404 }
383 if (!ag2.__edit.validate(true)) { 405 if (!ag2.__edit.validate(true)) {
384 - return ag.__edit.errMessage; 406 + return ag2.__edit.errMessage;
  407 + }
  408 + if (!ag3.__edit.validate(true)) {
  409 + return ag3.__edit.errMessage;
385 } 410 }
386 411
387 var productStandardRelationStr = []; 412 var productStandardRelationStr = [];
@@ -421,8 +446,14 @@ GOLABDATA.on("TYgoodsParams", function() { @@ -421,8 +446,14 @@ GOLABDATA.on("TYgoodsParams", function() {
421 } 446 }
422 } 447 }
423 data.attributeProValuesOne = JSON.stringify(goodsParamArr); 448 data.attributeProValuesOne = JSON.stringify(goodsParamArr);
  449 +
  450 + data.productMaterial="";
  451 + if (ag3.rows.length > 0) {
  452 + data.productMaterial=ag3.rows[0].val;
  453 + }
  454 +
424 data.productSkn = $('#productSkn').val(); 455 data.productSkn = $('#productSkn').val();
425 - console.log(data); 456 + console.log("data",data);
426 return data; 457 return data;
427 458
428 }); 459 });
@@ -17,10 +17,10 @@ var config = { @@ -17,10 +17,10 @@ var config = {
17 // domain:'http://172.16.6.240:8088/platform',// 王书生 17 // domain:'http://172.16.6.240:8088/platform',// 王书生
18 // domain: 'http://172.16.6.124:8088/platform',//陈超 18 // domain: 'http://172.16.6.124:8088/platform',//陈超
19 //http://172.16.6.124:8088/platform/product/queryAllProductAttr 19 //http://172.16.6.124:8088/platform/product/queryAllProductAttr
20 - //domain: 'http://172.16.6.227:8088/platform', //玛丽 20 + domain: 'http://172.16.6.227:8088/platform', //玛丽
21 // domain: 'http://192.168.102.202:8088/platform', 21 // domain: 'http://192.168.102.202:8088/platform',
22 //domain:'http://172.16.6.197:8080/yohobuy-platform-web',//葛超 22 //domain:'http://172.16.6.197:8080/yohobuy-platform-web',//葛超
23 - domain: 'http://192.168.102.202:8088/platform', 23 + // domain: 'http://192.168.102.202:8088/platform',
24 // domain: 'http://192.168.102.202:8088/platform', 24 // domain: 'http://192.168.102.202:8088/platform',
25 //domain:'http://172.16.9.8:8080/yohobuy-platform-web',//葛超 25 //domain:'http://172.16.9.8:8080/yohobuy-platform-web',//葛超
26 // domain: 'http://192.168.102.202:8088/platform', 26 // domain: 'http://192.168.102.202:8088/platform',
@@ -166,7 +166,8 @@ exports.res = [{ //基础商品列表 @@ -166,7 +166,8 @@ exports.res = [{ //基础商品列表
166 url: '/productColor/queryProductColors', 166 url: '/productColor/queryProductColors',
167 data: { 167 data: {
168 pageTitle: "创建基础商品", 168 pageTitle: "创建基础商品",
169 - action: "/base/goods/ajax/add" 169 + action: "/base/goods/ajax/add",
  170 + btnText:"提交审核"
170 }, 171 },
171 src: '/basegoods/edit' 172 src: '/basegoods/edit'
172 }, { //添加接口 173 }, { //添加接口
@@ -265,7 +266,8 @@ exports.res = [{ //基础商品列表 @@ -265,7 +266,8 @@ exports.res = [{ //基础商品列表
265 src: '/basegoods/edit', 266 src: '/basegoods/edit',
266 data: { 267 data: {
267 pageTitle: "修改基础商品", 268 pageTitle: "修改基础商品",
268 - action: "/base/goods/ajax/update" 269 + action: "/base/goods/ajax/update",
  270 + btnText:"保存"
269 } 271 }
270 }, { //删除 272 }, { //删除
271 route: '/base/goods/ajax/delete', 273 route: '/base/goods/ajax/delete',
@@ -493,6 +495,15 @@ exports.res = [{ //基础商品列表 @@ -493,6 +495,15 @@ exports.res = [{ //基础商品列表
493 } 495 }
494 ] 496 ]
495 }, { 497 }, {
  498 + route: '/base/goods/queryMaterialList',
  499 + method: 'POST',
  500 + url: '/product/queryMaterialList',
  501 + params: [{
  502 + name: 'categoryId',
  503 + type: 'Number'
  504 + }
  505 + ]
  506 + },{
496 route: '/goods/query/querySortBySmallSort', 507 route: '/goods/query/querySortBySmallSort',
497 method: 'POST', 508 method: 'POST',
498 url: '/product/querySortBySmallSort', 509 url: '/product/querySortBySmallSort',
@@ -334,6 +334,9 @@ exports.res = [{ @@ -334,6 +334,9 @@ exports.res = [{
334 }, { 334 }, {
335 name: 'productStandardRelationStr', 335 name: 'productStandardRelationStr',
336 type: 'string' 336 type: 'string'
  337 + },{
  338 + name: 'productMaterial',
  339 + type: 'string'
337 }] 340 }]
338 }, { 341 }, {
339 //网销信息 -> 保存基本信息接口 342 //网销信息 -> 保存基本信息接口
@@ -702,5 +705,4 @@ exports.res = [{ @@ -702,5 +705,4 @@ exports.res = [{
702 type: 'Number' 705 type: 'Number'
703 }] 706 }]
704 } 707 }
705 -  
706 ]; 708 ];
@@ -82,5 +82,8 @@ exports.res = [{ @@ -82,5 +82,8 @@ exports.res = [{
82 }, { 82 }, {
83 name: 'productStandardRelationStr', 83 name: 'productStandardRelationStr',
84 type: 'string' 84 type: 'string'
  85 + },{
  86 + name: 'productMaterial',
  87 + type: 'string'
85 }] 88 }]
86 }]; 89 }];
@@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
64 <div class="row"> 64 <div class="row">
65 <div class="col-sm-8 col-sm-offset-2"> 65 <div class="col-sm-8 col-sm-offset-2">
66 <a class="btn btn-default" href="/supplier/baseproduct/index">取消</a> 66 <a class="btn btn-default" href="/supplier/baseproduct/index">取消</a>
67 - <button type="submit" class="btn btn-success mr5" data-loading-text="保存中..." id="btnReview">保存</button> 67 + <button type="submit" class="btn btn-success mr5" data-loading-text="保存中..." id="btnReview">{{btnText}}</button>
68 </div> 68 </div>
69 </div> 69 </div>
70 </div> 70 </div>
@@ -6,10 +6,15 @@ @@ -6,10 +6,15 @@
6 </div> 6 </div>
7 <h2 class="panel-title">商品参数</h2> 7 <h2 class="panel-title">商品参数</h2>
8 </div> 8 </div>
9 - <div id="goodsParamWrap" class="panel-body nopadding">  
10 - </div>  
11 - <div id="attributeTable" class="panel-body nopadding"> 9 + <div class="panel-body">
  10 + <div id="attributeTable" class="panel-body nopadding">
  11 + </div>
  12 + <div id="goodsParamWrap" class="panel-body nopadding">
  13 + </div>
  14 + <div id="goodsParamWrap2" class="panel-body nopadding">
  15 + </div>
12 </div> 16 </div>
  17 +
13 <div class="panel-footer" id="goodsParams-footer"> 18 <div class="panel-footer" id="goodsParams-footer">
14 <a href="javascript:;" class="btn btn-primary" id="propertySave">保存</a> 19 <a href="javascript:;" class="btn btn-primary" id="propertySave">保存</a>
15 </div> 20 </div>
@@ -67,17 +72,17 @@ @@ -67,17 +72,17 @@
67 [[if inputType=='checkbox']] 72 [[if inputType=='checkbox']]
68 [[each idNameList as item index ]] 73 [[each idNameList as item index ]]
69 <label class="radio-inline"> 74 <label class="radio-inline">
70 - <input type="checkbox" name="attr_[[__index]]" data-index=[[__index]] class="attr_checkobx_class" value="[[item.id]]">[[item.text]]</label> 75 + <input type="checkbox" name="[[__name]]_attr_[[__index]]" data-index=[[__index]] class="attr_checkobx_class" value="[[item.id]]">[[item.text]]</label>
71 [[/each]] 76 [[/each]]
72 - <input type="hidden" id="attr_[[__index]]" value="[[__val||'']]" [[required]] for="checkbox" placeholder="[[attributeName]]"/> 77 + <input type="hidden" id="[[__name]]_attr_[[__index]]" value="[[__val||'']]" [[required]] for="checkbox" placeholder="[[attributeName]]"/>
73 [[/if]] 78 [[/if]]
74 79
75 [[if inputType=='radio']] 80 [[if inputType=='radio']]
76 [[each idNameList as item index ]] 81 [[each idNameList as item index ]]
77 <label class="radio-inline"> 82 <label class="radio-inline">
78 - <input type="radio" name="attr_[[__index]]" data-index=[[__index]] class="attr_input" value="[[item.id]]">[[item.text]]</label> 83 + <input type="radio" name="[[__name]]_attr_[[__index]]" data-index=[[__index]] class="attr_input" value="[[item.id]]">[[item.text]]</label>
79 [[/each]] 84 [[/each]]
80 -<input type="hidden" id="attr_[[__index]]" data-index='[[__index]]' value="[[__val||'']]" [[required]] for="radio" placeholder="[[attributeName]]" /> 85 +<input type="hidden" id="[[__name]]_attr_[[__index]]" data-index='[[__index]]' value="[[__val||'']]" [[required]] for="radio" placeholder="[[attributeName]]" />
81 [[/if]] 86 [[/if]]
82 87
83 [[if inputType=='select']] 88 [[if inputType=='select']]