|
|
@@ -3421,7 +3421,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}]);
|
|
|
|
|
|
//采购询价
|
|
|
- app.controller('SaleInquiryCtrl', ['$scope', '$filter', 'PurcInquiry', 'ngTableParams', 'toaster', 'BaseService', 'PurcInquiryInfo', '$upload', '$rootScope', function ($scope, $filter, PurcInquiry, ngTableParams, toaster, BaseService, PurcInquiryInfo, $upload, $rootScope) {
|
|
|
+ app.controller('SaleInquiryCtrl', ['$scope', '$filter', 'PurcInquiry', 'ngTableParams', 'toaster', 'BaseService', 'PurcInquiryInfo', '$upload', '$rootScope', 'token', function ($scope, $filter, PurcInquiry, ngTableParams, toaster, BaseService, PurcInquiryInfo, $upload, $rootScope, token) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
if ($rootScope.active) {
|
|
|
$scope.active = $rootScope.active;
|
|
|
@@ -3608,6 +3608,17 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
return bool;
|
|
|
};
|
|
|
|
|
|
+ // 获取token信息
|
|
|
+ $scope.getToken = function() {
|
|
|
+ if($scope.token == null) {
|
|
|
+ token.info({userType: 'salenotice'}, {}, function(data) {
|
|
|
+ $scope.token = data.token;
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$scope.onReplyClick = function (item, withSteps) {
|
|
|
if (item.vendFromDate instanceof Date) {
|
|
|
item.vendFromDate = item.vendFromDate.getTime();
|
|
|
@@ -3636,9 +3647,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
itemId: item.id
|
|
|
}
|
|
|
}).success(function (attach) {
|
|
|
- console.log(attach);
|
|
|
+
|
|
|
});
|
|
|
- PurcInquiry.reply({itemId: item.id}, item, function () {
|
|
|
+ PurcInquiry.reply({itemId: item.id, token: $scope.token}, item, function () {
|
|
|
$scope.loading = false;
|
|
|
toaster.pop('info', '提示', '报价成功');
|
|
|
$scope.tableParams.reload();
|
|
|
@@ -3647,7 +3658,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
toaster.pop('error', '询价失效', response.data);
|
|
|
});
|
|
|
} else {
|
|
|
- PurcInquiry.saveItem({itemId: item.id}, item, function () {
|
|
|
+ PurcInquiry.saveItem({itemId: item.id, token: $scope.token}, item, function () {
|
|
|
$scope.loading = false;
|
|
|
toaster.pop('info', '提示', '保存成功');
|
|
|
$scope.tableParams.reload();
|
|
|
@@ -5991,7 +6002,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}]);
|
|
|
|
|
|
// 发货提醒
|
|
|
- app.controller('SaleNoticeCtrl', ['$scope', '$rootScope', '$filter', 'PurcNotice', 'ngTableParams', 'toaster', 'BaseService', 'PurcNoticeHis', '$modal', 'SaleTruck', 'Symbol', '$state', '$timeout', 'PurcNoticeInfo', function ($scope, $rootScope, $filter, PurcNotice, ngTableParams, toaster, BaseService, PurcNoticeHis, $modal, SaleTruck, Symbol, $state, $timeout, PurcNoticeInfo) {
|
|
|
+ app.controller('SaleNoticeCtrl', ['$scope', '$rootScope', '$filter', 'PurcNotice', 'ngTableParams', 'toaster', 'BaseService', 'PurcNoticeHis', '$modal', 'SaleTruck', 'Symbol', '$state', '$timeout', 'PurcNoticeInfo', 'token', function ($scope, $rootScope, $filter, PurcNotice, ngTableParams, toaster, BaseService, PurcNoticeHis, $modal, SaleTruck, Symbol, $state, $timeout, PurcNoticeInfo, token) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
$scope.active = 'todo';
|
|
|
$scope.currency = Symbol.currency;
|
|
|
@@ -6117,7 +6128,18 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.autoCode = function (notice) {
|
|
|
notice.send.code = $filter('date')(new Date(), 'yyMMddHHmmss-sss');
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
+ // 获取token信息
|
|
|
+ $scope.getToken = function() {
|
|
|
+ if($scope.token == null) {
|
|
|
+ token.info({userType: 'salenotice'}, {}, function(data) {
|
|
|
+ $scope.token = data.token;
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//可送货日期
|
|
|
$scope.sendDate = function (notice) {
|
|
|
var stock = notice.orderItem.product.ltinstock || 0;
|
|
|
@@ -6135,7 +6157,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
// 锁定时间按钮5秒
|
|
|
$scope.lockClick = function (notice) {
|
|
|
if (!notice.send || !notice.send.qty || notice.send.qty > notice.qty - (notice.endQty || 0)) {
|
|
|
+
|
|
|
} else if (!notice.send.code) {
|
|
|
+
|
|
|
} else {
|
|
|
$scope.lockstatus = true;
|
|
|
$timeout(function () {
|
|
|
@@ -6158,7 +6182,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
sendItems: [{qty: notice.send.qty}]
|
|
|
};
|
|
|
$scope.loading = true;
|
|
|
- PurcNotice.save({id: notice.id}, send, function (data) {
|
|
|
+ PurcNotice.save({id: notice.id, token: $scope.token}, send, function (data) {
|
|
|
$scope.loading = false;
|
|
|
toaster.pop('success', '提示', '发货成功,跳转至发货单:' + notice.send.code);
|
|
|
$state.go('sale.send_detail', {id: data.id});
|
|
|
@@ -6199,24 +6223,40 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.checkboxes.checked = result;
|
|
|
};
|
|
|
|
|
|
+ // 打开批量发货模态框
|
|
|
+ var sendByBatch = function() {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: 'static/tpl/index/sale/sendByBatch.html',
|
|
|
+ controller: 'SaleNoticeSendByBatchCtrl',
|
|
|
+ size: 'lg',
|
|
|
+ resolve: {
|
|
|
+ selectedNotices: function () {
|
|
|
+ return $scope.tableParams.data;
|
|
|
+ },
|
|
|
+ token: function() {
|
|
|
+ return $scope.token;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ modalInstance.result.then(function () {
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function () {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
$scope.sendByBatch = function () {
|
|
|
- var modalInstance = $modal.open({
|
|
|
- animation: true,
|
|
|
- templateUrl: 'static/tpl/index/sale/sendByBatch.html',
|
|
|
- controller: 'SaleNoticeSendByBatchCtrl',
|
|
|
- size: 'lg',
|
|
|
- resolve: {
|
|
|
- selectedNotices: function () {
|
|
|
- return $scope.tableParams.data;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- modalInstance.result.then(function () {
|
|
|
- $scope.tableParams.reload();
|
|
|
- }, function () {
|
|
|
+ if($scope.token == null) {
|
|
|
+ token.info({userType: 'salenotice'}, {}, function(data) {
|
|
|
+ $scope.token = data.token;
|
|
|
+ sendByBatch();
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ sendByBatch();
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
};
|
|
|
|
|
|
$scope.getSends = function (notice) {
|
|
|
@@ -6279,7 +6319,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}, true);
|
|
|
}]);
|
|
|
|
|
|
- app.controller('SaleNoticeSendByBatchCtrl', ['$scope', '$modalInstance', 'Symbol', 'selectedNotices', 'PurcNotice', 'toaster', '$state', '$timeout', function ($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster, $state, $timeout) {
|
|
|
+ app.controller('SaleNoticeSendByBatchCtrl', ['$scope', '$modalInstance', 'Symbol', 'selectedNotices', 'PurcNotice', 'toaster', '$state', '$timeout', 'token', function ($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster, $state, $timeout, token) {
|
|
|
$scope.notices = angular.copy(selectedNotices);
|
|
|
$scope.currency = Symbol.currency;//将币别转化为对应的符号
|
|
|
$scope.saleSend = {
|
|
|
@@ -6292,7 +6332,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
sendItems: []
|
|
|
|
|
|
};
|
|
|
-
|
|
|
// 计算总数、总额
|
|
|
$scope.$watch(function () {
|
|
|
return $scope.notices;
|
|
|
@@ -6369,7 +6408,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
toaster.pop('error', '错误', '只有客户一致、币别一致、付款方式一致才能一起发货。');
|
|
|
} else {
|
|
|
if (!isSumbit) {
|
|
|
- PurcNotice.sendByBatch({}, $scope.saleSend, function (data) {
|
|
|
+ PurcNotice.sendByBatch({token: token}, $scope.saleSend, function (data) {
|
|
|
toaster.pop('success', '提示', '发货成功,跳转至发货单:' + $scope.saleSend.code);
|
|
|
$modalInstance.close('success');
|
|
|
$state.go('sale.send_detail', {id: data.id});
|