|
|
@@ -5379,341 +5379,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
// 公共询价列表
|
|
|
app.controller('PublicInquiryListCtrl', ['$scope', '$stateParams', 'PurchaseInquiry', '$filter', 'toaster', 'BaseService', 'ngTableParams', 'PurcInquiry', 'publicInquiry', 'publicInquiryList', '$modal', '$http', 'AccountEnterprise', 'customer', 'AuthenticationService', function ($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams, PurcInquiry, publicInquiry, publicInquiryList, $modal, $http, AccountEnterprise, customer, AuthenticationService) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
- /**
|
|
|
- * 改变单据日期范围
|
|
|
- */
|
|
|
- var getTenderDateCondition = function (zone, condition) {
|
|
|
- var date = new Date();
|
|
|
- if (zone == -1) {
|
|
|
- condition.dateFrom = null;
|
|
|
- condition.dateTo = null;
|
|
|
- } else if (zone == 7) { // 一星期内
|
|
|
- date.setHours(0, 0, 0 ,0);
|
|
|
- date.setDate(date.getDate() - 7);
|
|
|
- condition.dateFrom = date;
|
|
|
- var ndate = new Date();
|
|
|
- ndate.setHours(23, 59, 59 ,999);
|
|
|
- ndate.setDate(ndate.getDate() - 1);
|
|
|
- condition.dateTo = ndate;
|
|
|
- } else if (zone == 1) { // 一个月内
|
|
|
- date.setMonth(date.getMonth() - 1);
|
|
|
- condition.dateFrom = date;
|
|
|
- condition.dateTo = new Date();
|
|
|
- } else if (zone == 3) { // 三个月内
|
|
|
- date.setMonth(date.getMonth() - 3);
|
|
|
- condition.dateFrom = date;
|
|
|
- condition.dateTo = new Date();
|
|
|
- } else if (zone == 6) { // 半年内
|
|
|
- date.setMonth(date.getMonth() - 6);
|
|
|
- condition.dateFrom = date;
|
|
|
- condition.dateTo = new Date();
|
|
|
- } else { // 一年内
|
|
|
- date.setYear(date.getYear() - 1);
|
|
|
- condition.dateFrom = date;
|
|
|
- condition.dateTo = new Date();
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- $scope.active = 'enterprise';
|
|
|
- $scope.dateZoneText = '不限';
|
|
|
- $scope.deliveryZoneText = '不限';
|
|
|
- $scope.condition = {dateZone: -1};
|
|
|
- $scope.changeDateZone = function (zone) {
|
|
|
- $scope.condition.dateZone = zone;
|
|
|
- $scope.condition.$dateZoneOpen = false;
|
|
|
- getTenderDateCondition(zone, $scope.condition);
|
|
|
- $scope.tableParams.page(1);
|
|
|
- $scope.tableParams.reload();
|
|
|
- };
|
|
|
-
|
|
|
- $scope.openDatePicker = function ($event, item, openParam) {
|
|
|
- $event.preventDefault();
|
|
|
- $event.stopPropagation();
|
|
|
- item[openParam] = !item[openParam];
|
|
|
- };
|
|
|
-
|
|
|
- $scope.parseDate = function (dateStr) {
|
|
|
- if (dateStr)
|
|
|
- return Date.parse(dateStr, 'yyyy-MM-dd');
|
|
|
- return new Date();
|
|
|
- };
|
|
|
-
|
|
|
- $scope.isOverDue = function (date) {
|
|
|
- if (date) {
|
|
|
- var ndate = new Date();
|
|
|
- ndate.setHours(23, 59, 59 ,999);
|
|
|
- ndate.setDate(ndate.getDate());
|
|
|
- var timestamp = Date.parse(ndate);
|
|
|
- if (date > timestamp) {
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- return false;
|
|
|
- }
|
|
|
- } else {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- // 选择查找日期
|
|
|
- $scope.onDateCondition = function () {
|
|
|
- $scope.tableParams.page(1);
|
|
|
- $scope.tableParams.reload();
|
|
|
- };
|
|
|
-
|
|
|
- $scope.nowdate = new Date().getTime() - 24 * 3600 * 1000;
|
|
|
- var getState = function (active) {
|
|
|
- var fn = 'getOpenAll';
|
|
|
- switch (active) {
|
|
|
- case 'all':
|
|
|
- fn = 'getOpenAll';
|
|
|
- break;
|
|
|
- case 'todo':
|
|
|
- fn = 'getOpenTodo';
|
|
|
- break;
|
|
|
- case 'end':
|
|
|
- fn = 'getOpenEnd';
|
|
|
- break;
|
|
|
- }
|
|
|
- return fn;
|
|
|
- };
|
|
|
-
|
|
|
- customer.distribute({}, function(data) {
|
|
|
- $scope.customer = data;
|
|
|
- });
|
|
|
-
|
|
|
- $scope.setActive = function (state) {
|
|
|
- if ($scope.active != state) {
|
|
|
- $scope.active = state;
|
|
|
- if ($scope.active == 'enterprise') {
|
|
|
- $scope.distribute = null;
|
|
|
- $scope.remind = false;
|
|
|
- } else if ($scope.active == 'customer') {
|
|
|
- $scope.distribute = $scope.customer;
|
|
|
- if ($scope.distribute.length == 0) {
|
|
|
- $scope.distribute = [0];
|
|
|
- }
|
|
|
- $scope.remind = false;
|
|
|
- } else if ($scope.active == 'remind') {
|
|
|
- $scope.remind = true;
|
|
|
- } else if ($scope.active == 'all') {
|
|
|
- $scope.distribute = null;
|
|
|
- $scope.remind = false;
|
|
|
- }
|
|
|
- if ($scope.tableParams.page() == 1) {
|
|
|
- $scope.tableParams.reload();
|
|
|
- } else {
|
|
|
- $scope.tableParams.page(1);
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- var getService = function () {
|
|
|
- return publicInquiryList.getInquirylist;
|
|
|
- }
|
|
|
-
|
|
|
- $scope.tableParams = new ngTableParams({
|
|
|
- page: 1,
|
|
|
- count: 20,
|
|
|
- sorting: {
|
|
|
- }
|
|
|
- }, {
|
|
|
- total: 0,
|
|
|
- counts: [10, 25, 50, 100],
|
|
|
- getData: function ($defer, params) {
|
|
|
- $scope.loading = true;
|
|
|
- var pageParams = params.url();
|
|
|
- pageParams.searchFilter = { // 筛选条件
|
|
|
- keyword: $scope.keyword,
|
|
|
- fromDate: getDateTime($scope.condition.dateFrom),
|
|
|
- endDate: getDateTime($scope.condition.dateTo)
|
|
|
- };
|
|
|
-
|
|
|
- AccountEnterprise.get({}, function(data) {
|
|
|
- $scope.currentEn = data;
|
|
|
- publicInquiry.getUrl({}, function(data) {
|
|
|
- $scope.url = data.url;
|
|
|
- if ($scope.active == 'enterprise') {// 企业商机
|
|
|
- AuthenticationService.getAuthentication().success(function (data) {
|
|
|
- $scope.loading = false;
|
|
|
- $scope.thisUser = data;
|
|
|
- $http({
|
|
|
- method: 'get',
|
|
|
- dataType: 'json',
|
|
|
- url: $scope.url + '/inquiry/sale/enremind',
|
|
|
- params: {
|
|
|
- pageNumber: pageParams.page,
|
|
|
- pageSize: pageParams.count,
|
|
|
- useruu: $scope.thisUser.userUU,
|
|
|
- enuu: $scope.currentEn.uu,
|
|
|
- keyword: $scope.keyword,
|
|
|
- fromDate: getDateTime($scope.condition.dateFrom),
|
|
|
- endDate: getDateTime($scope.condition.dateTo)
|
|
|
- }
|
|
|
- }).success(function (response) {
|
|
|
- $scope.loading = false;
|
|
|
- if (response) {
|
|
|
- params.total(response.totalElements);
|
|
|
- $defer.resolve(response.content);
|
|
|
- $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
|
|
|
- }
|
|
|
- }).error(function (err) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '数据加载失败', err);
|
|
|
- });
|
|
|
- });
|
|
|
- } else if ($scope.active == 'remind') {// 推荐报价信息
|
|
|
- AuthenticationService.getAuthentication().success(function (data) {
|
|
|
- $scope.loading = false;
|
|
|
- $scope.thisUser = data;
|
|
|
- $http({
|
|
|
- method: 'get',
|
|
|
- dataType: 'json',
|
|
|
- url: $scope.url + '/inquiry/sale/remind',
|
|
|
- params: {pageNumber: pageParams.page, pageSize: pageParams.count, useruu: $scope.thisUser.userUU, enuu: $scope.currentEn.uu,
|
|
|
- keyword: $scope.keyword, fromDate: getDateTime($scope.condition.dateFrom), endDate: getDateTime($scope.condition.dateTo)}
|
|
|
- }).success(function (response) {
|
|
|
- $scope.loading = false;
|
|
|
- if (response) {
|
|
|
- params.total(response.totalElements);
|
|
|
- $defer.resolve(response.content);
|
|
|
- $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
|
|
|
- }
|
|
|
- }).error(function (err) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '数据加载失败', err);
|
|
|
- });
|
|
|
- });
|
|
|
- } else if ($scope.active == 'all') {// 全部
|
|
|
- $http({
|
|
|
- method: 'get',
|
|
|
- dataType: 'json',
|
|
|
- url: $scope.url + '/inquiry/public',
|
|
|
- params: {pageNumber: pageParams.page, pageSize: pageParams.count, enUU: $scope.currentEn.uu, keyword: $scope.keyword,
|
|
|
- fromDate: getDateTime($scope.condition.dateFrom), endDate: getDateTime($scope.condition.dateTo), distribute: $scope.distribute, remind: $scope.remind}
|
|
|
- }).success(function (response) {
|
|
|
- $scope.loading = false;
|
|
|
- if (response) {
|
|
|
- params.total(response.totalElements);
|
|
|
- $defer.resolve(response.content);
|
|
|
- $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
|
|
|
- }
|
|
|
- }).error(function (err) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '数据加载失败', err);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- // 顶部滚动消息
|
|
|
- $http({
|
|
|
- method: 'get',
|
|
|
- url: $scope.url + '/inquiry/public/messageList',
|
|
|
- params: {enuu: $scope.currentEn.uu, size: 10},
|
|
|
- dataType: 'json'
|
|
|
- }).success(function(data) {
|
|
|
- $scope.message = data;
|
|
|
- }).error(function(error) {
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- $scope.toDetail = function (item) {
|
|
|
- if (item.quoted == 0) {
|
|
|
- window.location.hash = '#/baseInfo/inquiryList/' + item.id;
|
|
|
- } else {
|
|
|
- window.open("#/sale/pubinquiry/" + item.quteId);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- // 转客户询价
|
|
|
- $scope.qute = function (remind) {
|
|
|
- $http({
|
|
|
- method: 'get',
|
|
|
- dataType: 'json',
|
|
|
- url: $scope.url + '/inquiry/sale/quote',
|
|
|
- params: {id: remind.itemId, en_uu: $scope.currentEn.uu}
|
|
|
- }).success(function (response) {
|
|
|
- $scope.loading = false;
|
|
|
- if (response.inquiry != null) {
|
|
|
- toaster.pop('error', '该单据已报价');
|
|
|
- } else {
|
|
|
- $http({
|
|
|
- method: 'get',
|
|
|
- dataType: 'json',
|
|
|
- url: $scope.url + '/inquiry/public/findItemByItemId',
|
|
|
- params: {itemId: remind.itemId, enuu: $scope.currentEn.uu}
|
|
|
- }).success(function (response) {
|
|
|
- var inquiryItem = response;
|
|
|
- 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.tableParams.reload();
|
|
|
- }, function () {
|
|
|
-
|
|
|
- });
|
|
|
- }).error(function (error) {
|
|
|
- toaster.pop('error', '数据加载失败', error);
|
|
|
- });
|
|
|
- }
|
|
|
- }).error(function (err) {
|
|
|
- toaster.pop('error', '数据加载失败', err);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- // 跳转详情
|
|
|
- $scope.remindDetail = function(remind) {
|
|
|
- if (remind.newId == null) {
|
|
|
- window.location.hash = '#/baseInfo/inquiryList/' + remind.itemId;
|
|
|
- } else {
|
|
|
- window.open("#/sale/pubinquiry/" + remind.newId);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 搜索框回车
|
|
|
- $scope.onSearch = function () {
|
|
|
- $scope.tableParams.page(1);
|
|
|
- $scope.tableParams.reload();
|
|
|
- };
|
|
|
-
|
|
|
- // 转客户询价
|
|
|
- $scope.transtoInquiry = function (inquiryItem) {
|
|
|
- if ($scope.currentEn.uu == inquiryItem.inquiry.enUU) {
|
|
|
- toaster.pop('warning', '不能对自己企业报价');
|
|
|
- } 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.tableParams.reload();
|
|
|
- }, function () {
|
|
|
-
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 跳转到我的报价列表
|
|
|
- $scope.linkToInquiry = function () {
|
|
|
- window.open("#/sale/pubinquiry");
|
|
|
- }
|
|
|
-
|
|
|
}]);
|
|
|
|
|
|
/**
|
|
|
@@ -22913,7 +22578,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
/**
|
|
|
* 针对卖家,已转询价的公共询价单列表
|
|
|
*/
|
|
|
- app.controller('SalePubInquiryCtrl', ['$scope', '$filter', 'PubInquirySearchInfo', 'ngTableParams', 'toaster', 'BaseService', 'PubInquiryNoSearchInfo', '$upload', '$rootScope', 'token', '$timeout', 'CurrentRole', 'publicInquiry', '$modal', 'AccountEnterprise', '$http', function ($scope, $filter, PubInquirySearchInfo, ngTableParams, toaster, BaseService, PubInquiryNoSearchInfo, $upload, $rootScope, token, $timeout, CurrentRole, publicInquiry, $modal, AccountEnterprise, $http) {
|
|
|
+ app.controller('SalePubInquiryCtrl', ['$scope', '$filter', 'PubInquirySearchInfo', 'ngTableParams', 'toaster', 'BaseService', 'PubInquiryNoSearchInfo', '$upload', '$rootScope', 'token', '$timeout', 'CurrentRole', 'publicInquiry', '$modal', 'AccountEnterprise', '$http', 'customer', 'AuthenticationService',
|
|
|
+ function ($scope, $filter, PubInquirySearchInfo, ngTableParams, toaster, BaseService, PubInquiryNoSearchInfo, $upload, $rootScope, token, $timeout, CurrentRole, publicInquiry, $modal, AccountEnterprise, $http, customer, AuthenticationService) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
|
|
|
// 获取当前用户是否为普通用户
|
|
|
@@ -22921,6 +22587,18 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.isUser = data.isUser;
|
|
|
});
|
|
|
|
|
|
+ /**
|
|
|
+ * active 状态说明:
|
|
|
+ * all: 客户公共询价单全部
|
|
|
+ * done: 已报价
|
|
|
+ * agreed: 已采纳
|
|
|
+ * refused: 未采纳
|
|
|
+ * invalid: 已失效
|
|
|
+ * todo**: 待报价
|
|
|
+ * todoAll: 所有公共询价
|
|
|
+ * todoRemind: 个人商机
|
|
|
+ * todoComRemind: 企业商机
|
|
|
+ */
|
|
|
if ($rootScope.active) {
|
|
|
$scope.active = $rootScope.active;
|
|
|
$rootScope.active = null;
|
|
|
@@ -22962,11 +22640,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.tableParams.page(1);
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
- $scope.searchMethod = false;
|
|
|
- var getService = function () {
|
|
|
- return $scope.searchMethod ? PubInquirySearchInfo : PubInquiryNoSearchInfo;
|
|
|
- };
|
|
|
+ $scope.url = null;
|
|
|
$scope.tableParams = new ngTableParams({
|
|
|
page: 1,
|
|
|
count: 20,
|
|
|
@@ -22975,266 +22649,122 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
'inquiry.enterprise.enName': 'asc',
|
|
|
'inquiry.code': 'asc'
|
|
|
}
|
|
|
- }, {
|
|
|
- total: 0,
|
|
|
- counts: [5, 10, 25, 50],
|
|
|
- getData: function ($defer, params) {
|
|
|
- $scope.loading = true;
|
|
|
- var pageParams = params.url();
|
|
|
- var realActive = {};
|
|
|
- pageParams.searchFilter = { // 筛选条件
|
|
|
- keyword: $scope.keyword,
|
|
|
- fromDate: getDateTime($scope.condition.dateFrom),
|
|
|
- endDate: getDateTime($scope.condition.dateTo)
|
|
|
- };
|
|
|
- if ($scope.active == 'overdue') {
|
|
|
- $scope.active = 'end';
|
|
|
- }
|
|
|
- AccountEnterprise.get({}, function(data) {
|
|
|
- $scope.currentEn = data;
|
|
|
- publicInquiry.getUrl({}, function(data) {
|
|
|
- var url = data.url;
|
|
|
- var filter = {vendUU: $scope.currentEn.uu, keyword: $scope.keyword,
|
|
|
- fromDate: getDateTime($scope.condition.dateFrom), endDate: getDateTime($scope.condition.dateTo)};
|
|
|
- $http({
|
|
|
- method: 'get',
|
|
|
- dataType: 'json',
|
|
|
- url: url + '/inquiry/public/quotation/list',
|
|
|
- params: {pageNumber: pageParams.page, pageSize: pageParams.count, filter: filter, _state: $scope.active}
|
|
|
- }).success(function (response) {
|
|
|
- $scope.loading = false;
|
|
|
- if (response) {
|
|
|
- params.total(response.totalElements);
|
|
|
- $defer.resolve(response.content);
|
|
|
- }
|
|
|
- }).error(function (err) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '数据加载失败', err);
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- $scope.isUnread = function (id) {
|
|
|
- for (var i in $scope.unreadCode) {
|
|
|
- if (id == $scope.unreadCode[i]) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- $scope.getMinDate = function (item) {
|
|
|
- return $filter('date')(item.inquiry.date, 'yyyy-MM-dd');
|
|
|
- };
|
|
|
- $scope.replyPrices = [];
|
|
|
- $scope.replylapQtys = [];
|
|
|
- $scope.replyPrices.push(true);
|
|
|
- $scope.replylapQtys.push(true);
|
|
|
- $scope.addStep = function (inquiryItem) {
|
|
|
- $scope.replyPrices.push(true);
|
|
|
- if (inquiryItem.replies.length >= 10) {
|
|
|
- toaster.pop('warning', '提示', '最多支持10个分段!');
|
|
|
- } 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.openDatePicker = function ($event, item, openParam) {
|
|
|
- $event.preventDefault();
|
|
|
- $event.stopPropagation();
|
|
|
- item[openParam] = !item[openParam];
|
|
|
- };
|
|
|
-
|
|
|
- $scope.openFilterDatePicker = function ($event, item, openParam) {
|
|
|
- $event.preventDefault();
|
|
|
- $event.stopPropagation();
|
|
|
- item[openParam] = !item[openParam];
|
|
|
- if ($scope.condition.dateFrom && $scope.condition.dateTo && !item[openParam]) {
|
|
|
- $scope.tableParams.reload();
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- $scope.getHistory = function (item) {
|
|
|
- if (!item.history) {
|
|
|
- publicInquiry.getHistory({itemId: item.id}, function (data) {
|
|
|
- item.history = data;
|
|
|
- });
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- // 报价
|
|
|
- $scope.quote = function(inquiryItem) {
|
|
|
- $modal.open({
|
|
|
- animation: true,
|
|
|
- templateUrl: 'static/tpl/index/sale/modal/quote_inquiry.html',
|
|
|
- controller: 'QuoteInquiryCtrl',
|
|
|
- resolve: {
|
|
|
- inquiryItem: function () {
|
|
|
- return inquiryItem
|
|
|
- }
|
|
|
- }
|
|
|
- }).result.then(function (data) {
|
|
|
-
|
|
|
- }, function () {})
|
|
|
- };
|
|
|
-
|
|
|
- $scope.deleteAttach = function (attaches, index) {
|
|
|
- attaches.splice(index, 1);
|
|
|
- };
|
|
|
-
|
|
|
- $scope.onReplyClick = function (item, withSteps) {
|
|
|
- if (item.vendFromDate instanceof Date) {
|
|
|
- item.vendFromDate = item.vendFromDate.getTime();
|
|
|
- }
|
|
|
- if (item.vendToDate instanceof Date) {
|
|
|
- item.vendToDate = item.vendToDate.getTime();
|
|
|
- }
|
|
|
- if (item.vendFromDate > item.vendToDate) {
|
|
|
- toaster.pop('warning', '警告', '有效开始日期不能超过有效截止日期');
|
|
|
- return;
|
|
|
- }
|
|
|
- var replies = [];
|
|
|
- // 判断分段数是否合法
|
|
|
- var valid = true;
|
|
|
- var validLapQty = 0;
|
|
|
- angular.forEach(item.replies, function (r, i) {
|
|
|
- if ((i > 0 ? r.lapQty : 1) || r.price) {
|
|
|
- replies.push(r);
|
|
|
- }
|
|
|
- // 直接比较是字符串比较,需要先转换再比较 2017年9月7日 15:05:51
|
|
|
- if (i > 0 && parseInt(r.lapQty) <= parseInt(item.replies[i - 1].lapQty) || r.lapQty == null) {
|
|
|
- valid = false;
|
|
|
- validLapQty = r.lapQty;
|
|
|
- }
|
|
|
- });
|
|
|
- item.replies = replies;
|
|
|
- $scope.loading = true;
|
|
|
- if (!valid) {
|
|
|
- if (validLapQty) {
|
|
|
- toaster.pop('info', '提示', '分段' + validLapQty + '小于等于了上一分段数,不能保存!');
|
|
|
- } else {
|
|
|
- toaster.pop('info', '提示', '分段数量不合法,不能保存!');
|
|
|
- }
|
|
|
- $scope.loading = false;
|
|
|
- } else {
|
|
|
- var file = item.myFiles, file = file && file.length > 0 ? file[0] : null;
|
|
|
- if (withSteps) { // 保存并报价
|
|
|
- if(null != file) {
|
|
|
- $upload.upload({
|
|
|
- url: 'sale/pubInquiry/addAttach',
|
|
|
- file: file,
|
|
|
- method: 'POST',
|
|
|
- data: {
|
|
|
- item: item,
|
|
|
- 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', '附件上传失败');
|
|
|
- });
|
|
|
- } else {
|
|
|
- publicInquiry.reply({itemId: item.id, token: $scope.token}, item, function (data) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('info', '提示', '报价成功');
|
|
|
- $scope.tableParams.reload();
|
|
|
- }, function (response) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '询价失效', response.data);
|
|
|
- });
|
|
|
- }
|
|
|
- } else { // 保存
|
|
|
- if(null != file) {
|
|
|
- $upload.upload({
|
|
|
- url: 'sale/pubInquiry/addAttach',
|
|
|
- file: file,
|
|
|
- method: 'POST',
|
|
|
- data: {
|
|
|
- item: item,
|
|
|
- method: 'save'
|
|
|
- }
|
|
|
- }).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', '附件上传失败');
|
|
|
- });
|
|
|
- } else {
|
|
|
- publicInquiry.saveItem({itemId: item.id, token: $scope.token}, item, function (data) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('info', '提示', '保存成功');
|
|
|
- $scope.tableParams.reload();
|
|
|
- }, function (response) {
|
|
|
- $scope.loading = false;
|
|
|
- toaster.pop('error', '保存失败', response.data);
|
|
|
- });
|
|
|
- }
|
|
|
+ }, {
|
|
|
+ total: 0,
|
|
|
+ counts: [5, 10, 25, 50],
|
|
|
+ getData: function ($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ var pageParams = params.url();
|
|
|
+ pageParams.searchFilter = { // 筛选条件
|
|
|
+ keyword: $scope.keyword,
|
|
|
+ fromDate: getDateTime($scope.condition.dateFrom),
|
|
|
+ endDate: getDateTime($scope.condition.dateTo)
|
|
|
+ };
|
|
|
+ if ($scope.active == 'overdue') {
|
|
|
+ $scope.active = 'end';
|
|
|
}
|
|
|
+ AccountEnterprise.get({}, function(data) {
|
|
|
+ $scope.currentEn = data;
|
|
|
+ publicInquiry.getUrl({}, function(data) {
|
|
|
+ var url = data.url;
|
|
|
+ $scope.url = url;
|
|
|
+ if ($scope.active == 'todoComRemind') {// 企业商机
|
|
|
+ AuthenticationService.getAuthentication().success(function (data) {
|
|
|
+ $scope.loading = false;
|
|
|
+ $scope.thisUser = data;
|
|
|
+ $http({
|
|
|
+ method: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ url: url + '/inquiry/sale/enremind',
|
|
|
+ params: {
|
|
|
+ pageNumber: pageParams.page,
|
|
|
+ pageSize: pageParams.count,
|
|
|
+ useruu: $scope.thisUser.userUU,
|
|
|
+ enuu: $scope.currentEn.uu,
|
|
|
+ keyword: $scope.keyword,
|
|
|
+ fromDate: getDateTime($scope.condition.dateFrom),
|
|
|
+ endDate: getDateTime($scope.condition.dateTo)
|
|
|
+ }
|
|
|
+ }).success(function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (response) {
|
|
|
+ params.total(response.totalElements);
|
|
|
+ $defer.resolve(response.content);
|
|
|
+ $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
|
|
|
+ }
|
|
|
+ }).error(function (err) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', err);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else if ($scope.active == 'todoRemind') {// 推荐报价信息
|
|
|
+ AuthenticationService.getAuthentication().success(function (data) {
|
|
|
+ $scope.loading = false;
|
|
|
+ $scope.thisUser = data;
|
|
|
+ $http({
|
|
|
+ method: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ url: url + '/inquiry/sale/remind',
|
|
|
+ params: {pageNumber: pageParams.page, pageSize: pageParams.count, useruu: $scope.thisUser.userUU, enuu: $scope.currentEn.uu,
|
|
|
+ keyword: $scope.keyword, fromDate: getDateTime($scope.condition.dateFrom), endDate: getDateTime($scope.condition.dateTo)}
|
|
|
+ }).success(function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (response) {
|
|
|
+ params.total(response.totalElements);
|
|
|
+ $defer.resolve(response.content);
|
|
|
+ $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
|
|
|
+ }
|
|
|
+ }).error(function (err) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', err);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else if ($scope.active == 'todoAll') {// 全部
|
|
|
+ $http({
|
|
|
+ method: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ url: url + '/inquiry/public',
|
|
|
+ params: {pageNumber: pageParams.page, pageSize: pageParams.count, enUU: $scope.currentEn.uu, keyword: $scope.keyword,
|
|
|
+ fromDate: getDateTime($scope.condition.dateFrom), endDate: getDateTime($scope.condition.dateTo), distribute: $scope.distribute, remind: $scope.remind}
|
|
|
+ }).success(function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (response) {
|
|
|
+ params.total(response.totalElements);
|
|
|
+ $defer.resolve(response.content);
|
|
|
+ $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的关键词
|
|
|
+ }
|
|
|
+ }).error(function (err) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', err);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ var filter = {vendUU: $scope.currentEn.uu, keyword: $scope.keyword,
|
|
|
+ fromDate: getDateTime($scope.condition.dateFrom), endDate: getDateTime($scope.condition.dateTo)};
|
|
|
+ $http({
|
|
|
+ method: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ url: url + '/inquiry/public/quotation/list',
|
|
|
+ params: {pageNumber: pageParams.page, pageSize: pageParams.count, filter: filter, _state: $scope.active}
|
|
|
+ }).success(function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (response) {
|
|
|
+ params.total(response.totalElements);
|
|
|
+ $defer.resolve(response.content);
|
|
|
+ }
|
|
|
+ }).error(function (err) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
- };
|
|
|
-
|
|
|
- $scope.isValid = function (item, withSteps) {
|
|
|
- var bool = item.leadtime && item.replies && item.replies[0].price > 0;
|
|
|
- if (!withSteps || !bool)
|
|
|
- return bool;
|
|
|
- angular.forEach(item.replies, function (r, i) {
|
|
|
- $scope.verifylapQty(r.lapQty, i, item);
|
|
|
- bool = (i > 0 ? r.lapQty : 1) && r.price && $scope.replylapQtys[i];
|
|
|
- });
|
|
|
- return bool;
|
|
|
- };
|
|
|
+ });
|
|
|
|
|
|
- $scope.verifylapQty = function (value, index, inquiryItem) {
|
|
|
- value = parseInt(value);
|
|
|
- var regex = /^\d+(.\d{1,5})?$/;
|
|
|
- var valid = true;
|
|
|
- angular.forEach(inquiryItem.replies, function(reply, $index) {
|
|
|
- if ($index < index && reply.lapQty >= value) {
|
|
|
- valid = false;
|
|
|
- }
|
|
|
- });
|
|
|
- $scope.replylapQtys[index] = regex.test(value) && valid;
|
|
|
+ $scope.getMinDate = function (item) {
|
|
|
+ return $filter('date')(item.inquiry.date, 'yyyy-MM-dd');
|
|
|
};
|
|
|
|
|
|
- $scope.minOrderQtyVerify = $scope.minPackQtyVerify = $scope.leadtimeVerify = true;
|
|
|
- $scope.verify = function (value, type) {
|
|
|
- var regex = /^\d+(.\d{1,6})?$/;//
|
|
|
- switch (type) {
|
|
|
- case 'minOrderQty':
|
|
|
- $scope.minOrderQtyVerify = regex.test(value);
|
|
|
- break;
|
|
|
- case 'minPackQty':
|
|
|
- $scope.minPackQtyVerify = regex.test(value);
|
|
|
- break;
|
|
|
- case 'leadtime':
|
|
|
- $scope.leadtimeVerify = regex.test(value);
|
|
|
- break;
|
|
|
- default:
|
|
|
- $scope.replyPrices[type] = regex.test(value);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
// 搜索框回车
|
|
|
$scope.onSearch = function (keyword) {
|
|
|
// 每次搜索重置获取数据方法
|
|
|
@@ -23261,6 +22791,124 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
toaster.pop('error', '数据加载失败', response.data);
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ $scope.isOverDue = function (date) {
|
|
|
+ if (date) {
|
|
|
+ var ndate = new Date();
|
|
|
+ ndate.setHours(23, 59, 59 ,999);
|
|
|
+ ndate.setDate(ndate.getDate());
|
|
|
+ var timestamp = Date.parse(ndate);
|
|
|
+ if (date > timestamp) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $scope.nowdate = new Date().getTime() - 24 * 3600 * 1000;
|
|
|
+
|
|
|
+ customer.distribute({}, function(data) {
|
|
|
+ $scope.customer = data;
|
|
|
+ });
|
|
|
+
|
|
|
+ $scope.toDetail = function (item) {
|
|
|
+ if (item.quoted == 0) {
|
|
|
+ window.location.hash = '#/baseInfo/inquiryList/' + item.id;
|
|
|
+ } else {
|
|
|
+ window.open("#/sale/pubinquiry/" + item.quteId);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 转客户询价
|
|
|
+ $scope.qute = function (remind) {
|
|
|
+ $http({
|
|
|
+ method: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ url: $scope.url + '/inquiry/sale/quote',
|
|
|
+ params: {id: remind.itemId, en_uu: $scope.currentEn.uu}
|
|
|
+ }).success(function (response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ if (response.inquiry != null) {
|
|
|
+ toaster.pop('error', '该单据已报价');
|
|
|
+ } else {
|
|
|
+ $http({
|
|
|
+ method: 'get',
|
|
|
+ dataType: 'json',
|
|
|
+ url: $scope.url + '/inquiry/public/findItemByItemId',
|
|
|
+ params: {itemId: remind.itemId, enuu: $scope.currentEn.uu}
|
|
|
+ }).success(function (response) {
|
|
|
+ var inquiryItem = response;
|
|
|
+ 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.tableParams.reload();
|
|
|
+ }, function () {
|
|
|
+
|
|
|
+ });
|
|
|
+ }).error(function (error) {
|
|
|
+ toaster.pop('error', '数据加载失败', error);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).error(function (err) {
|
|
|
+ toaster.pop('error', '数据加载失败', err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 跳转详情
|
|
|
+ $scope.remindDetail = function(remind) {
|
|
|
+ if (remind.newId == null) {
|
|
|
+ window.location.hash = '#/baseInfo/inquiryList/' + remind.itemId;
|
|
|
+ } else {
|
|
|
+ window.open("#/sale/pubinquiry/" + remind.newId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 搜索框回车
|
|
|
+ $scope.onSearch = function () {
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
+ // 转客户询价
|
|
|
+ $scope.transtoInquiry = function (inquiryItem) {
|
|
|
+ if ($scope.currentEn.uu == inquiryItem.inquiry.enUU) {
|
|
|
+ toaster.pop('warning', '不能对自己企业报价');
|
|
|
+ } 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.tableParams.reload();
|
|
|
+ }, function () {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 跳转到我的报价列表
|
|
|
+ $scope.linkToInquiry = function () {
|
|
|
+ window.open("#/sale/pubinquiry");
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
/**
|