Browse Source

兑换码

yuhaitao14 7 years ago
parent
commit
3e3a070fc2

+ 15 - 5
shop/src/main/java/com/zskk/shop/controller/h5/H5ExchangeCodeController.java

@@ -10,6 +10,7 @@ package com.zskk.shop.controller.h5;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import com.zskk.shop.controller.AbstractController;
 import com.zskk.shop.controller.bean.ControllerResult;
 import com.zskk.shop.controller.bean.UserBean;
+import com.zskk.shop.dao.entry.BuyOrder;
 import com.zskk.shop.dao.entry.ExchangeCode;
 import com.zskk.shop.dao.entry.ExchangeCodeItem;
 import com.zskk.shop.exception.ErrorConstant;
@@ -30,18 +32,26 @@ public class H5ExchangeCodeController  extends AbstractController {
 	@Autowired
 	private ExchangeCodeService exchangeCodeService;
 	
+	@RequestMapping("/goexchange")
+	public String goexchange(Model model){
+		return "/h5/exchagecode";
+	}
+	
 	@RequestMapping("/exchange")
-	@ResponseBody
-	public ControllerResult exchange(@RequestParam("eicode") String eicode, @RequestParam("pwd") String pwd){
+	public String exchange(Model model, @RequestParam("eicode") String eicode, @RequestParam("pwd") String pwd){
 		ExchangeCodeItem item = exchangeCodeService.queryOneExchangeCodeItem(eicode);
 		if (item == null){
-			throw new ZSKKException(ErrorConstant.EXCODE_ERROR);
+			model.addAttribute("msg", ErrorConstant.EXCODE_ERROR.getMsg());
+			return "/h5/exchangeError";
 		}
 		if (!item.getEipwd().equals(pwd.toUpperCase())){
-			throw new ZSKKException(ErrorConstant.EXCODE_ERROR);
+			model.addAttribute("msg", ErrorConstant.EXCODE_ERROR.getMsg());
+			return "/h5/exchangeError";
 		}
 		UserBean user 	= this.getH5User().getUser();
 		ExchangeCode ec = exchangeCodeService.queryOneExchangeCode(item.getEid());
-		return new ControllerResult(exchangeCodeService.exchange(user, ec, item));
+		BuyOrder order 	= exchangeCodeService.exchange(user, ec, item);
+		model.addAttribute("order", order);
+		return "/h5/exchangeSuccess";
 	}
 }

+ 38 - 0
shop/src/main/resource/templates/h5/exchagecode.html

@@ -0,0 +1,38 @@
+<!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>
+<script src="/h5/js/nav.js"></script>
+</head>
+
+<body>
+	<form action="/h5/ec/exchange" method="POST">
+		<div class="txtBox">
+			<dl>
+				<dt>请输入礼品卡号:</dt>
+				<dd>
+					<input name="eicode" type="text" class="txt" style="width: 100%" />
+				</dd>
+			</dl>
+
+			<dl>
+				<dt>请输入对应密码:</dt>
+				<dd>
+					<input name="pwd" type="text" class="txt" style="width: 100%" />
+				</dd>
+			</dl>
+
+			<dl>
+				<dd>
+					<button class="btn" style="width: 100%" type="submit">提交</button>
+				</dd>
+			</dl>
+		</div>
+	</form>
+</body>
+</html>

+ 20 - 0
shop/src/main/resource/templates/h5/exchangeError.html

@@ -0,0 +1,20 @@
+<!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>
+<script src="/h5/js/nav.js"></script>
+</head>
+
+<body>
+	<div class="txtBox-tips mt50">
+    	<div class="false">
+        	<p>请检查礼卡输入信息</p>
+            <p><a href="/h5/ec/goexchange">重新输入</a></p>
+        </div>
+    </div>
+</body>
+</html>

+ 21 - 0
shop/src/main/resource/templates/h5/exchangeSuccess.html

@@ -0,0 +1,21 @@
+<!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>
+<script src="/h5/js/nav.js"></script>
+</head>
+
+<body>
+	<div class="txtBox-tips mt50">
+    	<div class="ture">
+        	<p>兑换成功</p>
+            <p>请进入个人中心进行体检预约</p>
+            <p><a href="/h5/buy/mypayedorders">立即预约</a></p>
+        </div>
+    </div>
+</body>
+</html>

+ 3 - 0
shop/src/main/resource/templates/h5/my.html

@@ -27,6 +27,9 @@
         <ul>
         	<li class="scdd"><a href="/h5/buy/nopayorders">商城订单</a></li>
         </ul>
+        <ul>
+        	<li class="lkdh"><a href="/h5/ec/goexchange">礼卡兑换</a></li>
+        </ul>
         <ul>
         	<li class="cjwt"><a href="/h5/my/questions">常见问题</a></li>
             <!-- <li class="xgmm"><a href="####">修改密码</a></li>  --> 

+ 1 - 1
shop/static/h5/js/nav.js

@@ -52,7 +52,7 @@ $(function () {
         var dom = $(this);
         dom.on('click', function () {
             hideNav();
-            //alert(dom.text())
+            alert(dom.text())
         });
     });
 

BIN
shop/static/h5/style/false-tips.png


BIN
shop/static/h5/style/mine_lkdh.png


+ 33 - 4
shop/static/h5/style/style.css

@@ -65,13 +65,14 @@ a{ text-decoration:none; }
 /*套餐详情页*/
 .v-banner{ width:100%; }
 .v-v{ padding:20px 10px 0px; }
-.v-v h1{ font-size:1.2rem; margin-bottom:8px; }
-.v-v h3{ font-size:.8rem; line-height:1.2rem; color:#999; margin-bottom:8px; }
 .v-v .price{ line-height:1.4rem; }
 .v-v .price em{ font-size:1rem; color:#D83F31; margin:0 2px; }
 .v-v .price .new{ font-size:1.5rem; color:#D83F31; margin-right:20px; }
-.v-v .price .old{ font-size:1rem; color:#CCC; text-decoration:line-through; }
+.v-v .price .old{ font-size:1rem; color:#CCC; }
+.v-v .price .old span{ text-decoration:line-through; }
 .v-v .tag{ height:22px; margin:10px 0; text-align:justify; text-justify:inter-ideograph; }
+.v-v h1{ font-size:1.2rem; margin:8px 0; }
+.v-v h3{ font-size:.8rem; line-height:1.2rem; color:#999; margin-bottom:8px; }
 .v-v .sstk, .v-v .ksyy{ height:22px; line-height:22px; display:inline-block; padding-left:25px; margin-right:10px; font-size:.8rem; color:#999; }
 .v-v .sstk{ background:url(tag-sstk.png) no-repeat center left; background-size:18px; }
 .v-v .ksyy{ background:url(tag-ksyy.png) no-repeat center left; background-size:18px; }
@@ -145,15 +146,43 @@ a{ text-decoration:none; }
 .mineNavL em, .mineNavC em, .mineNavR em{ padding-bottom:3px; font-size:.8rem; color:#999; }
 .mineNavL span, .mineNavC span, .mineNavR span{ padding-top:3px; font-size:1.2rem; color:#000; }
 .mine ul{ display:block; margin:15px; background-color:#FFF; border-radius:4px; }
-.mine ul .yytj, .mine ul .bgcx, .mine ul .scdd, .mine ul .cjwt, .mine ul .xgmm{ display:block; height:50px; margin:0 12px; padding-left:36px; }
+.mine ul .yytj, .mine ul .bgcx, .mine ul .scdd, .mine ul .cjwt, .mine ul .xgmm, .mine ul .lkdh{ display:block; height:50px; margin:0 12px; padding-left:36px; }
 .mine ul .yytj{ background:url(mine_yytj.png) no-repeat center left; background-size:28px; }
 .mine ul .bgcx{ background:url(mine_bgcx.png) no-repeat center left; background-size:28px; }
 .mine ul .scdd{ background:url(mine_scdd.png) no-repeat center left; background-size:28px; }
 .mine ul .cjwt{ background:url(mine_cjwt.png) no-repeat center left; background-size:28px; }
 .mine ul .xgmm{ background:url(mine_xgmm.png) no-repeat center left; background-size:28px; }
+.mine ul .lkdh{ background:url(mine_lkdh.png) no-repeat center left; background-size:28px; }
 .mine ul .yytj a{ border-bottom:.5px solid #DDD; }
 .mine ul .cjwt a{ border-bottom:.5px solid #DDD; }
 .mine ul li a{ display:block; height:50px; line-height:50px; color:#000; background:url(mine_more.png) right center no-repeat; background-size:12px; }
 .mine .tcdl{ display:block; height:50px; line-height:50px; text-align:center; text-decoration:none; margin:15px; background-color:#FFF; border-radius:4px; color:#666; }
 
+/*0719新增商品购买页*/
+.shopBuy{}
+.shopBuy dl{}
+.shopBuy dt{ padding:0 15px; height:35px; line-height:35px; color:#999; font-size:.8rem; }
+.shopBuy dd{ background-color:#FFF; }
+.shopBuy dd ul li{ padding:15px; overflow:hidden; border-bottom:1px solid #EEE; }
+.shopBuy dd ul li img{ width:70px; height:50px; float:left; margin-right:15px; }
+.shopBuy dd ul li h3{ font-size:1rem; color:#333; }
+.shopBuy dd ul li p{ margin-top:10px; }
+.shopBuy dd ul li p span, .shopBuy dd ul li p em{ font-style:normal; font-size:.9rem; color:#999; }
+.shopBuy dd ul li p em{ float:right; }
+.shopBuy dd a{ padding:0 15px; height:50px; line-height:50px; color:#999; font-size:.8rem; display:inline-block; }
+
+/*表单提交*/
+.txtBox{ padding:5px 15px; }
+.txtBox dl{ padding:0 0 10px; }
+.txtBox dt{ padding:0 0 10px; font-size:1rem; }
+.txtBox dd{ width:100%; }
+.txtBox .txt{ height:50px; border:1px solid #CCC; border-radius:3px;-webkit-appearance: none; font-size:1rem; }
+.txtBox .btn{ height:50px; border-radius:3px; border:none; font-size:1rem; background-image:linear-gradient(to bottom right, #F4E1E1, #65D8EB); color:#FFF; }
 
+/*提交结果提示*/
+.txtBox-tips{ }
+.txtBox-tips .ture, .txtBox-tips .false{ width:100%; padding-top:80px; }
+.txtBox-tips .ture{ background:url(true-tips.png) no-repeat center top; background-size:64px; }
+.txtBox-tips .false{ background:url(false-tips.png) no-repeat center top; background-size:64px; }
+.txtBox-tips p{ text-align:center; line-height:1.6rem; }
+.txtBox-tips p a{ display:inline-block; padding:5px 8px; }

BIN
shop/static/h5/style/true-tips.png