浏览代码

已发出的询价单增加详情

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@8122 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 年之前
父节点
当前提交
409c7f8450

+ 9 - 10
src/main/java/com/uas/platform/b2b/service/impl/PurcInquiryServiceImpl.java

@@ -585,36 +585,35 @@ public class PurcInquiryServiceImpl implements PurcInquiryService {
 			inquiryInfo.setRemark(inquiry.getRemark());
 			inquiryInfo.setRemark(inquiry.getRemark());
 			inquiryInfo.setSourceApp(inquiry.getSourceApp());
 			inquiryInfo.setSourceApp(inquiry.getSourceApp());
 			inquiryInfo.setSourceId(inquiry.getSourceId());
 			inquiryInfo.setSourceId(inquiry.getSourceId());
-			Set<InquiryProductInfo> products = new HashSet<InquiryProductInfo>();
 			Set<Long> ids = new HashSet<Long>();
 			Set<Long> ids = new HashSet<Long>();
 			List<Long> idStrings = new ArrayList<>();
 			List<Long> idStrings = new ArrayList<>();
-			Set<PurchaseInquiryItemInfo> items = new HashSet<PurchaseInquiryItemInfo>();
+			Set<InquiryProductInfo> products = new HashSet<InquiryProductInfo>();
 			if (!CollectionUtils.isEmpty(inquiry.getInquiryItems())) {
 			if (!CollectionUtils.isEmpty(inquiry.getInquiryItems())) {
-				InquiryProductInfo productInfo = new InquiryProductInfo();
 				for (PurchaseInquiryItemInfo item : inquiry.getInquiryItems()) {
 				for (PurchaseInquiryItemInfo item : inquiry.getInquiryItems()) {
 					idStrings.add(item.getProductId());
 					idStrings.add(item.getProductId());
 					ids.addAll(idStrings);
 					ids.addAll(idStrings);
 				}
 				}
+			}
+			if (!CollectionUtils.isEmpty(ids)) {
 				for (Long idInfo : ids) {
 				for (Long idInfo : ids) {
+					InquiryProductInfo productInfo = new InquiryProductInfo();
+					Set<PurchaseInquiryItemInfo> items = new HashSet<PurchaseInquiryItemInfo>();
 					Product product = productDao.findOne(idInfo);
 					Product product = productDao.findOne(idInfo);
 					productInfo.setBrand(product.getBrand());
 					productInfo.setBrand(product.getBrand());
 					productInfo.setId(product.getId());
 					productInfo.setId(product.getId());
 					productInfo.setSpec(product.getSpec());
 					productInfo.setSpec(product.getSpec());
 					productInfo.setCode(product.getCode());
 					productInfo.setCode(product.getCode());
 					productInfo.setTitle(product.getTitle());
 					productInfo.setTitle(product.getTitle());
-					products.add(productInfo);
-				}
-				for (InquiryProductInfo prodInfo : products) {
 					for (PurchaseInquiryItemInfo item : inquiry.getInquiryItems()) {
 					for (PurchaseInquiryItemInfo item : inquiry.getInquiryItems()) {
-						if (item.getProductId().equals(prodInfo.getId())) {
+						if (item.getProductId().equals(idInfo)) {
 							items.add(item);
 							items.add(item);
 						}
 						}
 					}
 					}
+					productInfo.setInquiryItems(items);
+					products.add(productInfo);
+					inquiryInfo.setProducts(products);
 				}
 				}
-				productInfo.setInquiryItems(items);
-				products.add(productInfo);
 			}
 			}
-			inquiryInfo.setProducts(products);
 		}
 		}
 		return inquiryInfo;
 		return inquiryInfo;
 	}
 	}

+ 219 - 3
src/main/webapp/resources/js/index/app.js

