|
|
@@ -15,6 +15,17 @@ define([ 'app/app' ], function(app) {
|
|
|
status : 601
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * 最大
|
|
|
+ * @type {number}
|
|
|
+ */
|
|
|
+ $scope.maxReserve = 999999999;
|
|
|
+ /**
|
|
|
+ * 最小包装量的最大值
|
|
|
+ */
|
|
|
+ $scope.maxPackQty = 999999;
|
|
|
+ $scope.minReserve = 1;
|
|
|
+
|
|
|
// 商品分页数据
|
|
|
$scope.goodsPageParams = {};
|
|
|
$scope.selfSupportType = {
|
|
|
@@ -425,8 +436,10 @@ define([ 'app/app' ], function(app) {
|
|
|
price.uSDPricePre = price.uSDPrice;
|
|
|
price.uSDPriceDirty = false;
|
|
|
});
|
|
|
- commodity.editPrices[commodity.editPrices.length - 1].end = commodity.reserve;
|
|
|
- commodity.editPrices[commodity.editPrices.length - 1].endPre = commodity.reserve;
|
|
|
+ commodity.editPrices[commodity.editPrices.length - 1].end = $scope.maxReserve;
|
|
|
+ commodity.editPrices[commodity.editPrices.length - 1].endPre = $scope.maxReserve;
|
|
|
+ commodity.editPrices[0].start = $scope.minReserve;
|
|
|
+ commodity.editPrices[0].startPre = $scope.minReserve;
|
|
|
|
|
|
commodity.editReserve = commodity.reserve;
|
|
|
commodity.editReservePre = commodity.reserve;
|
|
|
@@ -468,6 +481,14 @@ define([ 'app/app' ], function(app) {
|
|
|
commodity.editSelfDeliveryDemMaxTimePre = commodity.selfDeliveryDemMaxTime;
|
|
|
commodity.editSelfDeliveryDemMaxTimeDirty = false;
|
|
|
|
|
|
+ commodity.editMinDelivery = commodity.minDelivery;
|
|
|
+ commodity.editMinDeliveryPre = commodity.minDelivery;
|
|
|
+ commodity.editMinDeliveryDirty = false;
|
|
|
+
|
|
|
+ commodity.editMaxDelivery = commodity.maxDelivery;
|
|
|
+ commodity.editMaxDeliveryPre = commodity.maxDelivery;
|
|
|
+ commodity.editMaxDeliveryDirty = false;
|
|
|
+
|
|
|
commodity.editSelfSale = $scope.storeInfo.uuid != 'undefind' && commodity.storeid == $scope.storeInfo.uuid && $scope.storeInfo.storeName.indexOf('优软测试二') < 0 && $scope.storeInfo.storeName.indexOf('优软商城') < 0 ? 1 : 2;
|
|
|
};
|
|
|
|
|
|
@@ -478,13 +499,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.toggleIsBreadUp = function (commodity) {
|
|
|
commodity.editBreakUp = !commodity.editBreakUp;
|
|
|
if(!commodity.editBreakUp) {
|
|
|
- if(commodity.editMinPackQty&&commodity.editMinBuyQty) {
|
|
|
- commodity.editMinBuyQty = Number(NumberService.sub(commodity.editMinBuyQty, (commodity.editMinBuyQty % commodity.editMinPackQty)));
|
|
|
- if(commodity.editMinBuyQty < 1) {
|
|
|
- commodity.editMinBuyQty = commodity.editMinPackQty;
|
|
|
- }
|
|
|
- $scope.changeMinBuyQty(commodity);
|
|
|
- }
|
|
|
+ $scope.isNotBreakUp(commodity);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -536,7 +551,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
if(isEnd) {
|
|
|
if(index < commodity.editPrices.length - 1) {
|
|
|
- if(commodity.editPrices[index].end <= commodity.editPrices[index].start) {
|
|
|
+ if(commodity.editPrices[index].end < commodity.editPrices[index].start) {
|
|
|
toaster.pop('warning', '提示', '修改之后当前分段的结束值' + parseInt(commodity.editPrices[index].end) + '小于' + commodity.editPrices[index].start);
|
|
|
commodity.editPrices[index].end = commodity.editPrices[index].endPre;
|
|
|
}else if((commodity.editPrices[index + 1].end)&&(parseInt(commodity.editPrices[index].end) + 1) >= parseInt(commodity.editPrices[index + 1].end)) {
|
|
|
@@ -547,55 +562,56 @@ define([ 'app/app' ], function(app) {
|
|
|
commodity.editPrices[index].endPre = commodity.editPrices[index].end;
|
|
|
commodity.editPrices[index + 1].startPre = commodity.editPrices[index + 1].start;
|
|
|
}
|
|
|
- }else {
|
|
|
- if(commodity.editPrices[index].end > commodity.editMinBuyQty) {
|
|
|
- if(commodity.editPrices[index].end > commodity.reserve) {
|
|
|
- toaster.pop('warning', '提示', '修改最后一个分段的结束值之后,新的库存量大于原有的库存量');
|
|
|
- commodity.editPrices[index].end = commodity.editPrices[index].endPre;
|
|
|
- }else {
|
|
|
- commodity.editReserve = commodity.editPrices[index].end;
|
|
|
- commodity.editPrices[index].endPre = commodity.editPrices[index].end;
|
|
|
- commodity.editReservePre = commodity.editReserve;
|
|
|
- }
|
|
|
- }else {
|
|
|
- toaster.pop('warning', '提示', '修改最后一个分段的结束值之后导致库存量小于起拍量');
|
|
|
- commodity.editPrices[index].end = commodity.editPrices[index].endPre;
|
|
|
- }
|
|
|
}
|
|
|
+ // else {
|
|
|
+ // if(commodity.editPrices[index].end > commodity.editMinBuyQty) {
|
|
|
+ // if(commodity.editPrices[index].end > commodity.reserve) {
|
|
|
+ // toaster.pop('warning', '提示', '修改最后一个分段的结束值之后,新的库存量大于原有的库存量');
|
|
|
+ // commodity.editPrices[index].end = commodity.editPrices[index].endPre;
|
|
|
+ // }else {
|
|
|
+ // commodity.editReserve = commodity.editPrices[index].end;
|
|
|
+ // commodity.editPrices[index].endPre = commodity.editPrices[index].end;
|
|
|
+ // commodity.editReservePre = commodity.editReserve;
|
|
|
+ // }
|
|
|
+ // }else {
|
|
|
+ // toaster.pop('warning', '提示', '修改最后一个分段的结束值之后导致库存量小于起拍量');
|
|
|
+ // commodity.editPrices[index].end = commodity.editPrices[index].endPre;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}else {
|
|
|
if(index != 0) {
|
|
|
- if(parseInt(commodity.editPrices[index].start) >= parseInt(commodity.editPrices[index].end)) {
|
|
|
- toaster.pop('warning', '提示', '修改本分段之后,会导致分段的起始值' + commodity.editPrices[index ].start + '大于等于结束值' + parseInt(commodity.editPrices[index].end));
|
|
|
+ if(parseInt(commodity.editPrices[index].start) > parseInt(commodity.editPrices[index].end)) {
|
|
|
+ toaster.pop('warning', '提示', '修改本分段之后,会导致分段的起始值' + commodity.editPrices[index ].start + '大于结束值' + parseInt(commodity.editPrices[index].end));
|
|
|
commodity.editPrices[index].start = commodity.editPrices[index].startPre;
|
|
|
- }else if((parseInt(commodity.editPrices[index].start) - 1) <= commodity.editPrices[index - 1].start) {
|
|
|
- toaster.pop('warning', '提示', '修改本分段之后,会导致前一个分段的起始值' + commodity.editPrices[index - 1].start + '大于等于结束值' + (parseInt(commodity.editPrices[index].start) - 1));
|
|
|
+ }else if((parseInt(commodity.editPrices[index].start) - 1) < commodity.editPrices[index - 1].start) {
|
|
|
+ toaster.pop('warning', '提示', '修改本分段之后,会导致前一个分段的起始值' + commodity.editPrices[index - 1].start + '大于结束值' + (parseInt(commodity.editPrices[index].start) - 1));
|
|
|
commodity.editPrices[index].start = commodity.editPrices[index].startPre;
|
|
|
}else {
|
|
|
commodity.editPrices[index - 1].end = parseInt(commodity.editPrices[index].start) - 1;
|
|
|
commodity.editPrices[index].startPre = commodity.editPrices[index].start;
|
|
|
commodity.editPrices[index - 1].endPre = commodity.editPrices[index - 1].end;
|
|
|
}
|
|
|
- }else {
|
|
|
- if(commodity.editMinPackQty) {
|
|
|
- if(commodity.editPrices[index].start % commodity.editMinPackQty != 0) {
|
|
|
- commodity.editPrices[index].startInValid = false;
|
|
|
- commodity.editPrices[index].start = commodity.editMinBuyQty;
|
|
|
- commodity.editPrices[index].startPre = commodity.editMinBuyQty;
|
|
|
- toaster.pop('warning', '提示', '第一个分段的起始量必须是倍数(' + commodity.editMinPackQty + ")的整数倍");
|
|
|
- }else {
|
|
|
- commodity.editMinBuyQty = commodity.editPrices[index].start;
|
|
|
- commodity.editMinBuyQtyPre = commodity.editPrices[index].start;
|
|
|
- commodity.editMinBuyQtyInValid = false;
|
|
|
- }
|
|
|
- }else {
|
|
|
- commodity.editMinBuyQty = commodity.editPrices[index].start;
|
|
|
- commodity.editMinBuyQtyPre = commodity.editMinBuyQty;
|
|
|
- commodity.editPrices[index].startPre = commodity.editPrices[index].start;
|
|
|
- commodity.editMinBuyQtyInValid = false;
|
|
|
- }
|
|
|
- }
|
|
|
+ }//else {
|
|
|
+ // if(commodity.editMinPackQty) {
|
|
|
+ // if(commodity.editPrices[index].start % commodity.editMinPackQty != 0) {
|
|
|
+ // commodity.editPrices[index].startInValid = false;
|
|
|
+ // commodity.editPrices[index].start = commodity.editMinBuyQty;
|
|
|
+ // commodity.editPrices[index].startPre = commodity.editMinBuyQty;
|
|
|
+ // toaster.pop('warning', '提示', '第一个分段的起始量必须是倍数(' + commodity.editMinPackQty + ")的整数倍");
|
|
|
+ // }else {
|
|
|
+ // commodity.editMinBuyQty = commodity.editPrices[index].start;
|
|
|
+ // commodity.editMinBuyQtyPre = commodity.editPrices[index].start;
|
|
|
+ // commodity.editMinBuyQtyInValid = false;
|
|
|
+ // }
|
|
|
+ // }else {
|
|
|
+ // commodity.editMinBuyQty = commodity.editPrices[index].start;
|
|
|
+ // commodity.editMinBuyQtyPre = commodity.editMinBuyQty;
|
|
|
+ // commodity.editPrices[index].startPre = commodity.editPrices[index].start;
|
|
|
+ // commodity.editMinBuyQtyInValid = false;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
/**
|
|
|
* @param commodity 需要验证的批次的信息
|
|
|
@@ -622,19 +638,13 @@ define([ 'app/app' ], function(app) {
|
|
|
toaster.pop('warning', "提示", "分段数量必须是数字");
|
|
|
return false;
|
|
|
}
|
|
|
- if(parseInt(price[i].start) >= parseInt(price[i].end)) {
|
|
|
+ if(parseInt(price[i].start) > parseInt(price[i].end)) {
|
|
|
price[i].startInValid = true;
|
|
|
- toaster.pop('warning', "提示", "存在分段的起始值大于等于分段的结束值");
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(parseInt(price[i].end) > parseInt(commodity.editReserve)){
|
|
|
- price[i].endInValid = true;
|
|
|
- toaster.pop('warning', "提示", "存在分段的结束值大于新库存数量");
|
|
|
+ toaster.pop('warning', "提示", "存在分段的起始值大于分段的结束值");
|
|
|
return false;
|
|
|
}
|
|
|
previousEnd = price[i].end;
|
|
|
}
|
|
|
- commodity.editPrices[0].start = commodity.editMinBuyQty || 0;
|
|
|
return true;
|
|
|
};
|
|
|
|
|
|
@@ -660,30 +670,25 @@ define([ 'app/app' ], function(app) {
|
|
|
toaster.pop('warning', '提示', '修改的库存只能减少库存量');
|
|
|
return false;
|
|
|
}
|
|
|
- if(parseInt(commodity.editReserve) <= parseInt(commodity.editMinBuyQty)) {
|
|
|
+ if(parseInt(commodity.editReserve) < parseInt(commodity.editMinBuyQty)) {
|
|
|
commodity.editReserve = commodity.editReservePre;
|
|
|
commodity.editReserveInvalid = false;
|
|
|
toaster.pop('warning', '提示', '起拍量不能大于库存量');
|
|
|
return false;
|
|
|
}
|
|
|
- if(parseInt(commodity.editReserve) > 99999999 || commodity.editReserve < 1) {
|
|
|
+ if(parseInt(commodity.editReserve) > $scope.maxReserve || commodity.editReserve < $scope.minReserve) {
|
|
|
commodity.editReserve = commodity.editReservePre;
|
|
|
commodity.editReserveInvalid = false;
|
|
|
- toaster.pop('warning', '提示', '总库存量的数量必须介于1 ~ 99999999');
|
|
|
+ toaster.pop('warning', '提示', '总库存量的数量必须介于' + $scope.minReserve+' ~ ' + $scope.maxReserve);
|
|
|
return false;
|
|
|
}
|
|
|
- if(parseInt(commodity.editPrices[commodity.editPrices.length - 1].start) >= parseInt(commodity.editReserve)) {
|
|
|
- commodity.editReserve = commodity.editReservePre;
|
|
|
- commodity.editReserveInvalid = false;
|
|
|
- toaster.pop('warning', '提示', '最新库存量必须要大于最后一个分段的起始量。');
|
|
|
- return false;
|
|
|
- }else {
|
|
|
- commodity.editPrices[commodity.editPrices.length - 1].end = commodity.editReserve;
|
|
|
- commodity.editPrices[commodity.editPrices.length - 1].endPre = commodity.editPrices[commodity.editPrices.length - 1].end;
|
|
|
- commodity.editReservePre = commodity.editReserve;
|
|
|
- commodity.editReserveInvalid = false;
|
|
|
- return true;
|
|
|
+ commodity.editReservePre = commodity.editReserve;
|
|
|
+ commodity.editReserveInvalid = false;
|
|
|
+ if(!commodity.breakUp) {
|
|
|
+ $scope.isNotBreakUp(commodity);
|
|
|
}
|
|
|
+ return true;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -699,7 +704,7 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
if(!$scope.isInt.test(commodity.editMinBuyQty)) {
|
|
|
commodity.editMinBuyQty = null;
|
|
|
- toaster.pop('warning', '提示', '起拍量必须是数字');
|
|
|
+ toaster.pop('warning', '提示', '起拍量必须是正整数');
|
|
|
return false;
|
|
|
}
|
|
|
if(commodity.editMinBuyQty > commodity.editReserve) {
|
|
|
@@ -713,24 +718,10 @@ define([ 'app/app' ], function(app) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ commodity.editMinBuyQtyPre = commodity.editMinBuyQty;
|
|
|
+ commodity.editMinBuyQtyInValid = false;
|
|
|
if(!commodity.editBreakUp) {
|
|
|
- if(commodity.editMinPackQty) {
|
|
|
- if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
|
|
|
- commodity.editMinBuyQty = null;
|
|
|
- toaster.pop('warning', '提示', '起拍量必须是倍数的整数倍');
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(!commodity.editPrices[0].end || commodity.editMinBuyQty < commodity.editPrices[0].end) {
|
|
|
- commodity.editPrices[0].start = commodity.editMinBuyQty;
|
|
|
- commodity.editPrices[0].startPre = commodity.editPrices[0].start;
|
|
|
- commodity.editMinBuyQtyPre = commodity.editMinBuyQty;
|
|
|
- commodity.editMinBuyQtyInValid = false;
|
|
|
- }else {
|
|
|
- toaster.pop('warning', '提示', '修改起拍量之后导致第一个分段的起始值'+ commodity.editMinBuyQty +'大于结束值' + commodity.editPrices[0].end);
|
|
|
- commodity.editMinBuyQty = commodity.editMinBuyQtyPre;
|
|
|
- commodity.editMinBuyQtyInValid = false;
|
|
|
+ $scope.isNotBreakUp(commodity);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -746,27 +737,23 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
if(!$scope.isInt.test(commodity.editMinPackQty)) {
|
|
|
commodity.editMinPackQty = null;
|
|
|
- toaster.pop('warning', '提示', '倍数必须是正整数');
|
|
|
+ toaster.pop('warning', '提示', '最小包装数必须是正整数');
|
|
|
return false;
|
|
|
}
|
|
|
if(commodity.editMinPackQty < 1) {
|
|
|
commodity.editMinPackQty = null;
|
|
|
- toaster.pop('warning', '提示', '倍数必须大于0');
|
|
|
+ toaster.pop('warning', '提示', '最小包装数必须大于0');
|
|
|
return false;
|
|
|
}
|
|
|
if(commodity.editMinPackQty > commodity.editReserve) {
|
|
|
commodity.editMinPackQty = null;
|
|
|
- toaster.pop('warning', '提示', '倍数必须是起拍量的整数倍且小于起拍量。');
|
|
|
+ toaster.pop('warning', '提示', '最小包装数必须小于等于库存量。');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if(commodity.editMinBuyQty) {
|
|
|
- if(!commodity.editIsBreakUp) {
|
|
|
- if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
|
|
|
- commodity.editMinPackQty = null;
|
|
|
- toaster.pop('warning', '提示', '倍数必须是起拍量的整数倍且小于起拍量。');
|
|
|
- return false;
|
|
|
- }
|
|
|
+ if(!commodity.editBreakUp) {
|
|
|
+ $scope.isNotBreakUp(commodity);
|
|
|
}
|
|
|
}
|
|
|
commodity.editMinPackQtyPre = commodity.editMinPackQty;
|
|
|
@@ -783,69 +770,49 @@ define([ 'app/app' ], function(app) {
|
|
|
*/
|
|
|
$scope.compareNum = function(min, max, type, commodity) {
|
|
|
if(!min) {
|
|
|
+ commodity.editMinDeliveryinValid = true;
|
|
|
if(type == 1) {
|
|
|
- commodity.selfDemMinTimeinValid = true;
|
|
|
- toaster.pop('warning', '大陆交期存在空值,请重新操作');
|
|
|
+ toaster.pop('warning', '提示', '大陆交期存在空值,请重新操作');
|
|
|
}else if(type == 2){
|
|
|
- commodity.selfHkMinTimeinValid = true;
|
|
|
- toaster.pop('warning', '香港交期存在空值,请重新操作');
|
|
|
+ toaster.pop('warning', '提示', '香港交期存在空值,请重新操作');
|
|
|
}
|
|
|
return false;
|
|
|
}else if(!max) {
|
|
|
+ commodity.editMaxDeliveryinValid = true;
|
|
|
if(type == 1) {
|
|
|
- commodity.selfDemMaxTimeinValid = true;
|
|
|
- toaster.pop('warning', '大陆交期存在空值,请重新操作');
|
|
|
+ toaster.pop('warning', '提示', '大陆交期存在空值,请重新操作');
|
|
|
}else if(type == 2){
|
|
|
- commodity.selfHkMaxTimeinValid = true;
|
|
|
- toaster.pop('warning', '香港交期存在空值,请重新操作');
|
|
|
+ toaster.pop('warning', '提示', '香港交期存在空值,请重新操作');
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
- if(isNaN(min)) {
|
|
|
- if(type == 1) {
|
|
|
- commodity.selfDemMinTimeinValid = true;
|
|
|
- }else {
|
|
|
- commodity.selfHkMinTimeinValid = true;
|
|
|
- }
|
|
|
- toaster.pop('warning', '最小交期必须是数字');
|
|
|
+ if(!$scope.isInt.test(min)) {
|
|
|
+ commodity.editMinDeliveryinValid = true;
|
|
|
+ toaster.pop('warning', '提示', '最小交期必须是正整数');
|
|
|
return false;
|
|
|
}
|
|
|
- if(isNaN(max)) {
|
|
|
- if(type == 1) {
|
|
|
- commodity.selfDemMaxTimeinValid = true;
|
|
|
- }else {
|
|
|
- commodity.selfHkMaxTimeinValid = true;
|
|
|
- }
|
|
|
- toaster.pop('warning', '最大交期必须是数字');
|
|
|
+ if(!$scope.isInt.test(max)) {
|
|
|
+ commodity.editMaxDeliveryinValid = true;
|
|
|
+ toaster.pop('warning', '提示', '最大交期必须是正整数');
|
|
|
return false;
|
|
|
}
|
|
|
- if(min < 1 || min > 9) {
|
|
|
- if(type == 1) {
|
|
|
- commodity.selfDemMinTimeinValid = true;
|
|
|
- }else {
|
|
|
- commodity.selfHkMinTimeinValid = true;
|
|
|
- }
|
|
|
- toaster.pop('warning', '交期的时间必须是1-9天之内');
|
|
|
+ if(min < 1 || min > 31) {
|
|
|
+ commodity.editMinDeliveryinValid = true;
|
|
|
+ toaster.pop('warning', '提示', '交期的时间必须是1-31天之内');
|
|
|
return false;
|
|
|
}
|
|
|
- if(max < 1 || max > 9) {
|
|
|
- if(type == 1) {
|
|
|
- commodity.selfDemMaxTimeinValid = true;
|
|
|
- }else {
|
|
|
- commodity.selfHkMaxTimeinValid = true;
|
|
|
- }
|
|
|
- toaster.pop('warning', '交期的时间必须是1-9天之内');
|
|
|
+ if(max < 1 || max > 31) {
|
|
|
+ commodity.editMaxDeliveryinValid = true;
|
|
|
+ toaster.pop('warning', '提示', '交期的时间必须是1-31天之内');
|
|
|
return false;
|
|
|
}
|
|
|
- if(min > max) {
|
|
|
+ if(Number(min) > Number(max)) {
|
|
|
+ commodity.editMaxDeliveryinValid = true;
|
|
|
+ commodity.editMinDeliveryinValid = true;
|
|
|
if(type == 1) {
|
|
|
- commodity.selfDemMaxTimeinValid = true;
|
|
|
- commodity.selfDemMinTimeinValid = true;
|
|
|
- toaster.pop('warning', '大陆交期最短交期大于最大交期');
|
|
|
+ toaster.pop('warning', '提示', '大陆交期填写错误,最短交期应小于等于最长交期');
|
|
|
}else if(type == 2){
|
|
|
- commodity.selfHkMaxTimeinValid = true;
|
|
|
- commodity.selfHkMinTimeinValid = true;
|
|
|
- toaster.pop('warning', '香港交期最短交期大于最大交期');
|
|
|
+ toaster.pop('warning', '提示', '香港交期填写错误,最短交期应小于等于最长交期');
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
@@ -860,68 +827,55 @@ define([ 'app/app' ], function(app) {
|
|
|
* @param commodity 批次信息
|
|
|
*/
|
|
|
$scope.changeDelivery = function(min, max, isMin, isHk, commodity) {
|
|
|
- commodity.selfDemMinTimeinValid = false;
|
|
|
- commodity.selfDemMaxTimeinValid = false;
|
|
|
- commodity.selfHkMinTimeinValid = false;
|
|
|
- commodity.selfHkMaxTimeinValid = false;
|
|
|
+ commodity.editMinDeliveryinValid = false;
|
|
|
+ commodity.editMaxDeliveryinValid = false;
|
|
|
var day = -1;
|
|
|
if(isMin) {
|
|
|
- if(min && !isNaN(min)) {
|
|
|
+ if(min && $scope.isInt.test(min)) {
|
|
|
day = min;
|
|
|
}else {
|
|
|
- if(isNaN(min)) {
|
|
|
- toaster.pop('warning', '提示', '交期请输入1~9的数字');
|
|
|
- }
|
|
|
- if(isHk) {
|
|
|
- commodity.selfHkMinTimeinValid = true;
|
|
|
- }else {
|
|
|
- commodity.selfDemMinTimeinValid = true;
|
|
|
+ if(!$scope.isInt.test(min)) {
|
|
|
+ toaster.pop('warning', '提示', '交期请输入1~31的正整数');
|
|
|
}
|
|
|
+ commodity.editMinDeliveryinValid = true;
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
}else {
|
|
|
- if(max && !isNaN(max)) {
|
|
|
+ if(max && $scope.isInt.test(max)) {
|
|
|
day = max;
|
|
|
}else {
|
|
|
- if(isNaN(max)) {
|
|
|
- toaster.pop('warning', '提示', '交期请输入1~9的数字');
|
|
|
- }
|
|
|
- if(isHk) {
|
|
|
- commodity.selfHkMaxTimeinValid = true;
|
|
|
- }else {
|
|
|
- commodity.selfDemMaxTimeinValid = true;
|
|
|
+ if(!$scope.isInt.test(max)) {
|
|
|
+ toaster.pop('warning', '提示', '交期请输入1~31的数字');
|
|
|
}
|
|
|
+ commodity.editMaxDeliveryinValid = true;
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- if(day > 9 || day < 1) {
|
|
|
+ if(day > 31 || day < 1) {
|
|
|
+ if(isMin) {
|
|
|
+ commodity.editMinDeliveryinValid = true;
|
|
|
+ }else {
|
|
|
+ commodity.editMaxDeliveryinValid = true;
|
|
|
+ }
|
|
|
if(isHk) {
|
|
|
- if(isMin) {
|
|
|
- commodity.selfHkMinTimeinValid = true;
|
|
|
- }else {
|
|
|
- commodity.selfHkMaxTimeinValid = true;
|
|
|
- }
|
|
|
+ toaster.pop('warning', '提示', '香港交期填写错误,交期的范围必须在1~31天');
|
|
|
}else {
|
|
|
- if(isMin) {
|
|
|
- commodity.selfDemMinTimeinValid = true;
|
|
|
- }else {
|
|
|
- commodity.selfDemMaxTimeinValid = true;
|
|
|
- }
|
|
|
+ toaster.pop('warning', '提示', '大陆交期填写错误,交期的范围必须在1~31天');
|
|
|
}
|
|
|
- toaster.pop('warning', '提示', '交期的值必须在1~9天');
|
|
|
+
|
|
|
return ;
|
|
|
}
|
|
|
- if(min > max) {
|
|
|
+ if(Number(min) > Number(max)) {
|
|
|
+ commodity.editMinDeliveryinValid = true;
|
|
|
+ commodity.editMaxDeliveryinValid = true;
|
|
|
if(isHk) {
|
|
|
- commodity.selfHkMinTimeinValid = true;
|
|
|
- commodity.selfHkMaxTimeinValid = true;
|
|
|
+ toaster.pop('warning', '提示', '香港交期填写错误,最短交期应小于等于最长交期');
|
|
|
}else {
|
|
|
- commodity.selfDemMinTimeinValid = true;
|
|
|
- commodity.selfDemMaxTimeinValid = true;
|
|
|
+ toaster.pop('warning', '提示', '大陆交期填写错误,最短交期应小于等于最长交期');
|
|
|
}
|
|
|
- toaster.pop('warning', '提示', '最小交期必须小于最大交期');
|
|
|
+
|
|
|
return ;
|
|
|
}
|
|
|
}
|
|
|
@@ -936,125 +890,125 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.checkGoodsInfo = function (commodity) {
|
|
|
var result = false;
|
|
|
if(!commodity) {
|
|
|
- toaster.pop('warning', '库存信息丢失,请重新操作');
|
|
|
+ toaster.pop('warning', '提示', '库存信息丢失,请重新操作');
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
if(!commodity.editPackaging) {
|
|
|
commodity.editPackagingInvalid = true;
|
|
|
- toaster.pop('warning', '请填写包装方式');
|
|
|
+ toaster.pop('warning', '提示', '请填写包装方式');
|
|
|
return result;
|
|
|
}
|
|
|
if(!commodity.editProduceDate) {
|
|
|
commodity.editProduceDateInvalid = true;
|
|
|
- toaster.pop('warning', '请填写生产日期');
|
|
|
+ toaster.pop('warning', '提示', '请填写生产日期');
|
|
|
return result;
|
|
|
}
|
|
|
if(isNaN(commodity.editReserve)) {
|
|
|
commodity.editReserveInvalid = true;
|
|
|
- toaster.pop('warning', '最新库存必须是数字');
|
|
|
+ toaster.pop('warning', '提示', '最新库存必须是数字');
|
|
|
return result;
|
|
|
}
|
|
|
- if(commodity.editReserve < 1) {
|
|
|
+ if(commodity.editReserve < $scope.minReserve) {
|
|
|
commodity.editReserveInvalid = true;
|
|
|
- toaster.pop('warning', '最新库存必须大于0');
|
|
|
+ toaster.pop('warning', '提示', '最新库存必须大于0');
|
|
|
return result;
|
|
|
}
|
|
|
if(commodity.editReserve > commodity.reserve) {
|
|
|
commodity.editReserveInvalid = true;
|
|
|
- toaster.pop('warning', '最新库存量只能小于原有库存');
|
|
|
+ toaster.pop('warning', '提示', '最新库存量只能小于原有库存');
|
|
|
return result;
|
|
|
}
|
|
|
- if(commodity.editReserve > 999999999) {
|
|
|
+ if(commodity.editReserve > $scope.maxReserve) {
|
|
|
commodity.editReserveInvalid = true;
|
|
|
- toaster.pop('warning', '最新库存量不能大于999999999');
|
|
|
+ toaster.pop('warning', '最新库存量不能大于' + $scope.maxReserve);
|
|
|
return result;
|
|
|
}
|
|
|
- if(isNaN(commodity.editMinBuyQty)) {
|
|
|
+ if(!$scope.isInt.test(commodity.editMinBuyQty)) {
|
|
|
commodity.editMinBuyQtyInValid = true;
|
|
|
- toaster.pop('warning', '最小起拍量必须是数字');
|
|
|
+ toaster.pop('warning', '提示', '最小起拍量必须是正整数');
|
|
|
return result;
|
|
|
}
|
|
|
if(commodity.editReserve < commodity.editMinBuyQty) {
|
|
|
commodity.editReserveInvalid = true;
|
|
|
commodity.editMinBuyQtyInValid = true;
|
|
|
- toaster.pop('warning', '最新库存必须大于最小起拍量');
|
|
|
+ toaster.pop('warning', '提示', '最新库存必须大于最小起拍量');
|
|
|
return result;
|
|
|
}
|
|
|
- if(isNaN(commodity.editMinPackQty)) {
|
|
|
+ if(!$scope.isInt.test(commodity.editMinPackQty)) {
|
|
|
commodity.editMinPackQtyInValid = true;
|
|
|
- toaster.pop('warning', '倍数必须是数字');
|
|
|
+ toaster.pop('warning', '提示', '最小包装数必须是正整数');
|
|
|
return result;
|
|
|
}
|
|
|
if(!commodity.editMinBuyQty) {
|
|
|
commodity.editMinBuyQtyInValid = true;
|
|
|
- toaster.pop('warning', '请填写起拍量之后再提交');
|
|
|
+ toaster.pop('warning', '提示', '请填写起拍量之后再提交');
|
|
|
return result;
|
|
|
}
|
|
|
if(!commodity.editMinPackQty) {
|
|
|
commodity.editMinPackQtyInValid = true;
|
|
|
- toaster.pop('warning', '请填写倍数之后再提交');
|
|
|
+ toaster.pop('warning', '提示', '请填写最小包装量之后再提交');
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ if(Number(commodity.editMinPackQty) > $scope.maxPackQty) {
|
|
|
+ commodity.editMinPackQtyInValid = true;
|
|
|
+ toaster.pop('warning', '提示', '最小包装量数量必须小于' + $scope.maxPackQty);
|
|
|
return result;
|
|
|
}
|
|
|
if(!commodity.editBreakUp) {
|
|
|
- if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
|
|
|
- commodity.editMinBuyQtyInValid = true;
|
|
|
- commodity.editMinPackQtyInValid = true;
|
|
|
- toaster.pop('warning', '起拍量必须是倍数的整数倍');
|
|
|
- return result;
|
|
|
- }
|
|
|
+ $scope.isNotBreakUp(commodity);
|
|
|
}
|
|
|
var lastEnd = -1;
|
|
|
for (var i = 0; i < commodity.editPrices.length; i++) {
|
|
|
if(isNaN(commodity.editPrices[i].start)) {
|
|
|
commodity.editPrices[i].startInValid = true;
|
|
|
- toaster.pop('warning', '分段数量必须是数字');
|
|
|
+ toaster.pop('warning', '提示', '分段数量必须是数字');
|
|
|
return result;
|
|
|
}
|
|
|
if(commodity.editPrices[i].start <= lastEnd) {
|
|
|
commodity.editPrices[i].startInValid = true;
|
|
|
- toaster.pop('warning', "存在分段的起始值小于等于上一个分段的结束值");
|
|
|
+ toaster.pop('warning', '提示', "存在分段的起始值小于等于上一个分段的结束值");
|
|
|
return result;
|
|
|
}
|
|
|
if(isNaN(commodity.editPrices[i].end)) {
|
|
|
commodity.editPrices[i].endInValid = true;
|
|
|
- toaster.pop('warning', '分段数量必须是数字');
|
|
|
+ toaster.pop('warning', '提示', '分段数量必须是数字');
|
|
|
return result;
|
|
|
}
|
|
|
- if(commodity.editPrices[i].start >= commodity.editPrices[i].end) {
|
|
|
+ if(commodity.editPrices[i].start > commodity.editPrices[i].end) {
|
|
|
commodity.editPrices[i].startInValid = true;
|
|
|
commodity.editPrices[i].endInValid = true;
|
|
|
- toaster.pop('warning', "存在分段的起始值大于等于分段的结束值");
|
|
|
+ toaster.pop('warning', '提示', "存在分段的起始值大于分段的结束值");
|
|
|
return result;
|
|
|
}
|
|
|
if(commodity.currencyName.indexOf('USD') > -1) {
|
|
|
if(!commodity.editPrices[i].uSDPrice) {
|
|
|
commodity.editPrices[i].usdPriceInvalid = true;
|
|
|
- toaster.pop('warning', "香港交货($)为空,请填写后再次提交!");
|
|
|
+ toaster.pop('warning', '提示', "香港交货($)为空,请填写后再次提交!");
|
|
|
return result;
|
|
|
}else if(isNaN(commodity.editPrices[i].uSDPrice)){
|
|
|
commodity.editPrices[i].usdPriceInvalid = true;
|
|
|
- toaster.pop('warning', "香港交货($)信息必须是数字");
|
|
|
+ toaster.pop('warning', '提示', "香港交货($)信息必须是数字");
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
if(commodity.currencyName.indexOf('RMB') > -1) {
|
|
|
if(!commodity.editPrices[i].rMBPrice) {
|
|
|
commodity.editPrices[i].rmbPriceInvalid = true;
|
|
|
- toaster.pop('warning', "大陆交货(¥)为空,请填写后再次提交!");
|
|
|
+ toaster.pop('warning', '提示', "大陆交货(¥)为空,请填写后再次提交!");
|
|
|
return result;
|
|
|
}else if(isNaN(commodity.editPrices[i].rMBPrice)){
|
|
|
commodity.editPrices[i].rmbPriceInvalid = true;
|
|
|
- toaster.pop('warning', "大陆交货(¥)信息必须是数字");
|
|
|
+ toaster.pop('warning', '提示', "大陆交货(¥)信息必须是数字");
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(commodity.currencyName.indexOf('USD') > -1 && !$scope.compareNum(commodity.editSelfDeliveryHKMinTime, commodity.editSelfDeliveryHKMaxTime, 2, commodity)) {
|
|
|
+ if(commodity.currencyName.indexOf('USD') > -1 && !$scope.compareNum(commodity.editMinDelivery, commodity.editMaxDelivery, 2, commodity)) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- if(commodity.currencyName.indexOf('RMB') > -1 && !$scope.compareNum(commodity.editSelfDeliveryDemMinTime, commodity.editSelfDeliveryDemMaxTime, 1, commodity)) {
|
|
|
+ if(commodity.currencyName.indexOf('RMB') > -1 && !$scope.compareNum(commodity.editMinDelivery, commodity.editMaxDelivery, 1, commodity)) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -1085,7 +1039,7 @@ define([ 'app/app' ], function(app) {
|
|
|
toaster.pop('success', '库存信息修改成功');
|
|
|
$scope.currenctGoods.splice(index, 1, data.data);
|
|
|
}else {
|
|
|
- toaster.pop('warning', '失败', data.message);
|
|
|
+ toaster.pop('warning', '提示', '失败', data.message);
|
|
|
}
|
|
|
}, function(response){
|
|
|
toaster.pop('error', '修改失败', response.data);
|
|
|
@@ -1103,6 +1057,8 @@ define([ 'app/app' ], function(app) {
|
|
|
commodity.selfDeliveryHKMaxTime = commodity.editSelfDeliveryHKMaxTime;
|
|
|
commodity.selfDeliveryDemMinTime = commodity.editSelfDeliveryDemMinTime;
|
|
|
commodity.selfDeliveryDemMaxTime = commodity.editSelfDeliveryDemMaxTime;
|
|
|
+ commodity.minDelivery = commodity.editMinDelivery;
|
|
|
+ commodity.maxDelivery = commodity.editMaxDelivery;
|
|
|
commodity.selfSale = commodity.editSelfSale;
|
|
|
commodity.minPackQty = commodity.editMinPackQty;
|
|
|
commodity.img = commodity.editPic;
|
|
|
@@ -1249,7 +1205,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.downGoods = function () {
|
|
|
var listId = getDownLoadGoodsId();
|
|
|
if(listId.length < 1) {
|
|
|
- toaster.pop('warning', '当前需要下载的订单条数为0');
|
|
|
+ toaster.pop('warning', '提示', '当前需要下载的订单条数为0');
|
|
|
return ;
|
|
|
}
|
|
|
Loading.show();
|
|
|
@@ -1333,6 +1289,24 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.selfSupport = type;
|
|
|
loadDataReload();
|
|
|
};
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 如果不拆分需要重新计算最小起订量的信息
|
|
|
+ * @param goods
|
|
|
+ */
|
|
|
+ $scope.isNotBreakUp = function (commodity) {
|
|
|
+ if(commodity.editMinPackQty&&commodity.editMinBuyQty) {
|
|
|
+ var remainder = commodity.editMinBuyQty % commodity.editMinPackQty;
|
|
|
+ if(remainder != 0) {
|
|
|
+ commodity.editMinBuyQty = Number(NumberService.add((NumberService.sub(commodity.editMinBuyQty, (commodity.editMinBuyQty % commodity.editMinPackQty))), commodity.editMinPackQty));
|
|
|
+ }
|
|
|
+ if(commodity.editReserve) {
|
|
|
+ if(commodity.editMinBuyQty > commodity.editReserve) {
|
|
|
+ commodity.editMinBuyQty = Number(NumberService.sub(commodity.editReserve, (commodity.editReserve % commodity.editMinPackQty)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
app.register.controller('editPictureCtrl', ['$scope', 'pic', '$modalInstance', function ($scope, pic, $modalInstance) {
|