Sfoglia il codice sorgente

权限控制询价

yangc 7 anni fa
parent
commit
77bcfafb39

+ 79 - 51
src/main/webapp/resources/js/usercenter/controllers/forstore/seek_purchase_ctrl.js

@@ -6,9 +6,9 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
   'use strict';
   app.register.controller('seekPurchaseCtrl',
       ['$scope', '$location', '$rootScope', 'seekPurchase', 'toaster', 'BaseService',
-        'ngTableParams', 'Order', 'SessionService', '$filter', '$upload', '$stateParams', 'Search', '$http',
+        'ngTableParams', 'Order', 'SessionService', '$filter', '$upload', '$stateParams', 'Search', '$http', 'Authority',
         function ($scope, $location, $rootScope, seekPurchase, toaster, BaseService,
-            ngTableParams, Order, SessionService, $filter, $upload, $stateParams, Search, $http) {
+            ngTableParams, Order, SessionService, $filter, $upload, $stateParams, Search, $http, Authority) {
           $rootScope.active = 'seek_purchase';
           document.title = '我的求购-优软商城';
           $scope.activeType = $stateParams.type ? $stateParams.type :'seekManage';
@@ -443,32 +443,39 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
           };
           // 发布求购
           $scope.release = function () {
-            // 校验
-            if ($scope.checkAll()) {
-                var materialUrl = seekUrl;
-                if (seekUrl == 'https://api-inquiry.usoftmall.com') {
-                    materialUrl = 'https://api-product.usoftmall.com/';
-                }
-                $http({
-                    method: 'get',
-                    dataType: 'json',
-                    url: materialUrl + '/productuser/match/getKind',
-                    params: {cmpCode: $scope.applyObj.code, brand: $scope.applyObj.brand}
-                }).success(function (data) {
-                    startRelease(data && data.length ? data : $scope.applyObj.prodTitle);
-                }).error(function (response) {
-                    startRelease($scope.applyObj.prodTitle);
-                    toaster.pop('error', response || '获取关联类目失败');
-                });
-            } else {
-              if (!$scope.validObj.deadline) {
-                toaster.pop('error', '截止日期不能为空');
-              } else if (!$scope.validObj.unitPrice) {
-                // toaster.pop('error', '单价必须是大于0的数字');
-              } else if (!$scope.validObj.amount) {
-                toaster.pop('error', '请输入正确的数值');
-              }
-            }
+              Authority.getAuthority({resUrl: '/authInquiry/inquiry/buyer/save'}, function (data) {
+                  if (data.status == 'fail') {
+                      toaster.pop('error', data.msg || '系统错误');
+                      return;
+                  } else {
+                      // 校验
+                      if ($scope.checkAll()) {
+                          var materialUrl = seekUrl;
+                          if (seekUrl == 'https://api-inquiry.usoftmall.com') {
+                              materialUrl = 'https://api-product.usoftmall.com/';
+                          }
+                          $http({
+                              method: 'get',
+                              dataType: 'json',
+                              url: materialUrl + '/productuser/match/getKind',
+                              params: {cmpCode: $scope.applyObj.code, brand: $scope.applyObj.brand}
+                          }).success(function (data) {
+                              startRelease(data && data.length ? data : $scope.applyObj.prodTitle);
+                          }).error(function (response) {
+                              startRelease($scope.applyObj.prodTitle);
+                              toaster.pop('error', response || '获取关联类目失败');
+                          });
+                      } else {
+                          if (!$scope.validObj.deadline) {
+                              toaster.pop('error', '截止日期不能为空');
+                          } else if (!$scope.validObj.unitPrice) {
+                              // toaster.pop('error', '单价必须是大于0的数字');
+                          } else if (!$scope.validObj.amount) {
+                              toaster.pop('error', '请输入正确的数值');
+                          }
+                      }
+                  }
+              });
           }
 
           // 立即购买
@@ -584,9 +591,16 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
             });
             // 查看报价
             if (status == 2 && $scope.offerCount != 0) {
-              $scope.offer = seek.qutations;
-              clearSeekStatus();
-              seek.$status = status;
+                Authority.getAuthority({resUrl: '/authInquiry/inquiry/getQuotations'}, function (data) {
+                    if (data.status == 'fail') {
+                        toaster.pop('error', data.msg || '系统错误');
+                        return;
+                    } else {
+                        $scope.offer = seek.qutations;
+                        clearSeekStatus();
+                        seek.$status = status;
+                    }
+                });
             } else if (status == 1 && $scope.goodsCount != 0) {// 查看现货
               clearSeekStatus();
               initFragments();
@@ -914,25 +928,32 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
             // if(($scope.bomFiles == null) || ($scope.bomFiles.length == 0)) {
             //   return ;
             // }
-            var file = angular.element('#uploadCommodity')[0].files[0];
-            console.info(file);
-            if(!file) {
-              toaster.pop('info', '请选择需要上传的文件');
-              return;
-            }
-            $upload.upload({
-              url: 'seek/importBom',
-              file: file,
-              method: 'POST'
-            }).success(function(data) {
-              if (data.success) {
-                window.location.href = "applyPurchase/" + data.data;
-              } else {
-                toaster.pop('error', data.message);
-              }
-            }).error(function(response) {
-              toaster.pop('error', response.data);
-            });
+              Authority.getAuthority({resUrl: '/seek/importBom'}, function (data) {
+                  if (data.status == 'fail') {
+                      toaster.pop('error', data.msg || '系统错误');
+                      return;
+                  } else {
+                      var file = angular.element('#uploadCommodity')[0].files[0];
+                      console.info(file);
+                      if(!file) {
+                          toaster.pop('info', '请选择需要上传的文件');
+                          return;
+                      }
+                      $upload.upload({
+                          url: 'seek/importBom',
+                          file: file,
+                          method: 'POST'
+                      }).success(function(data) {
+                          if (data.success) {
+                              window.location.href = "applyPurchase/" + data.data;
+                          } else {
+                              toaster.pop('error', data.message);
+                          }
+                      }).error(function(response) {
+                          toaster.pop('error', response.data);
+                      });
+                  }
+              });
           };
 
           // 搜索
