yuhaitao14 7 years ago
parent
commit
c5577eb044

+ 41 - 0
shop/src/main/java/com/zskk/shop/controller/h5/H5AppointmentController.java

@@ -10,15 +10,18 @@ package com.zskk.shop.controller.h5;
 
 
 import java.util.List;
 import java.util.List;
 
 
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.zskk.shop.controller.AbstractController;
 import com.zskk.shop.controller.AbstractController;
 import com.zskk.shop.controller.bean.UserBean;
 import com.zskk.shop.controller.bean.UserBean;
+import com.zskk.shop.dao.entry.BuyOrder;
 import com.zskk.shop.dao.entry.BuyOrderItem;
 import com.zskk.shop.dao.entry.BuyOrderItem;
 import com.zskk.shop.dao.entry.FamilyPeople;
 import com.zskk.shop.dao.entry.FamilyPeople;
 import com.zskk.shop.exception.ErrorConstant;
 import com.zskk.shop.exception.ErrorConstant;
@@ -26,6 +29,7 @@ import com.zskk.shop.exception.ZSKKException;
 import com.zskk.shop.service.BuyOrderService;
 import com.zskk.shop.service.BuyOrderService;
 import com.zskk.shop.service.FamilyPeopleService;
 import com.zskk.shop.service.FamilyPeopleService;
 import com.zskk.shop.service.GoodService;
 import com.zskk.shop.service.GoodService;
+import com.zskk.shop.utils.ToolsUtil;
 
 
 @RequestMapping("/h5/appointment")
 @RequestMapping("/h5/appointment")
 @Controller
 @Controller
@@ -59,4 +63,41 @@ public class H5AppointmentController extends AbstractController  {
 		this.initUser(model);
 		this.initUser(model);
 		return "/h5/appointment";
 		return "/h5/appointment";
 	}
 	}
+	
+	@RequestMapping("save")
+	public String save(Model model, @RequestParam("bid") Long bid, @RequestParam("itemid") Long itemid, 
+			@RequestParam("fid") Integer fid, @RequestParam("idcard") String idcard, @RequestParam("name") String name, @RequestParam("sex") Integer sex,
+			@RequestParam("phone") String phone, @RequestParam("birth") String birth,
+			@RequestParam("atime") String atime, @Param("extend") String extend){
+		UserBean userBean 	= this.getUser();
+		BuyOrder buyOrder 	= buyOrderService.queryBuyOrder(bid);
+		if (buyOrder == null){
+			throw new ZSKKException(ErrorConstant.PARAM_ERROR);
+		}
+		if (!buyOrder.getPayStatus().equals(BuyOrderService.PAY_STATUS_PAYED)){
+			throw new ZSKKException(ErrorConstant.PARAM_ERROR);
+		}
+		FamilyPeople people = null;
+		if (fid.equals(0)){ //新建
+			people = new FamilyPeople();
+			people.setId(0);
+			people.setAddress("");
+			people.setCtime(ToolsUtil.getNow());
+			people.setIsDel(0);
+			people.setUid(userBean.getUserid());
+		}else{
+			people = familyPeopleService.queryMyPeople(fid);
+			if (people == null){
+				throw new ZSKKException(ErrorConstant.PARAM_ERROR);
+			}
+		}
+		people.setName(name);
+		people.setSex(sex);
+		people.setIdcard(idcard);
+		people.setPhone(phone);
+		people.setBirth(birth);
+		BuyOrderItem item = buyOrderService.queryItem(itemid);
+		familyPeopleService.addAppointment(userBean, people, buyOrder, item, atime, extend);
+		return "/h5/appointment_success";
+	}
 }
 }

+ 123 - 62
shop/src/main/resource/templates/h5/appointment.html