@@ -2775,7 +2775,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		$scope.inquiry = {
 		$scope.inquiry = {
 				code: 'XJ' + $filter('date')(new Date(), 'yyMMddsss'),
 				code: 'XJ' + $filter('date')(new Date(), 'yyMMddsss'),
 				showdate: $filter('date')(new Date, 'yyyy-MM-dd'),
 				showdate: $filter('date')(new Date, 'yyyy-MM-dd'),
-				priceType: '采购'
+				priceType: '采购',
+				isOpen: 1
 		};
 		};
 		
 		
 	    $scope.currentDay = function() {
 	    $scope.currentDay = function() {
@@ -3119,6 +3120,192 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				toaster.pop('error', '提示', response.data);
 				toaster.pop('error', '提示', response.data);
 			})
 			})
 		}
 		}
+
+		// 发布公共询价
+		$scope.publish = function(id) {
+			PurchaseInquiry.publishInquiry({id: id}, {}, function(data) {
+				toaster.pop('success', '提示', data.success);
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			})
+		}
+	}]);
+	
+	// 公共询价列表
+	app.controller('PublicInquiryListCtrl', ['$scope', '$stateParams', 'PurchaseInquiry','$filter', 'toaster', 'BaseService', 'ngTableParams', function($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams) {
+		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.setDate(date.getDate() - 7);
+                condition.dateFrom = date;
+                condition.dateTo = new Date();
+            } 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.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.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.onDateCondition = function(){
+            $scope.tableParams.page(1);
+            $scope.tableParams.reload();
+        };
+        // $scope.setActive = function(state) {
+        //     if($scope.active != state) {
+        //         $scope.active = state;
+        //         if($scope.tableParams.page() == 1)
+        //             $scope.tableParams.reload();
+        //         else
+        //             $scope.tableParams.page(1);
+        //     }
+        // };
+        
+        $scope.nowdate = new Date().getTime();
+        var getOpenState = function(active) {
+            var fn = 'getOpenAll';
+            switch(active) {
+                case 'all':
+                    fn = 'getOpenAll';break;
+                case 'todo':
+                    fn = 'getOpenTodo';break;
+                case 'end':
+                    fn = 'getOpenEnd';break;
+            }
+            return fn;
+        };
+
+        $scope.tableParams = new ngTableParams({
+            page : 1,
+            count : 10,
+            sorting: {
+//                'tender.endDate': 'desc',
+//                'tender.enterprise.enName': 'asc',
+//                'tender.code': 'asc'
+            }
+        }, {
+            total : 0,
+            counts: [10, 25, 50, 100],
+            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)
+                };
+//                AccountEnterprise.get({}, function(data){
+//                    $scope.loading = false;
+//                    $scope.currentEn = data;
+//                });
+                PurchaseInquiry.publicInquiryItem.call(null, BaseService.parseParams(pageParams), function(page){
+                    $scope.loading = false;
+                    if(page) {
+                        params.total(page.totalElement);
+                        $defer.resolve(page.content);
+                        // $scope.keywordXls = angular.copy($scope.keyword); // 保存当前取值的关键词  做导出时需要的字段
+                    }
+                }, function(response){
+                    $scope.loading = false;
+                    toaster.pop('error', '数据加载失败', response.data);
+                });
+            }
+        });
+
+        $scope.toDetail = function(id) {
+            window.location.hash = '#/baseInfo/inquiryList/' + id;
+        };
+
+        // 搜索框回车
+        $scope.onSearch = function() {
+            $scope.tableParams.page(1);
+            $scope.tableParams.reload();
+        };
+
+	}]);
+	
+	/**
+	 * 公共询价详情
+	 */
+	app.controller('PublicInquiryListDetailCtrl', ['$scope', '$stateParams', 'PurchaseInquiry','$filter', 'toaster', 'BaseService', 'ngTableParams', 'AccountEnterprise', function($scope, $stateParams, PurchaseInquiry, $filter, toaster, BaseService, ngTableParams, AccountEnterprise) {
+		BaseService.scrollBackToTop();
+		var loadData = function() {
+			PurchaseInquiry.inquiryItemDetail({id: $stateParams.id}, function(data) {
+				$scope.inquiryItem = data;
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
+		loadData();
+		
+		// 当前时间
+        $scope.nowdate = new Date().getTime();
+        
+		 // 当前企业
+		AccountEnterprise.get({}, function(data){
+			$scope.loading = false;
+			$scope.enterprise = data;
+		});
+        
+		// 转客户询价
+		$scope.transtoInquiry = function(id) {
+			PurchaseInquiry.transtoInquiry({id: id}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+					window.location.hash = "sale/inquiry/" + data.id;
+				} 
+				if(data.error) {
+					toaster.pop('error', '提示', data.error);
+				}
+				if(data.info) {
+					toaster.pop('info', '提示', data.info);
+				}
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
 	}]);
 	}]);
 	// 询价单明细
 	// 询价单明细
 	app.controller('PurcInquiryDetailCtrl', ['$scope', '$stateParams', 'PurcInquiry','$filter', 'toaster', function($scope, $stateParams, PurcInquiry,$filter, toaster){
 	app.controller('PurcInquiryDetailCtrl', ['$scope', '$stateParams', 'PurcInquiry','$filter', 'toaster', function($scope, $stateParams, PurcInquiry,$filter, toaster){
@@ -3274,6 +3461,37 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				});
 				});
 			}
 			}
 		};
 		};
