wuwen 5 лет назад
Родитель
Сommit
5b36ca5c40

+ 10 - 0
src/main/java/com/ssj/bean/sys/fx/domain/Merchant.java

@@ -106,6 +106,8 @@ public class Merchant extends BaseEntity {
 	
 	private Date activeTime;
 	
+	private Date endActiveTime;
+	
 	private Date computeTime;
 	
 
@@ -457,6 +459,14 @@ public class Merchant extends BaseEntity {
 	public void setPortNumOdd(Integer portNumOdd) {
 		this.portNumOdd = portNumOdd;
 	}
+
+	public Date getEndActiveTime() {
+		return endActiveTime;
+	}
+
+	public void setEndActiveTime(Date endActiveTime) {
+		this.endActiveTime = endActiveTime;
+	}
 	
 	
 

+ 25 - 0
src/main/java/com/ssj/framework/basic/utils/DateHelper.java

@@ -921,5 +921,30 @@ public class DateHelper {
 	 }
 	 
 
+	 public static int getDifferMonth(Date start, Date end) {
+	      if(end.getTime()<start.getTime()) {
+	    	  return 0;
+	      }
+	      int i=1;
+	      while (true) {
+	    	  Calendar startCalendar = Calendar.getInstance();
+	    	  startCalendar.setTime(start);
+	    	  startCalendar.add(Calendar.MONTH, i);
+	    	  if(startCalendar.getTime().getTime()>end.getTime()) {
+	    		  break;
+	    	  }
+	    	  i=i+1;
+	      }
+	      return i;
+	  }
+	 
+	 
+	 public static void main(String[] args) throws ParseException {
+		
+		 DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+		 System.out.println(getDifferMonth(format.parse("2020-12-01"), format.parse("2020-05-15")));
+		 
+	}
+	 
 
 }

+ 4 - 0
src/main/java/com/ssj/service/sys/fx/service/MerchantService.java

@@ -21,6 +21,10 @@ public interface MerchantService extends BaseService<Merchant, String> {
 	Response saveMerchantByNew(Merchant merchant,String startTime,String endTime,String startActiveTimeStr,String activeTimeStr,String computeTimeStr
     		,String password,String province,String city,String area,String schoollist,String location,Admin curadmin);
 	
+	//保存新模式的商户
+	Response saveMerchantByNew_Sc(Merchant merchant,String startTime,String endTime,String activeTimeStr,String endActiveTimeStr
+    		,String password,String province,String city,String area,String schoollist,String location,Admin curadmin);
+	
 	//导入商户数据,生成帐号
 	String importMerchants(List<Merchant> list,Map<String,String> password);
 	

+ 340 - 1
src/main/java/com/ssj/service/sys/fx/service/impl/MerchantServiceImpl.java

@@ -1757,6 +1757,345 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 		response.success();
 		return response;
 	}
+	
+	
+
+
+	@Override
+	public Response saveMerchantByNew_Sc(Merchant merchant, String startTime, String endTime,
+			String activeTimeStr, String endActiveTimeStr, String password, String province, String city, String area,
+			String schoollist, String location, Admin curadmin) {
+		Response response=new Response();
+		
+		if(StringUtils.isNotEmpty(merchant.getId())){
+				
+				boolean isSignType=false;//修改了服务包
+				boolean isServiceMonth=false;//修改了月份
+				
+				Merchant oldmerchant =this.getById(merchant.getId());
+				
+				//发生了旧转新,记录旧模式的币,端,当前时间。
+				if(oldmerchant.getSignType()==0) {
+					oldmerchant.setLibServiceOdd(oldmerchant.getLibService());
+					oldmerchant.setPortNumOdd(oldmerchant.getPortNum());
+					oldmerchant.setChangeTime(new Date());
+				}
+				
+				if(StringUtils.isNotEmpty(merchant.getLibId())) {
+					Merchant libMerchant=this.getMerchantByLibId(merchant.getLibId());
+					if(libMerchant!=null && !libMerchant.getId().equals(merchant.getId())) {
+						response.failure("您选择的机构已绑定其它商户,不可重复绑定。");
+				        return response;
+					}
+				}
+				
+				//旧的月份
+				Integer oldMonth=oldmerchant.getLibServiceMonth();
+				
+				if(!oldmerchant.getSignType().equals(merchant.getSignType())) {
+					isSignType=true;
+				}
+
+				oldmerchant.setDeputyName(merchant.getDeputyName());
+				oldmerchant.setDeputyPhone(merchant.getDeputyPhone());
+				oldmerchant.setLegalPerson(merchant.getLegalPerson());
+				oldmerchant.setLevel(merchant.getLevel());
+				oldmerchant.setPhone(merchant.getPhone());
+				oldmerchant.setPrice(merchant.getPrice());
+				oldmerchant.setOutPrice(merchant.getOutPrice());
+				oldmerchant.setStatus(merchant.getStatus());
+				oldmerchant.setRemarks(merchant.getRemarks());
+				oldmerchant.setUnitName(merchant.getUnitName());
+				oldmerchant.setSignService(merchant.getSignService());
+				oldmerchant.setType(merchant.getType());
+				oldmerchant.setHardwareService(merchant.getHardwareService());
+				oldmerchant.setHardwarePrice(merchant.getHardwarePrice());
+				oldmerchant.setAddress(merchant.getAddress());
+				oldmerchant.setMealType(merchant.getMealType());
+				oldmerchant.setLibServiceMonth(merchant.getLibServiceMonth());
+				oldmerchant.setLocation(location);
+				
+				//合同日期
+				if(StringUtils.isNotEmpty(startTime)) {
+					oldmerchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
+				}
+				
+				//合同日期
+				if(StringUtils.isNotEmpty(endTime)) {
+					oldmerchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
+				}
+				
+				//激活结束日期,初始化下一个结算日。
+				if(StringUtils.isNotEmpty(activeTimeStr)) {
+					oldmerchant.setStartActiveTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
+					oldmerchant.setActiveTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
+					
+					oldmerchant.setCurSummaryTime(oldmerchant.getActiveTime());//当前结算日为激活结束日期
+					oldmerchant.setNextSummaryTime(DateHelper.getMonthDate(oldmerchant.getCurSummaryTime(),1));//下一个结算日为激活结束日期+1月
+				}
+				
+				if(StringUtils.isNotEmpty(endActiveTimeStr)) {
+					oldmerchant.setEndActiveTime(DateHelper.parseDate(endActiveTimeStr, "yyyy-MM-dd"));
+				}
+				
+				Integer month=DateHelper.getDifferMonth(oldmerchant.getActiveTime(), oldmerchant.getEndActiveTime());
+				oldmerchant.setLibServiceMonth(month);
+				
+				if(!oldMonth.equals(month)) {
+					isServiceMonth=true;
+				}
+				
+				//重新关联学校
+				if(StringUtils.isNotEmpty(schoollist)) {
+					//删除所有关联的学校
+					List<MerchantArea> merchantAreas=merchantAreaService.findSchoolByMerchantList(merchant.getId());
+					for (MerchantArea merchantArea : merchantAreas) {
+						merchantAreaService.delete(merchantArea);
+					}
+					
+					merchantAreas=new ArrayList<MerchantArea>();
+					String[] areaIds=schoollist.split(";");
+					for (String areaId : areaIds) {
+						MerchantArea merchantArea=new MerchantArea();
+						merchantArea.setCnAreaId(areaId);
+						merchantArea.setCreateTime(new Date());
+						merchantArea.setMerchantId(merchant.getId());
+						merchantArea.setSchoolName(cnAreaService.getById(areaId).getName());
+						merchantAreas.add(merchantArea);
+					}
+					merchantAreaService.save(merchantAreas);
+				}
+				
+				//如果修改了套餐的模式,就重新处理数据 加油包
+				if(!oldmerchant.getSignType().equals(merchant.getSignType())) {
+					List<MerchantSign> merchantSigns=merchantSignService.findMerchantSignByMerchantIdGTTime(
+							oldmerchant.getId(),
+							oldmerchant.getComputeTime()!=null ? oldmerchant.getComputeTime() : oldmerchant.getActiveTime(),
+							0);
+					Integer signNum=0;
+					for (MerchantSign merchantSign : merchantSigns) {
+						signNum=signNum+merchantSign.getLibService();
+					}
+					switch (merchant.getSignType()) {
+						case 1:
+							oldmerchant.setLibService(30+signNum);
+							oldmerchant.setPortNum(200);
+							break;
+						case 2:
+							oldmerchant.setLibService(50+signNum);
+							oldmerchant.setPortNum(200);
+							break;
+						case 3:
+							oldmerchant.setLibService(100+signNum);
+							oldmerchant.setPortNum(400);
+							break;
+						case 4:
+							oldmerchant.setLibService(20+signNum);
+							oldmerchant.setPortNum(200);
+							break;
+						case 5:
+							oldmerchant.setLibService(merchant.getLibService());
+							oldmerchant.setPortNum(400);
+							break;
+						default:
+							oldmerchant.setLibService(0);
+							oldmerchant.setPortNum(0);
+							break;
+					}
+					oldmerchant.setSignType(merchant.getSignType());//更新套餐
+				}
+				this.save(oldmerchant);
+				
+				if(isSignType || isServiceMonth) {
+					//记录套餐更改记录
+					for (int i = oldMonth+1; i <= month; i++) {
+						TbLibJoinConsume consume=new TbLibJoinConsume();
+						consume.setToLibId(merchant.getLibId());
+						consume.setToMerchantId(merchant.getId());
+						consume.setLibService(oldmerchant.getLibService());
+						consume.setPlatformService(0);
+						consume.setType(6);
+						consume.setSignType(merchant.getSignType());
+						consume.setComputeNum(merchant.getCurIsSummary());
+						consume.setRemarks("服务包开通【服务包开通:第"+i+"月】");
+						consume.setCreateTime(new Date());
+						libJoinConsumeService.save(consume);
+					}
+				}
+				
+				//调用openApi接口
+				if(StringUtils.isNotEmpty(oldmerchant.getLibId())) {
+					DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+					libVipServiceService.openApiServiceCRM(
+							3,
+							oldmerchant.getLibId(), 
+							oldmerchant.getSignType(),
+							oldmerchant.getMealType(),
+							oldmerchant.getLibService(),
+							oldmerchant.getActiveTime()!=null ? format.format(oldmerchant.getActiveTime()) : "",
+							oldmerchant.getActiveTime()!=null ? format.format(oldmerchant.getActiveTime()) : "",
+							oldmerchant.getEndActiveTime()!=null ? format.format(oldmerchant.getEndActiveTime()) : ""
+							);
+				}
+				this.syncRecordByMerchant(curadmin.getLoginName(), oldmerchant.getId(),"", "修改套餐商户");
+				
+		}else{
+				Merchant posMerchant =this.getMerchantByPosCode(merchant.getPosCode());
+				if(posMerchant!=null) {
+					response.failure("商户账号不得包含已经创建的商户账号,请重新填写账号。");
+			        return response;
+				}
+				List<Merchant> posCodeMerchants=this.getMerchantByLikePosCode(merchant.getPosCode());
+				if(posCodeMerchants!=null && posCodeMerchants.size()>0){
+					response.failure("商户账号不得包含已经创建的商户账号,请重新填写账号。");
+			        return response;
+				}
+				if(StringUtils.isNotEmpty(merchant.getLibId())) {
+					Merchant libMerchant=this.getMerchantByLibId(merchant.getLibId());
+					if(libMerchant!=null) {
+						response.failure("您选择的机构已绑定其它商户,不可重复绑定。");
+				        return response;
+					}
+				}			
+				Admin admin=adminService.getByLoginName(merchant.getPosCode());
+				if(admin!=null){
+					response.failure("商户账号已存在");
+			        return response;
+				}
+				
+				merchant.setLocation(location);
+				merchant.setPortNum(0);
+				merchant.setPlatformService(0);
+				merchant.setHardwareService(0);
+				merchant.setHardwarePrice((double)0);
+				merchant.setCreateTime(new Date());
+				merchant.setSaleLoginName(curadmin.getLoginName());
+				merchant.setCurIsSummary(0);
+				
+				if(StringUtils.isNotEmpty(activeTimeStr)) {
+					merchant.setStartActiveTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
+					merchant.setActiveTime(DateHelper.parseDate(activeTimeStr, "yyyy-MM-dd"));
+					
+					merchant.setCurSummaryTime(merchant.getActiveTime());//当前结算日为激活结束日期
+					merchant.setNextSummaryTime(DateHelper.getMonthDate(merchant.getCurSummaryTime(),1));//下一个结算日为激活结束日期+1月
+				}
+				if(StringUtils.isNotEmpty(endActiveTimeStr)) {
+					merchant.setEndActiveTime(DateHelper.parseDate(endActiveTimeStr, "yyyy-MM-dd"));
+				}
+				
+				Integer month=DateHelper.getDifferMonth(merchant.getActiveTime(), merchant.getEndActiveTime());
+				merchant.setLibServiceMonth(month);
+							
+				if(StringUtils.isNotEmpty(startTime)) {
+					merchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
+				}
+				if(StringUtils.isNotEmpty(endTime)) {
+					merchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
+				}
+				
+				String code="SSJ-FX";
+				if(StringUtils.isNotEmpty(merchant.getParentPosCode())){
+					Merchant pMerchant =this.getMerchantByPosCode(merchant.getParentPosCode());
+					code=pMerchant.getOrgCode()+"-"+merchant.getPosCode();
+				}else{
+					code=code+"-"+merchant.getPosCode(); 
+				}
+				merchant.setOrgCode(code);
+				
+				switch (merchant.getSignType()) {
+					case 1:
+						merchant.setLibService(30);
+						merchant.setPortNum(200);
+						break;
+					case 2:
+						merchant.setLibService(50);
+						merchant.setPortNum(200);
+						break;
+					case 3:
+						merchant.setLibService(100);
+						merchant.setPortNum(400);
+					case 4:
+						merchant.setLibService(20);
+						merchant.setPortNum(200);
+						break;
+					case 5:
+						merchant.setLibService(merchant.getLibService());
+						merchant.setPortNum(400);
+						break;
+					default:
+						merchant.setLibService(0);
+						merchant.setPortNum(0);
+						break;
+				}
+				
+				//添加admin用户信息
+				admin=new Admin();
+				admin.setLoginName(merchant.getPosCode());
+				admin.setNickName(merchant.getPosCode());
+				admin.setCreateTime(new Date());
+				admin.setPassword(MD5.getMD5(password.getBytes()));
+				admin.setStatus(1);
+				admin=adminService.save(admin);
+				
+				//添加商户的权限
+				roleService.saveAdminRole(admin.getId(), "eadc6389-6a29-4864-bce6-a18b30e0a998");
+				
+				//保存商户信息
+				merchant=this.save(merchant);
+				
+				if(StringUtils.isNotEmpty(schoollist)) {
+					List<MerchantArea> merchantAreas=new ArrayList<MerchantArea>();
+					String[] areaIds=schoollist.split(";");
+					for (String areaId : areaIds) {
+						MerchantArea merchantArea=new MerchantArea();
+						merchantArea.setCnAreaId(areaId);
+						merchantArea.setCreateTime(new Date());
+						merchantArea.setMerchantId(merchant.getId());
+						merchantAreas.add(merchantArea);
+					}
+					merchantAreaService.save(merchantAreas);
+				}
+
+				//记录开通商户记录
+				for (int i = 1; i <= merchant.getLibServiceMonth(); i++) {
+					TbLibJoinConsume consume=new TbLibJoinConsume();
+					consume.setToLibId(merchant.getLibId());
+					consume.setToMerchantId(merchant.getId());
+					consume.setLibService(merchant.getLibService());
+					consume.setPlatformService(0);
+					consume.setSignType(merchant.getSignType());
+					consume.setType(6);
+					consume.setComputeNum(merchant.getCurIsSummary());
+					consume.setRemarks("服务包开通【服务包开通:第"+i+"月】");
+					consume.setCreateTime(new Date());
+					libJoinConsumeService.save(consume);
+				}
+	
+				//调用openApi接口
+				if(StringUtils.isNotEmpty(merchant.getLibId())) {
+					DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+					libVipServiceService.openApiServiceCRM(
+							3,
+							merchant.getLibId(), 
+							merchant.getSignType(),
+							merchant.getMealType(),
+							merchant.getLibService(),
+							merchant.getActiveTime()!=null ? format.format(merchant.getActiveTime()) : "",
+									merchant.getActiveTime()!=null ? format.format(merchant.getActiveTime()) : "",
+											merchant.getEndActiveTime()!=null ? format.format(merchant.getEndActiveTime()) : ""
+							);
+				}
+	
+				this.syncRecordByMerchant(curadmin.getLoginName(), merchant.getId(),"", "新增套餐商户");
+		}
+		
+		response.success();
+		return response;
+	}
+	
+	
+	
+	
 
 	@Override
 	public List<Merchant> findMerchantSignByAll() {
@@ -1772,7 +2111,7 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 	public List<Merchant> findMerchantSignByComputeTime() {
 		return dao.findMerchantSignByComputeTime();
 	}
-	
+
 
 }
 

+ 76 - 0
src/main/java/com/ssj/sys/controller/FxController.java

@@ -746,6 +746,53 @@ public class FxController  extends BaseController {
     }
 	
 	
+	
+	@RequestMapping("/merchantAdd_sc")
+    public String merchantAddSchool(Model model,String id)throws Exception {
+		
+		HttpSession session = request.getSession();
+		Admin admin =(Admin) session.getAttribute("admin");
+		Merchant curMerchant=merchantService.getMerchantByPosCode(admin.getLoginName());
+		
+		Merchant merchant=new Merchant();
+		List<PositionSchoolV1Dto> positionSchoolV1Dtos=new ArrayList<PositionSchoolV1Dto>();
+		String schoolText="";
+		
+		if(StringUtils.isNotEmpty(id)){
+			merchant=merchantService.getById(id);
+			
+			if(merchant!=null && StringUtils.isNotEmpty(merchant.getLibId())) { 
+				 positionSchoolV1Dtos= merchantAreaService.findSchoolList(merchant.getLibId());
+				 if(positionSchoolV1Dtos!=null) {
+					 for (PositionSchoolV1Dto positionSchoolV1Dto : positionSchoolV1Dtos) {
+						 schoolText=schoolText+positionSchoolV1Dto.getSchoolName()+";";
+					 }
+					 if(schoolText.endsWith(";")) {
+						 schoolText=schoolText.substring(0, schoolText.length()-1);
+					 }
+				 }
+			}
+			
+		}
+		List<Merchant> list=merchantService.findMerchantByPage();
+		
+		List<CnArea> areaList = cnAreaService.findByTypeList("1");
+		model.addAttribute("areaList", areaList);
+		
+		List<TbLibJoin> joinList=libJoinService.findAll();
+		
+		model.addAttribute("positionSchoolV1Dtos", positionSchoolV1Dtos);
+		model.addAttribute("schoolText", schoolText);
+		model.addAttribute("joinList", joinList);
+		model.addAttribute("poslist", list);
+		model.addAttribute("merchant", merchant);
+		model.addAttribute("minDate", merchant.getSignTime()!=null ? merchant.getSignTime() : new Date());
+		model.addAttribute("curMerchant", curMerchant);
+        return "sys/fx/merchantAdd_sc";
+    }
+	
+	
+	
 	@RequestMapping("/merchantInfo")
     public String merchantInfo(Model model,String id)throws Exception {
 		
@@ -1451,6 +1498,35 @@ public class FxController  extends BaseController {
     }
 	
 	
+	@RequestMapping("/saveMerchant_sc")
+	@ResponseBody
+    public Response saveMerchantSc(Model model,Merchant merchant,String startTime,String endTime,String activeTimeStr,String endActiveTimeStr
+    		,String password,String province,String city,String area,String schoollist,String location)throws Exception {
+		Response response = new  Response();
+		HttpSession session = request.getSession();
+		Admin curadmin =(Admin) session.getAttribute("admin");
+		
+		//签约模式
+		if(merchant.getSignType().equals(0)) {
+			
+	        return merchantService.saveMerchantByUsed(merchant, startTime, endTime, password, province, city, area, schoollist, location, curadmin);
+		}else {
+			
+			if(StringUtils.isEmpty(activeTimeStr)) {
+				response.failure("试用开始时间不可为空");
+		        return response;
+			}
+			if(StringUtils.isEmpty(endActiveTimeStr)) {
+				response.failure("试用结束时间不可为空");
+		        return response;
+			}
+	        return merchantService.saveMerchantByNew_Sc(merchant, startTime, endTime,activeTimeStr, endActiveTimeStr, password, province, city, area, schoollist, location, curadmin);
+		}
+    }
+	
+	
+	
+	
 	
 	@RequestMapping("/merchant/untying")
 	@ResponseBody

+ 2 - 2
src/main/resources/templates/sys/fx/merchantAdd.html

@@ -153,7 +153,7 @@ dtext{
 						<option value="5" th:selected="${merchant.signType==5 ? true : false}" th:data-val="${merchant.libService!=null ? merchant.libService : 0}" >服务包5</option>
 					</select>
 				</div>
-				<text th:if="${merchant.id!=null}"  style="width: 230px;color:red">[修改套餐模式,不会影响加油包有效性 ]</text>
+				<text th:if="${merchant.id!=null}"  style="width: 230px;color:red">[ 修改套餐模式,不会影响加油包有效性 ]</text>
 			</li>
 			
 			<li>
@@ -167,7 +167,7 @@ dtext{
 			<li>
 				<label><b >【服务包模式】</b>充值月份数:<b>*</b></label>
 				<input type="number" id="libServiceMonth" min="0" class="dfinput fl" name="libServiceMonth" th:value="${merchant.libServiceMonth!=null ? merchant.libServiceMonth : 0}" autocomplete="off"/>
-				<text th:if="${merchant.id!=null}"  style="width: 230px;color:red">[增量添加数值为续费开通 ]</text>
+				<text th:if="${merchant.id!=null}"  style="width: 230px;color:red">[ 增量添加数值为续费开通 ]</text>
 			</li>
 			
 			<li>

+ 834 - 0
src/main/resources/templates/sys/fx/merchantAdd_sc.html

@@ -0,0 +1,834 @@
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+<title>私塾家</title>
+<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
+<script th:include="sys/common/metaJS" th:remove="tag"></script> 
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/city.json.js}"></script>
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/citySetMe_V.js}"></script>
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/Popt.js}"></script>
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
+</head>
+ <style type="text/css">
+   body{min-width:180px;}
+       .select1{
+   		    width:100%;
+		    height: 32px;
+		    line-height: 32px;
+		    border-top: solid 1px #a7b5bc;
+		    border-left: solid 1px #a7b5bc;
+		    border-right: solid 1px #ced9df;
+		    border-bottom: solid 1px #ced9df;
+		    opacity:1;
+	        margin-bottom: 10px;
+    	}
+    	.btn{
+    	  width: 100px;
+    	}
+     label.control-label-error {color: Red;}	
+     
+._citys {     background-color: whitesmoke;width: 450px; display: inline-block; border: 2px solid #eee; padding: 5px; position: relative; }
+._citys span { color: #05920a; height: 15px; width: 15px; line-height: 15px; text-align: center; border-radius: 3px; position: absolute; right: 10px; top: 10px; border: 1px solid #05920a; cursor: pointer; }
+._citys0 { width: 95%; height: 34px; line-height: 34px; display: inline-block; border-bottom: 2px solid #05920a; padding: 0px 5px; font-size:14px; font-weight:bold; margin-left:6px; }
+._citys0 li { display: inline-block; line-height: 34px; font-size: 15px; color: #888; width: 80px; text-align: center; cursor: pointer; }
+._citys1 { width: 100%; display: inline-block; padding: 10px 0; }
+._citys1 a { width: 83px; height: 35px; display: inline-block; background-color: #f5f5f5; color: #666; margin-left: 6px; margin-top: 3px; line-height: 35px; text-align: center; cursor: pointer; font-size: 12px; border-radius: 5px; overflow: hidden; }
+._citys1 a:hover { color: #fff; background-color: #05920a; }
+.AreaS { background-color: #05920a !important; color: #fff !important; }
+#school{
+	margin-left: 110px;
+	padding-bottom: 10px;
+}  
+#school span{
+  	min-width: 25%;
+    float: left;
+    margin-bottom: 10px;
+}
+.joinseachform li{
+	width: 50%;
+	margin-right: 0px;
+	padding-right: 0px;
+}
+
+.schoolseachform li{
+	width: 50%;
+	margin-right: 0px;
+	padding-right: 0px;
+}    
+
+dtext{
+	color: red;
+	cursor: pointer;
+}
+.forminfo li label{
+	width: 250px;
+	text-align: right;
+	padding-right: 10px
+}
+  
+</style>
+<body>
+<div class="formbody">
+		<ul class="forminfo">
+			<li style="margin-bottom: 20px">
+				<label>商户账号:<b>*</b></label>
+				<input autocomplete="off"  th:if="${merchant.id==null}" type="text" id="poscode" class="dfinput fl" name="poscode" style="float: left;" th:value="${merchant.posCode}"/>
+				<label th:if="${merchant.id==null}" style="width: 230px;color:red">&nbsp;[提交后无法修改,只可包含字母/数字 ]</label>
+				<input autocomplete="off"  th:if="${merchant.id!=null}" disabled="disabled" type="text" id="poscode" class="dfinput fl" name="poscode" style="float: left;" th:value="${merchant.posCode}"/>
+				<br/>
+			</li>
+			<li th:if="${merchant.id==null}" style="margin-bottom: 20px">
+				<label>初始密码:<b>*</b></label>
+				<input type="text" id="password" class="dfinput fl" name="password"  style="float: left;" value="00000000" autocomplete="off" />
+				
+				<br/>
+			</li>
+			<li>
+				<label>商户名称:合作名称/合作校区<b>*</b></label>
+				<input type="text" id="unitname" class="dfinput fl" name="unitname" th:value="${merchant.unitName}" autocomplete="off" />
+			</li>
+			
+			<li id="location_wrap" >
+				<label th:if="${merchant.location==null || merchant.location==''}">商户区域:<b>*</b></label>
+				<label th:if="${merchant.location!=null && merchant.location!=''}">修改区域:<b>*</b></label>
+				<div class="wrap">
+					<div class="vocation" style="margin-right: 5px; width: 100px">
+						<select name="province" id="province" class="select1" onchange="funcprovince()"> 
+							<option data-type="1" value="" >选择省</option>
+						</select>
+					</div>
+					
+					<div class="vocation" style="margin-right: 5px; width: 100px">
+						<select name="city" id="city" class="select1" onchange="funccity()">
+							<option data-type="2" value="" >选择市</option>
+						</select>
+					</div>
+					
+					<div class="vocation" style="margin-right: 5px; width: 100px">
+						<select name="area" id="area" class="select1" onchange="funcarea()">
+							<option data-type="3" value="" >选择区</option>
+						</select>
+					</div>
+					
+					<div class="vocation" style="margin-right: 5px; width: 130px">
+						<input name="libId" id="libId" class="select1"  type="text" autocomplete="off" onfocus="funcblurlibId()" >
+						<input name="radiolibId" id="radiolibId"  type="hidden" >
+					</div>
+					
+					<div class="vocation" style="margin-right: 5px; width: 130px">
+						<input name="schooltext" id="schooltext" class="select1" autocomplete="off" type="text" onfocus="funcblurschooltext()"  >
+					</div>
+					
+				</div>
+			</li>
+			
+			<li>
+				<label>合同日期:<b >*</b></label>
+				<input type="hidden"  id="minDate" value="2020-01-01" >
+				<input type="text" id="signTime" name="signTime"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'minDate\')}'})" autocomplete="off" th:value="${#dates.format(merchant.signTime, 'yyyy-MM-dd')}" class="scinput date_width " placeholder="合同开始日期">
+				&nbsp;&nbsp;&nbsp;~~&nbsp;&nbsp;
+				<input type="text" id="endSignTime" name="endSignTime"   onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'signTime\')}'})"  autocomplete="off" th:value="${#dates.format(merchant.endSignTime, 'yyyy-MM-dd')}" class="scinput date_width" placeholder="合同结束日期">
+			</li>
+			
+			<li>
+				<label>套餐:套餐类型<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="mealType" id="mealType" class="select1"  > 
+						<option value="0" th:selected="${merchant.mealType==0 ? true : false}">合同签约模式(旧模式)</option>
+						<option value="1" th:selected="${merchant.mealType==1 ? true : false}">优选套餐</option>
+						<option value="2" th:selected="${merchant.mealType==2 ? true : false}">VIP套餐</option>
+						<option value="3" th:selected="${merchant.mealType==3 ? true : false}">尊享套餐</option>
+					</select>
+				</div>
+			</li>
+			
+			<li>
+				<label>套餐:服务包类型<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="signType" id="signType" class="select1"  > 
+						<option value="0" th:selected="${merchant.signType==0 ? true : false}" data-val="0">合同签约模式(旧模式)</option>
+						<option value="1" th:selected="${merchant.signType==1 ? true : false}" data-val="30" >服务包1</option>
+						<option value="2" th:selected="${merchant.signType==2 ? true : false}" data-val="50" >服务包2</option>
+						<option value="3" th:selected="${merchant.signType==3 ? true : false}" data-val="100" >服务包3</option>
+						<option value="4" th:selected="${merchant.signType==4 ? true : false}" data-val="20" >服务包4</option>
+						<option value="5" th:selected="${merchant.signType==5 ? true : false}" th:data-val="${merchant.libService!=null ? merchant.libService : 0}" >服务包5</option>
+					</select>
+				</div>
+				<text th:if="${merchant.id!=null}"  style="width: 230px;color:red">[ 修改套餐模式,不会影响加油包有效性 ]</text>
+			</li>
+			
+			<li>
+				<label>服务包人数:<b>*</b></label>
+				<input type="number" id="libService" min="0" class="dfinput fl" name="libService" th:value="${merchant.libService!=null ? merchant.libService : 0}" autocomplete="off"/>
+				<text id="libServiceTips" style="width: 230px;color:red;display: none;">[ 请输入服务包5的服务人数 ]</text>
+			</li>
+
+			<li>
+				<label>试用开始时间:<b >*</b></label>
+				<input type="text"  class="dfinput fl"  id="activeTime" name="activeTime"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',autoPickDate:true})" autocomplete="off" th:value="${#dates.format(merchant.activeTime, 'yyyy-MM-dd')}" placeholder="试用开始时间日期">
+			</li>
+			
+			<li>
+				<label>试用结束时间:<b >*</b></label>
+				<input type="text"  class="dfinput fl"  id="endActiveTime" name="endActiveTime"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',autoPickDate:true})" autocomplete="off" th:value="${#dates.format(merchant.endActiveTime, 'yyyy-MM-dd')}" placeholder="试用结束时间日期">
+			</li>
+			
+
+			<li>
+				<label>签约数量(练习册用):<b>*</b></label>
+				<input type="text" id="signService" class="dfinput fl" name="signService" th:value="${merchant.signService!=null ? merchant.signService : 0}" autocomplete="off"/>
+			</li>
+			
+			<li>
+				<label>合同硬件采购数量:<b>*</b></label>
+				<input type="text" id="hardwareService" class="dfinput fl" name="hardwareService" th:value="${merchant.hardwareService!=null ? merchant.hardwareService : 0}" autocomplete="off"/>
+			</li>
+			
+			<li >
+				<label>上级渠道<b >*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="parentposcode" id="parentposcode" class="select1" th:disabled="${merchant.id!=null || curMerchant.orgCode ne 'SSJ-FX' ? 'true' : 'false'}" > 
+						<option th:if="${merchant.id==null || merchant.parentPosCode=='' || merchant.parentPosCode==null }" data-orgcode="" data-id="" value="" >无商户上级</option>
+						<option th:each="item:${poslist}" th:selected="${merchant.id==null ?  (curMerchant.posCode  eq item.posCode ? true : false) : (merchant.parentPosCode  eq item.posCode ? true : false)}" th:if="${item.orgCode ne 'SSJ-FX' && #strings.contains(item.orgCode,curMerchant.orgCode) }" th:data-orgcode="${item.orgCode}" th:data-id="${item.id}" th:value="${item.posCode}" th:text="${item.unitName}+' ['+${item.posCode}+']'"></option>
+					</select>
+				</div>
+			</li>
+
+			<li th:if="${curMerchant.orgCode eq 'SSJ-FX'}" >
+				<label>商户级别:<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="level" id="level" class="select1"> 
+						<option value="4" th:selected="${merchant.level==4 ? true : false}">普通</option>
+						<option value="1" th:selected="${merchant.level==1 ? true : false}">市代</option>
+						<option value="2" th:selected="${merchant.level==2 ? true : false}">区代</option>
+						<option value="3" th:selected="${merchant.level==3 ? true : false}">学校独家</option>
+					</select>
+				</div>
+			</li>
+			
+			<li th:if="${curMerchant.orgCode ne 'SSJ-FX'}" >
+				<label>商户级别:<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="level" id="level" class="select1"> 
+						<option value="4" th:if="${curMerchant.level<=1 || curMerchant.level<=2 || curMerchant.level<=3}" th:selected="${merchant.level==4 ? true : false}">普通</option>
+						<option value="2" th:if="${curMerchant.level<=1}" th:selected="${merchant.level==2 ? true : false}">区代</option>
+						<option value="3" th:if="${curMerchant.level<=1 || curMerchant.level<=2}" th:selected="${merchant.level==3 ? true : false}">学校独家</option>
+						
+					</select>
+				</div>
+			</li>
+			
+			
+			<li th:if="${curMerchant.orgCode eq 'SSJ-FX' && curMerchant.posCode ne 'sishujia' }" >
+				<label>商户类型:<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="type" id="type" class="select1"> 
+						<option value="5" th:selected="${merchant.type==5 ? true : false}">直接签约(新模式)</option>
+						<option value="1" th:selected="${merchant.type==1 ? true : false}">直接签约(旧模式)</option>
+						<option value="2" th:selected="${merchant.type==2 ? true : false}">内部消耗</option>
+						<option value="3" th:selected="${merchant.type==3 ? true : false}">外部签约</option>
+						<option value="4" th:selected="${merchant.type==4 ? true : false}">内部不结算(财务)</option>
+						<option value="6" th:selected="${merchant.type==6 ? true : false}">旧转新(新不结算)</option>
+						<option value="7" th:selected="${merchant.type==7 ? true : false}">旧转新(新旧不结算)</option>
+					</select>
+				</div>
+			</li>
+			
+			<li th:if="${curMerchant.orgCode eq 'SSJ-FX-aijia001-ssj001' || curMerchant.posCode eq 'sishujia'}" >
+				<label>商户类型:<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="type" id="type" class="select1"> 
+						<option value="5" th:selected="${merchant.type==5 ? true : false}">直接签约(新模式)</option>
+						
+						<option value="1" th:selected="${merchant.type==1 ? true : false}">直接签约(旧模式)</option>
+						<option value="2" th:selected="${merchant.type==2 ? true : false}">内部消耗</option>
+						<option value="4" th:selected="${merchant.type==4 ? true : false}">内部不结算(财务)</option>
+						
+						<option value="6" th:selected="${merchant.type==6 ? true : false}">旧转新(新不结算)</option>
+						<option value="7" th:selected="${merchant.type==7 ? true : false}">旧转新(新旧不结算)</option>
+					</select>
+				</div>
+			</li>
+			
+			<li th:if="${curMerchant.orgCode ne 'SSJ-FX' && curMerchant.orgCode ne 'SSJ-FX-aijia001-ssj001' && curMerchant.posCode ne 'sishujia' }" >
+				<label>商户类型:<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="type" id="type" class="select1"> 
+						<option value="3" th:selected="${merchant.type==3 ? true : false}">外部签约</option>
+					</select>
+				</div>
+			</li>
+			
+			 <li style="display: none;">
+				<label>签约状态:<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="status" id="status" class="select1"> 
+						<option value="3" th:selected="${merchant.status==3 ? true : false}">已签已交付</option>
+						<option value="1" th:selected="${merchant.status==1 ? true : false}">待签</option>
+						<option value="2" th:selected="${merchant.status==2 ? true : false}">已签待交付</option>
+						
+					</select>
+				</div>
+			</li>
+				
+		    <li>
+				<label>服务包充值金额 / 服务:签约单价<b></b></label>
+				<input type="text" id="price" class="dfinput fl" name="price" th:value="${merchant.price==null ? 0 : merchant.price}" autocomplete="off"/>
+			</li>
+			
+			<li>
+				<label>平台管理费金额<b></b></label>
+				<input type="text" id="outPrice" class="dfinput fl" name="outPrice" th:value="${merchant.outPrice==null ? 0 : merchant.outPrice}" autocomplete="off"/>
+			</li>
+			
+			<li>
+				<label>硬件:签约单价<b></b></label>
+				<input type="text" id="hardwarePrice" class="dfinput fl" name="hardwarePrice" th:value="${merchant.hardwarePrice}" autocomplete="off"/>
+			</li>
+			
+			<li>
+				<label>法人姓名 :<b></b></label>
+				<input type="text" id="legalperson" class="dfinput fl" name="legalperson" th:value="${merchant.legalPerson}" autocomplete="off"/>
+			</li>
+			<li>
+				<label>法人电话:<b></b></label>
+				<input type="text" id="phone" class="dfinput fl" name="phone" th:value="${merchant.phone}" autocomplete="off"/>
+			</li>
+			<li>
+				<label>代表姓名:<b></b></label>
+				<input type="text" id="deputyname" class="dfinput fl" name="deputyname"  th:value="${merchant.deputyName}" autocomplete="off"/>
+			</li>
+			<li>
+				<label>代表电话:<b></b></label>
+				<input type="text" id="deputyphone" class="dfinput fl" name=deputyphone th:value="${merchant.deputyPhone}" autocomplete="off"/>
+			</li>
+		
+			<li>
+				<label>商户备注:<b></b></label>
+				<input type="text" id="remarks" class="dfinput fl" name="remarks"  th:value="${merchant.remarks}" autocomplete="off"/>
+			</li>
+
+			<li>
+				<label>地址:<b></b></label>
+				<input type="text" id="address" class="dfinput fl" name="address"  th:value="${merchant.address}" autocomplete="off"/>
+			</li>
+
+			<li>
+				<label>&nbsp;</label>
+				<button type="submit" onclick="push_user();" class="btn">提交</button>
+				<button type="button" class="btn" onclick="closeWin();">取消</button>
+			</li>
+		</ul>
+		<br/><br/><br/>
+</div>
+
+
+<div class="formbody" id="schoollist" style="display: none">
+	<div class="rightinfo">	
+			<ul class="seachform">
+			    <li>
+				 	<label style="color:red">已选择:</label>
+				 	<sldiv id="selectschoollist">
+					 	<label th:each="item:${positionSchoolV1Dtos}"><sdiv><stext th:data-val="${item.id}">[[${item.schoolName}]]</stext><dtext >[X]</dtext></sdiv></label>
+				 	</sldiv>
+			    </li>
+				
+			</ul>
+	
+	
+			<ul class="seachform">
+			    <li>
+				 	<label>学校名称:</label>
+				 	<input name="likeschoolname" id="likeschoolname" type="text" class="scinput" />
+			    </li>
+				<li>
+					<input type="button" class="scbtn" value="全局查询" onclick="funcblurschoollist()" style="height: 32px;"/>
+				</li>
+			</ul>
+			
+			<ul class="seachform schoolseachform">
+			   
+			</ul>
+			<br/><br/>
+	</div>
+	<div class="pagin" style="float: left;width: 90%;">
+	    	<div class="message">共<i class="blue schoolcountNum">0</i>条记录,当前显示第&nbsp;<i class="blue schoolpageNo">0</i>页</div>
+			    <form id="splitFrom" name="splitFrom" >
+						<input type="hidden" id="pageNo" name="pageNo" value="1">
+						<input type="hidden" id="pageSize" name="pageSize" value="20">
+						<ul class="paginList schoolpaginList">
+							
+						</ul>
+				</form>
+				<br/><br/>
+		</div>
+</div>
+
+
+
+<div class="formbody" id="likejoinlist" style="display: none">
+	<div class="rightinfo">
+			<ul class="seachform">
+			    <li>
+				 	<label>机构名称:</label>
+				 	<input name="likename" id="likename" type="text" class="scinput" />
+			    </li>
+				<li>
+					<input type="button" class="scbtn" value="全局查询" onclick="funcblurlibIdlist()" style="height: 32px;"/>
+				</li>
+			</ul>
+			
+			<ul class="seachform joinseachform">
+			   
+			</ul>
+			<br/><br/>
+	</div>
+	<div class="pagin" style="float: left;width: 90%;">
+	    	<div class="message">共<i class="blue countNum">0</i>条记录,当前显示第&nbsp;<i class="blue pageNo">0</i>页</div>
+			    <form id="splitFrom" name="splitFrom" >
+						<input type="hidden" id="pageNo" name="pageNo" value="1">
+						<input type="hidden" id="pageSize" name="pageSize" value="20">
+						<ul class="paginList joinpaginList">
+							
+						</ul>
+				</form>
+				<br/><br/>
+		</div>
+</div>
+
+
+
+</body>
+<script type="text/javascript">
+
+var areaUrl="[[${sysUrl}]]/sys/fx/areaList";
+var areaPageUrl="[[${sysUrl}]]/sys/fx/areaListPage";
+var likejoinUrl="[[${sysUrl}]]/sys/fx/likejoinList";
+var curLocation="[[${merchant.location}]]";
+var curLibJoin="[[${merchant.libJoin!=null ?  merchant.libJoin.leagueName : '' }]]";
+var curLibJoinId="[[${merchant.libJoin!=null ? merchant.libJoin.id : '' }]]";
+var schoolText="[[${schoolText}]]";
+var id='[[${param.id}]]';
+var merchantLibId='[[${merchant.libId}]]';
+
+
+
+$(function (){
+	$("#location_txt").click(function (){
+		$("#location_wrap").show();
+	})
+	
+	$(".radiolib").on("change",function(){
+	    alert("");
+	});
+	
+	$("#signType").on("change",function(){
+	    var val=$(this).find("option:selected").data("val");
+	    $("#libService").val(val);
+	    if($(this).val()<=4){
+	    	$("#libServiceTips").hide();
+	    }else{
+	    	$("#libServiceTips").show();
+	    }
+	});
+	
+	$("#libService").on("focus",function(){
+		if($("#signType").val()<=4){
+			parent.layer.msg("当前服务包类型不支持修改服务人数",{icon:3});
+		}
+		return;
+	});
+	
+	
+	$("#selectschoollist").on("click","dtext",function(){
+		$(this).parent().remove();
+		
+		var schoollist=[];
+		 $.each($('stext'),function(){
+	       	schoollist.push($(this).text());
+	    });
+	 	$("#schooltext").val(schoollist.join(";"));
+	});
+	
+	funcinitprovince();
+	
+})
+
+
+function funcinitprovince(){
+	var val = 0;
+	var type =1;
+	
+	$("#province").html("<option value='' >选择省</option>");
+	
+	var params ={ 'type' : type,'upId':val}
+	$.post(areaUrl,params,function(data){
+		if(data.meta.success){
+			var html=[];
+			for (var i = 0; i < data.data.length; i++) {
+				html.push("<option "+((curLocation.indexOf(data.data[i].name)!=-1) ? 'selected' : '')+" data-type='"+data.data[i].type+"' value='"+data.data[i].id+"' >"+data.data[i].name+"</option>");
+			}
+			$("#province").append(html.join(""));
+			funcprovince();
+		}else{
+			
+		}
+	});
+}
+
+
+function funcprovince(){
+	var val = $('#province  option:selected').val();
+	var type = $('#province  option:selected').data("type");
+	
+	$("#city").html("<option value='' >选择市</option>");
+	
+	var params ={ 'type' : (type+1),'upId':val}
+	$.post(areaUrl,params,function(data){
+		if(data.meta.success){
+			var html=[];
+			for (var i = 0; i < data.data.length; i++) {
+				html.push("<option "+((curLocation.indexOf(data.data[i].name)!=-1) ? 'selected' : '')+" data-type='"+data.data[i].type+"' value='"+data.data[i].id+"' >"+data.data[i].name+"</option>");
+			}
+			$("#city").append(html.join(""));
+			funccity();
+		}else{
+			
+		}
+	});
+}
+
+function funccity(){
+	var val = $('#city  option:selected').val();
+	var type = $('#city  option:selected').data("type");
+	
+	$("#area").html("<option value='' >选择区</option>");
+	//$("#libId").hide();
+	//$("#school").html("").hide();
+	
+	var params ={ 'type' : (type+1),'upId':val}
+	$.post(areaUrl,params,function(data){
+		if(data.meta.success){
+			var html=[];
+			for (var i = 0; i < data.data.length; i++) {
+				html.push("<option "+((curLocation.indexOf(data.data[i].name)!=-1) ? 'selected' : '')+" data-type='"+data.data[i].type+"' value='"+data.data[i].id+"' >"+data.data[i].name+"</option>");
+			}
+			$("#area").append(html.join(""));
+			funcarea();
+		}else{
+			
+		}
+	});
+}
+
+function funcarea(){
+	if(curLibJoin!=''){
+		$("#libId").val(curLibJoin);
+		$("#radiolibId").val(curLibJoinId);
+		$("#schooltext").val(schoolText);
+		funclibId();
+	}
+	$("#libId").show();
+	$("#funcblurschooltext").show();
+}
+
+function funclibId(){
+	
+	//$("#school").html("").show();
+	
+	var val = $('#area  option:selected').val();
+	var type = $('#area  option:selected').data("type");
+	
+	var params ={ 'type' : (type+1),'upId':val}
+	$.post(areaUrl,params,function(data){
+		if(data.meta.success){
+			var html=[];
+			for (var i = 0; i < data.data.length; i++) {
+				html.push("<span><input name='school' type='checkbox' value='"+data.data[i].id+"'> "+data.data[i].name+"</span>");
+			}
+			//$("#school").append(html.join(""));
+		}else{
+			
+		}
+	});
+}
+
+var likejoinlistindex=null;
+var schoollistindex=null;
+function funcblurlibId(){
+	funcblurlibIdlist();
+	
+	if($("#radiolibId").val()!='' && merchantLibId!=''){
+		parent.layer.msg("此处不支持修改绑定机构,请先解绑机构。",{icon:3});
+		return;
+	}
+	
+	if($(".layui-layer-shade").length<=0){
+		likejoinlistindex =layer.open({
+			    type: 1,
+			    title: '选择机构',
+			    closeBtn: 1, //不显示关闭按钮
+			    shift: 0.8,
+			    offset: '150px',
+			    area: ['80%', '60%'],
+			    content: $("#likejoinlist")
+		});
+	}
+}
+
+function funcblurschooltext(){
+	
+	funcblurschoollist();
+	if($(".layui-layer-shade").length<=0){
+		schoollistindex =layer.open({
+			    type: 1,
+			    title: '选择学校',
+			    closeBtn: 1, //不显示关闭按钮
+			    shift: 0.8,
+			    offset: '150px',
+			    area: ['80%', '60%'],
+			    content: $("#schoollist")
+		});
+	}
+}
+
+
+function funcblurschoollist(pageNo){
+	$(".schoolseachform").html("");
+	var val = $('#area  option:selected').val();
+	var type = $('#area  option:selected').data("type");
+
+	var params ={ 
+			'type' : (type+1),
+			'upId':val,
+			'area' : $("#area option:selected").text(),
+			'name' : $("#likeschoolname").val(),
+			'pageNo' : pageNo,
+			'pageSize':16
+			}
+	
+	$.post(areaPageUrl,params,function(data){
+		if(data.meta.success){
+			var html=[];
+			for (var i = 0; i < data.data.jsonList.length; i++) {
+				html.push("<li><label><text  data-value='"+data.data.jsonList[i].id+"' name='schoolcheckbox' type='checkbox' onclick='funcblurschoolcheckbox(this)' >"+data.data.jsonList[i].name+"</text></label></li>");
+			}
+
+			var countPage=data.data.countPage;
+			var pageNo=data.data.pageNo;
+			$(".schoolcountNum").html(data.data.countNum);
+			$(".schoolpageNo").html(data.data.pageNo);
+			
+			var pagehtml=[];
+			if(pageNo>1){
+				pagehtml.push('<li class="paginItem"><a href="javascript:;" onclick="javascript:funcblurschoollist('+(pageNo-1)+');"><span class="pagepre"></span></a></li>');
+			}
+			for (var i = 1; i <= countPage; i++) {
+				if(i==pageNo){
+					pagehtml.push('<li class="paginItem  current"><a href="javascript:;" onclick="javascript:funcblurschoollist(\''+i+'\');return false;">'+i+'</a></li>' );
+				}else{
+					pagehtml.push('<li class="paginItem"><a href="javascript:;" onclick="javascript:funcblurschoollist(\''+i+'\');return false;">'+i+'</a></li>' );
+				}
+			}
+			if(countPage>pageNo){
+				pagehtml.push('<li class="paginItem"><a href="javascript:;" onclick="javascript:funcblurschoollist('+(pageNo+1)+');"><span class="pagenxt"></span></a></li>');
+			}
+			
+			$(".schoolpaginList").html(pagehtml.join(''));
+			$(".schoolseachform").append(html.join(""));
+		}else{
+			
+		}
+	});
+}
+
+
+
+function funcblurlibIdlist(pageNo){
+	$(".joinseachform").html("");
+	var params ={ 
+			'province' : $("#province option:selected").text(),
+			'city' : $("#city option:selected").text(),
+			'area' : $("#area option:selected").text(),
+			'name' : $("#likename").val(),
+			'pageNo' : pageNo,
+			'pageSize':16
+			}
+	
+	$.post(likejoinUrl,params,function(data){
+		if(data.meta.success){
+			var html=[];
+			for (var i = 0; i < data.data.jsonList.length; i++) {
+				html.push("<li><label><input name='radiolib' value='"+data.data.jsonList[i].id+"' type='radio' onchange='funcblurlibIdradio(this)' >"+data.data.jsonList[i].leagueName+"</label></li>");
+			}
+
+			var countPage=data.data.countPage;
+			var pageNo=data.data.pageNo;
+			$(".countNum").html(data.data.countNum);
+			$(".pageNo").html(data.data.pageNo);
+			
+			var pagehtml=[];
+			if(pageNo>1){
+				pagehtml.push('<li class="paginItem"><a href="javascript:;" onclick="javascript:funcblurlibIdlist('+(pageNo-1)+');"><span class="pagepre"></span></a></li>');
+			}
+			for (var i = 1; i <= countPage; i++) {
+				if(i==pageNo){
+					pagehtml.push('<li class="paginItem  current"><a href="javascript:;" onclick="javascript:funcblurlibIdlist(\''+i+'\');return false;">'+i+'</a></li>' );
+				}else{
+					pagehtml.push('<li class="paginItem"><a href="javascript:;" onclick="javascript:funcblurlibIdlist(\''+i+'\');return false;">'+i+'</a></li>' );
+				}
+			}
+			if(countPage>pageNo){
+				pagehtml.push('<li class="paginItem"><a href="javascript:;" onclick="javascript:funcblurlibIdlist('+(pageNo+1)+');"><span class="pagenxt"></span></a></li>');
+			}
+			
+			$(".joinpaginList").html(pagehtml.join(''));
+			$(".joinseachform").append(html.join(""));
+		}else{
+			
+		}
+	});
+}
+
+
+function funcblurlibIdradio(obj){
+	
+	var libtext = $("input[name=radiolib]:checked").parent("label").text();
+	var libId = $("input[name=radiolib]:checked").val();
+	
+	$("#radiolibId").val(libId);
+	$("#libId").val(libtext);
+	
+	funclibId();
+	
+	layer.close(likejoinlistindex);	
+}
+
+function funcblurschoolcheckbox(obj){
+ 	$("#selectschoollist").append('<label><sdiv><stext data-val="'+$(obj).data("value")+'">'+$(obj).parent("label").text()+'</stext>  <dtext >[X]</dtext></sdiv></label>');
+ 	
+ 	var schoollist=[];
+	 $.each($('stext'),function(){
+       	schoollist.push($(this).text());
+    });
+ 	$("#schooltext").val(schoollist.join(";"));
+}
+
+
+function push_user(){
+	//新增的
+	if(id==''){
+		var url="[[${sysUrl}]]/sys/fx/checkMerchant";
+		var params ={ 'name' : $("#poscode").val()}
+		$.post(url,params,function(data){
+			if(data.meta.success){
+				save();
+			}else{
+				parent.layer.msg(data.meta.message,{icon:11});
+			}
+		});
+	}else{
+		//修改的
+		save();
+	}
+}
+
+function save(){
+	var schoollist=[];
+	$.each($('stext'),function(){
+        schoollist.push($(this).data("val"));
+    });
+	if($("#poscode").val()==''){
+		parent.layer.msg("商户账号不能为空",{icon:11});
+		return
+	}
+	var reg = /^[0-9a-zA-Z]+$/
+	if(!reg.test($("#poscode").val())){
+		parent.layer.msg("商户账号只可包含字母、数字",{icon:11});
+		return
+	}	
+	if($("#unitname").val()==''){
+		parent.layer.msg("商户名称不能为空",{icon:11});
+		return
+	}
+	if($("#signTime").val()==''){
+		parent.layer.msg("合同开始日期不能为空",{icon:11});
+		return
+	}
+	if($("#endSignTime").val()==''){
+		parent.layer.msg("合同结束日期不能为空",{icon:11});
+		return
+	}
+	
+	if($("#signType").val()!='' && $("#signType").val()>=1 && $("#curSummaryTime").val()==''){
+		parent.layer.msg("新模式激活时间不可为空",{icon:11});
+		return
+	}
+
+	var title="您确定要保存商户信息?<br/>此动作会把商户塾币覆盖到机构塾币";
+	if(id!=''){
+		title="您确定要保存商户信息?";
+	}
+	parent.layer.confirm(title, {
+		icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
+	}, function(){
+		var url="[[${sysUrl}]]/sys/fx/saveMerchant_sc";
+		if( $("#poscode").val()==''){
+			alert("商户账号不能为空");
+			return ;
+		}
+		var params ={
+		 	'id' : id,
+            'posCode' : $("#poscode").val(),
+            'type' : $("#type").val(),
+            'level' : $("#level").val(),
+            'unitName' : $("#unitname").val(),
+            'legalPerson' : $("#legalperson").val(),
+            'phone' : $("#phone").val(),
+            'deputyName' : $("#deputyname").val(),
+            'deputyPhone' : $("#deputyphone").val(),
+            'status':$("#status").val(),
+            'parentPosCode':$("#parentposcode").val(),
+            'price':$("#price").val(),
+            'outPrice':$("#outPrice").val(),
+            'remarks':$("#remarks").val(),
+            'password':$("#password").val(),
+            'signService':$("#signService").val(),
+            'hardwareService':$("#hardwareService").val(),
+            
+            'signType':$("#signType").val(),
+            'mealType':$("#mealType").val(),
+            'libService':$("#libService").val(),
+            
+            'startTime':$("#signTime").val(),
+            'endTime':$("#endSignTime").val(),
+            
+            'activeTimeStr':$("#activeTime").val(),
+            'endActiveTimeStr':$("#endActiveTime").val(),
+            
+            'province':$("#province").val(),
+            'city':$("#city").val(),
+			'address':$("#address").val(),
+            'area':$("#area").val(),
+            'libId':$("#radiolibId").val(),
+            'location':
+            	($("#province option:selected").text()!='选择省' ? $("#province option:selected").text() : '') +
+            			($("#city option:selected").text()!='选择市' ? $("#city option:selected").text() : '') +
+            			($("#area option:selected").text()!='选择区' ? $("#area option:selected").text() : ''),
+            'schoollist':schoollist.join(";")
+        };
+		$.post(url,params,function(data){
+			if(data.meta.success){
+				parent.layer.msg("保存成功",{icon:1});
+				parent.location.reload();
+				parent.layer.close(parent.layer.getFrameIndex(window.name));
+			}else{
+				parent.layer.msg(data.meta.message,{icon:11});
+			}
+		});
+	});
+}
+
+
+
+</script>
+</html>

+ 23 - 4
src/main/resources/templates/sys/fx/merchantAllList.html

@@ -159,7 +159,11 @@
 				#lists.contains(#httpSession.getAttribute('admin').authorities,'超级管理员角色')  
 			)  }">
 				<a href="javascript:;" onclick="savemerchant('')">
-					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}"></span>添加</li>
+					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}"></span>机构商户</li>
+				</a>
+				
+				<a href="javascript:;" onclick="savemerchantsc('')">
+					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}"></span>学校商户</li>
 				</a>
 			</ul>
 			