@@ -993,7 +1014,14 @@ define(['app/app', 'clipboard', 'QRCode'], function (app, clipboard, QRCode) {
           }
 
           $scope.toBomdetail = function(id) {
-            window.location.href = 'user#/bomDetail/' + id
+              Authority.getAuthority({resUrl: '/authInquiry/inquiry/public/findInquiryById'}, function (data) {
+                  if (data.status == 'fail') {
+                      toaster.pop('error', data.msg || '系统错误');
+                      return;
+                  } else {
+                      window.location.href = 'user#/bomDetail/' + id;
+                  }
+              });
           }
           // 分享移入
           $scope.setShowShare = function(seek, index) {

+ 8 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/purchase_offer_ctrl.js

@@ -1,5 +1,5 @@
 define(['app/app'], function(app) {
-    app.register.controller('purchaseOfferCtrl', ['$scope', '$rootScope', '$stateParams', '$state', 'toaster', 'seekPurchase', 'BaseService', 'ngTableParams', '$modal', '$http', function ($scope, $rootScope, $stateParams, $state, toaster, seekPurchase, BaseService, ngTableParams, $modal, $http) {
+    app.register.controller('purchaseOfferCtrl', ['$scope', '$rootScope', '$stateParams', '$state', 'toaster', 'seekPurchase', 'BaseService', 'ngTableParams', '$modal', '$http', 'Authority', function ($scope, $rootScope, $stateParams, $state, toaster, seekPurchase, BaseService, ngTableParams, $modal, $http, Authority) {
         document.title = '我的报价-优软商城';
         $rootScope.active = 'vendor_seek_purchase';
         $scope.seekPurchaseRate = {};
@@ -156,7 +156,13 @@ define(['app/app'], function(app) {
         $scope.linkBoxIndex = -1;
 
         $scope.setLinkBoxIndex = function (index) {
-            $scope.linkBoxIndex = index;
+            Authority.getAuthority({resUrl: '/authInquiry/basic/enterprise/tels'}, function (data) {
+                if (data.status == 'fail') {
+                    toaster.pop('error', data.msg || '系统错误');
+                } else {
+                    $scope.linkBoxIndex = index;
+                }
+            });
         }
       });
     }]);

+ 27 - 21
src/main/webapp/resources/js/vendor/controllers/forstore/seek_purchase_ctrl.js

@@ -1,9 +1,9 @@
 define(['app/app'], function (app) {
   app.register.controller('seekPurchaseCtrl',
       ['$scope', '$location', '$rootScope', '$stateParams', '$state', 'toaster',
-        'seekPurchase', 'BaseService', 'ngTableParams', '$modal', '$upload', '$http',
+        'seekPurchase', 'BaseService', 'ngTableParams', '$modal', '$upload', '$http', 'Authority',
         function ($scope, $location, $rootScope, $stateParams, $state, toaster,
-            seekPurchase, BaseService, ngTableParams, $modal, $upload, $http) {
+            seekPurchase, BaseService, ngTableParams, $modal, $upload, $http, Authority) {
           document.title = '求购询价-优软商城';
           $rootScope.active = 'vendor_seek_purchase';
           $scope.seekPurchaseRate = {};
@@ -309,26 +309,32 @@ define(['app/app'], function (app) {
           $scope.isShowSayPriceBox = false;
           /*设置列表状态*/
           $scope.setSeekActive = function (seek, flag, index) {
-            if (flag) {
-              angular.forEach($scope.seekListData, function (item) {
-                item.$active = false;
-              });
-              $scope.offer = {
-                currency: seek.currency ? seek.currency : "RMB",
-                spId: seek.spId
-              }
-              $scope.inquiryItem = seek;
-              $scope.inquiryItem.leadtime = '';
-              $scope.inquiryItem.replies = [
-                {
-                  lapQty: '',
-                  price: ''
+            Authority.getAuthority({resUrl: '/authInquiry/inquiry/sale/item/save'}, function (data) {
+              if (data.status == 'fail') {
+                toaster.pop('error', data.msg || '系统错误');
+              } else {
+                if (flag) {
+                  angular.forEach($scope.seekListData, function (item) {
+                    item.$active = false;
+                  });
+                  $scope.offer = {
+                    currency: seek.currency ? seek.currency : "RMB",
+                    spId: seek.spId
+                  }
+                  $scope.inquiryItem = seek;
+                  $scope.inquiryItem.leadtime = '';
+                  $scope.inquiryItem.replies = [
+                    {
+                      lapQty: '',
+                      price: ''
+                    }
+                  ];
                 }
-              ];
-            }
-            //seek.$active = flag;
-            $scope.isShowSayPriceBox = flag;
-          }
+                //seek.$active = flag;
+                $scope.isShowSayPriceBox = flag;
+              }
+            });
+          };
 
 
           $scope.onLeadtimeInput = function () {

+ 1 - 1
src/main/webapp/resources/view/usercenter/forstore/seekPurchase.html

@@ -1351,7 +1351,7 @@
                         <div>共 <span class="blue-text" ng-bind="bom.amount || 0"></span> 个产品<!--,<span class="red-text" ng-bind="bom.offerAmount || 0">10</span> 个有报价,<span class="red-text" ng-bind="bom.goodsAmount || 0">7</span> 个有现货--></div>
                         <div ng-bind="bom.releaseDate | date:'yyyy-MM-dd HH:mm:ss'"></div>
                     </div>
-                    <a href="user#/bomDetail/{{bom.id}}" class="fr">查看详情</a>
+                    <a class="fr">查看详情</a>
                 </td>
             </tr>
             <tr ng-if="!$data.length" class="empty">