+		
+		// 采纳
+		$scope.accept = function(id) {
+			PurchaseInquiry.accept({id: id}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+					$scope.tableParams.reload();
+				}
+				if(data.error) {
+					toaster.pop('error', '提示', data.error);
+				}
+				
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			})
+		};
+		
+		// 拒绝
+		$scope.refuse = function(id) {
+			PurchaseInquiry.refuse({id: id}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+					$scope.tableParams.reload();
+				}
+				if(data.error) {
+					toaster.pop('error', '提示', data.error);
+				}
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			})
+		}
 	}]);
 	}]);
 	
 	
 	
 	
@@ -3491,8 +3709,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			$scope.tableParams.reload();
 			$scope.tableParams.reload();
 		};
 		};
 		
 		
-		
-		
 	}]);
 	}]);
 		
 		
 	
 	

+ 1 - 1
src/main/webapp/resources/tpl/index/baseInfo/inquiry_list.html

@@ -139,7 +139,7 @@
         <div class="purc-tender" id="tender-list">
         <div class="purc-tender" id="tender-list">
             <div class="tender-label list-unstyled">
             <div class="tender-label list-unstyled">
                 <div class="condition block" id="resultTop">
                 <div class="condition block" id="resultTop">
-                    <strong>|&nbsp;&nbsp;&nbsp;公共招标</strong>
+                    <strong>|&nbsp;&nbsp;&nbsp;公共询价</strong>
                 </div>
                 </div>
                 <div class="tender-list-content">
                 <div class="tender-list-content">
                     <div class="container">
                     <div class="container">

+ 7 - 6
src/main/webapp/resources/tpl/index/purc/inquiryInfo_detail.html

