Browse Source

修改了质保卡功能

liuzhiwei 7 years ago
parent
commit
182ea44b9e

+ 50 - 0
wateroPF-common-core/src/main/java/com/iamberry/wechat/core/entity/machineNumber/WarrantyCard.java

@@ -32,8 +32,58 @@ public class WarrantyCard implements Serializable {
 
     private String userEmail;   //邮箱
 
+    private Integer cardWatero; //水质范围
+
+    private String cardProvince;//省
+
+    private String cardCity;    //市
+
+    private String cardLocation;    //地址
+
+    private String cardDistrict;//区
+
     private PageBean page;      //分页信息
 
+    public String getCardLocation() {
+        return cardLocation;
+    }
+
+    public void setCardLocation(String cardLocation) {
+        this.cardLocation = cardLocation;
+    }
+
+    public Integer getCardWatero() {
+        return cardWatero;
+    }
+
+    public void setCardWatero(Integer cardWatero) {
+        this.cardWatero = cardWatero;
+    }
+
+    public String getCardProvince() {
+        return cardProvince;
+    }
+
+    public void setCardProvince(String cardProvince) {
+        this.cardProvince = cardProvince;
+    }
+
+    public String getCardCity() {
+        return cardCity;
+    }
+
+    public void setCardCity(String cardCity) {
+        this.cardCity = cardCity;
+    }
+
+    public String getCardDistrict() {
+        return cardDistrict;
+    }
+
+    public void setCardDistrict(String cardDistrict) {
+        this.cardDistrict = cardDistrict;
+    }
+
     public PageBean getPage() {
         return page;
     }

+ 5 - 1
wateroPF-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/machineNumberMapper.xml

@@ -35,7 +35,11 @@ PUBLIC
 		number_barcode cardBarcode,
 		number_sales_time cardSaleTime,
 		user_email userEmail,
-		user_name userName
+		user_name userName,
+		number_watero cardWatero,
+		number_province cardProvince,
+		number_city cardCity,
+		number_district cardDistrict
 	</sql>
 
 	<!-- 统计批次及已完成条数-->

+ 10 - 0
wateroPF-wechat-web/src/main/java/com/iamberry/wechat/handles/admin/QrCodeHandler.java

@@ -325,6 +325,16 @@ public class QrCodeHandler {
         //添加质保结束时间和包换时间
         if (cardList != null && cardList.size() > 0) {
             for (WarrantyCard warrantyCard : cardList) {
+                StringBuilder location = new StringBuilder(warrantyCard.getCardProvince());
+                if (StringUtils.isNotEmpty(warrantyCard.getCardCity())) {
+                    location.append("-");
+                    location.append(warrantyCard.getCardCity());
+                }
+                if (StringUtils.isNotEmpty(warrantyCard.getCardDistrict())) {
+                    location.append("-");
+                    location.append(warrantyCard.getCardDistrict());
+                }
+                warrantyCard.setCardLocation(location.toString());
                 if (warrantyCard.getCardSaleTime() != null) {
                     warrantyCard.setCardEndTime(updateDate(warrantyCard.getCardSaleTime(),endRule.getRuleNum().intValue()));
                     warrantyCard.setCardRenewTime(updateDate(warrantyCard.getCardSaleTime(),renewRule.getRuleNum().intValue()));

+ 44 - 0
wateroPF-wechat-web/src/main/java/com/iamberry/wechat/handles/qrcode/MachineQrCodeHandler.java

@@ -362,6 +362,50 @@ public class MachineQrCodeHandler {
     }
 
     /**
+     * 根据经纬度通过腾讯地址位置
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/get_location_by_qq")
+    public ResultMsg getLocationByQq(HttpServletRequest request) throws Exception {
+        ResultMsg msg = new ResultMsg();
+        Map<String,Object> map = new HashMap<String,Object>();
+        //纬度
+        String latitude = request.getParameter("latitude");
+        //经度
+        String longitude = request.getParameter("longitude");
+        if (!StringUtils.isNotEmpty(latitude)) {
+            msg.setResultCode(ResultInfo.ERRORCODE);
+            msg.setStatus(false);
+            msg.setMessage("纬度不能为空!");
+            return msg;
+        }
+        if (!StringUtils.isNotEmpty(longitude)) {
+            msg.setResultCode(ResultInfo.ERRORCODE);
+            msg.setStatus(false);
+            msg.setMessage("经度不能为空!");
+            return msg;
+        }
+        JSONObject json = new JSONObject(
+                HttpUtility.httpsGet(MessageFormat.format(NameUtils.getConfig("LOCATION_QQ_URL"),latitude,longitude)));
+        JSONObject resultJson = json.getJSONObject("result");
+        JSONObject locationJson = resultJson.getJSONObject("ad_info");
+        String numberProvince = locationJson.getString("province");
+        String numberCity = locationJson.getString("city");
+        String numberDistrict = locationJson.getString("district");
+        System.out.println("locationJson="+locationJson);
+        map.put("numberProvince",numberProvince);
+        map.put("numberCity",numberCity);
+        map.put("numberDistrict",numberDistrict);
+        msg.setData(map);
+        msg.setResultCode(ResultInfo.SUCCESSCODE);
+        msg.setStatus(true);
+        return msg;
+    }
+
+    /**
      * 查询百胜订单信息
      * @param request
      * @param member

+ 2 - 0
wateroPF-wechat-web/src/main/resources/platform.properties

@@ -131,6 +131,8 @@ order_field=order_sn,deal_code,order_status,shipping_status,pay_status,process_s
 BINDINGDOWNLOD=/WEB-INF/views/other/index.html
 # SINA_IP_URL
 SINA_IP_URL=http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip={0}
+# LOCATION_QQ_URL
+LOCATION_QQ_URL=http://apis.map.qq.com/ws/geocoder/v1/?location={0},{1}&key=P2WBZ-LH73F-QZYJ2-JOVWI-J7G5J-ZFFEY&get_poi=0
 # ot_none
 OT_NONE=0
 # ot_writer

+ 28 - 11
wateroPF-wechat-web/src/main/webapp/WEB-INF/views/admin/qrCode/warrantyCardList.jsp

@@ -47,24 +47,41 @@
         <table class="table table-border table-bordered table-bg table-hover table-sort">
             <thead>
             <tr class="text-c">
-                <th width="100">质保卡号</th>
-                <th width="100">姓名</th>
+                <th width="60">质保卡号</th>
+                <th width="60">姓名</th>
                 <th width="100">邮箱</th>
-                <th width="100">购买日期</th>
-                <th width="100">换新截止日期</th>
-                <th width="100">十年质保日期</th>
+                <th width="60">水质范围</th>
+                <th width="100">地址</th>
+                <th width="60">购买日期</th>
+                <th width="60">换新截止日期</th>
+                <th width="60">十年质保日期</th>
             </tr>
             </thead>
             <tbody id="listid">
             <c:if test="${ !(empty cardList)}">
                 <c:forEach items="${cardList}" var="card">
                     <tr>
-                        <td class="text-c" width="100">${card.cardBarcode }</td>
-                        <td class="text-c" width="100">${card.userName }</td>
-                        <td class="text-c" width="100">${card.userEmail }</td>
-                        <td class="text-c" width="100"><fmt:formatDate value="${card.cardSaleTime }" pattern="yyyy-MM-dd" /></td>
-                        <td class="text-c" width="100"><fmt:formatDate value="${card.cardRenewTime }" pattern="yyyy-MM-dd" /></td>
-                        <td class="text-c" width="100"><fmt:formatDate value="${card.cardEndTime }" pattern="yyyy-MM-dd" /></td>
+                        <td class="text-c" width="60">${card.cardBarcode }</td>
+                        <td class="text-c" width="60">${card.userName }</td>
+                        <td class="text-c" width="60">${card.userEmail }</td>
+                        <td class="text-c" width="60">
+                            <c:if test="${card.cardWatero == 1 }">
+                                0-100 TDS
+                            </c:if>
+                            <c:if test="${card.cardWatero == 2 }">
+                                101-250 TDS
+                            </c:if>
+                            <c:if test="${card.cardWatero == 3 }">
+                                251-500 TDS
+                            </c:if>
+                            <c:if test="${card.cardWatero == 4 }">
+                                501 TDS 以上
+                            </c:if>
+                        </td>
+                        <td class="text-c" width="100">${card.cardLocation }</td>
+                        <td class="text-c" width="60"><fmt:formatDate value="${card.cardSaleTime }" pattern="yyyy-MM-dd" /></td>
+                        <td class="text-c" width="60"><fmt:formatDate value="${card.cardRenewTime }" pattern="yyyy-MM-dd" /></td>
+                        <td class="text-c" width="60"><fmt:formatDate value="${card.cardEndTime }" pattern="yyyy-MM-dd" /></td>
                     </tr>
                 </c:forEach>
             </c:if>

+ 1 - 1
wateroPF-wechat-web/src/main/webapp/WEB-INF/views/wechat/vip_center.html

@@ -131,7 +131,7 @@
 				<div class="iconfont icon-wodequanbao"></div>
 				我的券包
 			</a>
-			<a  id="myMachine" class="mui-control-item" href="/wateroPF/view/warranty_card.html">
+			<a  id="myMachine" class="mui-control-item" href="/wateroPF/wechat/qrcode/_add_warranty">
 				<div class="iconfont icon-zhi"></div>
 				质保卡
 			</a>

+ 313 - 309
wateroPF-wechat-web/src/main/webapp/view/add_machine.html

@@ -1,118 +1,119 @@
 <!DOCTYPE html>
 <html>
-	<head>
-		<meta charset="UTF-8">
-		<title>领取质保卡</title>
-		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
-		<meta name="apple-mobile-web-app-capable" content="yes">
-		<meta name="apple-mobile-web-app-status-bar-style" content="black">
-		<link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/css/mui.min.css?v=2017092601" />
-		<link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/css/mui.picker.min.css?v=2017092601" />
-		<link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/new/css/iconfont.css?v=2017092601" />
-		<link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/css/style.css?v=2017092601" />
-		<link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/new/css/personal_information.css?v=2017092601" />
-		<style>
-			h4{margin-top:5px;margin-bottom: 5px;font-size: 20px;}
-			.btn-pull-code{position: absolute;right: 10px;top:7px;height:34px;padding:0 6px;border-radius: 5px; line-height: 34px;font-size: 12px; color: #fff; background: #24cae9;}
-			.btn-pull-code .active{background: #c8c8c8;}
-			.icon-fuxuankuang a{color: #24cae9;}
-			.icon-yanse,.icon-youhui,.icon-fuxuankuang,.icon-jiage,.icon-songhuo{font-size: 15px;padding-left: 22px;}
-			.icon-yanse:before,.icon-fuxuankuang:before,.icon-youhui:before,.icon-jiage:before,.icon-songhuo:before{font-size: 18px;color: #24cae9;position: absolute;left: 0;width: 20px;height: 18px;}
-			.try_price{color: #f1436c;}
-			.ul_radio{width: 100%;}
-			.ul_radio li{width:21%;height: 55px;margin: 0 1%;border: 1px solid rgba(0,0,0,.1);border-radius: 5px; display: inline-block;position: relative;font-family:"iconfont" !important;font-style:normal;-webkit-font-smoothing: antialiased;}
-			.ul_radio .active:after{position: absolute;right: 0;bottom: 0;content: "\e66f";color: #f1436c;line-height: 1;font-size: 20px;}
+<head>
+	<meta charset="UTF-8">
+	<title>领取质保卡</title>
+	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
+	<meta name="apple-mobile-web-app-capable" content="yes">
+	<meta name="apple-mobile-web-app-status-bar-style" content="black">
+	<link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/css/mui.min.css?v=2017092601" />
+	<link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/css/mui.picker.min.css?v=2017092601" />
+	<link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/new/css/iconfont.css?v=2017092601" />
+	<link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/css/style.css?v=2017092601" />
+	<link rel="stylesheet" type="text/css" href="//s.iamberry.com/wateroPF/new/css/personal_information.css?v=2017092601" />
+	<style>
+		h4{margin-top:5px;margin-bottom: 5px;font-size: 20px;}
+		.btn-pull-code{position: absolute;right: 10px;top:7px;height:34px;padding:0 6px;border-radius: 5px; line-height: 34px;font-size: 12px; color: #fff; background: #24cae9;}
+		.btn-pull-code .active{background: #c8c8c8;}
+		.icon-fuxuankuang a{color: #24cae9;}
+		.icon-yanse,.icon-youhui,.icon-fuxuankuang,.icon-jiage,.icon-songhuo{font-size: 15px;padding-left: 22px;}
+		.icon-yanse:before,.icon-fuxuankuang:before,.icon-youhui:before,.icon-jiage:before,.icon-songhuo:before{font-size: 18px;color: #24cae9;position: absolute;left: 0;width: 20px;height: 18px;}
+		.try_price{color: #f1436c;}
+		.ul_radio{width: 100%;}
+		.ul_radio li{width:21%;height: 55px;margin: 0 1%;border: 1px solid rgba(0,0,0,.1);border-radius: 5px; display: inline-block;position: relative;font-family:"iconfont" !important;font-style:normal;-webkit-font-smoothing: antialiased;}
+		.ul_radio .active:after{position: absolute;right: 0;bottom: 0;content: "\e66f";color: #f1436c;line-height: 1;font-size: 20px;}
 
-			.head-img {position: absolute;bottom: 15px;right: 13px;width: 60px;height: 60px;border-radius: 30px;border: 3px solid #E5E5E5;}
-			.mui-table-view .mui-media .mui-media-body{height: 41px;line-height: 41px;color: #333;}
-			.mui-table-view .mui-media .mui-media-body>span{color: #f1436c;}
-			.my-table-view-try{border-top: .6em solid #f0f0f0;border-bottom: .6em solid #f0f0f0;padding-bottom: 10px;}
-			.my-table-view-try .mui-table-view-cell{padding:10px 13px 10px 30px !important;font-size: 12px;}
-			.mui-table-view-cell:after,.mui-table-view:before,.mui-table-view:after,.mui-input-group .mui-input-row:after,.mui-input-group:before,.mui-input-group:after{display: none;}
-			.mui-table-view-cell>a:not(.mui-btn){color: #666;margin: -15px -15px;}
-			.mui-table-view-cell>a .mui-pull-right{color: #999;font-size: 14px;}
-			#btn_submit{color: #fff;padding: 10px 0;font-size: 18px;background: #24cae9;width: 70%;margin:40px auto 0 auto;}
-			.mui-btn-block.mui-active,.btn-pull-code.mui-active{background-color: #c8c8c8 !important;}
-			.icon-fuxuankuang.mui-active:before{color: #c8c8c8;}
-			.mui-content-padded{margin: 10px 13px;}
-			.tips{padding: 25px 10px;background: #36a4c6;text-align: center;color: #fff;}
-			.mui-input-group .mui-input-row {height: 50px;padding: 5px 0;border: 1px solid rgba(0,0,0,.1); margin:10px 0;}
-			.mui-input-row label{color: #666;width:27%;font-size: 15px;}
-			.mui-input-row label~input{width:73%;}
-			.mui-input-row label~input::-webkit-input-placeholder{font-size: 15px;}
-			.triangle-down {width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid #ccc;}
-			.my-arrowright{position: absolute;right: 18px;top: 28px;color: #666;pointer-events:none;}
-			.mui-btn-red{background-color: #e9004c;}
-			.icon-saoma{position: absolute;right: 0;top:0;padding: 12px;color: #55c0dc;}
-			.mui-icon-arrowdown{position: absolute;right: 0;top:0;padding: 12px;color: #999;pointer-events: none;}
-		</style>
-	</head>
-	<body style="background: #fff;">
-	<div class="loading-bg">
-			<div class="mui-loading">
-				<div class="mui-spinner">
-				</div>
-				&nbsp;&nbsp;加载中...
-			</div>
+		.head-img {position: absolute;bottom: 15px;right: 13px;width: 60px;height: 60px;border-radius: 30px;border: 3px solid #E5E5E5;}
+		.mui-table-view .mui-media .mui-media-body{height: 41px;line-height: 41px;color: #333;}
+		.mui-table-view .mui-media .mui-media-body>span{color: #f1436c;}
+		.my-table-view-try{border-top: .6em solid #f0f0f0;border-bottom: .6em solid #f0f0f0;padding-bottom: 10px;}
+		.my-table-view-try .mui-table-view-cell{padding:10px 13px 10px 30px !important;font-size: 12px;}
+		.mui-table-view-cell:after,.mui-table-view:before,.mui-table-view:after,.mui-input-group .mui-input-row:after,.mui-input-group:before,.mui-input-group:after{display: none;}
+		.mui-table-view-cell>a:not(.mui-btn){color: #666;margin: -15px -15px;}
+		.mui-table-view-cell>a .mui-pull-right{color: #999;font-size: 14px;}
+		#btn_submit{color: #fff;padding: 10px 0;font-size: 18px;background: #24cae9;width: 70%;margin:40px auto 0 auto;}
+		.mui-btn-block.mui-active,.btn-pull-code.mui-active{background-color: #c8c8c8 !important;}
+		.icon-fuxuankuang.mui-active:before{color: #c8c8c8;}
+		.mui-content-padded{margin: 10px 13px;}
+		.tips{padding: 25px 10px;background: #36a4c6;text-align: center;color: #fff;}
+		.mui-input-group .mui-input-row {height: 50px;padding: 5px 0;border: 1px solid rgba(0,0,0,.1); margin:10px 0;}
+		.mui-input-row label{color: #666;width:27%;font-size: 15px;}
+		.mui-input-row label~input{width:73%;}
+		.mui-input-row label~input::-webkit-input-placeholder{font-size: 15px;}
+		.triangle-down {width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid #ccc;}
+		.my-arrowright{position: absolute;right: 18px;top: 28px;color: #666;pointer-events:none;}
+		.mui-btn-red{background-color: #e9004c;}
+		.icon-saoma{position: absolute;right: 0;top:0;padding: 12px;color: #55c0dc;}
+		.mui-icon-arrowdown{position: absolute;right: 0;top:0;padding: 12px;color: #999;pointer-events: none;}
+	</style>
+</head>
+<body style="background: #fff;">
+<div class="loading-bg">
+	<div class="mui-loading">
+		<div class="mui-spinner">
+		</div>
+		&nbsp;&nbsp;加载中...
 	</div>
+</div>
 
-					<div class="mui-content" style="background: #fff;">
-				<div class="tips more">
-					<h4>现在完善机器信息!</h4>
-					<span>尊享WaterO全面服务保障</span>
-					<div></div>
-				</div>
-				<div class="mui-content-padded">
-					<div><span class="iconfont icon-dingwei" style="color: #f00;"></span>地址:<span id="wx-ads"></span></div>
-				<form class="mui-input-group">
-					<div class="mui-input-row">
-						<label>您的姓名</label>
-						<input type="text" maxlength="12" class="mui-input-clear" placeholder="请填写您的姓名" id="ipt-name">
-					</div>
-					<div class="mui-input-row">
-						<label>您的邮箱</label>
-						<input type="text" maxlength="32" class="mui-input-clear" placeholder="请填写您的邮箱" id="ipt-email">
-					</div>
-					<div class="mui-input-row">
-						<label>水质范围</label>
-						<input type="text"  placeholder="请选择您的水质范围" id="ipt-water" txtvalue="" readonly="readonly">
-					</div>
-					<div class="mui-input-row">
-						<label>手机号码</label>
-						<input type="tel" maxlength="11" class="mui-input-clear" placeholder="请填写物流发货时预留的手机号" id="ipt-phone">
-					</div>
-					<div class="mui-input-row">
-						<label>验&nbsp;&nbsp;证&nbsp;&nbsp;码</label>
-						<input type="text" maxlength="4" placeholder="请输入验证码" id="ipt-code">
-						<span class="btn-pull-code" id="pull-code">获取验证码</span>
-					</div>
-					<div class="">
-						<label style="color: red;"><b>*注意:</b><label id="txt_message">请填写与您物流信息相符的联系电话,否则将会无法识别您的产品信息</label></label>
-					</div>
-
-				</form>
-				</div>
-				<div class="mui-content-padded">
-					<button type="button" data-loading-icon="mui-spinner mui-spinner-custom" data-loading-text="提交中" class="mui-btn mui-btn-block mui-btn-outlined mui-active" id="btn_submit" disabled="disabled" >提交</button>
-				</div>
+<div class="mui-content" style="background: #fff;">
+	<div class="tips more">
+		<h4>现在完善机器信息!</h4>
+		<span>尊享WaterO全面服务保障</span>
+		<div></div>
+	</div>
+	<div class="mui-content-padded">
+		<div><span class="iconfont icon-dingwei" style="color: #f00;"></span>地址:<span id="wx-ads"></span></div>
+		<form class="mui-input-group">
+			<div class="mui-input-row">
+				<label>姓名</label>
+				<input type="text" maxlength="12" class="mui-input-clear" placeholder="请填写您的姓名" id="ipt-name">
+			</div>
+			<div class="mui-input-row">
+				<label>邮箱</label>
+				<input type="text" maxlength="32" class="mui-input-clear" placeholder="请填写您的邮箱" id="ipt-email">
+			</div>
+			<div class="mui-input-row">
+				<label>水质</label>
+				<input type="text"  placeholder="请选择您的水质范围" id="ipt-water" txtvalue="" readonly="readonly">
+			</div>
+			<div class="mui-input-row">
+				<label>手机号</label>
+				<input type="tel" maxlength="11" class="mui-input-clear" placeholder="请填写物流发货时预留的手机号" id="ipt-phone">
+			</div>
+			<div class="mui-input-row">
+				<label>验&nbsp;&nbsp;证&nbsp;&nbsp;码</label>
+				<input type="text" maxlength="4" placeholder="请输入验证码" id="ipt-code">
+				<span class="btn-pull-code" id="pull-code">获取验证码</span>
 			</div>
+			<div id="div_message" style="display: none;">
+				<label style="color: red;"><b>*注意:</b><label id="txt_message">请填写与您物流信息相符的联系电话,否则将会无法识别您的产品信息</label></label>
+			</div>
+
+		</form>
+	</div>
+	<div class="mui-content-padded">
+		<button type="button" data-loading-icon="mui-spinner mui-spinner-custom" data-loading-text="提交中" class="mui-btn mui-btn-block mui-btn-outlined mui-active" id="btn_submit" disabled="disabled" >提交</button>
+	</div>
+</div>
 
-	<script src="//s.iamberry.com/wateroPF/js/mui.min.js?v=2016101701"></script>
-	<script src="//s.iamberry.com/wateroPF/js/mui.picker.min.js"></script>
-	<script src="//s.iamberry.com/wateroPF/js/jquery-2.1.1.min.js"></script>
-	<script src="//s.iamberry.com/wateroPF/js/shop/main.js?v=2016101701"></script>
-	<script src="//s.iamberry.com/wateroPF/js/shop/wechat-utils-1.0.js"></script>
+<script src="//s.iamberry.com/wateroPF/js/mui.min.js?v=2016101701"></script>
+<script src="//s.iamberry.com/wateroPF/js/mui.picker.min.js"></script>
+<script src="//s.iamberry.com/wateroPF/js/jquery-2.1.1.min.js"></script>
+<script src="//s.iamberry.com/wateroPF/js/shop/main.js?v=2016101701"></script>
+<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
+<script src="//s.iamberry.com/wateroPF/js/shop/wechat-utils-1.0.js"></script>
 <script type="text/javascript">
 
-	var check = false,alert_msg='';
-	var mobile=/^(13|14|15|18)[0-9]{9}$/; //手机号码
-	var uname = /^[\u4e00-\u9fa5a-zA-Z]{1,12}$/; //中文英文
+    var check = false,alert_msg='';
+    var mobile=/^(13|14|15|18)[0-9]{9}$/; //手机号码
+    var uname = /^[\u4e00-\u9fa5a-zA-Z]{1,12}$/; //中文英文
     var email=/^\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,18}$/;
-	var code = /^[0-9]{4}$/; //数字
+    var code = /^[0-9]{4}$/; //数字
     var numberProvince = null;
     var numberCity = null;
     var numberDistrict = null;
-	mui.ready(function(){
+    mui.ready(function(){
         //选择示例
         var userPicker = new mui.PopPicker();
         userPicker.setData([{
@@ -149,61 +150,64 @@
                         break;
                 }
                 $('#txt_message').html(txt_message);
+                $('#div_message').show();
             });
         }, false);
+        document.querySelector('.loading-bg').style.display='none';
+    });
 
-        jWeixin.getLocation({
-            type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
+    wx.ready(function () {
+        // 7.2 获取当前地理位置
+        wx.getLocation({
             success: function (res) {
-                console.log(res);
                 var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
                 var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
                 var speed = res.speed; // 速度,以米/每秒计
                 var accuracy = res.accuracy; // 位置精度
-                //getLocation(latitude,longitude);
+                getlocation(latitude,longitude);
             },
             cancel: function (res) {
-                mui.alert('用户拒绝授权获取地理位置');
+                $("#wx-ads").text('定位失败');
             }
         });
-
-		document.querySelector('.loading-bg').style.display='none';
-	});
-window.onload=function(){
-
-};
-function getLocation(latitude,longitude){
-    $.ajax({
-        type: 'get',
-        url: 'http://apis.map.qq.com/ws/geocoder/v1/?location='+latitude+','+longitude+'&key=P2WBZ-LH73F-QZYJ2-JOVWI-J7G5J-ZFFEY&get_poi=0',
-        dataType: 'json',
-        timeout: 15000,
-        success: function(dt) {
-            console.log(dt);
-            if(dt.status==0){
-                $("#wx-ads").text(dt.result.ad_info.province+"-"+dt.result.ad_info.city+"-"+dt.result.ad_info.district);
-                numberProvince = dt.result.ad_info.province;
-                numberCity = dt.result.ad_info.city;
-                numberDistrict = dt.result.ad_info.district;
-			}
-        },
-        error: function(xhr, type, errorThrown) {
-            console.log("请检查网络或刷新页面重试!");
-        }
     });
-}
-	mui('body').on('tap', '#btn_submit', function() {
-		change_input();
-		if(check){
-			console.log("提交");
-			mui(this).button('loading');
-			setTimeout(function() {
-        mui(this).button('reset');
-    }.bind(this), 2000);
-			//mui.alert("本批watero试用机为新机,请您在试用过程中足够爱惜,切勿刮划机身及损坏包装,感谢您的配合!");
-			var data_array = {
-				"userTel":$('#ipt-phone').val()
-			};
+
+    function getlocation(latitude,longitude){
+        var data_array = {
+            "latitude":latitude,
+			"longitude":longitude
+        };
+        $.ajax({
+            type: 'get',
+            url: base_path + '/qrcode/get_location_by_qq',
+			data:data_array,
+            dataType: 'json',
+            timeout: 15000,
+            success: function(dt) {
+                if(dt.status){
+                    numberProvince = dt.data.numberProvince;
+                    numberCity = dt.data.numberCity;
+                    numberDistrict = dt.data.numberDistrict;
+                    $("#wx-ads").text(numberProvince+"-"+numberCity+"-"+numberDistrict);
+                }
+            },
+            error: function(xhr, type, errorThrown) {
+                console.log("请检查网络或刷新页面重试!");
+            }
+        });
+    }
+    mui('body').on('tap', '#btn_submit', function() {
+        change_input();
+        if(check){
+            console.log("提交");
+            mui(this).button('loading');
+            setTimeout(function() {
+                mui(this).button('reset');
+            }.bind(this), 2000);
+            //mui.alert("本批watero试用机为新机,请您在试用过程中足够爱惜,切勿刮划机身及损坏包装,感谢您的配合!");
+            var data_array = {
+                "userTel":$('#ipt-phone').val()
+            };
             $.ajax({
                 type: 'post',
                 url: base_path + '/qrcode/select_efast_order_num',
@@ -217,10 +221,10 @@ function getLocation(latitude,longitude){
                         var text = '';
                         if (dt.data.num > 0) {
                             text = '您有'+ dt.data.num + '个订单,是否确认领取质保卡?';
-						} else {
+                        } else {
                             mui.alert('未搜索到订单,请确认后提交,如有疑问,请联系公众号客服!');
                             return;
-						}
+                        }
                         var btnArray = ['否', '是'];
                         mui.confirm(text, '提示', btnArray, function(e) {
                             if (e.index == 1) {
@@ -229,7 +233,7 @@ function getLocation(latitude,longitude){
                                     "userName":$('#ipt-name').val(),
                                     "userTel":$('#ipt-phone').val(),
                                     "userEmail":$('#ipt-email').val(),
-									"numberWatero":$('#ipt-water').attr('txtvalue'),
+                                    "numberWatero":$('#ipt-water').attr('txtvalue'),
                                     "numberProvince":numberProvince,
                                     "numberCity":numberCity,
                                     "numberDistrict":numberDistrict,
@@ -264,174 +268,174 @@ function getLocation(latitude,longitude){
                     mui.alert("请检查网络或刷新页面重试!");
                 }
             });
-		}else{
-			console.log("未通过");
-			mui.alert(alert_msg);
-		}
-	});
-	mui('body').on('tap', '#xieyi-dalog', function() {
-		mui.openWindow({
-			url: 'try_xieyi.html'
-		});
-	});
-$(".ul_radio li").each(function() {
-	$(this).on("click", function() {
-		$(this).addClass("active");
-		$(this).siblings().removeClass("active");
-	});
-});
-$(document).on('tap', '#btn-tongyi', function() {
-	var btn_submit=$("#btn_submit");
-	console.log($(this).hasClass("mui-active"));
-	if($(this).hasClass("mui-active")){
-		$(this).removeClass("mui-active");
-		btn_submit.removeClass("mui-active");
-	}else{
-		$(this).addClass("mui-active");
-		btn_submit.addClass("mui-active");
-	}
-});
-$(document).on('tap', '#pull-code', function() {
-	if($("#ipt-phone").val().trim()=="" &&(!$("#pull-code").hasClass("mui-active"))){
-		mui.alert("请填写手机号码");
-		return;
-	}else{
-		if(!mobile.test($("#ipt-phone").val().trim())){
-			mui.alert("手机号码不正确,请重新填写");
-			return;
-		}else{
-			if($(this).hasClass("mui-active")){
-				mui.alert();
-				return;
-			}else{
-				$(this).addClass("mui-active");
-                $('#btn_submit').removeClass("mui-active");
-                $('#btn_submit').removeAttr("disabled");
-				settime("pull-code");
-                $.ajax({
-                    type: 'post',
-                    url: base_path + '/qrcode/send_phone_code',
-					data:{
-                        "phone" : $("#ipt-phone").val()
-                    },
-                    dataType: 'json',
-                    timeout: 15000,
-                    success: function(dt) {
-                    },
-                    error: function(xhr, type, errorThrown) {
-                        mui.alert("请检查网络或刷新页面重试!");
-                    }
-                });
-			}
-		}
-	}
-});
-var countdown=60; 
-function settime(val) { 
-pullid=dc(val);
-if (countdown == 0) { 
-pullid.removeAttribute("disabled");
-pullid.className='btn-pull-code';
-pullid.innerText="获取验证码"; 
-countdown = 60; 
-return false;
-} else { 
-pullid.setAttribute("disabled", true); 
-pullid.className='btn-pull-code mui-active';
-pullid.innerText="重新发送(" + countdown + ")"; 
-countdown--; 
-} 
-setTimeout(function() { 
-settime(val) 
-},1000) 
-} 
-function change_input() {
-    //活动暂时结束   下次开启时注释这段代码就好了
-    /*alert_msg="活动已暂停,开始时间请联系客服";
-    check=false;
-    return false;*/
+        }else{
+            console.log("未通过");
+            mui.alert(alert_msg);
+        }
+    });
+    mui('body').on('tap', '#xieyi-dalog', function() {
+        mui.openWindow({
+            url: 'try_xieyi.html'
+        });
+    });
+    $(".ul_radio li").each(function() {
+        $(this).on("click", function() {
+            $(this).addClass("active");
+            $(this).siblings().removeClass("active");
+        });
+    });
+    $(document).on('tap', '#btn-tongyi', function() {
+        var btn_submit=$("#btn_submit");
+        console.log($(this).hasClass("mui-active"));
+        if($(this).hasClass("mui-active")){
+            $(this).removeClass("mui-active");
+            btn_submit.removeClass("mui-active");
+        }else{
+            $(this).addClass("mui-active");
+            btn_submit.addClass("mui-active");
+        }
+    });
+    $(document).on('tap', '#pull-code', function() {
+        if($("#ipt-phone").val().trim()=="" &&(!$("#pull-code").hasClass("mui-active"))){
+            mui.alert("请填写手机号码");
+            return;
+        }else{
+            if(!mobile.test($("#ipt-phone").val().trim())){
+                mui.alert("手机号码不正确,请重新填写");
+                return;
+            }else{
+                if($(this).hasClass("mui-active")){
+                    mui.alert();
+                    return;
+                }else{
+                    $(this).addClass("mui-active");
+                    $('#btn_submit').removeClass("mui-active");
+                    $('#btn_submit').removeAttr("disabled");
+                    settime("pull-code");
+                    $.ajax({
+                        type: 'post',
+                        url: base_path + '/qrcode/send_phone_code',
+                        data:{
+                            "phone" : $("#ipt-phone").val()
+                        },
+                        dataType: 'json',
+                        timeout: 15000,
+                        success: function(dt) {
+                        },
+                        error: function(xhr, type, errorThrown) {
+                            mui.alert("请检查网络或刷新页面重试!");
+                        }
+                    });
+                }
+            }
+        }
+    });
+    var countdown=60;
+    function settime(val) {
+        pullid=dc(val);
+        if (countdown == 0) {
+            pullid.removeAttribute("disabled");
+            pullid.className='btn-pull-code';
+            pullid.innerText="获取验证码";
+            countdown = 60;
+            return false;
+        } else {
+            pullid.setAttribute("disabled", true);
+            pullid.className='btn-pull-code mui-active';
+            pullid.innerText="重新发送(" + countdown + ")";
+            countdown--;
+        }
+        setTimeout(function() {
+            settime(val)
+        },1000)
+    }
+    function change_input() {
+        //活动暂时结束   下次开启时注释这段代码就好了
+		/*alert_msg="活动已暂停,开始时间请联系客服";
+		 check=false;
+		 return false;*/
 
 
-	$(".mui-input-group input").each(function(index) {
-		switch ($(this).attr("id")){
-			case "ipt-name":
-			if($(this).val().trim()==""){
-				alert_msg="请填写姓名";
-				check=false;
-				return false;
-			}else{
-				if(uname.test($(this).val())) {
-					check=true;
-				}else{
-					alert_msg="姓名格式不正确,请重新填写";
-					check=false;
-					return false;
-				}
-			}
-				break;
-            case "ipt-email":
-                if($(this).val().trim()==""){
-                    alert_msg="请填写您的邮箱";
-                    check=false;
-                    return false;
-                }else{
-                    if(email.test($(this).val())) {
-                        check=true;
+        $(".mui-input-group input").each(function(index) {
+            switch ($(this).attr("id")){
+                case "ipt-name":
+                    if($(this).val().trim()==""){
+                        alert_msg="请填写姓名";
+                        check=false;
+                        return false;
+                    }else{
+                        if(uname.test($(this).val())) {
+                            check=true;
+                        }else{
+                            alert_msg="姓名格式不正确,请重新填写";
+                            check=false;
+                            return false;
+                        }
+                    }
+                    break;
+                case "ipt-email":
+                    if($(this).val().trim()==""){
+                        alert_msg="请填写您的邮箱";
+                        check=false;
+                        return false;
                     }else{
-                        alert_msg="邮箱格式不正确,请重新填写";
+                        if(email.test($(this).val())) {
+                            check=true;
+                        }else{
+                            alert_msg="邮箱格式不正确,请重新填写";
+                            check=false;
+                            return false;
+                        }
+                    }
+                    break;
+                case "ipt-phone":
+                    if($(this).val().trim()==""){
+                        alert_msg="请填写手机号";
                         check=false;
                         return false;
+                    }else{
+                        if(mobile.test($(this).val().trim())) {
+                            check=true;
+                        }else{
+                            alert_msg="手机号码不正确,请重新填写";
+                            check=false;
+                            return false;
+                        }
                     }
-                }
-                break;
-			case "ipt-phone":
-			if($(this).val().trim()==""){
-				alert_msg="请填写手机号";
-				check=false;
-				return false;
-			}else{
-				if(mobile.test($(this).val().trim())) {
-					check=true;
-				}else{
-					alert_msg="手机号码不正确,请重新填写";
-					check=false;
-					return false;
-				}
-			}
-				break;
-			case "ipt-code":
-			if($(this).val().trim()==""){
-				alert_msg="请填写验证码";
-				check=false;
-				return false;
-			}else{
-				if(code.test($(this).val().trim())) {
-					check=true;
-				}else{
-					alert_msg="验证码格式不正确,请重新填写";
-					check=false;
-					return false;
-				}
-			}
-				break;
-			default:
-				break;
-		}
-	});
-	var btn_submit = dc('btn_submit');
-	if(check) {
-		console.log("通过")
-	} else {
-		console.log(alert_msg);
-	}
-}
+                    break;
+                case "ipt-code":
+                    if($(this).val().trim()==""){
+                        alert_msg="请填写验证码";
+                        check=false;
+                        return false;
+                    }else{
+                        if(code.test($(this).val().trim())) {
+                            check=true;
+                        }else{
+                            alert_msg="验证码格式不正确,请重新填写";
+                            check=false;
+                            return false;
+                        }
+                    }
+                    break;
+                default:
+                    break;
+            }
+        });
+        var btn_submit = dc('btn_submit');
+        if(check) {
+            console.log("通过")
+        } else {
+            console.log(alert_msg);
+        }
+    }
 
 
-var flag = false;
-var mask = mui.createMask(function() {
-	return flag;
-	}); //callback为用户点击蒙版时自动执行的回调;
-	 mui('body').on('tap', '#ipt-date', function() {
+    var flag = false;
+    var mask = mui.createMask(function() {
+        return flag;
+    }); //callback为用户点击蒙版时自动执行的回调;
+    mui('body').on('tap', '#ipt-date', function() {
         var th = this;
         var picker = new mui.DtPicker({
             type: "date", //设置日历初始视图模式
@@ -444,6 +448,6 @@ var mask = mui.createMask(function() {
             picker.dispose();
         });
     });
-	</script>
-	</body>
+</script>
+</body>
 </html>