|
|
@@ -1,6 +1,6 @@
|
|
|
define([ 'app/app' ], function(app) {
|
|
|
'use strict';
|
|
|
- app.register.controller('vendor_onSaleCtrl', ['$scope', '$rootScope', 'Goods', '$modal', 'toaster', 'Loading', 'StoreInfo', 'AuthenticationService', '$q', 'StoreCms', function ($scope, $rootScope, Goods, $modal, toaster, Loading, StoreInfo, AuthenticationService, $q, StoreCms) {
|
|
|
+ app.register.controller('vendor_onSaleCtrl', ['$scope', '$rootScope', 'Goods', '$modal', 'toaster', 'Loading', 'StoreInfo', 'AuthenticationService', '$q', 'StoreCms', 'NumberService', function ($scope, $rootScope, Goods, $modal, toaster, Loading, StoreInfo, AuthenticationService, $q, StoreCms, NumberService) {
|
|
|
$rootScope.active = 'vendor_material';
|
|
|
$scope.keyword = '';
|
|
|
$scope.tab = 'onSale';
|
|
|
@@ -417,6 +417,10 @@ define([ 'app/app' ], function(app) {
|
|
|
commodity.editMinPackQtyPre = commodity.minPackQty;
|
|
|
commodity.editMinPackQtyDirty = false;
|
|
|
|
|
|
+ commodity.editBreakUp = commodity.breakUp;
|
|
|
+ commodity.editBreakUpPre = commodity.breakUp;
|
|
|
+ commodity.editBreakUpDirty = false;
|
|
|
+
|
|
|
commodity.editPackaging = commodity.packaging;
|
|
|
commodity.editPackagingPre = commodity.packaging;
|
|
|
commodity.editPackagingDirty = false;
|
|
|
@@ -444,6 +448,23 @@ define([ 'app/app' ], function(app) {
|
|
|
commodity.editSelfSale = $scope.storeInfo.uuid != 'undefind' && commodity.storeid == $scope.storeInfo.uuid && $scope.storeInfo.storeName.indexOf('优软测试二') < 0 && $scope.storeInfo.storeName.indexOf('优软商城') < 0 ? 1 : 2;
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * 是否可拆卖
|
|
|
+ * @param commodity
|
|
|
+ */
|
|
|
+ $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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改commodity的系列的dirty属性 为true;
|
|
|
* @param commodity
|
|
|
@@ -669,11 +690,13 @@ define([ 'app/app' ], function(app) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if(commodity.editMinPackQty) {
|
|
|
- if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
|
|
|
- commodity.editMinBuyQty = null;
|
|
|
- toaster.pop('warning', '提示', '起拍量必须是倍数的整数倍');
|
|
|
- return 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) {
|
|
|
@@ -715,10 +738,12 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
|
|
|
|
if(commodity.editMinBuyQty) {
|
|
|
- if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
|
|
|
- commodity.editMinPackQty = null;
|
|
|
- toaster.pop('warning', '提示', '倍数必须是起拍量的整数倍且小于起拍量。');
|
|
|
- return false;
|
|
|
+ if(!commodity.editIsBreakUp) {
|
|
|
+ if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
|
|
|
+ commodity.editMinPackQty = null;
|
|
|
+ toaster.pop('warning', '提示', '倍数必须是起拍量的整数倍且小于起拍量。');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
commodity.editMinPackQtyPre = commodity.editMinPackQty;
|
|
|
@@ -917,9 +942,9 @@ define([ 'app/app' ], function(app) {
|
|
|
toaster.pop('warning', '最新库存量只能小于原有库存');
|
|
|
return result;
|
|
|
}
|
|
|
- if(commodity.editReserve > 99999999) {
|
|
|
+ if(commodity.editReserve > 999999999) {
|
|
|
commodity.editReserveInvalid = true;
|
|
|
- toaster.pop('warning', '最新库存量不能大于99999999');
|
|
|
+ toaster.pop('warning', '最新库存量不能大于999999999');
|
|
|
return result;
|
|
|
}
|
|
|
if(isNaN(commodity.editMinBuyQty)) {
|
|
|
@@ -948,11 +973,13 @@ define([ 'app/app' ], function(app) {
|
|
|
toaster.pop('warning', '请填写倍数之后再提交');
|
|
|
return result;
|
|
|
}
|
|
|
- if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
|
|
|
- commodity.editMinBuyQtyInValid = true;
|
|
|
- commodity.editMinPackQtyInValid = true;
|
|
|
- toaster.pop('warning', '起拍量必须是倍数的整数倍');
|
|
|
- return result;
|
|
|
+ if(!commodity.editBreakUp) {
|
|
|
+ if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
|
|
|
+ commodity.editMinBuyQtyInValid = true;
|
|
|
+ commodity.editMinPackQtyInValid = true;
|
|
|
+ toaster.pop('warning', '起拍量必须是倍数的整数倍');
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
var lastEnd = -1;
|
|
|
for (var i = 0; i < commodity.editPrices.length; i++) {
|
|
|
@@ -1056,7 +1083,8 @@ define([ 'app/app' ], function(app) {
|
|
|
commodity.selfSale = commodity.editSelfSale;
|
|
|
commodity.minPackQty = commodity.editMinPackQty;
|
|
|
commodity.img = commodity.editPic;
|
|
|
- }
|
|
|
+ commodity.breakUp = typeof commodity.editBreakUp == 'undefined' ? false : commodity.editBreakUp;
|
|
|
+ };
|
|
|
|
|
|
/**
|
|
|
* 验证价格是否是合理的,
|