|
@@ -277,10 +277,10 @@ var g = new common.grid({ |
|
@@ -277,10 +277,10 @@ var g = new common.grid({ |
277
|
|
277
|
|
278
|
if (item.status == 4 || item.status == 1 || item.status == 5 || item.status == 6) {
|
278
|
if (item.status == 4 || item.status == 1 || item.status == 5 || item.status == 6) {
|
279
|
HtmArr.push('<a href="/goods/netsale/edit/' + item.productSkn + editPostion + '" class="btn btn-info btn-xs edit-btn">编辑</a>');
|
279
|
HtmArr.push('<a href="/goods/netsale/edit/' + item.productSkn + editPostion + '" class="btn btn-info btn-xs edit-btn">编辑</a>');
|
280
|
- HtmArr.push('<a href="javascript:;" class="btn btn-danger btn-xs shelve-btn" data-skn="' + item.productSkn + '">下架</a>');
|
280
|
+ HtmArr.push('<a href="javascript:;" class="btn btn-danger btn-xs shelve-btn" data-index="' + item.__index + '">下架</a>');
|
281
|
} else if (item.status == 3 || item.status == 8 || item.status == 2 || item.status == 0) {
|
281
|
} else if (item.status == 3 || item.status == 8 || item.status == 2 || item.status == 0) {
|
282
|
HtmArr.push('<a href="/goods/netsale/edit/' + item.productSkn + editPostion + '" class="btn btn-info btn-xs edit-btn">编辑</a>');
|
282
|
HtmArr.push('<a href="/goods/netsale/edit/' + item.productSkn + editPostion + '" class="btn btn-info btn-xs edit-btn">编辑</a>');
|
283
|
- HtmArr.push('<a href="javascript:;" class="btn btn-success btn-xs shelve-btn" data-skn="' + item.productSkn + '">上架</a>');
|
283
|
+ HtmArr.push('<a href="javascript:;" class="btn btn-success btn-xs shelve-btn" data-index="' + item.__index + '">上架</a>');
|
284
|
}
|
284
|
}
|
285
|
HtmArr.push('<a href="/goods/netsale/info/' + item.productSkn + editPostion + '" class="btn btn-info btn-xs info-btn">查看</a>');
|
285
|
HtmArr.push('<a href="/goods/netsale/info/' + item.productSkn + editPostion + '" class="btn btn-info btn-xs info-btn">查看</a>');
|
286
|
return HtmArr.join('');
|
286
|
return HtmArr.join('');
|
|
@@ -398,72 +398,110 @@ var shelveTable = new common.grid({ |
|
@@ -398,72 +398,110 @@ var shelveTable = new common.grid({ |
398
|
display: 'SKC上架操作(状态)',
|
398
|
display: 'SKC上架操作(状态)',
|
399
|
render: function(item) {
|
399
|
render: function(item) {
|
400
|
if (item.status == 0) {
|
400
|
if (item.status == 0) {
|
401
|
- return '<a class="btn btn-success" data-type="1" data-index="'+item.__index+'" data-skc="' + item.productSkc + '" href="javascript:;">点击上架</a>';
|
401
|
+ return '<a class="btn btn-success btnskc" data-type="1" data-index="'+item.__index+'" href="javascript:;">点击上架</a>';
|
402
|
} else {
|
402
|
} else {
|
403
|
- return '<a class="btn btn-danger" data-type="0" data-index="'+item.__index+'" data-skc="' + item.productSkc + '" href="javascript:;">点击下架</a>';
|
403
|
+ return '<a class="btn btn-danger btnskc" data-type="0" data-index="'+item.__index+'" href="javascript:;">点击下架</a>';
|
404
|
}
|
404
|
}
|
405
|
}
|
405
|
}
|
406
|
}, {
|
406
|
}, {
|
407
|
display: '<div class="subhhead"><span>SKU</span><span>尺码</span><span>库存</span><span>SKU上架操作</span><span>SKU上架操作</span></div>',
|
407
|
display: '<div class="subhhead"><span>SKU</span><span>尺码</span><span>库存</span><span>SKU上架操作</span><span>SKU上架操作</span></div>',
|
408
|
render: function(item){
|
408
|
render: function(item){
|
409
|
console.log(item);
|
409
|
console.log(item);
|
410
|
- return "<div class='subhhead'><i>xxx</i><i>尺码</i><i>库存</i><i>SKU上架操作</i><i>SKU上架操作</i></div>";
|
410
|
+ return common.util.__template2($("#template2").html(),item)
|
411
|
}
|
411
|
}
|
412
|
}]
|
412
|
}]
|
413
|
});
|
413
|
});
|
414
|
|
414
|
|
|
|
415
|
+/*代码优惠*/
|
|
|
416
|
+var goodsList={},shelveLayer=null;
|
415
|
//单个sku,skc上下架
|
417
|
//单个sku,skc上下架
|
416
|
$('#basicTable').on('click', '.shelve-btn', function() {
|
418
|
$('#basicTable').on('click', '.shelve-btn', function() {
|
417
|
- var that = this,
|
|
|
418
|
- skn = $(this).data('skn'),
|
|
|
419
|
- shelveModalHtml = '',
|
|
|
420
|
- shelveLayer = null;
|
419
|
+ var item=g.rows[$(this).data("index")];
|
|
|
420
|
+
|
|
|
421
|
+ var that = this;
|
421
|
|
422
|
|
422
|
$(that).addClass('disabled');
|
423
|
$(that).addClass('disabled');
|
423
|
|
424
|
|
424
|
- common.util.__ajax({
|
|
|
425
|
- url: '/goods/netsale/getdata',
|
|
|
426
|
- data: {
|
|
|
427
|
- param: skn
|
|
|
428
|
- }
|
|
|
429
|
- }, function(res) {
|
|
|
430
|
- shelveModalHtml = common.util.__template($('#template').html(), res.data.baseProductInfo.baseProduct);
|
425
|
+ getdata(item.productSkn,function(res){
|
431
|
shelveLayer = common.dialog.open({
|
426
|
shelveLayer = common.dialog.open({
|
432
|
title: '上/下架',
|
427
|
title: '上/下架',
|
433
|
width: 900,
|
428
|
width: 900,
|
434
|
- content: shelveModalHtml
|
429
|
+ content: common.util.__template($('#template').html(), res.data.baseProductInfo.baseProduct)
|
435
|
});
|
430
|
});
|
436
|
|
431
|
|
437
|
$(that).removeClass('disabled');
|
432
|
$(that).removeClass('disabled');
|
|
|
433
|
+ goodsList=res.data.goodsList;
|
|
|
434
|
+ shelveTable.init(goodsList);
|
|
|
435
|
+ });
|
438
|
|
436
|
|
439
|
- shelveTable.init(res.data.goodsList);
|
|
|
440
|
-
|
|
|
441
|
- $('#shelve-table').on('click', '.btn', function() {
|
|
|
442
|
- var item=res.data.goodsList[$(this).data("index")];
|
|
|
443
|
- var param = {},
|
|
|
444
|
- reqUrl = '';
|
|
|
445
|
- if ($(this).data('skc')) {
|
|
|
446
|
- param.productSkc = $(this).data('skc');
|
|
|
447
|
- reqUrl = '/goods/product/updateGoodsStatus';
|
|
|
448
|
- } else if ($(this).data('sku')) {
|
|
|
449
|
- param.productSku = $(this).data('sku');
|
|
|
450
|
- reqUrl = '/goods/product/updateProductSkuStatus';
|
|
|
451
|
- }
|
437
|
+});
|
452
|
|
438
|
|
453
|
- param.targetStatus = $(this).data('type');
|
|
|
454
|
- common.util.__ajax({
|
|
|
455
|
- url: reqUrl,
|
|
|
456
|
- data: param
|
|
|
457
|
- }, function(res) {
|
|
|
458
|
- if (res.code == 200) {
|
|
|
459
|
- // console.log("res.data.goodsList",res.data.goodsList);
|
|
|
460
|
- // console.log(res.data);
|
|
|
461
|
- item.status=(item.status)?0:1;
|
|
|
462
|
- shelveTable.reload();
|
|
|
463
|
- //shelveLayer.close();
|
|
|
464
|
- }
|
|
|
465
|
- })
|
|
|
466
|
- })
|
|
|
467
|
- }, true);
|
439
|
+function getdata(Skn,callback){
|
|
|
440
|
+ common.util.__ajax({
|
|
|
441
|
+ url: '/goods/netsale/getdata',
|
|
|
442
|
+ data: {
|
|
|
443
|
+ param: Skn
|
|
|
444
|
+ }
|
|
|
445
|
+ }, function(res) {
|
|
|
446
|
+ callback&&callback(res);
|
|
|
447
|
+ },true);
|
|
|
448
|
+}
|
468
|
|
449
|
|
469
|
-}); |
|
|
|
|
450
|
+
|
|
|
451
|
+
|
|
|
452
|
+$(document).on("click",".btnskc",function(){
|
|
|
453
|
+ var item=goodsList[$(this).data("index")];
|
|
|
454
|
+ console.log(item);
|
|
|
455
|
+ common.util.__ajax({
|
|
|
456
|
+ url: '/goods/product/updateGoodsStatus',
|
|
|
457
|
+ data: {productSkc:item.productSkc,targetStatus:item.status}
|
|
|
458
|
+ }, function(res) {
|
|
|
459
|
+ if (res.code == 200) {
|
|
|
460
|
+ getdata(item.productSkc,function(res){
|
|
|
461
|
+ goodsList=res.data.goodsList;
|
|
|
462
|
+ shelveTable.reload();
|
|
|
463
|
+ });
|
|
|
464
|
+
|
|
|
465
|
+ }
|
|
|
466
|
+ })
|
|
|
467
|
+});
|
|
|
468
|
+
|
|
|
469
|
+$(document).on("click",".btnsku",function(){
|
|
|
470
|
+ var item=goodsList[$(this).data("index")]
|
|
|
471
|
+ var item1=item.goodsSizeList[$(this).data("subindex")];
|
|
|
472
|
+ common.util.__ajax({
|
|
|
473
|
+ url: '/goods/product/updateProductSkuStatus',
|
|
|
474
|
+ data: {productSkc:item1.productSku,targetStatus:item.status}
|
|
|
475
|
+ }, function(res) {
|
|
|
476
|
+ if (res.code == 200) {
|
|
|
477
|
+ getdata(item.productSkc,function(res){
|
|
|
478
|
+ goodsList=res.data.goodsList;
|
|
|
479
|
+ console.log(goodsList);
|
|
|
480
|
+ shelveTable.reload();
|
|
|
481
|
+ });
|
|
|
482
|
+ }
|
|
|
483
|
+ })
|
|
|
484
|
+});
|
|
|
485
|
+
|
|
|
486
|
+$(document).on("change",".wqt_checkbox,.wqt_all",function(){
|
|
|
487
|
+ var _count1=0,_count2=0;
|
|
|
488
|
+ $.each(g.selected,function(index,item){
|
|
|
489
|
+ console.log(item.status);
|
|
|
490
|
+ /*添加兼容逻辑*/
|
|
|
491
|
+ if(item.status){
|
|
|
492
|
+ _count1++;//上
|
|
|
493
|
+ }else{
|
|
|
494
|
+ _count2++;//下
|
|
|
495
|
+ }
|
|
|
496
|
+ });
|
|
|
497
|
+ if(_count2==g.selected.length){
|
|
|
498
|
+ $("#offshelve").addClass("btn-info").removeClass("btn-default").prop("disabled",false);
|
|
|
499
|
+ }else{
|
|
|
500
|
+ $("#offshelve").addClass("btn-default").removeClass("btn-info").prop("disabled",true);
|
|
|
501
|
+ }
|
|
|
502
|
+ if(_count1==g.selected.length){
|
|
|
503
|
+ $("#onshelve").addClass("btn-info").removeClass("btn-default").prop("disabled",false);
|
|
|
504
|
+ }else{
|
|
|
505
|
+ $("#onshelve").addClass("btn-default").removeClass("btn-info").prop("disabled",true);
|
|
|
506
|
+ }
|
|
|
507
|
+}) |