浏览代码

供应商

Administrator 4 年之前
父节点
当前提交
4a3cb0691b
共有 1 个文件被更改,包括 39 次插入2 次删除
  1. 39 2
      src/main/resources/static/js/supplier-center/shop/goods.js

+ 39 - 2
src/main/resources/static/js/supplier-center/shop/goods.js

@@ -203,6 +203,7 @@ var myGoods = new Vue({
         ItemDownshelfAll: function(){//批量下架
         ItemDownshelfAll: function(){//批量下架
             var _this = this;
             var _this = this;
             var isValidFlag = false;
             var isValidFlag = false;
+            console.log(_this.checkList)
             if(_this.isCheckedAll){
             if(_this.isCheckedAll){
                 _this.productsList.map(function(el){
                 _this.productsList.map(function(el){
                     if(el.validFlag != 2){ isValidFlag = true; }
                     if(el.validFlag != 2){ isValidFlag = true; }
@@ -229,6 +230,33 @@ var myGoods = new Vue({
                         })
                         })
                     })
                     })
                 }
                 }
+            }else {
+            console.log(_this.checkList);
+             _this.checkList.map(function(el){
+                    if(el.validFlag != 2){ isValidFlag = true; }
+                });
+                 if(isValidFlag){
+                    CAIMEI.Alert('部分选中的商品暂未上架,不能进行下架操作','确定');
+                    return;
+                }else {
+                    CAIMEI.Modal('确定下架选中的商品吗?','取消','确定',function () {
+                          var shelProductsList='';
+                        _this.checkList.map(function(el){
+                            if(el.validFlag == 2){
+                                shelProductsList += el.productID+','
+                            }
+                        });
+                        SupplierApi.SupplierSoldOut({productIds:shelProductsList,},function (response) {
+                            if (response.code == 0){
+                                CAIMEI.dialog('下架成功!');
+                                _this.productsList = [];
+                                _this.GetMyproductDataInfo();
+                            }else{
+                                 CAIMEI.Alert(response.msg,'确定');
+                            }
+                        })
+                    })
+                }
             }
             }
         },
         },
         ItemDownshelf: function(pros){//下架商品
         ItemDownshelf: function(pros){//下架商品
@@ -283,8 +311,17 @@ var myGoods = new Vue({
         ischeck: function(pros){//为未选中的时候改变为true,反之为true
         ischeck: function(pros){//为未选中的时候改变为true,反之为true
             var _this = this;
             var _this = this;
             pros.productsChecked = !pros.productsChecked;
             pros.productsChecked = !pros.productsChecked;
-            _this.check = ! _this.check;
-            this.updateCheckAllBtn();
+            if(pros.productsChecked){
+                  _this.checkList.push(pros);
+                }else {
+                  _this.checkList.splice(_this.checkList.indexOf(pros), 1);
+                };
+                 if( _this.checkList.length>0){
+                     _this.check = true;
+                 } else {
+                     _this.check = false;
+                 }
+            _this.updateCheckAllBtn();
         },
         },
         updateCheckAllBtn: function() {// 全选勾选判断
         updateCheckAllBtn: function() {// 全选勾选判断
             var _this = this;
             var _this = this;