|
|
@@ -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) {
|