@@ -493,15 +493,13 @@ i, em {
 											<div class="dropdown-menu pane" style="width: 270px;">
 											<div class="dropdown-menu pane" style="width: 270px;">
 												<div class="pane-body">
 												<div class="pane-body">
 													<ul class="list-unstyled list-menu">
 													<ul class="list-unstyled list-menu">
-														<li ng-repeat="reply in ::inquiryItem.replies">
 															<div ng-class="{'text-inverse': $index==0}">
 															<div ng-class="{'text-inverse': $index==0}">
 																<div class="row row-sm"
 																<div class="row row-sm"
-																	ng-repeat="historyReply in historyItem.replies">
+																	ng-repeat="reply in ::inquiryItem.replies">
 																	<div class="col-xs-5">≥{{reply.lapQty}}</div>
 																	<div class="col-xs-5">≥{{reply.lapQty}}</div>
 																	<div class="col-xs-5">价格{{reply.price | number:6}}</div>
 																	<div class="col-xs-5">价格{{reply.price | number:6}}</div>
 																</div>
 																</div>
 															</div>
 															</div>
-														</li>
 													</ul>
 													</ul>
 													<div ng-show="inquiryItem.replies.length == 0"
 													<div ng-show="inquiryItem.replies.length == 0"
 														class="text-center text-muted">暂无报价信息</div>
 														class="text-center text-muted">暂无报价信息</div>
@@ -516,20 +514,23 @@ i, em {
                                         <em>{{inquiryItem.vendFromDate| date:'yyyy-MM-dd'}}</em><br/>
                                         <em>{{inquiryItem.vendFromDate| date:'yyyy-MM-dd'}}</em><br/>
                                         <em>{{inquiryItem.VendToDate|date: 'yyyy-MM-dd'}}</em>
                                         <em>{{inquiryItem.VendToDate|date: 'yyyy-MM-dd'}}</em>
                                     </span>
                                     </span>
-                                    <span><a>采纳</a><a>拒绝</a></span>
+                                    <span ng-if="inquiryItem.status == 200" class="text-trans info">暂未报价</span>
+                                    <span ng-if="inquiryItem.status == 201 && inquiryItem.agreed == null"><a ng-click="accept(inquiryItem.id)">采纳</a><a ng-click="refuse(inquiryItem.id)">拒绝</a></span>
+									<span ng-if="inquiryItem.status == 201 && inquiryItem.agreed == 1" class="text-trans success">报价已采纳</span>
+									<span ng-if="inquiryItem.status == 201 && inquiryItem.agreed == 0" class="text-trans error">报价未采纳</span>
                                 </dd>
                                 </dd>
                             </dl>
                             </dl>
                         </div>
                         </div>
                     </div>
                     </div>
                 </div>
                 </div>
-                <div class="col-xs-12" style="padding: 30px 0 0 0;">
+               <!--  <div class="col-xs-12" style="padding: 30px 0 0 0;">
                     <div class="col-xs-2 pull-right btn-bid">
                     <div class="col-xs-2 pull-right btn-bid">
                         <button class="btn"
                         <button class="btn"
                                 ng-disabled="bidForm.$invalid || tender.overdue == 0 || tender.result == 1"
                                 ng-disabled="bidForm.$invalid || tender.overdue == 0 || tender.result == 1"
                                 ng-click="submit(tender)">确定
                                 ng-click="submit(tender)">确定
                         </button>
                         </button>
                     </div>
                     </div>
-                </div>
+                </div> -->
             </div>
             </div>
         </div>
         </div>
     </form>
     </form>

+ 2 - 2
src/main/webapp/resources/tpl/index/purc/inquiry_new.html

@@ -935,13 +935,13 @@ input[type="radio"], input[type="checkbox"] {
                                         <span class="wid01"><input type="text" ng-model="prod.prodTitle" readonly /></span>
                                         <span class="wid01"><input type="text" ng-model="prod.prodTitle" readonly /></span>
                                         <span class="wid02"><input type="text" ng-model="prod.spec" readonly/></span>
                                         <span class="wid02"><input type="text" ng-model="prod.spec" readonly/></span>
                                         <span><input type="text" ng-model="prod.unit" readonly/></span>
                                         <span><input type="text" ng-model="prod.unit" readonly/></span>
-                                        <span><select class="wid01" data-style="btn-primary" ng-model="prod.currency" ng-init="prod.currency = 'RMB'">
+                                        <span><select class="wid01" data-style="btn-primary" ng-model="prod.currency" ng-init="prod.currency = 'RMB'" style="width: 56px;height: 34px;">
 					                            <option value ="RMB">RMB</option>
 					                            <option value ="RMB">RMB</option>
 					                            <option value ="USD">USD</option>
 					                            <option value ="USD">USD</option>
 					                            <option value ="HKD">HKD</option>
 					                            <option value ="HKD">HKD</option>
 					                            <option value ="EUR">EUR</option>
 					                            <option value ="EUR">EUR</option>
 					                       	  </select></span>
 					                       	  </select></span>
-                                        <span><input ng-model="prod.toDate" type="text" class="editable" 
+                                        <span><input ng-model="prod.toDate" type="text" class="editable"  required
 													placeholder="选择时间" datepicker-popup="yyyy-MM-dd" is-open="prod.$toDateOpen"
 													placeholder="选择时间" datepicker-popup="yyyy-MM-dd" is-open="prod.$toDateOpen"
 													min-date="getMinDate()"
 													min-date="getMinDate()"
 													current-text="今天" clear-text="清除" close-text="关闭"
 													current-text="今天" clear-text="清除" close-text="关闭"