@@ -1,62 +1,123 @@
-<!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" />
-</head>
-
-<body>
-	<div class="v-form">
-		<dl>
-			<dt>体检人</dt>
-			<dd>
-				<div>
-					<div>
-						<input type="radio" name="people" value="0"/>
-						<label>新建体检人</label>
-					</div>
-					<div th:each="people : ${peoples}">
-						<input type="radio" name="people" th:attr="value=${people.id}"/><label th:text="${people.name}"></label> 
-					</div>
-				</div>
-			</dd>
-		</dl>
-		<dl>
-			<dt>性别</dt>
-			<dd>
-				<div>
-					<input name="sex" type="radio" value="1" /><label>男</label>
-					<input name="sex" type="radio" value="0" /><label>女</label>
-				</div>
-			</dd>
-		</dl>
-		<dl>
-			<dt>身份证号</dt>
-			<dd>
-				<div>
-					<input name="" type="text" class="txt" />
-				</div>
-			</dd>
-		</dl>
-		<dl>
-			<dt>手机号</dt>
-			<dd>
-				<div>
-					<input name="" type="text" class="txt" />
-				</div>
-			</dd>
-		</dl>
-		<dl>
-			<dt>体检时间</dt>
-			<dd>
-				<div>
-					<input name="" type="date" class="txt" />
-				</div>
-			</dd>
-		</dl>
-	</div>
-</body>
-</html>
+<!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>
+</head>
+
+<body>
+	<div class="registerPost">
+		<form id="form1" action="/h5/appointment/save" method="post">
+			<input type="hidden" name="bid" th:attr="value=${bid}"/>
+			<input type="hidden" name="itemid" th:attr="value=${itemid}"/>
+			<input type="hidden" name="birth" value=""/>
+			<h6>选择体检人:</h6>
+			<table>
+				<tr>
+					<td>
+						<span><input name="fid" type="radio" value="" 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>
+						</span>
+					</td>
+				</tr>
+			</table>
+			<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" />
+						</div>
+					</td>
+				</tr>
+			</table>
+			<h6>姓名:</h6>
+			<table>
+				<tr>
+					<td>
+						<div class="box">
+							<input name="name" type="text" id="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="n">男</label> 
+						<input name="sex" type="radio" value="0" id="sex0" class="radio" /><label for="v">女</label>
+					</td>
+				</tr>
+			</table>
+			<h6>手机号码:</h6>
+			<table>
+				<tr>
+					<td>
+						<div class="box">
+							<input name="phone" id="phone" type="tel" />
+						</div>
+					</td>
+				</tr>
+			</table>
+			<h6>体检日期及时间:</h6>
+			<table>
+				<tr>
+					<td>
+						<div class="box">
+							<input id="atime"  name="atime" type="date" />
+						</div>
+					</td>
+				</tr>
+				<tr>
+					<td><div class="box mt10">
+							<select id="extend" name="extend">
+								<option value="08:00">08:00</option>
+	                    		<option value="08:30">08:30</option>
+	                    		<option value="09:00">09:00</option>
+							</select>
+						</div></td>
+				</tr>
+			</table>
+			<div class="h100"></div>
+			<div class="registerBottom">
+				<a href="javascript:cancel()" class="last">取消</a><a href="javascript:save()" class="next">预约</a>
+			</div>
+		</form>
+	</div>
+	
+	<script th:inline="javascript">
+		var peoples = JSON.parse([[${peoplesJSON}]])
+		/* <![CDATA[ */
+		function selectPeople(id){
+			for (var i = 0; i < peoples.length; ++i){
+				var obj = peoples[i]
+				if (obj.id==id){
+					$("#idcard").val(obj.idcard);
+					$("#name").val(obj.name);
+					$("#sex" + obj.sex).attr("checked","checked")
+					$("#phone").val(obj.phone)
+				}
+			}
+		}
+		
+		function save(){
+			$("#form1").submit();
+		}
+		
+		/* ]]> */
+	</script>
+</body>
+</html>

+ 31 - 0
shop/src/main/resource/templates/h5/appointment_success.html

@@ -0,0 +1,31 @@
+<!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">
+    	<h3 class="title">预约成功啦!<a href="/h5/index">"首页"</a></h3>
+    </div>
+</body>
+</html>

+ 14 - 3
shop/static/h5/style/style.css

@@ -10,6 +10,7 @@ a{ text-decoration:none; }
 .mr10{ margin-right:10px; }
 .mr10{ margin-right:10px; }
 .mt10{ margin-top:10px; }
 .mt10{ margin-top:10px; }
 .mt50{ margin-top:50px; }
 .mt50{ margin-top:50px; }
+.h100{ height:100px; }
 ::-webkit-input-placeholder{ color:#CCC; font-size:1rem; /* WebKit browsers */}/*文本框默认字体颜色*/
 ::-webkit-input-placeholder{ color:#CCC; font-size:1rem; /* WebKit browsers */}/*文本框默认字体颜色*/
 :-moz-placeholder { color:#CCC; font-size:1rem; /* Mozilla Firefox 4 to 18 */}
 :-moz-placeholder { color:#CCC; font-size:1rem; /* Mozilla Firefox 4 to 18 */}
 ::-moz-placeholder { color:#CCC; font-size:1rem; /* Mozilla Firefox 19+ */}
 ::-moz-placeholder { color:#CCC; font-size:1rem; /* Mozilla Firefox 19+ */}
@@ -116,10 +117,20 @@ a{ text-decoration:none; }
 .registerBar dt, .registerBar dd{ width:33.3%; font-size:.8rem; float:left; text-align:center; }
 .registerBar dt, .registerBar dd{ width:33.3%; font-size:.8rem; float:left; text-align:center; }
 .registerBar dt{ color:#0DC6E4; }
 .registerBar dt{ color:#0DC6E4; }
 .registerBar dd{ color:#999; }
 .registerBar dd{ color:#999; }
-.registerPost{ padding:0 15px; }
-.registerPost h6{ color:#333; font-size:.8rem; padding:10px 0; }
-
+.registerBottom{ width:100%; height:50px; position:fixed; left:0; bottom:0; }
+.registerBottom .last, .registerBottom .next{ width:50%; line-height:50px; float:left; text-align:center; }
+.registerBottom .last{ height:49.5px; border-top:.5px solid #DDD; color:#999; background-color:#FFF; }
+.registerBottom .next{ height:50px; color:#FFF; background-color:#0DC6E4; }
 
 
+.registerPost{ padding:0 15px; }
+.registerPost h6{ color:#333; font-size:.8rem; padding:10px 0; font-weight:bold; margin-top:6px; }
+.registerPost table{ width:100%; }
+.registerPost .box{ height:46px; padding:0 4px; border:1px solid #DCDCDC; border-radius:2px; box-shadow:2px 2px 5px #EEE inset;   }
+.registerPost .box input{ width:100%; height:46px; background-color:transparent; border:none; font-size:1rem; }
+.registerPost .box select{ width:100%; border:none; height:43px; color:#999; background-color:transparent; font-size:1rem; }
 
 
+.registerPost .radio { display: none; }
+.registerPost .radio+label { -webkit-appearance: none; border: 1px solid #DCDCDC; height:46px; line-height:46px; padding:0 20px; border-radius: 2px; display: inline-block; position: relative; color: #666; box-shadow:2px 2px 5px #EEE inset; margin-bottom:10px; }
+.registerPost .radio:checked+label { color: #FFF; border: 1px solid #0DC6E4; background-color:#0DC6E4; box-shadow:none; }