@@ -262,7 +266,8 @@
 							<a href="javascript:;" th:if="${item.signType!=0 && item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'mealServiceAdd(\''+${item.id}+'\')'" class="tablelink">加油包</a>
 						
 							<a href="javascript:;" th:if="${item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'updatemerchant(\''+${item.id}+'\',\'4\')'"   class="tablelink">删除</a>
-							<a href="javascript:;" th:if="${item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'savemerchant(\''+${item.id}+'\')'"  	class="tablelink">修改</a>
+							<a href="javascript:;" th:if="${item.endActiveTime==null && item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'savemerchant(\''+${item.id}+'\')'"  	class="tablelink">修改</a>
+							<a href="javascript:;" th:if="${item.endActiveTime!=null && item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'savemerchantsc(\''+${item.id}+'\')'"  	class="tablelink">修改</a>
 						</di>
 										
 						<a href="javascript:;" th:if="${item.status!=4 && item.libId!='' && item.libId!=null && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'untyingmerchant(\''+${item.id}+'\')'"  	class="tablelink">解绑</a>
@@ -703,7 +708,7 @@ function joinServiceEdit(id){
 
 
 		function savemerchant(id){
-			var title="开通商户";
+			var title="开通机构商户";
 			if(id!=null && id!='' && id!=undefined){
 				title="修改商户";
 			}
@@ -718,7 +723,21 @@ function joinServiceEdit(id){
 			});
 		}
 		
