Bläddra i källkod

企业圈邀请注册功能

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@7852 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 år sedan
förälder
incheckning
6cdc415a53

+ 31 - 0
src/main/java/com/uas/platform/b2b/controller/InvitationRecordController.java

@@ -0,0 +1,31 @@
+package com.uas.platform.b2b.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2b.model.InvitationRecord;
+import com.uas.platform.b2b.service.InvitationRecordService;
+
+@RestController
+@RequestMapping("/invitationrecord")
+public class InvitationRecordController {
+
+	@Autowired
+	private InvitationRecordService invitationRecordService;
+
+	/**
+	 * 邀请开通平台
+	 * 
+	 * @param formStore
+	 * @return
+	 */
+	@RequestMapping(value = "/invite", method = RequestMethod.POST)
+	private ModelMap invite(String formStore) {
+		InvitationRecord record = JSONObject.parseObject(formStore, InvitationRecord.class);
+		return invitationRecordService.invite(record);
+	}
+}

+ 155 - 0
src/main/java/com/uas/platform/b2b/model/InvitationRecord.java

@@ -0,0 +1,155 @@
+package com.uas.platform.b2b.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+/**
+ * 邀请合作伙伴注册
+ * 
+ * @author hejq
+ * @time 创建时间:2017年4月19日
+ */
+@Table(name = "invitationrecords")
+@Entity
+public class InvitationRecord implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "invitationrecords_gen")
+	@SequenceGenerator(name = "invitationrecords_gen", sequenceName = "invitationrecords_seq", allocationSize = 1)
+	@Column(name = "in_id")
+	private Long id;
+	
+	/**
+	 * 邀请企业uu
+	 */
+	@Column(name = "in_enuu")
+	private Long enuu;
+	
+	/**
+	 * 用户uu
+	 */
+	@Column(name = "in_useruu")
+	private Long useruu;
+	
+	/**
+	 * 最后一次邀请时间
+	 */
+	@Column(name = "in_date")
+	private Date date;
+
+	/**
+	 * 邀请的客户名称
+	 */
+	@Column(name = "in_vendname")
+	private String vendname;
+
+	/**
+	 * 邀请的用户名称
+	 */
+	@Column(name = "in_vendusername")
+	private String vendusername;
+
+	/**
+	 * 邀请的用户的电话
+	 */
+	@Column(name = "in_vendusertel")
+	private String vendusertel;
+
+	/**
+	 * 邀请的用户的邮箱
+	 */
+	@Column(name = "in_venduseremail")
+	private String venduseremail;
+
+	/**
+	 * 可能出现重复邀请的情况,记录邀请次数
+	 */
+	@Column(name = "in_count")
+	private Integer count;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getEnuu() {
+		return enuu;
+	}
+
+	public void setEnuu(Long enuu) {
+		this.enuu = enuu;
+	}
+
+	public Long getUseruu() {
+		return useruu;
+	}
+
+	public void setUseruu(Long useruu) {
+		this.useruu = useruu;
+	}
+
+	public Date getDate() {
+		return date;
+	}
+
+	public void setDate(Date date) {
+		this.date = date;
+	}
+
+	public String getVendname() {
+		return vendname;
+	}
+
+	public void setVendname(String vendname) {
+		this.vendname = vendname;
+	}
+
+	public String getVendusertel() {
+		return vendusertel;
+	}
+
+	public void setVendusertel(String vendusertel) {
+		this.vendusertel = vendusertel;
+	}
+
+	public String getVenduseremail() {
+		return venduseremail;
+	}
+
+	public void setVenduseremail(String venduseremail) {
+		this.venduseremail = venduseremail;
+	}
+
+	public Integer getCount() {
+		return count;
+	}
+
+	public void setCount(Integer count) {
+		this.count = count;
+	}
+
+	public String getVendusername() {
+		return vendusername;
+	}
+
+	public void setVendusername(String vendusername) {
+		this.vendusername = vendusername;
+	}
+
+}

+ 16 - 0
src/main/java/com/uas/platform/b2b/service/InvitationRecordService.java

@@ -0,0 +1,16 @@
+package com.uas.platform.b2b.service;
+
+import org.springframework.ui.ModelMap;
+
+import com.uas.platform.b2b.model.InvitationRecord;
+
+public interface InvitationRecordService {
+
+	/**
+	 * 进行邀请
+	 * 
+	 * @param record
+	 * @return
+	 */
+	public ModelMap invite(InvitationRecord record);
+}

