|
|
@@ -10416,7 +10416,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
getDeOrder[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function(page) {
|
|
|
$scope.loading = false;
|
|
|
if(page) {
|
|
|
- params.total(page.totalElements);
|
|
|
+ params.total(page.totalElement);
|
|
|
$scope.total = page.totalElement;
|
|
|
$defer.resolve(page.content);
|
|
|
$scope.keywordXls = angular.copy(pageParams.keyword);//保存当前取值的关键词
|
|
|
@@ -10455,12 +10455,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
*/
|
|
|
app.controller('NewDeputyOrderCtrl', ['$scope', 'toaster', '$modal', 'DeputyOrder', '$filter', 'ngTableParams', 'BaseService', function($scope, toaster, $modal, DeputyOrder, $filter, ngTableParams, BaseService) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
- // 费率
|
|
|
- DeputyOrder.vendorRate({}, function(data) {
|
|
|
- $scope.rate = data;
|
|
|
- }, function(response){
|
|
|
-
|
|
|
- });
|
|
|
$scope.deOrder = {
|
|
|
code: 'DC' + $filter('date')(new Date(), 'yyMMddHHmmss_sss'),
|
|
|
entrydate: new Date(),
|
|
|
@@ -10474,6 +10468,13 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
orderamount: 0,
|
|
|
usdpayment: 0
|
|
|
};
|
|
|
+ // 费率
|
|
|
+ DeputyOrder.vendorRate({}, function(data) {
|
|
|
+ $scope.rate = data;
|
|
|
+ }, function(response){
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
$scope.deOrder.deputyOrderItems = [];
|
|
|
var item = {
|
|
|
prodname: null,
|
|
|
@@ -10484,6 +10485,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
remark: null,
|
|
|
orderprice: null,
|
|
|
};
|
|
|
+ // 代采企业列表
|
|
|
+ DeputyOrder.deputyEnterprise({}, function(data) {
|
|
|
+ $scope.deputyEnterprises = data;
|
|
|
+ $scope.deOrder.deputyuu = $scope.deputyEnterprises[0].deputyEnterprise.uu;
|
|
|
+ });
|
|
|
$scope.deOrder.deputyOrderItems.push(item);
|
|
|
//增加商品
|
|
|
$scope.add = function(index) {
|
|
|
@@ -10533,22 +10539,45 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ // 查找供应商
|
|
|
+ $scope.dbfindVendor = function(deputyuu) {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ templateUrl: 'static/tpl/index/purc/modal/purc_order_vendor.html',
|
|
|
+ controller: 'DbfindDeputyVendorInfoCtrl',
|
|
|
+ size: 'lg',
|
|
|
+ resolve: {
|
|
|
+ deputyuu: function() {return deputyuu}
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function(data) {
|
|
|
+ console.log(data);
|
|
|
+ $scope.deOrder.customer = data.vendorEnterprise.enName;
|
|
|
+ $scope.deOrder.legalrepresent = data.vendorUser.userName;
|
|
|
+ $scope.deOrder.enaddress = data.vendorEnterprise.enAddress;
|
|
|
+ $scope.deOrder.usertel = data.vendorUser.userTel;
|
|
|
+ })
|
|
|
+ }
|
|
|
$scope.save = function() {
|
|
|
$scope.deOrder.entrystatus = '保存';
|
|
|
angular.forEach($scope.deOrder.deputyOrderItems, function(item) {
|
|
|
$scope.deOrder.totalamount += item.amount * item.unitprice;
|
|
|
$scope.deOrder.totalpayament += item.amount * item.unitprice;
|
|
|
});
|
|
|
- DeputyOrder.saveDeOrder({deOrder: $scope.deOrder}, {}, function(data) {
|
|
|
- if(data.id) {
|
|
|
- window.location.hash = "#/purc/deputy/"+data.id;
|
|
|
- }
|
|
|
- if(data.error) {
|
|
|
- toaster.pop('error', '提示', '保存失败');
|
|
|
- }
|
|
|
- }, function(response) {
|
|
|
-
|
|
|
- });
|
|
|
+ if($scope.deOrder.deputyOrderItems[0].prodcode == null) {
|
|
|
+ toaster.pop('info', '提示', '您还未填写任何商品信息');
|
|
|
+ } else {
|
|
|
+ DeputyOrder.saveDeOrder({deOrder: $scope.deOrder}, {}, function(data) {
|
|
|
+ if(data.id) {
|
|
|
+ window.location.hash = "#/purc/deputy/"+data.id;
|
|
|
+ }
|
|
|
+ if(data.error) {
|
|
|
+ toaster.pop('error', '提示', '保存失败');
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$scope.submit = function() {
|
|
|
@@ -10557,16 +10586,20 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
$scope.deOrder.totalamount += item.amount * item.unitprice;
|
|
|
$scope.deOrder.totalpayament += item.amount * item.unitprice;
|
|
|
});
|
|
|
- DeputyOrder.saveDeOrder({deOrder: $scope.deOrder}, {}, function(data) {
|
|
|
- if(data.id) {
|
|
|
- window.location.hash = "#/purc/deputy/"+data.id;
|
|
|
- }
|
|
|
- if(data.error) {
|
|
|
- toaster.pop('error', '提示', '保存失败');
|
|
|
- }
|
|
|
- }, function(response) {
|
|
|
-
|
|
|
- });
|
|
|
+ if($scope.deOrder.deputyOrderItems[0].prodcode == null) {
|
|
|
+ toaster.pop('info', '提示', '您还未填写任何商品信息');
|
|
|
+ } else {
|
|
|
+ DeputyOrder.saveDeOrder({deOrder: $scope.deOrder}, {}, function(data) {
|
|
|
+ if(data.id) {
|
|
|
+ window.location.hash = "#/purc/deputy/"+data.id;
|
|
|
+ }
|
|
|
+ if(data.error) {
|
|
|
+ toaster.pop('error', '提示', '保存失败');
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$scope.openDatePicker = function($event, deOrder, openParam) {
|
|
|
@@ -10577,6 +10610,50 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
|
|
|
}]);
|
|
|
|
|
|
+ // 代采企业供应商
|
|
|
+ app.controller('DbfindDeputyVendorInfoCtrl', ['$scope', 'toaster', '$upload', '$modalInstance', 'deputyuu', 'DeputyOrder', 'BaseService', 'ngTableParams', function($scope, toaster, $upload, $modalInstance, deputyuu, DeputyOrder, BaseService, ngTableParams) {
|
|
|
+ $scope.prod = false;
|
|
|
+ BaseService.scrollBackToTop();
|
|
|
+ // 搜索框回车
|
|
|
+ $scope.onSearch = function(keyword) {
|
|
|
+ $scope.keyword = keyword;
|
|
|
+ $scope.customerParams.page(1);
|
|
|
+ $scope.customerParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.customerParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 10
|
|
|
+ }, {
|
|
|
+ total : 0,
|
|
|
+ counts: [5, 10, 25, 50],
|
|
|
+ getData : function($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ var pageParams = params.url();
|
|
|
+ pageParams.keyword = $scope.keyword;
|
|
|
+ pageParams.enuu = deputyuu;
|
|
|
+ DeputyOrder.vendors.call(null, BaseService.parseParams(pageParams), function(page){
|
|
|
+ $scope.loading = false;
|
|
|
+ if(page) {
|
|
|
+ params.total(page.totalElements);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ }
|
|
|
+ $scope.totalCount = page.totalElements;
|
|
|
+ }, function(response){
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $scope.cancel = function() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.checkVendor = function(vendor) { // 直接选择
|
|
|
+ $modalInstance.close(vendor);
|
|
|
+ }
|
|
|
+ }]);
|
|
|
/**
|
|
|
* 代采订单批量导入
|
|
|
*/
|
|
|
@@ -10639,6 +10716,12 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
|
|
|
};
|
|
|
loadData();
|
|
|
|
|
|
+ // 代采企业列表
|
|
|
+ DeputyOrder.deputyEnterprise({}, function(data) {
|
|
|
+ $scope.deputyEnterprises = data;
|
|
|
+ $scope.deOrder.deputyuu = $scope.deputyEnterprises[0].deputyEnterprise.uu;
|
|
|
+ });
|
|
|
+
|
|
|
var getService = function() {
|
|
|
return DeputyOrder.getProdList;
|
|
|
};
|