yuhaitao14 6 years ago
parent
commit
81a51bed28

+ 12 - 0
shop/src/main/java/com/zskk/shop/controller/api/ApiController.java

@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import com.alibaba.druid.sql.visitor.functions.Ucase;
 import com.zskk.shop.controller.bean.ControllerResult;
 import com.zskk.shop.controller.bean.IncomeBean;
 import com.zskk.shop.controller.bean.PageBean;
@@ -27,6 +28,7 @@ import com.zskk.shop.dao.entry.BuyOrderItem;
 import com.zskk.shop.exception.ErrorConstant;
 import com.zskk.shop.service.BuyOrderService;
 import com.zskk.shop.service.TJCenterService;
+import com.zskk.shop.service.UserCenterService;
 
 @RequestMapping("/api")
 @Controller
@@ -38,6 +40,9 @@ public class ApiController {
 	@Autowired
 	private TJCenterService tJCenterService;
 	
+	@Autowired
+	private UserCenterService userCenterService;
+	
 	@RequestMapping("/refund")
 	@ResponseBody
 	public ControllerResult refund(@RequestParam("id") Long id){
@@ -112,4 +117,11 @@ public class ApiController {
 		String htmlContent = tJCenterService.getTjReport(id);
 		return htmlContent;
 	}
+	
+	@RequestMapping("sendCode/{phone}")
+	@ResponseBody
+	public ControllerResult sendCode(@PathVariable("phone") String phone){
+		userCenterService.sendCode(phone);
+		return new ControllerResult(Boolean.TRUE);
+	}
 }

+ 5 - 9
shop/src/main/java/com/zskk/shop/controller/h5/H5BuyOrderController.java

@@ -133,16 +133,12 @@ public class H5BuyOrderController extends AbstractController{
 		UserBean userBean 			= this.getUser();
 		List<TjOrder> orders		= null;
 		List<FamilyPeople> peoples 	= familyPeopleService.queryMyPeoples(userBean.getUserid());
-		if (peoples.isEmpty()){
-			orders = new ArrayList<>(0);
-		}else{
-			List<String> phones 	    = new ArrayList<>(peoples.size());
-			for (FamilyPeople p:peoples){
-				phones.add(p.getPhone());
-			}
-			phones.add(userBean.getPhone());
-			orders = tjCenterService.getTJOrders(userBean.getUserid(), phones);
+		List<String> phones 	    = new ArrayList<>(peoples.size());
+		for (FamilyPeople p:peoples){
+			phones.add(p.getPhone());
 		}
+		phones.add(userBean.getPhone());
+		orders = tjCenterService.getTJOrders(userBean.getUserid(), phones);
 		model.addAttribute("orders", orders);
 		this.initUser(model);
 		return "/h5/query_report";

+ 81 - 0
shop/src/main/java/com/zskk/shop/controller/h5/H5FamilyController.java

@@ -0,0 +1,81 @@
+package com.zskk.shop.controller.h5;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import com.zskk.shop.controller.AbstractController;
+import com.zskk.shop.controller.bean.UserBean;
+import com.zskk.shop.dao.entry.FamilyPeople;
+import com.zskk.shop.exception.ErrorConstant;
+import com.zskk.shop.exception.ZSKKException;
+import com.zskk.shop.service.FamilyPeopleService;
+import com.zskk.shop.service.UserCenterService;
+
+@Controller
+@RequestMapping("/h5/family")
+public class H5FamilyController extends AbstractController  {
+
+	@Autowired
+	private FamilyPeopleService familyPeopleService;
+	
+	@Autowired
+	private UserCenterService userCenterService;
+	
+	@RequestMapping("/list")
+	public String list(Model model){
+		UserBean userBean 	= this.getUser();
+		List<FamilyPeople> list = familyPeopleService.queryMyPeoples(userBean.getUserid());
+		model.addAttribute("list", list);
+		this.initUser(model);
+		return "/h5/family";
+	}
+	
+	@RequestMapping("goedit/{id}")
+	public String goedit(Model model, @PathVariable("id") Integer id){
+		FamilyPeople people = null;
+		if (id.equals(0)){
+			people = new FamilyPeople();
+			people.setId(0);
+			people.setIdcard("");
+			people.setSex(1);
+			people.setName("");
+			people.setPhone("");
+		}else{
+			people = familyPeopleService.queryMyPeople(id);
+		}
+		
+		if (people == null){
+			throw new ZSKKException(ErrorConstant.PARAM_ERROR);
+		}
+		
+		model.addAttribute("people", people);
+		this.initUser(model);
+		return "/h5/edit_people";
+	}
+	
+	@RequestMapping("save")
+	public String goedit(Model model,
+			FamilyPeople people, @RequestParam("code") String code){
+		
+		if (!userCenterService.checkCode(people.getPhone(), code)){
+			model.addAttribute("msg", "验证码错误");
+			return "/h5/op_error";
+		}
+		
+		if (people.getId().equals(0)){
+			familyPeopleService.addMyPeople(this.getUser().getUserid(), people.getName(), people.getPhone(), 
+					people.getIdcard(), people.getSex(), people.getBirth());
+		}else{
+			familyPeopleService.updateMyPeople(this.getUser().getUserid(), people.getId(), people.getName(), people.getPhone(), 
+					people.getIdcard(), people.getSex(), people.getBirth());
+		}
+		
+		return this.list(model);
+	}
+}

+ 5 - 9
shop/src/main/java/com/zskk/shop/controller/pc/BuyOrderController.java

@@ -81,16 +81,12 @@ public class BuyOrderController extends AbstractController {
 		UserBean userBean 			= this.getUser();
 		List<TjOrder> orders		= null;
 		List<FamilyPeople> peoples 	= familyPeopleService.queryMyPeoples(userBean.getUserid());
-		if (peoples.isEmpty()){
-			orders = new ArrayList<>(0);
-		}else{
-			List<String> phones 	    = new ArrayList<>(peoples.size());
-			for (FamilyPeople p:peoples){
-				phones.add(p.getPhone());
-			}
-			phones.add(userBean.getPhone());
-			orders = tjCenterService.getTJOrders(userBean.getUserid(), phones);
+		List<String> phones 	    = new ArrayList<>(peoples.size());
+		for (FamilyPeople p:peoples){
+			phones.add(p.getPhone());
 		}
+		phones.add(userBean.getPhone());
+		orders = tjCenterService.getTJOrders(userBean.getUserid(), phones);
 		model.addAttribute("orders", orders);
 		this.initUser(model);
 		

+ 28 - 0
shop/src/main/java/com/zskk/shop/service/UserCenterService.java

@@ -49,6 +49,34 @@ public class UserCenterService {
 	@Autowired
 	private SignService signService;
 	
+	public ControllerResult sendCode(String phone){
+		Map<String, String> params = new HashMap<>();
+		params.put("phone", phone);
+		
+		try{
+			String content = HttpClient.doPost(uccenter + "tools/sendCode", params);
+			return JSON.parseObject(content, ControllerResult.class);
+		}catch (Exception e) {
+			LogUtil.sysError(e.getMessage(), e);
+			return new ControllerResult(ErrorConstant.SERVER_ERROR);
+		}
+	}
+	
+	public Boolean checkCode(String phone, String code){
+		Map<String, String> params = new HashMap<>();
+		params.put("phone", phone);
+		params.put("code", code);
+		
+		try{
+			String content = HttpClient.doPost(uccenter + "tools/checkSendCode", params);
+			ControllerResult obj = JSON.parseObject(content, ControllerResult.class);
+			return (Boolean)obj.getObj();
+		}catch (Exception e) {
+			LogUtil.sysError(e.getMessage(), e);
+			return Boolean.FALSE;
+		}
+	}
+	
 	public ControllerResult createQRCode(AccountBean account, UserBean user, BuyOrder order, GoodBase good, Integer paytype, String orderid){
 		Map<String, String> params = new HashMap<>();
 		params.put("accountid", account.getAccountid());

+ 20 - 4
shop/src/main/resource/templates/h5/appointment.html

@@ -19,7 +19,6 @@
             <table>
                 <tr>
                     <td>
-                        <span><input name="fid" type="radio" value="0" id="tj0" class="radio" checked="checked" /><label for="tj0">新建体检人</label></span>
                         <span th:each="people : ${peoples}">
 							<input name="fid" type="radio"  th:attr="value=${people.id},id=${people.id}" class="radio" />
 							<label th:attr="for=${people.id},onclick='selectPeople(' + ${people.id} + ')'" for="tj1" th:text="${people.name}"></label>
@@ -58,8 +57,8 @@
             <table>
                 <tr>
                     <td>
-                        <input name="sex" type="radio" class="radio" id="sex1" value="1" checked="checked" /><label for="n">男</label>
-                        <input name="sex" type="radio" value="0" id="sex0" class="radio" /><label for="v">女</label>
+                        <input name="sex" type="radio" class="radio" id="sex1" value="1" checked="checked" /><label for="sex1">男</label>
+                        <input name="sex" type="radio" value="0" id="sex0" class="radio" /><label for="sex0">女</label>
                     </td>
                 </tr>
             </table>
@@ -68,7 +67,7 @@
                 <tr>
                     <td>
                         <div class="box">
-                            <input name="phone" id="phone" type="tel" placeholder="请输入手机号" />
+                            <input name="phone" id="phone" type="tel" placeholder="请输入手机号" readonly="readonly"/>
                         </div>
                     </td>
                 </tr>
@@ -117,6 +116,23 @@
         }
 
         function save() {
+        	var idcard = $("#idcard").val();
+        	var name = $("#name").val();
+        	var phone = $("#phone").val();
+        	
+        	if (idcard.length == 0){
+        		alert("请输入身份证号");
+        		return;
+        	}
+        	if (name.length == 0){
+        		alert("请输入姓名");
+        		return;
+        	}
+        	if (phone.length == 0){
+        		alert("请输入手机号");
+        		return;
+        	}
+        	
             $("#form1").submit();
         }
 

+ 3 - 4
shop/src/main/resource/templates/h5/changeappointment.html

@@ -18,7 +18,6 @@
             <table>
                 <tr>
                     <td>
-                        <span><input name="fid" type="radio" value="0" id="tj0" class="radio" checked="checked" /><label for="tj0" onclick="selectPeople(0)">新建体检人</label></span>
                         <span th:each="people : ${peoples}">
 							<input name="fid" type="radio"  th:attr="value=${people.id},id=${people.id}" class="radio" />
 							<label th:attr="for=${people.id},onclick='selectPeople(' + ${people.id} + ')',id='l' + ${people.id}" for="tj1" th:text="${people.name}"></label>
@@ -57,8 +56,8 @@
             <table>
                 <tr>
                     <td>
-                        <input name="sex" type="radio" class="radio" id="sex1" value="1" checked="checked" /><label for="n">男</label>
-                        <input name="sex" type="radio" value="0" id="sex0" class="radio" /><label for="v">女</label>
+                        <input name="sex" type="radio" class="radio" id="sex1" value="1" checked="checked" /><label for="sex1">男</label>
+                        <input name="sex" type="radio" value="0" id="sex0" class="radio" /><label for="sex0">女</label>
                     </td>
                 </tr>
             </table>
@@ -67,7 +66,7 @@
                 <tr>
                     <td>
                         <div class="box">
-                            <input name="phone" id="phone" type="tel" placeholder="请输入手机号" />
+                            <input name="phone" id="phone" type="tel" placeholder="请输入手机号" readonly="readonly"/>
                         </div>
                     </td>
                 </tr>

+ 163 - 0
shop/src/main/resource/templates/h5/edit_people.html

@@ -0,0 +1,163 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>预约体检</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
+    <link href="/h5/style/style.css" rel="stylesheet" />
+    <script src="/h5/js/jquery-2.1.1.min.js"></script>
+    <style>
+    	.btn {
+    		font-size: 1rem;
+    	}
+    </style>
+</head>
+
+<body>
+    <div class="registerPost">
+        <form id="form1" action="/h5/family/save" method="post">
+        	<input type="hidden" name="id" th:attr="value=${people.id}"/>
+            <h6>证件号:</h6>
+            <table>
+                <tr>
+                    <td style="width: 100px;">
+                        <div class="box mr10">
+                            <select name="" >
+								<option selected="selected">身份证</option>
+							</select>
+                        </div>
+                    </td>
+                    <td>
+                        <div class="box">
+                            <input name="idcard" type="text" id="idcard" placeholder="请输入证件ID"  th:attr="value=${people.idcard}" />
+                        </div>
+                    </td>
+                </tr>
+            </table>
+            <h6>姓名:</h6>
+            <table>
+                <tr>
+                    <td>
+                        <div class="box">
+                            <input name="name" type="text" id="name" placeholder="请输入姓名"  th:attr="value=${people.name}"/>
+                        </div>
+                    </td>
+                </tr>
+            </table>
+            <h6>性别:</h6>
+            <table>
+                <tr>
+                    <td>
+                        <input name="sex" type="radio" class="radio" id="sex1" value="1" checked="checked" /><label for="sex1">男</label>
+                        <input name="sex" type="radio" value="0" id="sex0" class="radio" /><label for="sex0">女</label>
+                    </td>
+                </tr>
+            </table>
+            <h6>生日:</h6>
+            <table>
+                <tr>
+                    <td>
+                        <div class="box">
+                            <input name="birth" id="birth" type="date" placeholder="请选择生日" />
+                        </div>
+                    </td>
+                </tr>
+            </table>
+            <h6>手机号码:</h6>
+            <table>
+                <tr>
+                    <td>
+                        <div class="box">
+                            <input name="phone" id="phone" type="tel" placeholder="请输入手机号"  th:attr="value=${people.phone}"/>
+                        </div>
+                    </td>
+                </tr>
+            </table>
+            <h6>验证码:</h6>
+            <table>
+                <tr>
+                    <td style="width: 70%">
+                        <div class="box">
+                            <input name="code" id="code" type="tel" placeholder="请输入验证码"  maxlength="4" />
+                        </div>
+                    </td>
+                    <td>
+                    	<input id="sendCodeBtn" type="button" value="发送验证码" class="btn" onclick="sendCode()"/> 
+                    </td>
+                </tr>
+            </table>
+            <div class="h100"></div>
+            <div class="registerBottom">
+                <a href="/h5/family/list" class="last">取消</a>
+                <a href="javascript:save()" class="next">保存</a>
+            </div>
+        </form>
+    </div>
+
+    <script th:inline="javascript">
+    	/* <![CDATA[ */
+        var peoples = JSON.parse([[${peoplesJSON}]])
+        
+        var maxTime = 60;
+        var nowTime = maxTime+1;
+        
+        function timer(){
+        	nowTime--;
+    		if (nowTime > 0){
+    			$("#sendCodeBtn").val(nowTime + "s");
+    			setTimeout(timer, 1000);
+    		}else{
+            	$("#sendCodeBtn").attr('disabled',false);
+            	$("#sendCodeBtn").val("发送验证码");
+            	nowTime = maxTime+1;
+    		}
+    	}
+        
+        function sendCode(){
+        	var phone = $("#phone").val();
+        	if (phone.length == 0){
+        		alert("请输入手机号");
+        		return;
+        	}
+        	$("#sendCodeBtn").attr('disabled',true);
+        	
+        	timer();
+        	
+        	$.get("/api/sendCode/" + phone, function(data){
+        		if (data.code == 0){
+        			console.log("OK");
+        		}
+        	});
+    	}
+
+        function save() {
+        	var idcard = $("#idcard").val();
+        	var name = $("#name").val();
+        	var phone = $("#phone").val();
+        	var code = $("#code").val();
+        	
+        	if (idcard.length == 0){
+        		alert("请输入身份证号");
+        		return;
+        	}
+        	if (name.length == 0){
+        		alert("请输入姓名");
+        		return;
+        	}
+        	if (phone.length == 0){
+        		alert("请输入手机号");
+        		return;
+        	}
+        	if (code.length == 0){
+        		alert("请输入验证码");
+        		return;
+        	}
+            $("#form1").submit();
+        }
+
+        /* ]]> */
+    </script>
+</body>
+
+</html>

+ 49 - 0
shop/src/main/resource/templates/h5/family.html

@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+<meta charset="UTF-8" />
+<meta name="viewport"
+	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
+<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
+<link rel="stylesheet"
+	href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
+	integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
+	crossorigin="anonymous" />
+<title>家人管理</title>
+<style type="text/css">
+	.content {
+		margin-top: 20px;
+	}
+	
+	.btnDiv {
+		margin:15px;
+	}
+	
+	.mybtn {
+		width: 100%;
+	}
+</style>
+</head>
+<body>
+	<div class="btnDiv">
+		<a href="/h5/family/goedit/0">
+			<button type="button" class="btn btn-primary mybtn">添加家人</button>
+		</a>
+	</div>
+	<a th:attr="href='/h5/family/goedit/' + ${people.id}" th:each="people : ${list}">
+		<div class="container-fluid content" >
+			<div class="panel panel-default">
+				<div class="panel-heading">
+					<h3 class="panel-title" th:text="${people.name}"></h3>
+				</div>
+				<div class="panel-body" th:text="'手机号:' + ${people.phone}"></div>
+			</div>
+		</div>
+	</a>
+	<script src="/h5/js/jquery-2.1.1.min.js"></script>
+	<script
+		src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"
+		integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
+		crossorigin="anonymous"></script>
+</body>
+</html>

+ 1 - 1
shop/src/main/resource/templates/h5/indexv2.html

@@ -86,7 +86,7 @@
     <ul class="nav ml10 mr10">
     	<li><a href="/h5/index"><img src="style/index-tj-icon.png" /><p>体检套餐</p></a></li>
         <li><a th:attr="href='/h5/search?label=' + ${picCheckLabel}"><img src="style/index-yx-icon.png" /><p>影像检查</p></a></li>
-        <li><a href="/h5/buy/completedorders"><img src="style/index-bg-icon.png" /><p>报告查询</p></a></li>
+        <li><a href="/h5/buy/tjorders"><img src="style/index-bg-icon.png" /><p>报告查询</p></a></li>
         <li><a href="/h5/buy/mypayedorders"><img src="style/index-yy-icon.png" /><p>我的预约</p></a></li>
     </ul>
     <div class="line-10-EEE"></div>

+ 2 - 1
shop/src/main/resource/templates/h5/my.html

@@ -22,7 +22,8 @@
         </div>
         <ul>
         	<li class="yytj"><a href="/h5/buy/mypayedorders">预约体检</a></li>
-            <li class="bgcx"><a href="/h5/buy/tjorders">报告查询</a></li>
+           	<li class="yytj"><a href="/h5/family/list">家人管理</a></li>
+           	<li class="bgcx"><a href="/h5/buy/tjorders">报告查询</a></li>
         </ul>
         <ul>
         	<li class="scdd"><a href="/h5/buy/nopayorders">商城订单</a></li>

+ 32 - 0
shop/src/main/resource/templates/h5/op_error.html

@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
+    <title>黑龙江昆仑盛和安体检中心</title>
+    <link rel="stylesheet" type="text/css" href="/style/common.css"/>
+    <link rel="stylesheet" type="text/css" href="/style/shop.css"/>
+    <!--[if lt IE 9]> 
+<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> 
+<![endif]-->
+    <!--窗口自适应适配低端IE-->
+    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
+    <style type="text/css">
+    	.content {
+    		text-align: center;
+    		margin-top: 100px;
+    	}
+    	.title {
+    		margin-top: 20px;
+    	}
+	</style>
+</head>
+
+<body>
+	<div class="content">
+    	<h1>操作失败</h1>
+    	<h3 class="title" th:text="${msg}"></h3>
+    </div>
+</body>
+</html>