+ 83 - 0
src/main/java/com/uas/platform/b2b/service/impl/InvitationRecordServiceImpl.java

@@ -0,0 +1,83 @@
+package com.uas.platform.b2b.service.impl;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.ui.ModelMap;
+
+import com.uas.message.mail.service.MailService;
+import com.uas.message.sms.service.SmsService;
+import com.uas.platform.b2b.dao.InvitationRecordDao;
+import com.uas.platform.b2b.model.InvitationRecord;
+import com.uas.platform.b2b.service.InvitationRecordService;
+import com.uas.platform.b2b.support.MessageConf;
+import com.uas.platform.b2b.support.SystemSession;
+
+@Service
+public class InvitationRecordServiceImpl implements InvitationRecordService {
+
+	@Autowired
+	private InvitationRecordDao invitationRecordDao;
+
+	@Autowired
+	private MailService mailService;
+
+	@Autowired
+	private MessageConf messageConf;
+
+	@Autowired
+	private SmsService smsService;
+
+	@Override
+	public ModelMap invite(InvitationRecord record) {
+		ModelMap map = new ModelMap();
+		Long useruu = SystemSession.getUser().getUserUU();
+		Long enuu = SystemSession.getUser().getEnterprise().getUu();
+		Map<String, Object> model = new HashMap<String, Object>();
+		// 邮件信息
+		model.put("vendorusername", record.getVendusername().trim());
+		model.put("vendorname", record.getVendname().trim());
+		model.put("custname", SystemSession.getUser().getUserName() + "("
+				+ SystemSession.getUser().getEnterprise().getEnName() + ")");
+		// 先判断记录
+		InvitationRecord oldrecord = invitationRecordDao.findByUseruuAndVendname(useruu, record.getVendname());
+		if (oldrecord != null) {
+			oldrecord.setCount(oldrecord.getCount() + 1);
+			oldrecord.setDate(new Date());
+			oldrecord.setVendusertel(record.getVendusertel().trim());
+			oldrecord.setVenduseremail(record.getVenduseremail());
+			invitationRecordDao.save(oldrecord);
+			mailService.send(messageConf.getTplInvitationForB2B(), record.getVenduseremail(), model);
+			// smsService.send(messageConf.getMsgInvitationForB2B(),
+			// record.getVendusertel(),
+			// new Object[] { record.getVendusername(), record.getVendname(),
+			// SystemSession.getUser().getUserName()
+			// + "(" + SystemSession.getUser().getEnterprise().getEnName() + ")"
+			// });
+			map.put("success", "邀请已发送");
+		} else {
+			record.setCount(1);
+			record.setEnuu(enuu);
+			record.setUseruu(useruu);
+			record.setDate(new Date());
+			record = invitationRecordDao.save(record);
+			mailService.send(messageConf.getTplInvitationForB2B(), record.getVenduseremail(), model);
+			// smsService.send(messageConf.getMsgInvitationForB2B(),
+			// record.getVendusertel(),
+			// new Object[] { record.getVendusername(), record.getVendname(),
+			// SystemSession.getUser().getUserName()
+			// + "(" + SystemSession.getUser().getEnterprise().getEnName() + ")"
+			// });
+			if (record.getId() != null) {
+				map.put("success", "邀请已发送");
+			} else {
+				map.put("success", "邀请发送失败");
+			}
+		}
+		return map;
+	}
+
+}

+ 36 - 0
src/main/java/com/uas/platform/b2b/support/MessageConf.java

@@ -0,0 +1,36 @@
+package com.uas.platform.b2b.support;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MessageConf {
+
+	/**
+	 * 模板id:邀请客户注册优软模板id
+	 * 
+	 * @return
+	 */
+	@Value("#{message.tplInvitationForB2B}")
+	private String tplInvitationForB2B;
+
+	@Value("#{message.msgInvitationForB2B}")
+	private String msgInvitationForB2B;
+
+	public String getTplInvitationForB2B() {
+		return tplInvitationForB2B;
+	}
+
+	public void setTplInvitationForB2B(String tplInvitationForB2B) {
+		this.tplInvitationForB2B = tplInvitationForB2B;
+	}
+
+	public String getMsgInvitationForB2B() {
+		return msgInvitationForB2B;
+	}
+
+	public void setMsgInvitationForB2B(String msgInvitationForB2B) {
+		this.msgInvitationForB2B = msgInvitationForB2B;
+	}
+
+}

