<!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="css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<style>
			.share-dalog {
				background: rgba(0, 0, 0, .7);
				position: fixed;
				left: 0;
				top: 0;
				right: 0;
				bottom: 0;
				width: 100%;
				height: 100%;
				z-index: 99;
				display: none;
			}
			
			.share-dalog img {
				width: 100%;
			}
			
			.ping-h1 {
				text-align: center;
				font-size: 18px;
				padding: 10px 0 15px 0;
			}
			
			.ping-h1 .red {
				color: #ff5673;
			}
			
			.mui-content .btn-ping {
				border-radius: 50px;
				display: block;
				width: 70%;
				margin: 15px auto;
				font-size: 16px;
				background: #ff5673;
				color: #fff;
				border: 0;
				padding: 12px 12px;
			}
			
			.mui-content .btn-ping:active {
				background: #fc4e67 !important;
			}
			
			.btn-details {
				border-radius: 50px;
				display: block;
				width: 70%;
				margin: 15px auto;
				font-size: 16px;
				padding: 12px 12px;
			}
			
			.btn-details:active {
				background: #f0f0f0;
			}
			
			.userHeader {
				border-radius: 50%;
			}
			
			.myicon-pin {
				background: #eba85e;
				color: #fff;
				border-radius: 25px;
				font-size: 12px;
				position: absolute;
				left: 0;
				top: 2px;
				line-height: 1.2;
				display: block;
				padding: 2px 5px;
			}
		</style>
		<script>
			// 屏蔽分享
			//window.hiddenAllWechatMenu = true;
		</script>
	</head>

	<body style="background: #fff;">
		<div class="loading-bg">
			<div class="mui-loading">
				<div class="mui-spinner">
				</div>
				&nbsp;&nbsp;加载中...
			</div>
		</div>
		<!--<nav class="mui-bar mui-bar-tab" id="footer-bar">
	<a class="mui-tab-item" >
		<div class="iconfont icon-shouye"></div>
		<span class="mui-tab-label">首页</span>
	</a>
	<a class="mui-tab-item">
		<div class="iconfont icon-gouwuche"><span class="mui-badge">0</span></div>
		<span class="mui-tab-label">购物车</span>
	</a>
	<a class="mui-tab-item">
		<div class="iconfont icon-dingdan"></div>
		<span class="mui-tab-label">订单</span>
	</a>
	<a class="mui-tab-item">
		<div class="iconfont icon-wode"></div>
		<span class="mui-tab-label">我的</span>
	</a>
</nav>-->
		<!--<header class="mui-bar mui-bar-nav header">
	<div class="go-index go_index">
		<img src="images/logo.png" />
	</div>
</header>-->
		<div class="mui-content" style="background: #fff;">
			<div style="padding: 30px 0 10px 0;">
				<div class="mui-table">
					<div class="mui-table-cell mui-col-xs-3 table-middle">
					</div>
					<div class="mui-table-cell mui-col-xs-3 mui-text-left">
						<img class="userHeader" width="80%" src="images/2019072918.jpg" />
						<span class="myicon-pin">拼主</span>
					</div>
					<div class="mui-table-cell mui-col-xs-3 mui-text-right">
						<img width="80%" src="images/2019072918.jpg" />
					</div>
					<div class="mui-table-cell mui-col-xs-3 table-middle">
					</div>
				</div>
			</div>
			<div class="ping-h1">还差<span class="red" id="count">0</span>人,快邀请好友来拼单吧</div>
			<div>
				<button type="button" class="mui-btn btn-ping">邀请好友拼单</button>
			</div>
			<div>
				<button type="button" class="mui-btn btn-details">查看订单详情</button>
			</div>
			<br />
			<p class="mui-text-center">注:分享给越多好友,越容易成团哟!</p>
		</div>
		<div class="share-dalog">
			<img src="images/share.png" />
		</div>
		<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/page/wechat-utils-1.0.js"></script>
	</body>
	<script>
		var isSpell = getParam('isSpell'),
			isSpellstr = '',
			openid = '',
			orderid = getParam('orderId'),
			productId = '',
			colorId = '',
			shareTit = '',
			shareDesc = '';
		if(isSpell == 1) {
			isSpellstr = '&isSpell=1';
		}
		var str = location.href; //取得整个地址栏
		var num = str.indexOf("?")
		str = str.substr(num + 1); //取得所有参数
		$(document).ready(function() {
			$.ajax(base_path + '/agent/member?dates=' + new Date().getTime(), {
				dataType: 'json',
				type: 'post',
				timeout: 15000,
				xhrFields: {
					withCredentials: true
				},
				crossDomain: true,
				success: function(dt) {
					if(dt.isRedirect) {
						location.href = dt.redirectURL;
					} else {
						var data = dt.data;
						if(dt.status) {
							if(typeof(data.userHead) != "undefined") {
								if(data.userHead != null && data.userHead != '') {
									$(".userHeader").attr('src', data.userHead)
								}
							}
							openid = data.userOpenid;
							getOrderId();
						} else {

						}
					}
				},
				error: function(xhr, type, errorThrown) {
					console.log(xhr)
				}
			});

			document.querySelector('.loading-bg').style.display = 'none'
		});

		function getOrderId() {
			$.ajax(base_path + '/cart/getShopOrderByOrderId', {
				data: {
					orderId: orderid
				},
				dataType: 'json',
				type: 'get',
				timeout: 15000,
				xhrFields: {
					withCredentials: true
				},
				crossDomain: true,
				success: function(dt) {
					if(dt.isRedirect) {
						location.href = dt.redirectURL;
					} else {

						if(dt.status) {
							if(typeof(dt.data.salesSpellOrderId) != "undefined") {
								$("#count").text('0');
							} else {
								$("#count").text('1');
							}
							$.each(dt.data.orderItemList, function(index) {
								if(index == 0) {
									productId = this.itemProductId;
									colorId = this.itemColorId;
									shareTit = '【在线等】我拼了' + this.itemProductName + '(' + this.productColor + ')';
									fenxiang();
								}
							});
						}
					}
				},
				error: function(xhr, type, errorThrown) {
					console.log(xhr)
				}
			});
		};
		$(document).on('tap', '.btn-details', function() {
			location.href = 'order_details.html?' + str
		});
		//分享弹窗
		$(document).on('tap', '.btn-ping', function() {
			$(".share-dalog").show();
		});
		//关闭分享弹窗
		$(document).on('tap', '.share-dalog', function() {
			$(this).hide();
		});
		//分享			
		function fenxiang() {
			var url = 'https://' + location.host + '/watero/wechat/pay_join_group.html?' + str + '&openid=' + openid;
			window.repleFlag = false;
			window.wxFriend = {
				"appId": "",
				"imgUrl": 'https://s.iamberry.com/watero/wechat/images/2019080701.jpg',
				"link": url,
				"desc": "快来和我一起拼团!",
				"title": shareTit,
				"netError": "您的网络异常,请刷新重试!如多次刷新无效,请向我们反应 ~",
				"shareTimeSuccess": "分享成功",
				"shareTimeCancel": "已取消分享",
				"shareAppSuccess": "分享成功!",
				"shareAppCancel": "已取消分享"
			};
			getConfig();
		}
	</script>

</html>