Browse Source

bomlist数据获取

yangc 7 năm trước cách đây
mục cha
commit
93885f467a

+ 76 - 71
src/main/webapp/resources/js/common/query/seekPurchase.js

@@ -1,76 +1,81 @@
 define([ 'ngResource' ], function() {
-	angular.module('seekPurchaseServices', [ 'ngResource' ]).factory('seekPurchase', ['$resource', 'BaseService', function($resource, BaseService) {
+    angular.module('seekPurchaseServices', [ 'ngResource' ]).factory('seekPurchase', ['$resource', 'BaseService', function($resource, BaseService) {
         var rootPath = BaseService.getRootPath();
-		return $resource('seek', {}, {
-		  getSeekUrl: {
-		    url: 'seek/accessUrl',
-        method: 'GET'
-      },
-      getSeekPurchaseRate: {
-        url: 'seek/offer/getSeekPurchaseRate',
-        method: 'GET'
-      },
-      getSeekPushGoodsPageInfo: {
-        url: 'http://218.17.158.219:24000/inquiry/public',
-        method: 'GET',
-      },
-      saveOneSeekPurchase: {
-        url: 'http://218.17.158.219:24000/inquiry/buyer/save',
-        method: 'POST'
-      },
-      saveOneSeekPurchaseProd: {
-        url: 'https://api-inquiry.usoftmall.com/inquiry/buyer/save',
-        method: 'POST'
-      },
-     saveOffer: {
-        url: 'http://218.17.158.219:24000/inquiry/sale/item/save',
-        method: 'POST'
-      },
-      saveOfferProd: {
-        url: 'https://api-inquiry.usoftmall.com/inquiry/sale/item/save',
-        method: 'POST'
-      },
-      getUserSeekPageInfo: {
-        url: 'http://218.17.158.219:24000/inquiry/buyer/list',
-        method: 'GET'
-      },
-      getUserSeekPageInfoByStatus: {
-        url: 'http://218.17.158.219:24000/inquiry/buyer/quotations',
-        method: 'GET'
-      },
-      getMallGoodsList: {
-        url: 'seek/getMallGoodsList',
-        method: 'GET',
-        isArray: true
-      },
-      getSeekPurchaseOfferPageInfo: {
-        url: 'http://218.17.158.219:24000/inquiry/buyer/product/detail',
-        method: 'GET'
-      },
-      getMyOfferPageInfo: {
-        url: 'http://218.17.158.219:24000/inquiry/public/quotation/list',
-        method: 'GET'
-      },
-      updateSeekPurchaseStatus: {
-              url: 'http://218.17.158.219:24000/inquiry/buyer/decide',
-              method: 'POST'
-      },
-      getSeekPurchaseBomListPage: {
-        url: 'http://218.17.158.219:24000/inquiry/buyer/inquiryList',
-        method: 'GET'
-      },
-      findOneBom: {
-          url: 'http://218.17.158.219:24000/inquiry/public/findInquiryById',
-          method: 'GET'
-      },
-      saveBomName: {
-          url: 'seek/updateSeekPurchaseBom',
-          method: 'PUT'
-      },
-      getBomDetail: {
-          url: 'http://218.17.158.219:24000/inquiry/sale/publicInquiry/detail',
-          method: 'GET'
-      }
+        return $resource('seek', {}, {
+            getSeekUrl: {
+                url: 'seek/accessUrl',
+                method: 'GET'
+            },
+            getSeekPurchaseRate: {
+                url: 'seek/offer/getSeekPurchaseRate',
+                method: 'GET'
+            },
+            getSeekPushGoodsPageInfo: {
+                url: 'http://218.17.158.219:24000/inquiry/public',
+                method: 'GET',
+            },
+            saveOneSeekPurchase: {
+                url: 'http://218.17.158.219:24000/inquiry/buyer/save',
+                method: 'POST'
+            },
+            saveOneSeekPurchaseProd: {
+                url: 'https://api-inquiry.usoftmall.com/inquiry/buyer/save',
+                method: 'POST'
+            },
+            saveOffer: {
+                url: 'http://218.17.158.219:24000/inquiry/sale/item/save',
+                method: 'POST'
+            },
+            saveOfferProd: {
+                url: 'https://api-inquiry.usoftmall.com/inquiry/sale/item/save',
+                method: 'POST'
+            },
+            getUserSeekPageInfo: {
+                url: 'http://218.17.158.219:24000/inquiry/buyer/list',
+                method: 'GET'
+            },
+            getUserSeekPageInfoByStatus: {
+                url: 'http://218.17.158.219:24000/inquiry/buyer/quotations',
+                method: 'GET'
+            },
+            getMallGoodsList: {
+                url: 'seek/getMallGoodsList',
+                method: 'GET',
+                isArray: true
+            },
+            getSeekPurchaseOfferPageInfo: {
+                url: 'http://218.17.158.219:24000/inquiry/buyer/product/detail',
+                method: 'GET'
+            },
+            getMyOfferPageInfo: {
+                url: 'http://218.17.158.219:24000/inquiry/public/quotation/list',
+                method: 'GET'
+            },
+            updateSeekPurchaseStatus: {
+                url: 'http://218.17.158.219:24000/inquiry/buyer/decide',
+                method: 'POST'
+            },
+            getSeekPurchaseBomListPage: {
+                url: 'http://218.17.158.219:24000/inquiry/buyer/inquiryList',
+                method: 'GET'
+            },
+            findOneBom: {
+                url: 'http://218.17.158.219:24000/inquiry/public/findInquiryById',
+                method: 'GET'
+            },
+            saveBomName: {
+                url: 'seek/updateSeekPurchaseBom',
+                method: 'PUT'
+            },
+            getBomDetail: {
+                url: 'http://218.17.158.219:24000/inquiry/sale/publicInquiry/detail',
+                method: 'GET'
+            },
+            // 获取BOM清单
+            getBomList: {
+                url: 'seek/bom/list',
+                method: 'GET'
+            }
 		});
 }])
 });

+ 68 - 47
src/main/webapp/resources/js/usercenter/controllers/forstore/seek_purchase_ctrl.js

@@ -15,10 +15,70 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
             $scope.bomTab = 'bomList';
             $scope.toogleBomTab = function (tab) {
                 $scope.bomTab = tab;
+                if (tab == 'seekRecord') {
+                    $scope.bomTableParams = new ngTableParams({
+                        pageNumber: 1,
+                        pageSize: 10,
+                        page: 1,
+                        count: 10
+                    }, {
+                        total: 0,
+                        getData: function ($defer, params) {
+                            var param = BaseService.parseParams(params.url());
+                            param.pageNumber = param.page
+                            if ($scope.userInfo.enterprise) {
+                                param.enUU = $scope.userInfo.enterprise.uu;
+                            } else {
+                                param.userUU = $scope.userInfo.userUU;
+                            }
+                            // 返回首页
+                            if ($scope.isSearch) {
+                                param.page = 1;
+                                params.page(1);
+                                $scope.isSearch = false;
+                            }
+                            $http({
+                                method: 'get',
+                                dataType: 'json',
+                                url: $scope.seekUrl + '/inquiry/buyer/inquiryList',
+                                params: param
+                            }).success(function (data) {
+                                params.total(data.totalElements);
+                                $scope.bomTotal = data.totalElements;
+                                $defer.resolve(data.content);
+                                $scope.bomDataList = data
+                            }).error(function (response) {
+                                toaster.pop('error', response);
+                            });
+                        }
+                    });
+                } else {
+                    $scope.bomTableParams = new ngTableParams({
+                        pageNumber: 1,
+                        pageSize: 10
+                    }, {
+                        total: 0,
+                        getData: function ($defer, params) {
+                            var param = BaseService.parseParams(params.url());
+                            param.pageNumber = param.page
+                            seekPurchase.getBomList(param, function (data) {
+                                params.total(data.totalElements);
+                                $scope.bomTotal = data.totalElements;
+                                $defer.resolve(data.content);
+                                $scope.bomDataList = data
+                            }, function (response) {
+                                toaster.pop('error', response);
+                            });
+                        }
+                    });
+                }
             }
             $scope.toogleType = function (type) {
                 clearSeekStatus();
                 $scope.activeType = type;
+                if (type === 'bomManage') {
+                    $scope.toogleBomTab('bomList');
+                }
           }
           $rootScope.ShaRETimer = {}
 
@@ -110,7 +170,7 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
             $scope.setFilters('dateArea', 'sevenDay', '1')
 
           seekPurchase.getSeekUrl({}, function(data) {
-            var seekUrl = data.url;
+            $scope.seekUrl = data.url;
             //   var seekUrl = 'http://10.1.51.82:24002';
             /*$scope.tab = 'waitOffer';*/
             $scope.toogleTab = function (tab) {
@@ -147,7 +207,7 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
                     $http({
                       method: 'get',
                       dataType: 'json',
-                      url: seekUrl + '/inquiry/buyer/list',
+                      url: $scope.seekUrl + '/inquiry/buyer/list',
                       params: param
                     }).success(function (data) {
                       params.total(data.totalElements);
@@ -180,7 +240,7 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
                     $http({
                       method: 'get',
                       dataType: 'json',
-                      url: seekUrl + '/inquiry/buyer/quotations',
+                      url: $scope.seekUrl + '/inquiry/buyer/quotations',
                       params: param
                     }).success(function (data) {
                       params.total(data.totalElements);
@@ -223,45 +283,6 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
           // 买家求购列表
           $scope.searchStatus = 0;
 
-
-          $scope.bomSearch = {};
-          $scope.bomTableParams = new ngTableParams({
-            pageNumber: 1,
-            pageSize: 10,
-            page: 1,
-            count: 10
-          }, {
-            total: 0,
-            getData: function ($defer, params) {
-                var param = BaseService.parseParams(params.url());
-                param.pageNumber = param.page
-              if ($scope.userInfo.enterprise) {
-                param.enUU = $scope.userInfo.enterprise.uu;
-              } else {
-                param.userUU = $scope.userInfo.userUU;
-              }
-              // 返回首页
-              if ($scope.isSearch) {
-                param.page = 1;
-                params.page(1);
-                $scope.isSearch = false;
-              }
-              $http({
-                method: 'get',
-                dataType: 'json',
-                url: seekUrl + '/inquiry/buyer/inquiryList',
-                params: param
-              }).success(function (data) {
-                params.total(data.totalElements);
-                $scope.bomTotal = data.totalElements;
-                $defer.resolve(data.content);
-                $scope.bomDataList = data
-              }).error(function (response) {
-                toaster.pop('error', response);
-              });
-            }
-          });
-
           var getRealLen = function (str) {
             var len = 0;
             for (var i = 0; i < str.length; i++) {
@@ -503,7 +524,7 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
               var inquiryItems = [];
               inquiryItems.push(inquiryItem);
               inquiry.inquiryItems = inquiryItems;
-              if (seekUrl == 'https://api-inquiry.usoftmall.com') {
+              if ($scope.seekUrl == 'https://api-inquiry.usoftmall.com') {
                   seekPurchase.saveOneSeekPurchaseProd(inquiry,
                       function (data) {
                           $scope.showUseFlag = false;
@@ -534,8 +555,8 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
                   } else {
                       // 校验
                       if ($scope.checkAll()) {
-                          var materialUrl = seekUrl;
-                          if (seekUrl == 'https://api-inquiry.usoftmall.com') {
+                          var materialUrl = $scope.seekUrl;
+                          if ($scope.seekUrl == 'https://api-inquiry.usoftmall.com') {
                               materialUrl = 'https://api-product.usoftmall.com/';
                           }
                           $http({
@@ -616,7 +637,7 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
                 },
               method: 'POST',
               dataType: 'json',
-              url: seekUrl + '/inquiry/buyer/adopt',
+              url: $scope.seekUrl + '/inquiry/buyer/adopt',
               params: {id: of.id, status: 1}
             }).success(function (data) {
               toaster.pop('success', '采纳报价成功');
@@ -651,7 +672,7 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
                       },
                       method: 'POST',
                       dataType: 'json',
-                      url: seekUrl + '/inquiry/buyer/refuse',
+                      url: $scope.seekUrl + '/inquiry/buyer/refuse',
                       params: {id:  $scope.currentRefuseOffer.id, status: 0, refusereason: choice}
                   }).success(function (data) {
                       toaster.pop('refuse', '已拒绝报价');