+ 2 - 0
src/main/resources/dev/message.properties

@@ -0,0 +1,2 @@
+tplInvitationForB2B=117d7807-b59b-4da8-9232-e03ab47d489b
+msgInvitationForB2B=73c513f8-7423-49c4-b57c-50a63bd8a0af

+ 2 - 0
src/main/resources/prod/message.properties

@@ -0,0 +1,2 @@
+tplInvitationForB2B=117d7807-b59b-4da8-9232-e03ab47d489b
+msgInvitationForB2B=73c513f8-7423-49c4-b57c-50a63bd8a0af

+ 8 - 0
src/main/resources/spring/dubbo-consumer.xml

@@ -15,5 +15,13 @@
 
 	<!-- 分布式文件服务 -->
 	<dubbo:reference id="fileClient" interface="com.uas.dfs.service.FileClient" timeout="100000"/>
+	
+	<!-- 邮件服务 -->
+	<dubbo:reference id="mailService"
+		interface="com.uas.message.mail.service.MailService" timeout="10000" />
+	
+	<!-- 消费短信服务 -->
+	<dubbo:reference id="smsService"
+		interface="com.uas.message.sms.service.SmsService" timeout="30000" />
 
 </beans>

+ 2 - 0
src/main/resources/test/message.properties

@@ -0,0 +1,2 @@
+tplInvitationForB2B=117d7807-b59b-4da8-9232-e03ab47d489b
+msgInvitationForB2B=73c513f8-7423-49c4-b57c-50a63bd8a0af

+ 328 - 6
src/main/webapp/resources/js/index/app.js

@@ -169,6 +169,18 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
             url : "/purcinquiry",
             templateUrl : "static/tpl/index/purc/inquiry_new.html",
             controller: 'PurcInquiryCtrl'
