InvoicefromPurcDetailCtrl.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. define([ 'app/app' ], function(app) {
  2. app.register.controller('InvoicefromPurcDetailCtrl', ['$scope', '$anchorScroll', '$location' , 'ngTableParams', 'InvoiceFPurchase', 'Purchase', 'toaster', '$stateParams', 'ComponentActive', '$modal', function($scope, $anchorScroll, $location , ngTableParams, InvoiceFPurchase, Purchase, toaster, $stateParams, ComponentActive, $modal) {
  3. //获取卖家出货单订单详情
  4. var loadData = function(){
  5. InvoiceFPurchase.getInvoiceFPurc({invoiceid: $stateParams.invoiceid}, {}, function(data){
  6. $scope.invoiceFPur = data;
  7. //状态变更记录
  8. $scope.statushistory = angular.fromJson($scope.invoiceFPur.statushistory);
  9. //地址
  10. $scope.address = angular.fromJson($scope.invoiceFPur.jsonSdAddress);
  11. //物流信息
  12. $scope.logistics = angular.fromJson($scope.invoiceFPur.logistics);
  13. console.log($scope.logistics);
  14. //查看物流详情
  15. $scope.listLogistics = function(){
  16. var modalInstance = $modal.open({
  17. animation: true,
  18. templateUrl: 'static/view/admin/modal/listLogistics_modal.html',
  19. controller: 'listLogisticsCtrl',
  20. resolve: {
  21. logistics : function () {
  22. return $scope.logistics
  23. }
  24. }
  25. });
  26. modalInstance.result.then(function(response){
  27. }, function(){
  28. });
  29. }
  30. //根据批次号获取标准元器件信息
  31. // var details = $scope.invoiceFPur.invoiceFPurchaseDetails;
  32. // var getComponent = function() {
  33. // angular.forEach(details, function(detail){
  34. // ComponentActive.getByBatchCode({batchCode:detail.batchCode}, {}, function(comp){
  35. // detail.img = comp.img;
  36. // detail.uuid = comp.uuid;
  37. // });
  38. // })
  39. // };
  40. // getComponent();
  41. //根据来源采购单id获取采购单信息
  42. var puid = $scope.invoiceFPur.puid;
  43. var getPurchase = function(){
  44. Purchase.getPurchaseById({id: puid}, {}, function(data){
  45. $scope.purc = data;
  46. });
  47. }
  48. getPurchase();
  49. //控制流程状态样式
  50. var scheduleStyle = function(){
  51. var statusAttr =['406', '404', '405', '506', '505'];
  52. if($scope.invoiceFPur.status == statusAttr[0]){
  53. $scope.styl0 = 'current';
  54. }
  55. if($scope.invoiceFPur.status == statusAttr[1]){
  56. $scope.styl0 = 'past';
  57. $scope.styl1 = 'current';
  58. }
  59. if($scope.invoiceFPur.status == statusAttr[2]){
  60. $scope.styl0 = 'past';
  61. $scope.styl1 = 'past';
  62. $scope.styl2 = 'current';
  63. }
  64. if($scope.invoiceFPur.status == statusAttr[3]){
  65. $scope.styl0 = 'past';
  66. $scope.styl1 = 'past';
  67. $scope.styl2 = 'past';
  68. $scope.styl3 = 'current';
  69. }
  70. if($scope.invoiceFPur.status == statusAttr[4]){
  71. $scope.styl0 = 'past';
  72. $scope.styl1 = 'past';
  73. $scope.styl2 = 'past';
  74. $scope.styl3 = 'past';
  75. $scope.styl4 = 'current';
  76. }
  77. }
  78. scheduleStyle();
  79. }), function(){
  80. toaster('提示', '获取出货单详情失败');
  81. };
  82. };
  83. loadData();
  84. }]);
  85. // 物流信息
  86. app.register.controller('listLogisticsCtrl', ['$scope', '$modal', 'ResponseLogistics', '$modalInstance', 'logistics', 'KdnLogistics', 'toaster', function($scope, $modal, ResponseLogistics, $modalInstance, logistics, KdnLogistics, toaster) {
  87. $scope.Info = [];
  88. $scope.getlogistics = function() {
  89. var params = {};
  90. params.companyName = logistics.companyName;
  91. params.logisticsCode = logistics.number;
  92. KdnLogistics.kdnQuery(params, {}, function(response){
  93. if(!response.errorInfo) {
  94. $scope.Info = eval ("(" + response.traces + ")");
  95. // statusOfLogistics($scope.logisticsInfo[$scope.logisticsInfo.length - 1].AcceptStation);
  96. }
  97. }, function(){
  98. // $scope.Info = [];
  99. toaster.pop('info', '查询物流信息失败,请核对物流公司和运单号');
  100. });
  101. // ResponseLogistics.get({id : lgtid}, {}, function(data) {
  102. // $scope.Info = data;
  103. // console.log(data);
  104. // });
  105. };
  106. $scope.getlogistics();
  107. $scope.cancel = function() {
  108. $modalInstance.dismiss();
  109. }
  110. } ]);
  111. });