|
|
@@ -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,7 @@ 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)
|
|
|
-
|
|
|
- //数字的正则表达式
|
|
|
- var intPattern = /^[1-9]+$/;
|
|
|
+ $scope.userInfo = $rootScope.userInfo || {};
|
|
|
|
|
|
// 更多操作数据和记录
|
|
|
$scope.handleLink = [
|
|
|
@@ -24,7 +20,6 @@ define([ 'app/app' ], function(app) {
|
|
|
{name: '其它出库', tab: 'outBound', id: 1},
|
|
|
{name: '销售出库', tab: 'outBound', id: 2}];
|
|
|
$scope.handleItem = $stateParams.storage_tab ? 1 : ($scope.storage_tab === 'inBound'? $scope.handleLink[0].id : $scope.handleLink[3].id);
|
|
|
- // $scope.handleItem = 2;
|
|
|
|
|
|
// 销售方式数据
|
|
|
$scope.boundType = {
|
|
|
@@ -67,6 +62,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 +96,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: '',
|
|
|
@@ -109,6 +137,7 @@ define([ 'app/app' ], function(app) {
|
|
|
$scope.storage_tab = type;
|
|
|
$scope.type = $scope.storage_tab === 'inBound'? 'INBOUND' : 'OUTBOUND';
|
|
|
getLoadStorageData();
|
|
|
+ initOtherData();
|
|
|
};
|
|
|
|
|
|
// 操作类型切换
|
|
|
@@ -117,6 +146,7 @@ define([ 'app/app' ], function(app) {
|
|
|
if(type !== 1) {
|
|
|
getLoadStorageData();
|
|
|
}
|
|
|
+ initOtherData();
|
|
|
clearRecordParams();
|
|
|
};
|
|
|
// 销售方式筛选
|
|
|
@@ -211,7 +241,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
|
|
|
}
|
|
|
@@ -249,15 +278,47 @@ define([ 'app/app' ], function(app) {
|
|
|
|
|
|
// 展开收起
|
|
|
$scope.unfoldClick = function (data, type) {
|
|
|
+ $scope.logistics.number = '';
|
|
|
+ $scope.logistics.companyName = '';
|
|
|
angular.forEach(data, function(key) {
|
|
|
type.id !== key.id ? key.seleted = false : key.seleted = true;
|
|
|
})
|
|
|
};
|
|
|
|
|
|
+ // 点击外面清除弹窗
|
|
|
+ $scope.clearOtherData = function() {
|
|
|
+ angular.forEach($scope.otherData, function(val) {
|
|
|
+ val.show = false;
|
|
|
+ if(!val.id){
|
|
|
+ val.pbranden = '';
|
|
|
+ val.key = '';
|
|
|
+ val.kind = '';
|
|
|
+ val.spec = '';
|
|
|
+ val.qty = '';
|
|
|
+ val.price = '';
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
$scope.onChange = function (type) {
|
|
|
+ angular.forEach($scope.otherData, function(val) {
|
|
|
+ val.show = false;
|
|
|
+ })
|
|
|
type.show = true;
|
|
|
Goods.getKeywordToProductId({keyword: type.key}, function(data) {
|
|
|
- $scope.listData = data
|
|
|
+ if(data.length <= 0) {
|
|
|
+ toaster.pop('info', '提示', '该型号不存在你的产品库中!');
|
|
|
+ type.pbranden = '';
|
|
|
+ type.key = '';
|
|
|
+ type.kind = '';
|
|
|
+ type.spec = '';
|
|
|
+ type.qty = '';
|
|
|
+ type.price = '';
|
|
|
+ $scope.listData = [];
|
|
|
+ type.show = false;
|
|
|
+ } else {
|
|
|
+ $scope.listData = data
|
|
|
+ }
|
|
|
}, function (res) {
|
|
|
$scope.listData = [];
|
|
|
type.show = false;
|
|
|
@@ -271,6 +332,8 @@ define([ 'app/app' ], function(app) {
|
|
|
type.kind = key.kind;
|
|
|
type.spec = key.spec;
|
|
|
type.id = key.id;
|
|
|
+ type.qty = key.erpReserve;
|
|
|
+ type.price = key.price;
|
|
|
};
|
|
|
|
|
|
$scope.addOneTable = function (type) {
|
|
|
@@ -292,17 +355,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 +520,46 @@ define([ 'app/app' ], function(app) {
|
|
|
};
|
|
|
|
|
|
//数量进行验证
|
|
|
- $scope.ChangeSendCount = function(details, val) {
|
|
|
+ $scope.onAmountChange = function (item, val, type, key, deg) {
|
|
|
+ if (deg) {
|
|
|
+ if (angular.isNumber(Number(val))) {
|
|
|
+ if (val >= 10000) {
|
|
|
+ item[type] = Number(val.toString().substring(0, key));
|
|
|
+ } else if (val.toString().indexOf('.') > -1) {
|
|
|
+ var arr = val.toString().split(".");
|
|
|
+ if (arr[0].length > key) {
|
|
|
+ item[type] = Number(arr[0].substring(0, key) + '.' + arr[1]);
|
|
|
+ } else if (arr[1].length > deg) {
|
|
|
+ item[type] = Number(arr[0] + '.' + arr[1].substring(0, deg));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item[type] = ''
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ 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.checkAmount = function (item, val, type) {
|
|
|
+ $scope.validObj.amount = $scope.applyObj.amount === '' ? true
|
|
|
+ : $scope.applyObj.amount > 0 && $scope.applyObj.amount
|
|
|
+ < 1000000000;
|
|
|
+ return $scope.validObj.amount;
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.outBlurSendCount = function(details, val) {
|
|
|
var newShipQty = details.shipQty ? details.shipQty : 0
|
|
|
if (val > details.number - newShipQty) {
|
|
|
toaster.pop('warning', '提示', '本次发货数量不能大于已剩数量')
|
|
|
@@ -513,7 +620,7 @@ define([ 'app/app' ], function(app) {
|
|
|
// TODO huxz 跳转到订单管理页面
|
|
|
if (res.success) {
|
|
|
toaster.pop("success", "信息", "发货成功");
|
|
|
- $state.go('vendor_order');
|
|
|
+ // $state.go('vendor_order');
|
|
|
} else {
|
|
|
toaster.pop("error", res.message);
|
|
|
}
|
|
|
@@ -552,18 +659,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 +782,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 ++;
|