+        }).state('purc.inquiry', {
+            url : "/purchaseinquiry",
+            templateUrl : "static/tpl/index/purc/inquiry.html",
+            controller: 'PurchaseInquiryCtrl'
+        }).state('purc.inquiry_detail', {
+            url : "/purcinquirydetail",
+            templateUrl : "static/tpl/index/purc/inquiry_detail.html",
+            controller: 'PurcInquiryDetailCtrl'
+        }).state('purc.inquiry_unapply', {
+            url : "/inquiry_unapply",
+            templateUrl : "static/tpl/index/purc/inquiry_unapply.html",
+            controller: 'UnapplyInquiryCtrl'
         }).state('sale.tenderlist', {
             url : "/tender",
             templateUrl : "static/tpl/index/sale/tenderlist.html",
@@ -803,7 +815,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
     /**
      * 顶部搜索
      */
-	app.controller('TopSearchCtrl', ['$scope', '$rootScope', 'getAccountUserSpace', 'ngTableParams', 'toaster', 'BaseService', 'AddPartner', '$filter', '$stateParams', 'SearchProd', '$sce', function($scope, $rootScope, getAccountUserSpace, ngTableParams, toaster, BaseService, AddPartner, $filter, $stateParams, SearchProd, $sce) {
+	app.controller('TopSearchCtrl', ['$scope', '$rootScope', 'getAccountUserSpace', 'ngTableParams', 'toaster', 'BaseService', 'AddPartner', '$filter', '$stateParams', 'SearchProd', '$sce', '$modal', 'InvitationRecord', function($scope, $rootScope, getAccountUserSpace, ngTableParams, toaster, BaseService, AddPartner, $filter, $stateParams, SearchProd, $sce, $modal, InvitationRecord) {
 		BaseService.scrollBackToTop();
 		$scope.active = 'all';
 		$scope.tip = $rootScope.searchKeyword;
@@ -901,6 +913,47 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			$rootScope.prodId = id;
 			window.location.hash = "#/purc/addOrder";
 		}
+		
+		/**
+		 * 邀请注册商务平台
+		 */
+		$scope.invite = function(name) {
+			var modalInstance = $modal.open({
+				animation: true,
+				templateUrl: 'static/tpl/index/search/enterpirseInfo.html',
+				controller: 'InviteCtrl',
+				resolve: {
+					enname: function(){return name}
+				}
+			});
+			modalInstance.result.then(function(data) {
+				InvitationRecord.invite({formStore: data}, {}, function(data) {
+					if(data.success) {
+						toaster.pop('success', '提示', data.success);
+					}
+					if(data.error) {
+						toaster.pop('error', '提示', data.error);
+					}
+				}, function(response) {
+					toaster.pop('error', '提示', response.data);
+				});
+			});
+		}
+	
+	}]);
+	
+	app.controller('InviteCtrl', ['$scope', 'toaster', '$modalInstance', 'enname', function($scope, toaster, $modalInstance, enname) {
+		$scope.enter = {
+			vendname: enname	
+		};
+		
+		$scope.save = function(enter) {
+			$modalInstance.close(enter);
+		}
+		
+		$scope.cancel = function() {
+			$modalInstance.dismiss();
+		}
 	}]);
 	
 	app.controller('AuthCtrl', ['$scope', '$window', 'AuthenticationService', 'toaster', 'BaseService', '$modal', function($scope, $window, AuthenticationService, toaster, BaseService, $modal) {
@@ -2484,7 +2537,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 	}]);
 	
 	// 平台新增的询价单
-	app.controller('PurcInquiryCtrl', ['$scope', 'PurchaseInquiry', 'toaster', 'BaseService', '$upload', '$filter', '$modal', '$rootScope', 'ngTableParams', 'GetProductInfo', function($scope, PurchaseInquiry, toaster, BaseService, $upload, $filter, $modal, $rootScope, ngTableParams, GetProductInfo) {
+	app.controller('PurcInquiryCtrl', ['$scope', 'PurchaseInquiry', 'toaster', 'BaseService', '$upload', '$filter', '$modal', '$rootScope', 'ngTableParams', 'GetProductInfo', '$timeout', function($scope, PurchaseInquiry, toaster, BaseService, $upload, $filter, $modal, $rootScope, ngTableParams, GetProductInfo, $timeout) {
 		BaseService.scrollBackToTop();
 		$scope.active = 'all';
 		var getService = function() {
@@ -2627,22 +2680,291 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 //    			toaster.pop('error', '操作失败', data.error);
 //    		});    
         	PurchaseInquiry.save({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
-        		
+        		if(data.success) {
+        			toaster.pop('success', '提示', data.success);
+        			$timeout(function() {
+        				window.loaction.hash = "#/purc/inquiry_unapply";
+        			}, 500);
+        		}
+        		if(data.error) {
+        			toaster.pop('error', '提示', data.error);
+        		}
         	}, function(response) {
-        		
+        		toaster.pop('error', '提示', response.data);
         	});
     	}
         
         // 保存并提交
         $scope.submit = function() {
         	PurchaseInquiry.submit({inquiry: $scope.inquiry}, $scope.vendors, function(data) {
-        		
+        		if(data.success) {
+        			toaster.pop('success', '提示', data.success);
+        			$timeout(function() {
+        				window.loaction.hash = "#/purc/purchaseinquiry";
+        			}, 500);
+        		}
+        		if(data.error) {
+        			toaster.pop('error', '提示', data.error);
+        		}
         	}, function(response) {
-        		
+        		toaster.pop('error', '提示', response.data);
         	});
     	}
 	}]);
 
+	// 平台询价单(已提交)
+	app.controller('PurchaseInquiryCtrl', ['$scope', '$filter', 'ngTableParams', 'toaster', 'BaseService', 'PurchaseInquiry', function($scope, $filter, ngTableParams, toaster, BaseService, PurchaseInquiry) {
+		
+		BaseService.scrollBackToTop();
+		$scope.active = 'todo';
+		$scope.agreedText = '全部';
+		$scope.dateZoneText = '一个月内';
+		$scope.condition = {dateZone: 1};
+		$scope.changeAgreed = function(agreed) {
+			$scope.condition.agreed = agreed;
+			$scope.agreedText = typeof agreed == 'undefined' ? '全部' : (agreed == 1 ? '已采纳' : '未采纳');
+			$scope.condition.$agreedOpen = false;
+		};
+		$scope.changeDateZone = function(zone) {
+			$scope.condition.dateZone = zone;
+			$scope.dateZoneText = typeof zone == 'undefined' ? '半年前' : (zone == 1 ? '一个月内' : '半年内');
+			$scope.condition.$dateZoneOpen = false;
+		};
+		
+		$scope.setActive = function(state) {
+			if($scope.active != state ) {
+				$scope.active = state;
+				if ($scope.tableParams.page() == 1) {
+					$scope.tableParams.reload();
+				} else {
+					$scope.tableParams.page(1);
+				}
+			}
+		}
+		
+		var getService = function() {
+			return PurchaseInquiry;
+		};
+
+		$scope.tableParams = new ngTableParams({
+			page : 1, 
+			count : 5,
+			sorting: {
+                'inquiry.date': 'desc',
+                '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.keyword = $scope.keyword;
+				if ($scope.active == 'overdue') {
+					$scope.active = 'end';
+				}
+				getService()[getState($scope.active)].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.openDatePicker = function($event, item, openParam) {
+			$event.preventDefault();
+		    $event.stopPropagation();
+		    item[openParam] = !item[openParam];
+		};
+		
+		// 搜索框回车
+		$scope.onSearch = function() {
+			$scope.tableParams.page(1);
+			$scope.tableParams.reload();
+		};
+		
+		// 采纳
+		$scope.accept = function(id) {
+			PurchaseInquiry.accept({id: id}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+				}
+				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);
+				}
+				if(data.error) {
+					toaster.pop('error', '提示', data.error);
+				}
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			})
+		}
+	}]);
+	
+	// 平台询价单(未提交)
+	app.controller('UnapplyInquiryCtrl', ['$scope', 'PurchaseInquiry', 'ngTableParams', 'BaseService', 'toaster', function($scope, PurchaseInquiry, ngTableParams, BaseService, toaster) {
+		BaseService.scrollBackToTop();
+		$scope.tableParams = new ngTableParams({
+			page : 1, 
+			count : 5,
+			sorting: {
+                'inquiry.date': 'desc',
+                '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 = {};
+				if ($scope.active == 'overdue') {
+					$scope.active = 'end';
+				}
+				PurchaseInquiry.getUnapply(null, BaseService.parseParams(pageParams), function(page){
+					$scope.loading = false;
+					if(page) {
+						params.total(page.totalElements);
+						$defer.resolve(page.content);
+					}
+				}, function(response){
+					$scope.loading = false;
+					toaster.pop('error', '数据加载失败', response.data);
+				});
+			}
+		});
+		
+		// 删除明细
+		$scope.deleteById = function(id) {
+			PurchaseInquiry.deleteById({id: id}, {}, function(data) {
+				toaster.pop('success', '提示', '删除成功');
+				$scope.tableParams.reload();
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
+		
+		// 删除主表
+		$scope.clearOrder = function(id) {
+			PurchaseInquiry.clearOrder({id: id}, {}, function(data) {
+				toaster.pop('success', '提示', '删除成功');
+				$scope.tableParams.reload();
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
+		
+		// 提交
+		$scope.submit = function(id) {
+			PurchaseInquiry.submitUnapply({id: id}, {}, function(data) {
+				toaster.pop('success', '提示', '单据提交成功');
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			})
+		}
+	}]);
+	// 询价单明细
+	app.controller('PurcInquiryDetailCtrl', ['$scope', '$stateParams', 'PurcInquiry','$filter', 'toaster', function($scope, $stateParams, PurcInquiry,$filter, toaster){
+		var loadData = function() {
+			PurcInquiry.getAll({id: $stateParams.id}, function(data){
+				$scope.newinquiryItems = data;
+				var inquiry = data[0].inquiry;
+				//inquiry.inquiryItems = data;
+				angular.forEach(inquiry.attachs, function(attach){
+					attach.type = attach.name.substr(attach.name.lastIndexOf('.')+1);
+				});
+				$scope.inquiry = inquiry;
+			});
+		};
+		loadData();
+		$scope.getMinDate = function(item) {
+			return $filter('date')(item.inquiry.date, 'yyyy-MM-dd');
+		};
+		
+		$scope.addStep = function(inquiryItem) {
+			if(inquiryItem.replies.length >= 10) {
+				toaster.pop('warning', '提示', '最多支持10个分段!');
+			} else
+				inquiryItem.replies.push({});
+		};
+		
+		$scope.removeStep = function(inquiryItem, stepIndex) {
+			inquiryItem.replies.splice(stepIndex, 1);
+		};
+		
+		$scope.openDatePicker = function($event, item, openParam) {
+			$event.preventDefault();
+		    $event.stopPropagation();
+		    item[openParam] = !item[openParam];
+		};
+		
+		$scope.getHistory = function(item) {
+			if(!item.history) {
+				PurcInquiry.getHistory({itemId: item.id}, function(data){
+					item.history = data;
+				});
+			}
+		};
+		
+		$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){
+				bool = (i > 0 ? r.lapQty : 1) && r.price;
+			});
+			return bool;
+		};
+		
+		$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 = [];
+			angular.forEach(item.replies, function(r, i){
+				if((i > 0 ? r.lapQty : 1) || r.price)
+					replies.push(r);
+			});
+			item.replies = replies;
+			if(withSteps) {
+				PurcInquiry.reply({itemId: item.id}, item, function(){
+					toaster.pop('info', '提示', '报价成功');
+					loadData();
+				}, function(response){
+					toaster.pop('error', '报价失败', response.data);
+				});
+			}
+		};
+	}]);
+	
 	// 模具询价管理 
 	app.controller('SaleInquiryMouldCtrl',['$scope', '$filter', 'PurcInquiryMould', 'ngTableParams', 'toaster', 'BaseService', '$upload', function($scope, $filter, PurcInquiryMould, ngTableParams, toaster, BaseService, $upload){
 		BaseService.scrollBackToTop();

+ 7 - 0
src/main/webapp/resources/js/index/services/BaseInfo.js

@@ -334,5 +334,12 @@ define(['ngResource'], function() {
 				isArray: false,
 			}
 		})
+	}]).factory('InvitationRecord', ['$resource', function($resource) {
+		return $resource('invitationrecord', {}, {
+			invite: {
+				url: 'invitationrecord/invite',
+				method: 'POST'
+			}
+		})
 	}]);
 });

+ 37 - 0
src/main/webapp/resources/tpl/index/search/enterpirseInfo.html

@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="UTF-8"/>
+	<title>B2B商务账号设置-个人信息</title>
+	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
+	<meta name="Keywords" content=""/>
+	<meta name="Description" content=""/>
+	<link rel="stylesheet" href="static/css/add.css "/>
+</head>
+<style>
+.bomb-box .box01 {
+	height: 320px;
+	width: 370px;
+}
+.modal-content{
+	border: none;
+}
+</style>
+<body>
+<!--B2B商务账号设置-个人信息-->
+<div class="bomb-box">
+	<div class="box01 box" >
+		<p>邀请合作伙伴</p>
+		<form class="per-data" name="contactInfo" id="contactInfo">
+			<ul>
+				<li><em>企业名称</em><input type="text" placeholder="企业名称" ng-model="enter.vendname" required="true" ng-pattern="/^[\u4e00-\u9fa5]{1,6}$|^[\dA-Za-z]{1,12}$/"></li>
+				<li><em>姓名</em><input type="text" placeholder="客户姓名"  ng-model="enter.vendusername"></li>
+				<li><em>手机</em><input type="text" placeholder="手机" ng-model="enter.vendusertel" required="true" ng-pattern="/^1(3|4|5|7|8)\d{9}$/"></li>
+				<li><em>邮箱</em><input type="email" placeholder="邮箱" ng-model="enter.venduseremail" ng-pattern="/^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/"/></li>
+				<li class="per-btn"><button ng-click="save(enter)" class="save">邀请</button><a ng-click="cancel()" class="mod-psd">取消</a></li>
+			</ul>
+		</form>
+	</div>
+</div>
+</body>
+</html>

+ 6 - 0
src/main/webapp/resources/tpl/index/search/search_result.html

@@ -195,12 +195,18 @@
 #resultTop a i{
 	margin-left: 5px;
 }
+
+#topSearch a {
+	margin-left: 100px;
+	border-radius: 0;
+}
 </style>
 <div class="block" style="margin-left: -240px; width: 1170px;">
 	<div class="tip-body">
 	 	<div id="topSearch">
 	 		<span class="text-muted"><i class="fa fa-search fa-lg"></i> 搜索"{{tip}}",为您找到结果:</span>
 	 		企业{{total}}家;物料{{prodtotal}}个
+	 		<a class="btn btn-danger" ng-click="invite(tip)" ng-if="total == 0">邀请合作伙伴</a>
 	 	</div>
 	</div>
 	<div class="loading in" ng-class="{'in': loading}">