yuhaitao14 7 years ago
parent
commit
f8bd9280a7

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

@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import com.alibaba.fastjson.JSON;
 import com.zskk.shop.controller.AbstractController;
 import com.zskk.shop.controller.bean.UserBean;
+import com.zskk.shop.dao.entry.Appointment;
 import com.zskk.shop.dao.entry.BuyOrder;
 import com.zskk.shop.dao.entry.BuyOrderItem;
 import com.zskk.shop.dao.entry.FamilyPeople;
@@ -100,4 +101,56 @@ public class H5AppointmentController extends AbstractController  {
 		familyPeopleService.addAppointment(userBean, people, buyOrder, item, atime, extend);
 		return "/h5/appointment_success";
 	}
+	
+	@RequestMapping("/gochangeappointment/{id}")
+	public String gochangeappointment(Model model, @PathVariable("id") Integer id){
+		UserBean userBean = this.getUser();
+		Appointment appointment = familyPeopleService.queryAppointment(id);
+		if (appointment == null){
+			throw new ZSKKException(ErrorConstant.PARAM_ERROR);
+		}
+		BuyOrderItem item			= buyOrderService.queryItem(appointment.getItemid());
+		List<FamilyPeople> peoples	= familyPeopleService.queryMyPeoples(userBean.getUserid());
+		FamilyPeople people			= familyPeopleService.queryMyPeople(appointment.getFid());
+		
+		model.addAttribute("good", goodService.queryOneGoodBase(item.getGid()));
+		model.addAttribute("appointment", appointment);
+		model.addAttribute("item", item);
+		model.addAttribute("peoples", peoples);
+		model.addAttribute("peoplesJSON", JSON.toJSONString(peoples));
+		model.addAttribute("people", people);
+		
+		this.initUser(model);
+		return "/h5/changeappointment";
+	}
+	
+	@RequestMapping("change")
+	public String change(Model model, @RequestParam("id") Integer id,
+			@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();
+		Appointment appointment = familyPeopleService.queryAppointment(id);
+		if (appointment == null){
+			throw new ZSKKException(ErrorConstant.PARAM_ERROR);
+		}
+		
+		FamilyPeople people = this.familyPeopleService.queryMyPeople(fid);
+		if (people == null){
+			throw new ZSKKException(ErrorConstant.PARAM_ERROR);
+		}
+		
+		appointment.setFid(fid);
+		appointment.setAtime(atime);
+		appointment.setExtend(extend);
+		
+		people.setIdcard(idcard);
+		people.setName(name);
+		people.setPhone(phone);
+		people.setSex(sex);
+		people.setBirth(birth);
+		
+		familyPeopleService.change(userBean, people, appointment);
+		
+		return "redirect:/h5/buy/mypayedorders";
+	}
 }

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

@@ -93,7 +93,7 @@
 			</table>
 			<div class="h100"></div>
 			<div class="registerBottom">
-				<a href="javascript:cancel()" class="last">取消</a><a href="javascript:save()" class="next">预约</a>
+				<a href="/h5/buy/mypayedorders" class="last">取消</a><a href="javascript:save()" class="next">预约</a>
 			</div>
 		</form>
 	</div>

+ 128 - 0
shop/src/main/resource/templates/h5/changeappointment.html

@@ -0,0 +1,128 @@
+<!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/change" method="post">
+			<input type="hidden" name="id" th:attr="value=${appointment.id}"/>
+			<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} + ')',id='l' + ${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" th:attr="value=${appointment.atime}"/>
+						</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="/h5/buy/mypayedorders" class="last">取消</a><a href="javascript:save()" class="next">改约</a>
+			</div>
+		</form>
+	</div>
+	
+	<script th:inline="javascript">
+		var peoples = JSON.parse([[${peoplesJSON}]])
+		var fid		= [[${appointment.fid}]]
+		var extend 	= [[${appointment.extend}]]
+		
+		/* <![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)
+				}
+			}
+		}
+		
+		$("#l" + fid).trigger('click');
+		$("#extend").val(extend);
+		
+		function save(){
+			$("#form1").submit();
+		}
+		
+		/* ]]> */
+	</script>
+</body>
+</html>