|
|
@@ -5474,7 +5474,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
|
|
|
// 保存报价信息
|
|
|
- $scope.save = function(inquiryItem) {
|
|
|
+ $scope.save = function(inquiryItem, method) {
|
|
|
var file = $scope.myFiles, file = file && file.length > 0 ? file[0] : null;// 可以不传附件
|
|
|
$upload.upload({
|
|
|
url: 'pubInquiry/turnToQuotation',
|
|
|
@@ -5482,7 +5482,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
method: 'POST',
|
|
|
data: {
|
|
|
item: inquiryItem,
|
|
|
- method: 'reply'
|
|
|
+ method: method
|
|
|
}
|
|
|
}).success(function (data) {
|
|
|
if (data.item) {
|
|
|
@@ -23086,18 +23086,17 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- // 获取token信息
|
|
|
- $scope.getToken = function() {
|
|
|
- token.info({userType: 'saleinquiry'}, {}, function(data) {
|
|
|
- $scope.token = data.token;
|
|
|
- }, function(response) {
|
|
|
- toaster.pop('error', '提示', response.data);
|
|
|
- });
|
|
|
+ // 报价
|
|
|
+ $scope.quote = function(inquiryItem) {
|
|
|
$modal.open({
|
|
|
animation: true,
|
|
|
templateUrl: 'static/tpl/index/sale/modal/quote_inquiry.html',
|
|
|
- controller: 'quoteInquiryCtrl',
|
|
|
- resolve: {}
|
|
|
+ controller: 'QuoteInquiryCtrl',
|
|
|
+ resolve: {
|
|
|
+ inquiryItem: function () {
|
|
|
+ return inquiryItem
|
|
|
+ }
|
|
|
+ }
|
|
|
}).result.then(function (data) {
|
|
|
|
|
|
}, function () {})
|
|
|
@@ -23545,15 +23544,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- // // 设置阅读状态
|
|
|
- // $scope.setReadStatus = function(msg) {
|
|
|
- // if(!msg.read) {
|
|
|
- // PurcInquiry.setStatus({id: msg.inid}, {}, function(data) {
|
|
|
- //
|
|
|
- // });
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
$scope.searchMethod = false;
|
|
|
var getService = function () {
|
|
|
return $scope.searchMethod ? PurcPubInquirySearchInfo : PurcPubInquiryNoSearchInfo;
|
|
|
@@ -23595,45 +23585,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- //获得各分类未阅读数量
|
|
|
- // var getUnreadCount = function () {
|
|
|
- // PurcInquiry.getUnreadCount(null, function (data) {
|
|
|
- // $scope.unread = data;
|
|
|
- // });
|
|
|
- // };
|
|
|
- // getUnreadCount();
|
|
|
-
|
|
|
- // //设置单据已读
|
|
|
- // $scope.setOrdersRead = function (id) {
|
|
|
- // // 如果单据本身已读,则不发送请求修改数据
|
|
|
- // if (!$scope.isUnread(id)){
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // var sourceId = [];
|
|
|
- // sourceId.push(id);
|
|
|
- // PurcInquiry.setRead({}, sourceId, function (message) {
|
|
|
- // getUnreadCount();
|
|
|
- // removeByValue($scope.unreadCode, id);
|
|
|
- // });
|
|
|
- // };
|
|
|
-
|
|
|
- // $scope.setOrdersReadByState = function () {
|
|
|
- // if (!$scope.unread.replied || $scope.unread.replied == 0) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // PurcInquiry.setReadByState({}, function () {
|
|
|
- // getUnreadIds();
|
|
|
- // getUnreadCount();
|
|
|
- // });
|
|
|
- // };
|
|
|
-
|
|
|
- // var getUnreadIds = function () {
|
|
|
- // PurcInquiry.getUnreadIds({}, "", function (message) {
|
|
|
- // $scope.unreadCode = message.content;
|
|
|
- // });
|
|
|
- // };
|
|
|
- // getUnreadIds();
|
|
|
-
|
|
|
$scope.isUnread = function (id) {
|
|
|
for (var i in $scope.unreadCode) {
|
|
|
if (id == $scope.unreadCode[i]) {
|
|
|
@@ -23821,11 +23772,66 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
})
|
|
|
}
|
|
|
}]);
|
|
|
+
|
|
|
/**
|
|
|
- * 公共询价模态框
|
|
|
- * **/
|
|
|
- app.controller('quoteInquiryCtrl', ['$scope', '$stateParams', 'toaster', function ($scope, $stateParams, toaster) {
|
|
|
+ * 公共询价模态框(供应商报价)
|
|
|
+ */
|
|
|
+ app.controller('QuoteInquiryCtrl', ['$scope', '$stateParams', 'toaster', 'inquiryItem', '$modalInstance', '$upload', function ($scope, $stateParams, toaster, inquiryItem, $modalInstance, $upload) {
|
|
|
+ $scope.inquiryItem = inquiryItem;
|
|
|
+ $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, method) {
|
|
|
+ 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: method
|
|
|
+ }
|
|
|
+ }).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', '附件上传失败');
|
|
|
+ });
|
|
|
+ }
|
|
|
}])
|
|
|
return app;
|
|
|
});
|