-		
+		function savemerchantsc(id){
+			var title="开通学校商户";
+			if(id!=null && id!='' && id!=undefined){
+				title="修改商户";
+			}
+			parent.layer.open({
+			    type: 2,
+			    title: title,
+			    closeBtn: 1, //不显示关闭按钮
+			    shift: 0.8,
+			    offset: '10px',
+			    area: ['90%', '95%'],
+			    content: '[[${sysUrl}]]/sys/fx/merchantAdd_sc.html?id='+id
+			});
+		}
 		
 		function untyingmerchant(id){
 			

+ 1 - 1
src/main/resources/templates/sys/lib/libJoinList.html

@@ -44,7 +44,7 @@
 			<label>&nbsp;</label>
 			<input type="button" class="scbtn" value="查询" />
 		</li>
-		<li th:if="${ #httpSession.getAttribute('admin') !=null  && #httpSession.getAttribute('admin').loginName eq 'admin'   } "  >
+		<li th:if="${ #httpSession.getAttribute('admin') !=null  && (#httpSession.getAttribute('admin').loginName eq 'admin' || #httpSession.getAttribute('admin').loginName eq 'sishujia' )  } "  >
 				<ul class="toolbar">
 					<a th:href="@{/sys/lib/libJoinAdd.html}"><li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增</li></a>
 				</ul>