|
|
@@ -47,7 +47,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
;
|
|
|
|
|
|
$scope.showClickText = function(goods, item) {
|
|
|
- goods.editPackaging = item;
|
|
|
+ goods.Packinfo = item;
|
|
|
}
|
|
|
;
|
|
|
|
|
|
@@ -124,7 +124,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
|
|
|
$scope.setPriceMinAmount = setPriceMinAmount;
|
|
|
$scope.setPriceMaxAmount = setPriceMaxAmount;
|
|
|
- $scope.setPriceMinPackAmount = setPriceMinPackAmount;
|
|
|
+ // $scope.setPriceMinPackAmount = setPriceMinPackAmount;
|
|
|
|
|
|
$scope.checkMinDelivery = checkMinDelivery;
|
|
|
$scope.checkMaxDelivery = checkMaxDelivery;
|
|
|
@@ -2300,54 +2300,48 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
$scope.isNotBreakUp(goods, edit);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- $scope.updateStartNumber = function(goods) {
|
|
|
- goods.editPrices[0].start = goods.editMinBuyQty;
|
|
|
- }
|
|
|
- ;
|
|
|
-
|
|
|
/**
|
|
|
* 设置最小包数量
|
|
|
*
|
|
|
* @param goods 商品信息
|
|
|
*/
|
|
|
- function setPriceMinPackAmount(goods) {
|
|
|
- goods.editMinPackQtyInValid = false;
|
|
|
- if (typeof goods.editMinPackQty == 'undefined') {
|
|
|
- if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
- toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (!$scope.isInt.test(goods.editMinPackQty)) {
|
|
|
- if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
- goods.editMinPackQtyInValid = true;
|
|
|
- toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (parseInt(goods.editMinPackQty) < 1) {
|
|
|
- if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
- goods.editMinPackQtyInValid = true;
|
|
|
- toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (parseInt(goods.editMinPackQty) > $scope.maxPackQty) {
|
|
|
- if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
- toaster.pop('warning', '提示', '包装数量必须小于' + $scope.maxPackQty);
|
|
|
- goods.editMinPackQtyInValid = true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (goods.editMinBuyQty) {
|
|
|
- if (!goods.editBreakUp) {
|
|
|
- $scope.isNotBreakUp(goods);
|
|
|
- }
|
|
|
- }
|
|
|
- goods.editMinPackQtyPre = goods.editMinPackQty;
|
|
|
- goods.editMinPackQtyInValid = false;
|
|
|
- }
|
|
|
+ // function setPriceMinPackAmount(goods) {
|
|
|
+ // goods.editMinPackQtyInValid = false;
|
|
|
+ // if (typeof goods.editMinPackQty == 'undefined') {
|
|
|
+ // if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ // toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
+ // }
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // if (!$scope.isInt.test(goods.editMinPackQty)) {
|
|
|
+ // if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ // goods.editMinPackQtyInValid = true;
|
|
|
+ // toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
+ // }
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // if (parseInt(goods.editMinPackQty) < 1) {
|
|
|
+ // if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ // goods.editMinPackQtyInValid = true;
|
|
|
+ // toaster.pop('warning', '提示', '包装数量必须是大于0的整数');
|
|
|
+ // }
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // if (parseInt(goods.editMinPackQty) > $scope.maxPackQty) {
|
|
|
+ // if (!$scope.$$nonProduct.enterSaveButton) {
|
|
|
+ // toaster.pop('warning', '提示', '包装数量必须小于' + $scope.maxPackQty);
|
|
|
+ // goods.editMinPackQtyInValid = true;
|
|
|
+ // }
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // if (goods.editMinBuyQty) {
|
|
|
+ // if (!goods.editBreakUp) {
|
|
|
+ // $scope.isNotBreakUp(goods);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // goods.editMinPackQtyPre = goods.editMinPackQty;
|
|
|
+ // goods.editMinPackQtyInValid = false;
|
|
|
+ // }
|
|
|
|
|
|
/**
|
|
|
* 设置价格梯度的最大数量
|
|
|
@@ -2957,6 +2951,14 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
}
|
|
|
;
|
|
|
+ /**
|
|
|
+ * 是否可拆卖
|
|
|
+ * @param commodity
|
|
|
+ */
|
|
|
+ $scope.updateStartNumber = function(goods) {
|
|
|
+ goods.editPrices[0].start = goods.editMinBuyQty;
|
|
|
+ }
|
|
|
+ ;
|
|
|
|
|
|
/**
|
|
|
* 如果不拆分需要重新计算最小起订量的信息
|
|
|
@@ -3361,7 +3363,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
|
|
|
$scope.onCodeChange = function(code, index) {
|
|
|
- if (!index) {
|
|
|
+ if (index === undefined) {
|
|
|
if (code === '') {
|
|
|
$scope.Regul.CodeList = []
|
|
|
return false
|
|
|
@@ -3397,7 +3399,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
// 品牌change事件
|
|
|
$scope.onBrandChange = function(brand, index) {
|
|
|
- if (!index) {
|
|
|
+ if (index === undefined) {
|
|
|
if (brand === '') {
|
|
|
$scope.Regul.BrandList = []
|
|
|
return false
|
|
|
@@ -3506,7 +3508,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
$scope.replaceMaterialList[index].showSimilarBrandList = flag;
|
|
|
}
|
|
|
$scope.setCode = function(code, index) {
|
|
|
- if (!index) {
|
|
|
+ if (index === undefined) {
|
|
|
$scope.Regul.cmpcode = code
|
|
|
$scope.Regul.CodeList = []
|
|
|
} else {
|
|
|
@@ -3659,14 +3661,17 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
$scope.Regul = {
|
|
|
IsLookOrUpdate: 'update'
|
|
|
}
|
|
|
+ $scope.setPriceMinPackAmount = function(num) {
|
|
|
+ $scope.Regul.minPackNumber = num
|
|
|
+ }
|
|
|
+
|
|
|
$scope.editRegulPicture = function(Regulpic, commodity) {
|
|
|
- for (var i = 0; i < $scope.currenctMaterial.length; i++) {
|
|
|
- $scope.currenctMaterial[i].editRegulShow = false
|
|
|
- }
|
|
|
+ if (commodity.editRegulShow ) return
|
|
|
+ $scope.clearCheckBox()
|
|
|
commodity.editRegulShow = true
|
|
|
- var ChooseItem = commodity
|
|
|
- $scope.Regul.iniUrlImg = 'static/img/vendor/images/upload_file_icon.png'
|
|
|
- $scope.Regul.Regulpic = (ChooseItem.productAttachSubmit && ChooseItem.productAttachSubmit.uploadAttach) || ChooseItem.attach || 'static/img/vendor/images/upload_file_icon.png'; // 图片
|
|
|
+ var ChooseItem = _deepCopy(commodity)
|
|
|
+ $scope.Regul.iniUrlImg = 'static/img/vendor/images/upload.png'
|
|
|
+ $scope.Regul.Regulpic = (ChooseItem.productAttachSubmit && ChooseItem.productAttachSubmit.uploadAttach) || ChooseItem.attach || 'static/img/vendor/images/upload.png'; // 图片
|
|
|
$scope.Regul.Ischange = (ChooseItem.productAttachSubmit && ChooseItem.productAttachSubmit.uploadAttach || ChooseItem.attach) ? true : false // 是否存在规格书
|
|
|
$scope.Regul.showAction = true // 个人产品库和企业产品 还是在售产品
|
|
|
$scope.Regul.IsLookOrUpdate = ChooseItem.standard === 1 ? 'look' : 'update' // 编辑还是查看
|
|
|
@@ -3678,7 +3683,10 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
$scope.Regul.CodeList = [] // 型号数组
|
|
|
$scope.Regul.RegulChange = (ChooseItem.standard === 1 && $scope.Regul.Ischange) ? false : true // 规格书是否可以编辑
|
|
|
$scope.Regul.ChooseItem = ChooseItem
|
|
|
- $scope.Regul.Productpic = 'static/img/vendor/images/upload_file_icon.png' // 物料图片
|
|
|
+ $scope.Regul.Productpic = 'static/img/vendor/images/upload.png' // 物料图片
|
|
|
+ $scope.Regul.Packinfo = '' // 包装信息
|
|
|
+ $scope.Regul.minPackNumber = 1 // 最小包装数
|
|
|
+ $scope.Regul.productData = '' // 生产日期
|
|
|
}
|
|
|
|
|
|
// 修改规格书
|
|
|
@@ -3689,6 +3697,151 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
$scope.onUploadSuccessProduct = function(data) {
|
|
|
$scope.Regul.Productpic = data.path;
|
|
|
}
|
|
|
+ $scope.productUpOff = {}
|
|
|
+ // 编辑上下架
|
|
|
+ $scope.dateArea = 'formMe';
|
|
|
+ $scope.editProductUpOff = function(commodity, index) {
|
|
|
+ if (commodity.editProductUpOff) return
|
|
|
+ $scope.clearCheckBox()
|
|
|
+ commodity.editProductUpOff = true
|
|
|
+ $scope.productUpOff = _deepCopy(commodity)
|
|
|
+ $scope.productUpOff.minPackNumber = 10 // 最小包装数
|
|
|
+ $scope.productUpOff.MinBuyQty = 0 // 最小起订量
|
|
|
+ $scope.productUpOff.BreakUp = false// 可不可拆卖
|
|
|
+ $scope.productUpOff.GrounDing = false
|
|
|
+ $scope.productUpOff.selfSale = $scope.storeInfo.uuid !== 'undefind' && $scope.storeInfo.storeName.indexOf('优软测试二') < 0 && $scope.storeInfo.storeName.indexOf('优软商城') < 0 ? 1 : 2
|
|
|
+ commodity.dateArea = $scope.productUpOff.selfSale === 1 ? 'formMe' : 'autoMonth' // 自营还是销售
|
|
|
+ $scope.productUpOff.priceInfo = [{count: 1, price: 100}, {count: 2, price: 200}, {count: 4, price: 200}]
|
|
|
+ }
|
|
|
+ // 最小起订量修改 梯度1的值等于最小起订量
|
|
|
+ $scope.ProductupdateStartNumber = function(productUpOff) {
|
|
|
+ $scope.productUpOff.priceInfo[0].count = productUpOff
|
|
|
+ }
|
|
|
+ // 最小起订量失去焦点
|
|
|
+ $scope.ProductblurMinBuyQty = function(MinBuyQty) {
|
|
|
+ if (!MinBuyQty) return
|
|
|
+ if (!$scope.productUpOff.BreakUp) {
|
|
|
+ $scope.productUpOff.MinBuyQty = $scope.productUpOff.minPackNumber
|
|
|
+ toaster.pop('warning', '提示', '不可拆卖时,起订量必须是包装数量的倍数');
|
|
|
+ $scope.ProductupdateStartNumber($scope.productUpOff.MinBuyQty)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 可拆卖 上下架开关
|
|
|
+ $scope.productToggleIsBreadUp = function(pom) {
|
|
|
+ $scope.productUpOff[pom] = !$scope.productUpOff[pom]
|
|
|
+ if (pom === 'BreakUp') {
|
|
|
+ // 重置最小起订量
|
|
|
+ $scope.ProductblurMinBuyQty()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 清空当前打开的状态
|
|
|
+ $scope.clearCheckBox = function() {
|
|
|
+ for (var i = 0; i < $scope.currenctMaterial.length; i++) {
|
|
|
+ $scope.currenctMaterial[i].editProductUpOff = false
|
|
|
+ $scope.currenctMaterial[i].editRegulShow = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 选择寄售还是自营
|
|
|
+ $scope.productChangeSelfType = function(num, type) {
|
|
|
+ $scope.productUpOff.selfSale = num
|
|
|
+ }
|
|
|
+ // 上下架保存按钮
|
|
|
+ $scope.productSave = function() {
|
|
|
+ $scope.productUpOff.EditMinBuyQty = false
|
|
|
+ if (!$scope.productUpOff.MinBuyQty || $scope.productUpOff.MinBuyQty === 0) {
|
|
|
+ toaster.pop('warning','提示','最小起订量不能为空')
|
|
|
+ $scope.productUpOff.EditMinBuyQty = true
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $scope.productUpOff.editMaxDeliveryinValid = $scope.productUpOff.editMinDeliveryinValid = false
|
|
|
+ if (!$scope.productUpOff.MinDelivery || !$scope.productUpOff.MaxDelivery) {
|
|
|
+ toaster.pop('warning','提示','交期不能为空')
|
|
|
+ if (!$scope.productUpOff.MinDelivery) {
|
|
|
+ $scope.productUpOff.editMinDeliveryinValid = true
|
|
|
+ }
|
|
|
+ if (!$scope.productUpOff.MaxDelivery) {
|
|
|
+ $scope.productUpOff.editMaxDeliveryinValid = true
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (($scope.productUpOff.MinDelivery < 1 || $scope.productUpOff.MinDelivery > 31) || ($scope.productUpOff.MaxDelivery < 0 || $scope.productUpOff.MaxDelivery > 31)) {
|
|
|
+ toaster.pop('warning', '提示', '交期只能填写1-31之间的值');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($scope.productUpOff.MinDelivery === 0 || $scope.productUpOff.MaxDelivery === 0) {
|
|
|
+ toaster.pop('warning','提示','交期不能为0')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var flag = true
|
|
|
+ for (var i = 0; i < $scope.productUpOff.priceInfo.length; i++) {
|
|
|
+ if (!$scope.productUpOff.priceInfo[i].count || !$scope.productUpOff.priceInfo[i].price) {
|
|
|
+ toaster.pop('warning','提示','价格梯度不能为空')
|
|
|
+ flag = false
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else if ($scope.productUpOff.priceInfo[i + 1] && $scope.productUpOff.priceInfo[i].count < $scope.productUpOff.priceInfo[i + 1].count) {
|
|
|
+ toaster.pop('warning','提示','价格梯度不能为空')
|
|
|
+ flag = false
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!flag) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 先判断是自营店铺 还是 寄售店铺
|
|
|
+ var _selfSale = $scope.storeInfo.uuid ? 1 : 2
|
|
|
+ if ($scope.storeInfo.uuid) { // 如果是自营店铺
|
|
|
+ if ($scope.productUpOff.selfSale === 1) { // 用户选择了自营
|
|
|
+ _selfSale = 1
|
|
|
+ } else if (_selfSale === 2) { // 用户选择了寄售
|
|
|
+ _selfSale = 2
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除对应的分段.
|
|
|
+ * @param commodity
|
|
|
+ */
|
|
|
+ $scope.productDeleteFragment = function(goods, index) {
|
|
|
+ if (index > -1 && index < goods.length) {
|
|
|
+ if (goods.length < 2) {
|
|
|
+ toaster.pop('warning', "提示", "商品至少需要一个分段");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var price = goods.splice(index, 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 增加对应的分段。
|
|
|
+ * @param commodity
|
|
|
+ */
|
|
|
+ $scope.productAddFragment = function(goods) {
|
|
|
+ if (goods.length > 2) {
|
|
|
+ toaster.pop('warning', "提示", "商品最多只能有三个分段");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ goods.push({count: '', price: ''})
|
|
|
+
|
|
|
+ }
|
|
|
+ // 对象深度拷贝
|
|
|
+ function _deepCopy(target) {
|
|
|
+ if (typeof target !== 'object') return
|
|
|
+ // 判断目标类型,来创建返回值
|
|
|
+ var newObj = target instanceof Array ? [] : {}
|
|
|
+ for (var item in target) {
|
|
|
+ // 只复制元素自身的属性,不复制原型链上的
|
|
|
+ if (target.hasOwnProperty(item)) {
|
|
|
+ newObj[item] = typeof target[item] === 'object' ? _deepCopy(target[item]) : target[item]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return newObj
|
|
|
+ }
|
|
|
}
|
|
|
]);
|
|
|
|