| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 | <!DOCTYPE html><html>	<head>		<meta charset="utf-8">		<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">		<title>免费领取充电器</title>		<link rel="stylesheet" type="text/css" href="css/mui.min.css" />		<link rel="stylesheet" type="text/css" href="css/iconfont.css" />		<link rel="stylesheet" type="text/css" href="css/main.css" />		<script type="text/javascript">			// 屏蔽分享			window.hiddenAllWechatMenu = true;		</script>	</head>	<body>		<div class="mui-content" style="padding-bottom: 56px;">			<div class="address-cantainner">				<ul class="mui-table-view mui-table-view-striped my-grid-view-no mui-table-view-condensed">					<li class="mui-table-view-cell">						<div class="mui-table">							<!--没有选地址时显示的div-->							<div class="mui-table-cell mui-col-xs-12 table-middle btn-add-address">								<div class="add-address"><span class="iconfont icon-jia"></span>添加收货地址</div>							</div>							<!--选择微信地址后显示的div-->							<div id="user-address-div" style="display: none;">								<!--<div class="mui-table-cell mui-col-xs-1 mui-text-left table-middle">								<p><span class="iconfont icon-dingwei"></span></p>							</div>							<div class="mui-table-cell mui-col-xs-10 mui-text-left table-middle">								<div>收货人:林笑笑 <span class="mui-pull-right">16899996678</span></div>								<p>收货地址:广东省深圳市福田区莲花街道深圳特区 报业大厦12b</p>							</div>							<div class="mui-table-cell mui-col-xs-1 mui-text-right table-middle">								<p><span class="mui-icon mui-icon-arrowright"></span></p>							</div>-->							</div>						</div>					</li>				</ul>			</div>			<br />			<div class="mui-content-padded">				选择充电器颜色			</div>			<div class="mui-content-padded">				<div class="mui-table">					<div class="mui-table-cell mui-col-xs-12" id="my-pull">						<!--<span class="pro-select-color active" name="42" src="https://s.iamberry.com/soodo/wechat/images/pro-bai.png" colorpresent="上朵柔性声波牙刷,柔和清洁牙龈沟,用温柔的力量守护你的笑容" price="39900">极光白</span><span class="pro-select-color " name="43" src="https://s.iamberry.com/soodo/wechat/images/pro-hei.png" colorpresent="上朵柔性声波牙刷,柔和清洁牙龈沟,用温柔的力量守护你的笑容" price="39900">晶石黑</span><span class="pro-select-color " name="44" src="https://s.iamberry.com/soodo/wechat/images/pro-fen.png" colorpresent="上朵柔性声波牙刷,柔和清洁牙龈沟,用温柔的力量守护你的笑容" price="39900">樱花粉</span><span class="pro-select-color " name="45" src="https://s.iamberry.com/soodo/wechat/images/pro-lan.png" colorpresent="上朵柔性声波牙刷,柔和清洁牙龈沟,用温柔的力量守护你的笑容" price="39900">冰川蓝</span><span class="pro-select-color " name="46" src="https://s.iamberry.com/soodo/wechat/images/pro-huang.png" colorpresent="上朵柔性声波牙刷,柔和清洁牙龈沟,用温柔的力量守护你的笑容" price="39900">奶油黄</span>-->					</div>				</div>			</div>			<div class="mui-content-padded">			<p>提示:</p>			<p>1、每位会员每一支已注册产品,每年可免费领取一次充电器(每次只限领取一个充电器)</p>			<p>2、同一年内,首次领取只需支付10元邮费,充电器无需支付任何费用</p>			<p>3、同一年内,第二次领用充电器需支付充电器费用10元,以及10元的邮费</p>			<p>4、领取过程如有疑问,请联系客服咨询</p>			</div>			<div class="buy-footer1">				<table class="tb-clearing">					<tr>						<td class="quanxuan">							共<span id="pro-count" class="cl-red">0</span>件						</td>						<td class="mui-text-center">合计:<span class="count_price_box">¥<span class="pay_price">10.0</span></span>						</td>						<td>							<a id="go-pay" class="mui-btn mui-pull-right add_gwc go-clearing">立即领取</a>						</td>					</tr>				</table>			</div>		</div>		<!-- 加载ing begin-->		<div class="loading covers">			<div class="loading-bj"></div>			<p>正在加载...</p>		</div>		<!-- 加载ing end -->		<script src="js/mui.min.js"></script>		<script src="js/jquery-2.1.1.min.js"></script>		<script src="js/main.js"></script>		<script src="js/wechat-utils-1.0.js"></script>		<script>			window.addEventListener('pageshow', function(e) {				// 通过persisted属性判断是否存在 BF Cache				if(e.persisted) {					location.reload();				}			});			mui.ready(function() {				/* 查询价格,一年内的购买次数 */				$.ajax(base_path + '/wechat/receive/select_charg_price?dates=' + new Date().getTime(), {						data: {},						dataType: 'json',						xhrFields: {							withCredentials: true						},						crossDomain: true,						type: 'post',						timeout: 15000,						success: function(dt) {							if(dt.isRedirect) {								location.href = dt.redirectURL;							} else {								console.log(dt)								if(dt.status) {									$(".pay_price").text(accDiv(dt.data.price,100));								}else{									mui.alert(dt.message, function() {										location.href = "index.html?dates=" + new Date().getTime(); // 前往首页									});								}							}						},						error: function(xhr, type, errorThrown) {							console.log(xhr);						}					});																				$.ajax(base_path + '/wechat/receive/select_color?dates=' + new Date().getTime(), {						data: {},						dataType: 'json',						xhrFields: {							withCredentials: true						},						crossDomain: true,						type: 'post',						timeout: 15000,						success: function(dt) {							if(dt.isRedirect) {								location.href = dt.redirectURL;							} else {								console.log(dt)								if(dt.status) {									var colorList = '';									mui.each(dt.data, function(index) { //遍历产品颜色集合										var active = '';										if(index == 0) {											active = 'active'; //弹窗选中当前颜色										}										colorList += '<span class="pro-select-color ' + active + '" name="' + this.colorId + '"  price="' + this.colorDiscount + '">' + this.colorName + '</span>';									});									if(colorList!=''){										$('#pro-count').text("1");									}									$("#my-pull").html(colorList);								}							}						},						error: function(xhr, type, errorThrown) {							console.log(xhr);						}					});				//默认自己拉出地址				//										if(dt.data.addressInfo != undefined && dt.data.addressInfo != null) {				//											$(".btn-add-address").hide();				//											$("#user-address-div").html('<div class="mui-table"><div class="mui-table-cell mui-col-xs-1 mui-text-left table-middle"><p><span class="iconfont icon-dingwei"></span></p></div><div class="mui-table-cell mui-col-xs-10 mui-text-left table-middle"><div>收货人:' + dt.data.addressInfo.salesAddressName + ' <span class="mui-pull-right">' + dt.data.addressInfo.salesAddressTel + '</span></div><p>收货地址:' + dt.data.addressInfo.salesAddressInfo + '</p></div><div class="mui-table-cell mui-col-xs-1 mui-text-right table-middle"><p><span class="mui-icon mui-icon-arrowright"></span></p></div></div>').show();				//											//给微信参数赋值				//											wechatAddr.status = true;				//											wechatAddr.detailInfo = dt.data.addressInfo.salesAddressInfo;				//											wechatAddr.userName = dt.data.addressInfo.salesAddressName;				//											wechatAddr.userTel = dt.data.addressInfo.salesAddressTel;				//											wechatAddr.postalCode = dt.data.addressInfo.salesAddressPostnum;				//										}else{				//											wechatAddr.status = false;				//										}				wechatAddr.status = false;				$(".loading").hide().css("opacity", "0"); //隐藏(正在加载...)			});			// 获取微信共享地址			$(document).on('tap', '.btn-add-address,#user-address-div', function() {				editAddrV1(					function(res) {						// 用户成功拉出地址 						var address = res.provinceName + "-" + res.cityName + "-" + res.countryName + "-" + res.detailInfo;						wechatAddr.status = true;						wechatAddr.detailInfo = address;						wechatAddr.postalCode = res.postalCode;						wechatAddr.userName = res.userName;						wechatAddr.userTel = res.telNumber;						wechatAddr.nationalCode = res.nationalCode;						$(".btn-add-address").hide();						$("#user-address-div").html('<div class="mui-table"><div class="mui-table-cell mui-col-xs-1 mui-text-left table-middle"><p><span class="iconfont icon-dingwei"></span></p></div><div class="mui-table-cell mui-col-xs-10 mui-text-left table-middle"><div>收货人:' + wechatAddr.userName + ' <span class="mui-pull-right">' + wechatAddr.userTel + '</span></div><p>收货地址:' + wechatAddr.detailInfo + '</p></div><div class="mui-table-cell mui-col-xs-1 mui-text-right table-middle"><p><span class="mui-icon mui-icon-arrowright"></span></p></div></div>').show();					},					function() {						if($('#user-address-div').html() != null && $('#user-address-div').html() != '') {							wechatAddr.status = true;						} else {							wechatAddr.status = false;							// 用户取消拉出地址							mui.alert("您没有选择收货地址!");						}					}				);			});			//马上领取			var isPay = true; // 是否在请求支付,false表示正在请求,true可以请求			$(document).on('tap', '#go-pay', function() {				if(wechatAddr.status) {					if($('#user-address-div').html() == null || $('#user-address-div').html() == '') {						wechatAddr.status = false;						mui.toast("请选择收货地址!");						return ;					}					if(isPay) {						isPay = false; // 锁定请求按钮				$.ajax(base_path + '/wechat/receive/charger_receive?dates=' + new Date().getTime(), {							data: {								colorId:$("#my-pull>.active").attr("name"),								colorName:$("#my-pull>.active").text(),								receiveAddressInfo:wechatAddr.detailInfo,								receiveAddressPostnum:wechatAddr.postalCode,								receiveAddressName:wechatAddr.userName,								receiveAddressTel:wechatAddr.userTel							},							dataType: 'json',							xhrFields: {								withCredentials: true							},							crossDomain: true,							type: 'get',							timeout: 15000,							success: function(dt) {								if(dt.isRedirect) {									location.href = dt.redirectURL;								} else {									if(dt.data.info == "isOK") {									mui.alert("领取成功!",function(){										location.href="receive-charger.html";									});									return;								};									if(dt.status) {										var str = dt.data.info;									var obj = JSON.parse("{" + str + "}");									WeixinJSBridge.invoke('getBrandWCPayRequest', obj, function(res) {										if(res.err_msg == 'get_brand_wcpay_request:ok') {											$.ajax(base_path + '/wechat/receive/select_pay?dates=' + new Date().getTime(), {												data: {													"orderId": dt.data.orderId												},												dataType: 'json',												xhrFields: {													withCredentials: true												},												crossDomain: true,												type: 'get',												timeout: 15000,												success: function(dataobj) {													if(dataobj.isRedirect) {														location.href = dataobj.redirectURL;													} else {														if(dataobj.status == true) { // 支付成功															mui.alert("支付成功!",function(){																location.href="receive-charger.html";															});														} else {															isPay = true;															mui.alert("支付失败!请稍后重试");														}													}												},												error: function(xhr, type, errorThrown) {													console.log(xhr);													isPay = true;													mui.alert("支付失败!网络错误!");												}											});										} else {											isPay = true;											mui.alert("支付失败!请稍后重试!");										}									});									} else {										isPay = true;										mui.alert("领取失败!");									}								}							},							error: function(xhr, type, errorThrown) {								console.log(xhr);								isPay = true;								mui.alert("领取失败!网络错误");							}						});						}else{							mui.toast("正在请求支付中~~!");							return;						}				}else{					mui.toast("请选择收货地址!");					return;				}			});				//切换颜色			$(document).on('tap', '.pro-select-color', function() {				var th = $(this);				th.addClass("active").siblings().removeClass("active");//选中自己再把前后的兄弟元素取消选中			});		</script>	</body></html>
 |