|
|
@@ -29,7 +29,9 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
pcmpcode: false,
|
|
|
spec: false,
|
|
|
minDelivery: false,
|
|
|
- maxDelivery: false
|
|
|
+ maxDelivery: false,
|
|
|
+ OnePrice: false,
|
|
|
+ minPackQty: false
|
|
|
}
|
|
|
for (var i = 0; i < $scope.Regul.prices.length; i++) {
|
|
|
$scope.Regul.prices[i].priceInvalid = false
|
|
|
@@ -125,12 +127,19 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
* @param name 品牌名称
|
|
|
*/
|
|
|
$scope.RegulonBrandBlur = function(name) {
|
|
|
- if (name === '') {
|
|
|
- $scope.Regul.BrandList = []
|
|
|
- } else {
|
|
|
- $scope.Regul.pbranden = $scope.Regul.BrandList.value[0].nameEn
|
|
|
- $scope.Regul.BrandList = []
|
|
|
- }
|
|
|
+ // setTimeout(function() {
|
|
|
+ if (name === '') {
|
|
|
+ $scope.Regul.BrandList = []
|
|
|
+ } else {
|
|
|
+ $scope.Regul.pbranden = $scope.Regul.BrandList.value && $scope.Regul.BrandList.value[0].nameEn || name
|
|
|
+ $scope.Regul.BrandList = []
|
|
|
+ }
|
|
|
+ // }, 300)
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.stopMounseDown = function(e) {
|
|
|
+ var _e = e || window.event
|
|
|
+ _e.preventDefault()
|
|
|
}
|
|
|
|
|
|
$scope.setBrand = function(brand, index) {
|
|
|
@@ -199,14 +208,12 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
* @param name 型号名称
|
|
|
*/
|
|
|
$scope.RegulonCodeBlur = function(name) {
|
|
|
- setTimeout(function() {
|
|
|
- if (name === '') {
|
|
|
- $scope.Regul.CodeList = []
|
|
|
- } else {
|
|
|
- $scope.Regul.pcmpcode = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].code || name
|
|
|
- $scope.Regul.CodeList = []
|
|
|
- }
|
|
|
- }, 0)
|
|
|
+ if (name === '') {
|
|
|
+ $scope.Regul.CodeList = []
|
|
|
+ } else {
|
|
|
+ $scope.Regul.pcmpcode = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].code || name
|
|
|
+ $scope.Regul.CodeList = []
|
|
|
+ }
|
|
|
}
|
|
|
$scope.setCode = function(code, index) {
|
|
|
$scope.Regul.pcmpcode = code
|
|
|
@@ -257,12 +264,13 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
|
|
|
$scope.setPriceMinPackAmount = function(num) {
|
|
|
- if (num.indexOf('.') > -1) {
|
|
|
+ if (num && num.indexOf('.') > -1) {
|
|
|
toaster.pop('warning', '提示', '最小包装数不能存在小数点')
|
|
|
$scope.Regul.minPackQty = 1
|
|
|
} else {
|
|
|
$scope.Regul.minPackQty = num
|
|
|
}
|
|
|
+ $scope.objError.minPackQty = false
|
|
|
}
|
|
|
|
|
|
$scope.setReserve = function(num) {
|
|
|
@@ -277,6 +285,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
|
|
|
$scope.setOnePrice = function(num) {
|
|
|
$scope.Regul.OnePrice = num
|
|
|
+ $scope.objError.OnePrice = false
|
|
|
}
|
|
|
// 修改规格书
|
|
|
$scope.onUploadSuccess = function(data) {
|
|
|
@@ -524,12 +533,30 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if ($scope.Regul.reserve <=0) {
|
|
|
+ if ($scope.Regul.reserve <= 0) {
|
|
|
toaster.pop('warning','提示', '库存数量必须大于等于1')
|
|
|
$scope.objError.reserve = true
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (/\D/.test($scope.Regul.reserve)) {
|
|
|
+ toaster.pop('warning','提示', '库存数量只能为正整数')
|
|
|
+ $scope.objError.reserve = true
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($scope.Regul.minPackQty !== '' && /\D/.test($scope.Regul.minPackQty)) {
|
|
|
+ toaster.pop('warning','提示', '最小包装数输入不正确')
|
|
|
+ $scope.objError.minPackQty = true
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($scope.Regul.OnePrice !== '' && !/^\d+(\.\d+)?$/.test($scope.Regul.OnePrice)) {
|
|
|
+ toaster.pop('warning','提示', '成本单价输入不正确')
|
|
|
+ $scope.objError.OnePrice = true
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (!$scope.Regul.minBuyQty || $scope.Regul.minBuyQty === 0) {
|
|
|
toaster.pop('warning','提示', '最小起订量必须是大于0的数字')
|
|
|
$scope.objError.minBuyQty = true
|
|
|
@@ -657,6 +684,13 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
// });
|
|
|
}
|
|
|
|
|
|
+ // document.addEventListener('click', function() {
|
|
|
+ // $scope.Regul.pcmpcode = $scope.Regul.CodeList&& $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].code || name
|
|
|
+ // $scope.Regul.CodeList = []
|
|
|
+ // $scope.Regul.pbranden = $scope.Regul.BrandList && $scope.Regul.BrandList.value[0].nameEn
|
|
|
+ // $scope.Regul.BrandList = []
|
|
|
+ // }, false)
|
|
|
+
|
|
|
|
|
|
}])
|
|
|
});
|