|
|
@@ -313,6 +313,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ $scope.chooseAll = false;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
@@ -385,18 +386,39 @@ define([ 'app/app' ], function(app) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ $scope.cancelBatch = function () {
|
|
|
+ $scope.batchStatus = false;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.batchOperation = function (num) {
|
|
|
+ getChooseInfo();
|
|
|
+ if (!$scope.choosedIds || $scope.choosedIds.length == 0) {
|
|
|
+ toaster.pop('info', '您尚未选中任何产品');
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ $scope.batchStatus = true;
|
|
|
+ $scope.batchType = num;
|
|
|
+ if (num == 1) {
|
|
|
+ $scope.batchTitle = '是否要删除选中的产品?'
|
|
|
+ } else {
|
|
|
+ $scope.batchTitle = '是否要下架选中的产品?'
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
/**
|
|
|
* 批量删除
|
|
|
*/
|
|
|
$scope.batchDelete = function () {
|
|
|
if ($scope.chooseAllPage) {
|
|
|
- Goods.deleteGoodsByEnUU({}, {}, function (data) {
|
|
|
- if (data.success) {
|
|
|
- toaster.pop('success', '删除成功');
|
|
|
- $scope.isSoldOut = false;
|
|
|
+ Goods.deleteGoodsByEnUU({}, {}, function (result) {
|
|
|
+ if (result.success) {
|
|
|
+ var message = "成功删除"+ result.data.success +"个产品,另有"
|
|
|
+ + result.data.fail + "个产品无法删除";
|
|
|
+ toaster.pop('success', message);
|
|
|
+ $scope.batchStatus = false;
|
|
|
loadDataReload();
|
|
|
} else {
|
|
|
- toaster.pop('error', data.message);
|
|
|
+ toaster.pop('error', result.message);
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
@@ -405,13 +427,15 @@ define([ 'app/app' ], function(app) {
|
|
|
toaster.pop("info", "您尚未选中任何产品");
|
|
|
return ;
|
|
|
}
|
|
|
- Goods.deleteGoodsByIdList({}, $scope.choosedIds, function (data) {
|
|
|
- if (data.success) {
|
|
|
- toaster.pop('success', '删除成功');
|
|
|
- $scope.isSoldOut = false;
|
|
|
+ Goods.deleteGoodsByIdList({}, $scope.choosedIds, function (result) {
|
|
|
+ if (result.success) {
|
|
|
+ var message = "成功删除"+ result.data.success +"个产品,另有"
|
|
|
+ + result.data.fail + "个产品无法删除";
|
|
|
+ toaster.pop('success', message);
|
|
|
+ $scope.batchStatus = false;
|
|
|
loadDataReload();
|
|
|
} else {
|
|
|
- toaster.pop('error', data.message);
|
|
|
+ toaster.pop('error', result.message);
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
@@ -422,7 +446,7 @@ define([ 'app/app' ], function(app) {
|
|
|
Goods.downNowEnterpriseGoods({}, {}, function(result) {
|
|
|
if (result.success) {
|
|
|
toaster.pop('success', '下架成功');
|
|
|
- $scope.isSoldOut = false;
|
|
|
+ $scope.batchStatus = false;
|
|
|
loadDataReload();
|
|
|
} else {
|
|
|
toaster.pop('error', result.message);
|
|
|
@@ -438,7 +462,7 @@ define([ 'app/app' ], function(app) {
|
|
|
Goods.offShelfGoodsByProvider({batchCodes : batchs}, {}, function(map){
|
|
|
if (map.success) {
|
|
|
toaster.pop('success', '下架成功');
|
|
|
- $scope.isSoldOut = false;
|
|
|
+ $scope.batchStatus = false;
|
|
|
loadDataReload();
|
|
|
} else {
|
|
|
toaster.pop('error', map.message);
|
|
|
@@ -627,7 +651,8 @@ define([ 'app/app' ], function(app) {
|
|
|
var name = tag.getAttribute('name');
|
|
|
if(name != null &&(name == 'edit-a' || name == 'down-a'
|
|
|
|| name == 'img-a' || name == 'kind-a' || name == 'brand-a'
|
|
|
- || name == 'cancle-a' || name == 'save-a' || name == 'reduce-a' || name == 'add-a')) {
|
|
|
+ || name == 'cancle-a' || name == 'save-a' || name == 'reduce-a'
|
|
|
+ || name == 'add-a' || name == 'check-one')) {
|
|
|
return ;
|
|
|
}
|
|
|
tag = tag.parentElement;
|
|
|
@@ -1535,26 +1560,70 @@ define([ 'app/app' ], function(app) {
|
|
|
return goodsID;
|
|
|
};
|
|
|
|
|
|
- var getDownLoadStatus = function () {
|
|
|
- $.ajax({
|
|
|
- type: 'GET',
|
|
|
- url: 'release/product/release/failure/xls',
|
|
|
- data : {isAjax : true, batch : $scope.result.batch},
|
|
|
- dataType : 'json',
|
|
|
- success: function (data) {
|
|
|
- if(!data.load) {
|
|
|
- $scope.$apply(function () {
|
|
|
- Loading.hide();
|
|
|
- toaster.pop('success', '数据处理完毕,正在下载文件,请稍等。');
|
|
|
- });
|
|
|
- clearInterval(intervalId);
|
|
|
- }
|
|
|
- },
|
|
|
- error: function () {
|
|
|
- Loading.hide();
|
|
|
- clearInterval(intervalId);
|
|
|
+ function downloadByJs(url, keyword, type) {
|
|
|
+ var form = $("<form>"); //定义一个form表单
|
|
|
+ form.attr('style', 'display:none'); //在form表单中添加查询参数
|
|
|
+ form.attr('target', '');
|
|
|
+ form.attr('method', 'get');
|
|
|
+ form.attr('action', url);
|
|
|
+
|
|
|
+ var input1 = $('<input>');
|
|
|
+ input1.attr('type', 'hidden');
|
|
|
+ input1.attr('name', 'keyword');
|
|
|
+ input1.attr('value', keyword);
|
|
|
+
|
|
|
+ var input2 = $('<input>');
|
|
|
+ input1.attr('type', 'hidden');
|
|
|
+ input1.attr('name', 'isSelfSupport');
|
|
|
+ input1.attr('value', type);
|
|
|
+
|
|
|
+ $('body').append(form); //将表单放置在web中
|
|
|
+ form.append(input1); //将查询参数控件提交到表单上
|
|
|
+ form.append(input2);
|
|
|
+ form.submit();
|
|
|
+ }
|
|
|
+
|
|
|
+ function downloadSelectedByJs(url, idList) {
|
|
|
+ var form = $("<form>"); //定义一个form表单
|
|
|
+ form.attr('style', 'display:none'); //在form表单中添加查询参数
|
|
|
+ form.attr('target', '');
|
|
|
+ form.attr('method', 'get');
|
|
|
+ form.attr('action', url);
|
|
|
+
|
|
|
+ var input1 = $('<input>');
|
|
|
+ input1.attr('type', 'hidden');
|
|
|
+ input1.attr('name', 'ids');
|
|
|
+ input1.attr('value', idList);
|
|
|
+
|
|
|
+ $('body').append(form); //将表单放置在web中
|
|
|
+ form.append(input1); //将查询参数控件提交到表单上
|
|
|
+ form.submit();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下载模板
|
|
|
+ $scope.download = function() {
|
|
|
+ if ($scope.currenctGoods && $scope.currenctGoods.length == 0) {
|
|
|
+ toaster.pop('info', '当前产品列表为空,无法下载');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if ($scope.chooseAllPage) {
|
|
|
+ if ($scope.selfSupport === $scope.selfSupportType.SELF_SUPPORT) {
|
|
|
+ $scope.param.isSelfSupport = true;
|
|
|
+ } else if ($scope.selfSupport === $scope.selfSupportType.CONSIGNMENT) {
|
|
|
+ $scope.param.isSelfSupport = false;
|
|
|
+ } else {
|
|
|
+ $scope.param.isSelfSupport = null;
|
|
|
}
|
|
|
- });
|
|
|
+ downloadByJs('trade/goods/down/goods', $scope.param.keyword, $scope.param.isSelfSupport);
|
|
|
+ } else {
|
|
|
+ getChooseInfo();
|
|
|
+ if (!$scope.choosedIds || $scope.choosedIds.length == 0) {
|
|
|
+ toaster.pop("info", "您尚未选中任何产品");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ var idStr = $scope.choosedIds.join('-');
|
|
|
+ downloadSelectedByJs('trade/goods/down/ids', idStr);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|