|
|
@@ -19,7 +19,6 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
minDelivery: 1,
|
|
|
maxDelivery: 10,
|
|
|
dateArea: 'formMe',
|
|
|
- autoPublish: false,
|
|
|
minBuyQty: 1
|
|
|
}
|
|
|
}
|
|
|
@@ -264,8 +263,8 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
|
|
|
$scope.setPriceMinPackAmount = function(num) {
|
|
|
- if (num === 0) {
|
|
|
- toaster.pop('warning','提示', '最小包装数必须大于等于1')
|
|
|
+ if (num.indexOf('.') > -1) {
|
|
|
+ toaster.pop('warning', '提示', '最小包装数不能存在小数点')
|
|
|
$scope.Regul.minPackQty = 1
|
|
|
} else {
|
|
|
$scope.Regul.minPackQty = num
|
|
|
@@ -273,8 +272,8 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
|
|
|
$scope.setReserve = function(num) {
|
|
|
- if (num === 0) {
|
|
|
- toaster.pop('warning','提示', '库存数量必须大于等于1')
|
|
|
+ if (num.indexOf('.') > -1) {
|
|
|
+ toaster.pop('warning', '提示', '库存数量不能存在小数点')
|
|
|
$scope.Regul.reserve = 1
|
|
|
} else {
|
|
|
$scope.Regul.reserve = num
|
|
|
@@ -282,15 +281,10 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
|
|
|
$scope.setOnePrice = function(num) {
|
|
|
- if (num === 0) {
|
|
|
- toaster.pop('warning','提示', '库存数量必须大于等于1')
|
|
|
- $scope.Regul.OnePrice = 1
|
|
|
- } else {
|
|
|
- $scope.Regul.OnePrice = num
|
|
|
- }
|
|
|
+ $scope.Regul.OnePrice = num
|
|
|
}
|
|
|
// 修改规格书
|
|
|
- $scope.onUploadSuccess = function(data){
|
|
|
+ $scope.onUploadSuccess = function(data) {
|
|
|
$scope.Regul.Regulpic = data.path;
|
|
|
$scope.Regul.Ischange = true
|
|
|
};
|
|
|
@@ -432,13 +426,6 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
if (!prices || !prices[index] || !price) {
|
|
|
return;
|
|
|
}
|
|
|
- if (index === 0) {
|
|
|
- if (Number(prices[index].rMBPrice) > 0 && $scope.storeInfo.enType !== 'HK') {
|
|
|
- $scope.Regul.autoPublish = true
|
|
|
- } else if (Number(prices[index].uSDPrice) > 0) {
|
|
|
- $scope.Regul.autoPublish = true
|
|
|
- }
|
|
|
- }
|
|
|
if (isNaN(price)) {
|
|
|
prices[index].priceInvalid = true;
|
|
|
toaster.pop('warning', '提示', '单价必须是大于0的数字');
|
|
|
@@ -620,6 +607,42 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
$scope.Regul.selfSale = 0
|
|
|
}
|
|
|
}
|
|
|
+ var jsonObject = {
|
|
|
+ isPcb: $rootScope.isPcbStore ? 1 : 0,
|
|
|
+ goods: {},
|
|
|
+ product: {}
|
|
|
+ }
|
|
|
+ jsonObject.product = {
|
|
|
+ spec: $scope.Regul.spec, // 规格
|
|
|
+ minPackQty: $scope.Regul.minPackQty, // 最小包装量
|
|
|
+ erpReserve: $scope.Regul.reserve, //库存
|
|
|
+ cmpCode: $scope.Regul.pcmpcode, //型号
|
|
|
+ brand: $scope.Regul.pbranden,//品牌
|
|
|
+ prodName: $scope.Regul.kind, // 名称
|
|
|
+ price: $scope.Regul.OnePrice, // 成本单价
|
|
|
+ attachment: $scope.Regul.Ischange ? '' : $scope.Regul.Regulpic, // 规格书
|
|
|
+ cmpImg: $scope.Regul.RegulImg !== $scope.Regul.iniUrlImg ? $scope.Regul.RegulImg : ''// 图片
|
|
|
+ }
|
|
|
+ jsonObject.goods = {
|
|
|
+ minBuyQty: $scope.Regul.minBuyQty, // 最小起订量
|
|
|
+ //分段报价信息
|
|
|
+ prices: $scope.Regul.prices,
|
|
|
+ breakUp: $scope.Regul.breakUp, // 是否拆卖
|
|
|
+ minDelivery: $scope.Regul.minDelivery, // 最短交期
|
|
|
+ maxDelivery: $scope.Regul.maxDelivery,// 最长交期
|
|
|
+ selfSale: $scope.Regul.selfSale // 销售方式
|
|
|
+ }
|
|
|
+ Material.importOneMaterail({}, jsonObject, function(data) {
|
|
|
+ if (data.code == 1) {
|
|
|
+ toaster.pop('success', '保存成功');
|
|
|
+ initInfo()
|
|
|
+ initError()
|
|
|
+ } else {
|
|
|
+ toaster.pop('error', '失败', data.message);
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '失败', response.data);
|
|
|
+ });
|
|
|
// Goods.updateGoods(null, $scope.productUpOff.goods, function(data) {
|
|
|
// if (data.code == 1) {
|
|
|
// toaster.pop('success', '保存成功');
|