|
|
@@ -1653,21 +1653,21 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
*/
|
|
|
var getProductDetail = function (product) {
|
|
|
Material.getProductDetail({id : product.id}, function (data) {
|
|
|
- $scope.goods.erpReserve = typeof data.reserve == 'undefined' ? 0 : data.reserve;
|
|
|
- $scope.goods.b2cReserve = typeof data.b2cReserve == 'undefined' ? 0 : data.b2cReserve;
|
|
|
- $scope.goods.packaging = data.packaging;
|
|
|
- $scope.goods.produceDate = data.produceDate;
|
|
|
- $scope.goods.minPackQty = data.minPackQty;
|
|
|
- $scope.goods.breakUp = data.breakUp;
|
|
|
- $scope.goods.minBuyQty = data.minBuyQty;
|
|
|
- $scope.goods.minDelivery = data.minDelivery;
|
|
|
- $scope.goods.maxDelivery = data.maxDelivery;
|
|
|
- $scope.goods.prices = [];
|
|
|
- product.selected = true;
|
|
|
- if ('MAINLAND' == $scope.store.enType)
|
|
|
- $scope.goods.prices.push({start : $scope.minReserve, end : $scope.maxReserve, rMBPrice: data.price});
|
|
|
- if ('HK' == $scope.store.enType)
|
|
|
- $scope.goods.prices.push({start : $scope.minReserve, end : $scope.maxReserve, uSDPrice: data.price});
|
|
|
+ // $scope.goods.erpReserve = typeof data.reserve == 'undefined' ? 0 : data.reserve;
|
|
|
+ // $scope.goods.b2cReserve = typeof data.b2cReserve == 'undefined' ? 0 : data.b2cReserve;
|
|
|
+ // $scope.goods.packaging = data.packaging;
|
|
|
+ // $scope.goods.produceDate = data.produceDate;
|
|
|
+ // $scope.goods.minPackQty = data.minPackQty;
|
|
|
+ // $scope.goods.breakUp = data.breakUp;
|
|
|
+ // $scope.goods.minBuyQty = data.minBuyQty;
|
|
|
+ // $scope.goods.minDelivery = data.minDelivery;
|
|
|
+ // $scope.goods.maxDelivery = data.maxDelivery;
|
|
|
+ // $scope.goods.prices = [];
|
|
|
+ // product.selected = true;
|
|
|
+ // if ('MAINLAND' == $scope.store.enType)
|
|
|
+ // $scope.goods.prices.push({start : $scope.minReserve, end : $scope.maxReserve, rMBPrice: data.price});
|
|
|
+ // if ('HK' == $scope.store.enType)
|
|
|
+ // $scope.goods.prices.push({start : $scope.minReserve, end : $scope.maxReserve, uSDPrice: data.price});
|
|
|
|
|
|
});
|
|
|
}
|
|
|
@@ -1763,9 +1763,6 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
* @param goods 商品信息
|
|
|
*/
|
|
|
function setPriceMinAmount(goods, edit) {
|
|
|
- if ($scope.$$nonProduct.enterSaveButton) {
|
|
|
- return ;
|
|
|
- }
|
|
|
// goods.editMinBuyQtyInValid = false;
|
|
|
// if (typeof goods.editMinBuyQty == 'undefined') {
|
|
|
// goods.editMinBuyQtyInValid = true;
|
|
|
@@ -1782,7 +1779,9 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
goods.editPrices[0].start = goods.editMinBuyQty;
|
|
|
}
|
|
|
}
|
|
|
- toaster.pop('warning', '提示', '起订量必须是大于0的整数');
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ toaster.pop('warning', '提示', '起订量必须是大于0的整数');
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
goods.editMinBuyQtyPre = goods.editMinBuyQty;
|
|
|
@@ -1801,27 +1800,32 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
* @param goods 商品信息
|
|
|
*/
|
|
|
function setPriceMinPackAmount(goods) {
|
|
|
- if ($scope.$$nonProduct.enterSaveButton) {
|
|
|
- return ;
|
|
|
- }
|
|
|
goods.editMinPackQtyInValid = false;
|
|
|
if (typeof goods.editMinPackQty == 'undefined') {
|
|
|
- toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
if (!$scope.isInt.test(goods.editMinPackQty)) {
|
|
|
- goods.editMinPackQtyInValid = true;
|
|
|
- toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ goods.editMinPackQtyInValid = true;
|
|
|
+ toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
if (parseInt(goods.editMinPackQty) < 1) {
|
|
|
- goods.editMinPackQtyInValid = true;
|
|
|
- toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ goods.editMinPackQtyInValid = true;
|
|
|
+ toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
if (parseInt(goods.editMinPackQty) > $scope.maxPackQty) {
|
|
|
- toaster.pop('warning', '提示', '包装数量必须小于' + $scope.maxPackQty);
|
|
|
- goods.editMinPackQtyInValid = true;
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ toaster.pop('warning', '提示', '包装数量必须小于' + $scope.maxPackQty);
|
|
|
+ goods.editMinPackQtyInValid = true;
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
if (goods.editMinBuyQty) {
|
|
|
@@ -1839,17 +1843,18 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
* @param goods 商品信息
|
|
|
*/
|
|
|
function setPriceMaxAmount(goods, edit) {
|
|
|
- if ($scope.$$nonProduct.enterSaveButton) {
|
|
|
- return ;
|
|
|
- }
|
|
|
if (!goods.editReserve) {
|
|
|
- goods.editReserveInvalid = true;
|
|
|
- toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ goods.editReserveInvalid = true;
|
|
|
+ toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
if (!$scope.isInt.test(goods.editReserve)) {
|
|
|
- goods.editReserveInvalid = true;
|
|
|
- toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ goods.editReserveInvalid = true;
|
|
|
+ toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
// if(goods.editMinBuyQty) {
|
|
|
@@ -1860,8 +1865,10 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
// }
|
|
|
// }
|
|
|
if (parseInt(goods.editReserve) > $scope.maxReserve || goods.editReserve < $scope.minReserve) {
|
|
|
- goods.editReserveInvalid = true;
|
|
|
- toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ goods.editReserveInvalid = true;
|
|
|
+ toaster.pop('warning', '提示', '库存须填写小于10亿的正整数');
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
goods.editReservePre = goods.editReserve;
|
|
|
@@ -1966,9 +1973,6 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
* @param isEnd 是否是结束值
|
|
|
*/
|
|
|
$scope.editQty = function (goods, index, isEnd, num) {
|
|
|
- if ($scope.$$nonProduct.enterSaveButton) {
|
|
|
- return ;
|
|
|
- }
|
|
|
goods.editPrices[index].endInValid = false;
|
|
|
goods.editPrices[index].startInValid = false;
|
|
|
if (goods.editPrices.length < index || index < 0) {
|
|
|
@@ -1978,26 +1982,32 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
return ;
|
|
|
}
|
|
|
if (!$scope.isInt.test(num)) {
|
|
|
- if (isEnd) {
|
|
|
- //goods.editPrices[index].endInValid = true;
|
|
|
- delete goods.editPrices[index].end;
|
|
|
- } else {
|
|
|
- //goods.editPrices[index].startInValid = true;
|
|
|
- delete goods.editPrices[index].start;
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ if (isEnd) {
|
|
|
+ //goods.editPrices[index].endInValid = true;
|
|
|
+ delete goods.editPrices[index].end;
|
|
|
+ } else {
|
|
|
+ //goods.editPrices[index].startInValid = true;
|
|
|
+ delete goods.editPrices[index].start;
|
|
|
+ }
|
|
|
+ toaster.pop('warning', '提示', '输入值必须为正整数');
|
|
|
}
|
|
|
- toaster.pop('warning', '提示', '输入值必须为正整数');
|
|
|
return ;
|
|
|
}
|
|
|
if (isEnd) {
|
|
|
if (index < goods.editPrices.length - 1) {
|
|
|
if (parseInt(goods.editPrices[index].end) < parseInt(goods.editPrices[index].start)) {
|
|
|
- toaster.pop('warning', '提示', '输入值必须大于' + goods.editPrices[index].start);
|
|
|
- //goods.editPrices[index].endInValid = true;
|
|
|
- delete goods.editPrices[index].end;
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ toaster.pop('warning', '提示', '输入值必须大于' + goods.editPrices[index].start);
|
|
|
+ //goods.editPrices[index].endInValid = true;
|
|
|
+ delete goods.editPrices[index].end;
|
|
|
+ }
|
|
|
} else if ((goods.editPrices[index + 1].end) && (parseInt(goods.editPrices[index].end) + 1) >= parseInt(goods.editPrices[index + 1].end)) {
|
|
|
- toaster.pop('warning', '提示', '输入值必须小于'+(parseInt(goods.editPrices[index + 1].end) - 1));
|
|
|
- //goods.editPrices[index].endInValid = true;
|
|
|
- delete goods.editPrices[index].end;
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ toaster.pop('warning', '提示', '输入值必须小于'+(parseInt(goods.editPrices[index + 1].end) - 1));
|
|
|
+ //goods.editPrices[index].endInValid = true;
|
|
|
+ delete goods.editPrices[index].end;
|
|
|
+ }
|
|
|
} else {
|
|
|
goods.editPrices[index + 1].start = parseInt(goods.editPrices[index].end) + 1;
|
|
|
goods.editPrices[index + 1].startInValid = false;
|
|
|
@@ -2025,13 +2035,17 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
if (parseInt(goods.editPrices[index].start) > parseInt(goods.editPrices[index].end)) {
|
|
|
// toaster.pop('warning', '提示', '修改本分段之后,会导致分段的起始值' + goods.editPrices[index ].start + '大于结束值' + parseInt(goods.editPrices[index].end));
|
|
|
//goods.editPrices[index].startInValid = true;
|
|
|
- toaster.pop('warning', '提示', '输入值必须小于'+ + goods.editPrices[index].end);
|
|
|
- delete goods.editPrices[index].start;
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ toaster.pop('warning', '提示', '输入值必须小于'+ + goods.editPrices[index].end);
|
|
|
+ delete goods.editPrices[index].start;
|
|
|
+ }
|
|
|
} else if ((parseInt(goods.editPrices[index].start) - 1) < goods.editPrices[index - 1].start) {
|
|
|
// toaster.pop('warning', '提示', '修改本分段之后,会导致前一个分段的起始值' + goods.editPrices[index - 1].start + '大于结束值' + (parseInt(goods.editPrices[index].start) - 1));
|
|
|
//goods.editPrices[index].startInValid = true;
|
|
|
- toaster.pop('warning', '提示', '输入值会导致梯度重叠,请重新修改');
|
|
|
- delete goods.editPrices[index].start;
|
|
|
+ if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ toaster.pop('warning', '提示', '输入值会导致梯度重叠,请重新修改');
|
|
|
+ delete goods.editPrices[index].start;
|
|
|
+ }
|
|
|
} else {
|
|
|
goods.editPrices[index - 1].end = parseInt(goods.editPrices[index].start) - 1;
|
|
|
goods.editPrices[index - 1].endInValid = false;
|
|
|
@@ -2152,9 +2166,6 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
* @param commodity 批次信息
|
|
|
*/
|
|
|
$scope.changeDelivery = function(min, max, isMin, goods) {
|
|
|
- if($scope.$$nonProduct.enterSaveButton) {
|
|
|
- return ;
|
|
|
- }
|
|
|
if(isMin) {
|
|
|
goods.editMinDeliveryinValid = false;
|
|
|
}else {
|
|
|
@@ -2169,9 +2180,11 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
return ;
|
|
|
}
|
|
|
if(!$scope.isInt.test(min)) {
|
|
|
- toaster.pop('warning', '提示', '交期请输入1-31的整数');
|
|
|
+ if(!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ toaster.pop('warning', '提示', '交期请输入1-31的整数');
|
|
|
+ goods.editMinDeliveryinValid = true;
|
|
|
+ }
|
|
|
}
|
|
|
- goods.editMinDeliveryinValid = true;
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
@@ -2183,27 +2196,32 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
return ;
|
|
|
}
|
|
|
if(!$scope.isInt.test(max)) {
|
|
|
- toaster.pop('warning', '提示', '交期只能填写1-31之间的整数值');
|
|
|
+ if(!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ toaster.pop('warning', '提示', '交期只能填写1-31之间的整数值');
|
|
|
+ goods.editMaxDeliveryinValid = true;
|
|
|
+ }
|
|
|
}
|
|
|
- goods.editMaxDeliveryinValid = true;
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if(day > 31 || day < 1) {
|
|
|
- if(isMin) {
|
|
|
- goods.editMinDeliveryinValid = true;
|
|
|
- }else {
|
|
|
- goods.editMaxDeliveryinValid = true;
|
|
|
- }
|
|
|
- toaster.pop('warning', '提示', '交期的值必须在1-31天');
|
|
|
-
|
|
|
+ if(!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ if(isMin) {
|
|
|
+ goods.editMinDeliveryinValid = true;
|
|
|
+ }else {
|
|
|
+ goods.editMaxDeliveryinValid = true;
|
|
|
+ }
|
|
|
+ toaster.pop('warning', '提示', '交期的值必须在1-31天');
|
|
|
+ }
|
|
|
return ;
|
|
|
}
|
|
|
if(Number(min) > Number(max)) {
|
|
|
- goods.editMinDeliveryinValid = true;
|
|
|
- goods.editMaxDeliveryinValid = true;
|
|
|
- toaster.pop('warning', '提示', '最短交期应小于等于最长交期');
|
|
|
+ if(!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ goods.editMinDeliveryinValid = true;
|
|
|
+ goods.editMaxDeliveryinValid = true;
|
|
|
+ toaster.pop('warning', '提示', '最短交期应小于等于最长交期');
|
|
|
+ }
|
|
|
return ;
|
|
|
}
|
|
|
goods.editMinDeliveryinValid = false;
|