|
|
@@ -1,6 +1,6 @@
|
|
|
define([ 'app/app' ], function(app) {
|
|
|
'use strict';
|
|
|
- app.register.controller('vendor_storageCtrl', ['$scope', '$rootScope', '$stateParams', 'BaseService', 'Goods', 'KdnLogistics', '$modal', 'toaster', 'Loading', 'AuthenticationService', '$q', '$upload', '$http', 'ngTableParams', 'InvoiceFPurchase', 'ShippingAddress', function ($scope, $rootScope, $stateParams, BaseService, Goods, KdnLogistics, $modal, toaster, Loading, AuthenticationService, $q, $upload, $http, ngTableParams, InvoiceFPurchase, ShippingAddress) {
|
|
|
+ app.register.controller('vendor_storageCtrl', ['$scope', '$rootScope', '$stateParams', 'BaseService', 'Goods', 'KdnLogistics', '$modal', 'toaster', 'Loading', 'AuthenticationService', '$q', '$upload', '$http', 'ngTableParams', 'InvoiceFPurchase', 'ShippingAddress', 'Enterprise', function ($scope, $rootScope, $stateParams, BaseService, Goods, KdnLogistics, $modal, toaster, Loading, AuthenticationService, $q, $upload, $http, ngTableParams, InvoiceFPurchase, ShippingAddress, Enterprise) {
|
|
|
$rootScope.active = 'vendor_storage';
|
|
|
$scope.keyword = '';
|
|
|
$scope.type = '';
|
|
|
@@ -9,11 +9,17 @@ define([ 'app/app' ], function(app) {
|
|
|
document.title = '卖家出入库-优软商城';
|
|
|
$scope.storage_tab = $stateParams.storage_tab? $stateParams.storage_tab : 'inBound';
|
|
|
$scope.countData = 10;
|
|
|
- $scope.userInfo = $rootScope.userInfo || {}
|
|
|
- console.log($stateParams)
|
|
|
+ $scope.userInfo = $rootScope.userInfo || {};
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 最大出入库数
|
|
|
+ * @type {number}
|
|
|
+ */
|
|
|
+ $scope.maxReserve = 999999999;
|
|
|
//数字的正则表达式
|
|
|
var intPattern = /^[1-9]+$/;
|
|
|
+ $scope.isInt = /^[0-9]*[1-9][0-9]*$/;
|
|
|
|
|
|
// 更多操作数据和记录
|
|
|
$scope.handleLink = [
|
|
|
@@ -67,6 +73,27 @@ define([ 'app/app' ], function(app) {
|
|
|
return new Date(_formatDate(date, 'yyyy-MM-dd')).getTime() - 8 * 60 * 60 * 1000
|
|
|
};
|
|
|
|
|
|
+ var getRealLen = function (str) {
|
|
|
+ var len = 0;
|
|
|
+ for (var i = 0; i < str.length; i++) {
|
|
|
+ if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
|
|
|
+ len += 2;
|
|
|
+ } else {
|
|
|
+ len++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return len;
|
|
|
+ }
|
|
|
+ var cutOutString = function (str, length) {
|
|
|
+ for (var i = 1; i <= str.length; i++) {
|
|
|
+ if (getRealLen(str.substr(0, i)) > length){
|
|
|
+ str = str.substr(0, i-1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return str;
|
|
|
+ };
|
|
|
+
|
|
|
// 清空数据初始化数据
|
|
|
var clearRecordParams = function () {
|
|
|
$scope.dateArea = 'oneMonth'
|
|
|
@@ -80,6 +107,18 @@ define([ 'app/app' ], function(app) {
|
|
|
};
|
|
|
clearRecordParams();
|
|
|
|
|
|
+ //获取币别信息
|
|
|
+ Enterprise.getCurrencyByRegisterAddress(null, function (data) {
|
|
|
+ if(data.code === 1) {
|
|
|
+ $scope.currency = data.data;
|
|
|
+ }else {
|
|
|
+ toaster.pop('info', '提示', '您公司的注册地址为空,无法确定币别,系统默认为人民币');
|
|
|
+ $scope.currency = 'RMB';
|
|
|
+ }
|
|
|
+ }, function (response) {
|
|
|
+ toaster.pop('info', '提示', '获取不到公司的币别信息');
|
|
|
+ });
|
|
|
+
|
|
|
// 其它出入库默认数据
|
|
|
$scope.othenParam = {
|
|
|
enName: '',
|
|
|
@@ -211,7 +250,6 @@ define([ 'app/app' ], function(app) {
|
|
|
total: 0,
|
|
|
getData: function ($defer, params) {
|
|
|
var param = BaseService.parseParams(params.url())
|
|
|
- console.log($scope.keyword, 'keyword')
|
|
|
if($scope.keyword){
|
|
|
param.keyword = $scope.keyword
|
|
|
}
|
|
|
@@ -292,17 +330,22 @@ define([ 'app/app' ], function(app) {
|
|
|
return false
|
|
|
}
|
|
|
$scope.othenParam.detail = [];
|
|
|
- console.log($scope.otherData)
|
|
|
- if(!$scope.othenParam.enName) {
|
|
|
- toaster.pop('error', '请填写' + ($scope.storage_tab === 'inBound' ? '卖家名称' : '买家名称'));
|
|
|
- return false
|
|
|
- }
|
|
|
+ var flag = false;
|
|
|
angular.forEach($scope.otherData, function(val) {
|
|
|
if(val.id) {
|
|
|
- $scope.othenParam.detail.push({productId: val.id, qty: 323, price: 4234})
|
|
|
+ if(val.qty && val.price) {
|
|
|
+ $scope.othenParam.detail.push({productId: val.id, qty: Number(val.qty), price: Number(val.price)});
|
|
|
+ flag = true;
|
|
|
+ }else {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
- Goods.saveOtherProductData({storage_tab: $scope.storage_tab, enName: $scope.othenParam.enName}, $scope.othenParam.detail, function(data) {
|
|
|
+ if(!flag) {
|
|
|
+ toaster.pop('info', '提示', '请正确填写下面的信息内容!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Goods.saveOtherProductData({storage_tab: $scope.storage_tab, enName: $scope.othenParam.enName ? $scope.othenParam.enName : null}, $scope.othenParam.detail, function(data) {
|
|
|
if(data.code === 1) {
|
|
|
toaster.pop('success', '申请成功!');
|
|
|
initOtherData();
|
|
|
@@ -452,7 +495,22 @@ define([ 'app/app' ], function(app) {
|
|
|
};
|
|
|
|
|
|
//数量进行验证
|
|
|
- $scope.ChangeSendCount = function(details, val) {
|
|
|
+ $scope.onAmountChange = function (item, val, type, key) {
|
|
|
+ if (!(/^[0-9]*$/).test(val)) {
|
|
|
+ var chineseIndex = -1;
|
|
|
+ for (var i = 0; i < val.length; i++) {
|
|
|
+ if (!(/^[0-9]*$/).test(val.charAt(i))) {
|
|
|
+ chineseIndex = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ item[type] = cutOutString(val, chineseIndex);
|
|
|
+ } else if (val.length > key) {
|
|
|
+ item[type] = cutOutString(val, key);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.outBlurSendCount = function(details, val) {
|
|
|
var newShipQty = details.shipQty ? details.shipQty : 0
|
|
|
if (val > details.number - newShipQty) {
|
|
|
toaster.pop('warning', '提示', '本次发货数量不能大于已剩数量')
|
|
|
@@ -552,18 +610,6 @@ define([ 'app/app' ], function(app) {
|
|
|
toaster.pop('info', '获取定单的信息' + response);
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
- var getRealLen = function(str) {
|
|
|
- var len = 0;
|
|
|
- for (var i = 0; i < str.length; i++) {
|
|
|
- if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
|
|
|
- len += 2;
|
|
|
- } else {
|
|
|
- len++;
|
|
|
- }
|
|
|
- }
|
|
|
- return len;
|
|
|
- }
|
|
|
}]);
|
|
|
|
|
|
// 设置物流公司
|
|
|
@@ -687,7 +733,6 @@ define([ 'app/app' ], function(app) {
|
|
|
|
|
|
$scope.onKeyDown = function () {
|
|
|
var dom = document.getElementById("ulContent");
|
|
|
- // console.log(dom.scrollTop);
|
|
|
if ($scope.showDownFrame && $scope.matchData){
|
|
|
if(event.keyCode == 40) { //监听到按下键
|
|
|
$scope.selectIndex ++;
|