|
|
@@ -5228,7 +5228,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}]);
|
|
|
|
|
|
// 公共询价列表
|
|
|
- app.controller('PublicInquiryListCtrl', ['$scope', '$stateParams', 'PurchaseInquiry', '$filter', 'toaster', 'BaseService', 'ngTableParams', 'PurcInquiry', 'publicInquiry', function ($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams, PurcInquiry, publicInquiry) {
|
|
|
+ app.controller('PublicInquiryListCtrl', ['$scope', '$stateParams', 'PurchaseInquiry', '$filter', 'toaster', 'BaseService', 'ngTableParams', 'PurcInquiry', 'publicInquiry', 'publicInquiryList', '$modal', function ($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams, PurcInquiry, publicInquiry, publicInquiryList, $modal) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
/**
|
|
|
* 改变单据日期范围
|
|
|
@@ -5333,11 +5333,12 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
};
|
|
|
|
|
|
var getService = function () {
|
|
|
- if ($scope.active == 'teams') {
|
|
|
- return PurchaseInquiry.hisquotation;
|
|
|
- } else {
|
|
|
- return PurchaseInquiry.publicInquiryItem;
|
|
|
- }
|
|
|
+ // if ($scope.active == 'teams') {
|
|
|
+ // return PurchaseInquiry.hisquotation;
|
|
|
+ // } else {
|
|
|
+ // return PurchaseInquiry.publicInquiryItem;
|
|
|
+ // }
|
|
|
+ return publicInquiryList.getInquirylist;
|
|
|
}
|
|
|
|
|
|
$scope.tableParams = new ngTableParams({
|
|
|
@@ -5394,38 +5395,118 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
});
|
|
|
|
|
|
// 转客户询价
|
|
|
- $scope.transtoInquiry = function (id) {
|
|
|
- publicInquiry.turnToInquiry({id: id}, {}, function (data) {
|
|
|
- if (data.success) {
|
|
|
- toaster.pop('success', '提示', data.success);
|
|
|
- window.location.hash = "sale/pubinquiry/" + data.id;
|
|
|
- }
|
|
|
- if (data.error) {
|
|
|
- toaster.pop('error', '提示', data.error);
|
|
|
- }
|
|
|
- if (data.info) {
|
|
|
- toaster.pop('info', '提示', data.info);
|
|
|
- window.open("#/sale/pubinquiry/" + data.inid);
|
|
|
+ $scope.transtoInquiry = function (inquiryItem) {
|
|
|
+ publicInquiry.quotationInfo({id: inquiryItem.id}, function(data) {
|
|
|
+ console.log(data);
|
|
|
+ if (data.inquiryItem) { //存在已报价的就不进行报价操作
|
|
|
+ toaster.pop('error', '该询价单已已经报价');
|
|
|
+ } else {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ templateUrl: 'static/tpl/index/baseInfo/modal/quotation_modal.html',
|
|
|
+ controller: 'QuoteCtrl',
|
|
|
+ size: 'lg',
|
|
|
+ resolve: {
|
|
|
+ inquiryItem: function () {
|
|
|
+ return inquiryItem
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function (data) {
|
|
|
+ $scope.item.product = data;
|
|
|
+ }, function () {
|
|
|
+
|
|
|
+ });
|
|
|
}
|
|
|
- }, function (response) {
|
|
|
- toaster.pop('error', '提示', response.data);
|
|
|
});
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 跳转到我的报价列表
|
|
|
$scope.linkToInquiry = function () {
|
|
|
window.open("#/sale/pubinquiry");
|
|
|
}
|
|
|
+
|
|
|
+ }]);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 报价操作
|
|
|
+ */
|
|
|
+ app.controller('QuoteCtrl', ['$scope', 'inquiryItem', 'toaster', 'publicInquiry', '$modalInstance', '$upload', function($scope, inquiryItem, toaster, publicInquiry, $modalInstance, $upload) {
|
|
|
+ $scope.inquiryItem = inquiryItem;
|
|
|
+ if ($scope.inquiryItem.replies == null) {
|
|
|
+ $scope.inquiryItem.replies = [];
|
|
|
+ var reply = {
|
|
|
+ lapQty: null,
|
|
|
+ price: null
|
|
|
+ };
|
|
|
+ $scope.inquiryItem.replies.push(reply);
|
|
|
+ }
|
|
|
+ $scope.replyPrices = [];
|
|
|
+ $scope.replylapQtys = [];
|
|
|
+ $scope.replyPrices.push(true);
|
|
|
+ $scope.replylapQtys.push(true);
|
|
|
+
|
|
|
+ // 增加一列分段报价
|
|
|
+ $scope.addStep = function (inquiryItem) {
|
|
|
+ $scope.replyPrices.push(true);
|
|
|
+ if (inquiryItem.replies.length >= 5) {
|
|
|
+ toaster.pop('warning', '提示', '最多支持5个分段!');
|
|
|
+ } else {
|
|
|
+ inquiryItem.replies.push({});
|
|
|
+ if (inquiryItem.replies.length != 1) {
|
|
|
+ $scope.replyPrices.push(true);
|
|
|
+ $scope.replylapQtys.push(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 删除一列分段报价
|
|
|
+ $scope.removeStep = function (inquiryItem, stepIndex) {
|
|
|
+ inquiryItem.replies.splice(stepIndex, 1);
|
|
|
+ $scope.replyPrices.splice(stepIndex, 1);
|
|
|
+ $scope.replylapQtys.splice(stepIndex, 1);
|
|
|
+ };
|
|
|
+
|
|
|
+ // 取消,关闭弹出框
|
|
|
+ $scope.cancel = function() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存报价信息
|
|
|
+ $scope.save = function(inquiryItem) {
|
|
|
+ var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
|
|
|
+ $upload.upload({
|
|
|
+ url: 'pubInquiry/turnToQuotation',
|
|
|
+ file: file,
|
|
|
+ method: 'POST',
|
|
|
+ data: {
|
|
|
+ item: inquiryItem,
|
|
|
+ method: 'reply'
|
|
|
+ }
|
|
|
+ }).success(function (data) {
|
|
|
+ if (data.item) {
|
|
|
+ item = data.item;
|
|
|
+ }
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('info', '提示', '报价成功');
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }).error(function (data) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '附件上传失败');
|
|
|
+ });
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 公共询价详情
|
|
|
*/
|
|
|
- app.controller('PublicInquiryListDetailCtrl', ['$scope', '$stateParams', 'PurchaseInquiry', '$filter', 'toaster', 'BaseService', 'ngTableParams', 'AccountEnterprise', 'publicInquiry', function ($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams, AccountEnterprise, publicInquiry) {
|
|
|
+ app.controller('PublicInquiryListDetailCtrl', ['$scope', '$stateParams', 'PurchaseInquiry', '$filter', 'toaster', 'BaseService', 'ngTableParams', 'AccountEnterprise', 'publicInquiry', 'publicInquiryList', function ($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams, AccountEnterprise, publicInquiry, publicInquiryList) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
$scope.currentHasBid = false;
|
|
|
var loadData = function () {
|
|
|
- PurchaseInquiry.inquiryItemDetail({id: $stateParams.id}, function (data) {
|
|
|
+ publicInquiryList.getDetail({id: $stateParams.id}, function (data) {
|
|
|
$scope.inquiryItem = data.inquiryItem;
|
|
|
if (data.id) {
|
|
|
$scope.id = data.id;
|