<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title><?php echo $info['name']; ?>下载      — <?php echo C('DOWNLOAD_KEYWORD'); ?>  — <?php echo $userconfig['seo_title'] . C('DOWNLOAD_TITLE'); ?></title>
		<!--<link href="/app/uhome/view/wap/css/style.css" rel="stylesheet">-->
		<link rel="stylesheet" type="text/css" href="/static/public/css/mui/3.7.0/css/mui.min.css"/>
		<link rel="stylesheet" type="text/css" href="/static/public/css/flexcss/flex.css">
		<link rel="stylesheet" type="text/css" href="/static/public/css/wap.1.0.0.css">
		<link rel="stylesheet" type="text/css" href="http://static.523w.cn/js/form/wap.css">
		<style type="text/css">
		body,.mui-content{ background:#f7f7f7;}
		.mui-content{ padding-bottom: 100px;}
		dl{ background:#fff; margin: 15px auto;}
		.tr{ text-align: right;}
		.mui-input-group .mui-input-row{ padding: 10px;}
		.mui-checkbox input[type=checkbox], .mui-radio input[type=radio]{ left: 5px; top: 8px;}
		.mui-radio label{ padding-left: 20px;}
		.mui-btn-blue, .mui-btn-primary, input[type=submit]{ background:#16a085; border-color: #16a085;}
		.mui-checkbox input[type=checkbox]:checked:before, .mui-radio input[type=radio]:checked:before{ color:#1abc9c;}
		.btn_submit{ padding: 5px;}
		.p10{ padding: 10px;}
		.p10 button{ padding: 5px 0;}
		
		nav.mui-bar-tab{ border:none;}
		
		#row1{ border-bottom: 1px solid #eee; padding: 10px; background:#fff; margin-top: 0;}
		
		.title1{ background:#1abc9c; color: #fff; padding: 10px;}
		#row2{ padding: 10px;}
		#row2 li{ line-height: 1.8em;}
		#row2 .title{ font-size: 20px; line-height: 2em; font-weight: 700;}
		#row2 table{ border-collapse: collapse; width: 100%;}
		#row2 td{ border: 1px solid #eee; padding: 5px; text-align: center;}
		#row2 .price{ color:#f00; font-weight: 700;}
		
		#row3 .mui-numbox{ width: 120px;}
		
		#row4 dd{ padding: 15px 0;}
		
		#boot{ position: fixed; bottom: 0; width: 100%; background:#16a085; height: 50px; line-height: 50px; text-align: center; color: #fff; z-index: 999;}
		#boot .c1{ background:#1abc9c;}
		#boot a{ color: #fff;}
		</style>
	</head>
	<body>
		<?php if($info['price']>0){?>
		<nav id="boot" flex="box:mean">
		    <div  class="c1 btn_submit1 blur">
		    	<a href="/file/download/pk/<?php echo $info['pk'];?>">提取码下载</a>
		    </div>
	   		<div  class="c2 btn_submit2 blur">确认支付(￥<span id="amount"><?php echo $info['price'];?></span>元)</div>
		</nav>
		<?php }else{?>
			<nav id="boot" flex="box:mean">
				<div  class="c1 btn_submit1">普通下载</div>
	   			<div  class="c2 btn_submit2">高速下载</div>
			</nav>
		<?php }?>
		<div class="mui-content">
			<form action="/pay/file" method="post"  id="pay" >
				<?php
				$orderno=date('YmdHis') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);	
				?>
				<input type="hidden" name="model_id" value="58" />
				<input type="hidden" name="ctime" value="<?php echo time(); ?>" />
				<input type="hidden" name="orderno" value="<?php echo $orderno; ?>" />
				<input type="hidden" name="file_id" value="<?php echo $info['id']; ?>" />
				<input type="hidden" name="uid" value="<?php echo $info['uid']; ?>" />
				<input type="hidden" name="pk1" value="<?php echo $info['pk1']; ?>" />
				<input type="hidden" name="pk2" value="<?php echo $info['pk2']; ?>" />
				<input type="hidden" name="pk3" value="<?php echo $info['pk3']; ?>" />
				<input type="hidden" name="pk4" value="<?php echo $info['pk4']; ?>" />
				<dl id="row1" flex="cross:center main:justify">
					<dd>
				    	<img src="/app/uhome/view/wap/images/logo.jpg?v=1" width="150"/>	
				    </dd>
				    <dd class="tr">
				    	<a href="/report/add/uid/<?php echo $info['pk1'];?>/pk/<?php echo $info['pk4']; ?>" class="mui-btn mui-btn-warning">我要投诉</a>
				    	<a href="/pay/order_search" class="mui-btn mui-btn-green">订单查询</a>
				    </dd>
				</dl>
				<dl id="row2">
					<dd>
						<ul>
					   		<li class="title"><?php echo $info['name']; ?></li>
					   		<?php if($info['price']>0){?>
					   		<li>软件价格：￥<span class="price"><?php echo $info['price']; ?></span>元</li>
					   		<?php }?>
					   		<li>软件大小：<?php echo $info['size']; ?></li>
					   		<li>更新时间：<?php echo date('Y-m-d H:i:s', $info['pk4'] / 1000); ?></li>
					   		<?php if($info['service']){?>
					   		<li>联系客服：<?php echo $info['service']; ?></li>
					   		<?php }?>
					   		<?php if($info['price']>0 && $info['youhui']){?>
					   		<li>
					   			优惠价格：
					   			<table>
					   				<?php foreach ($info['youhui'] as $k => $v) {?>
					   				<tr>
					   					<td><?php echo $v[0];?>张</td>
					   					<td><?php echo $v[1];?>元</td>
					   				</tr>
					   				<?php }?>
					   			</table>
					   		</li>
					   		<?php }?>
					   	</ul>
					</dd>
				</dl>
				<?php if($info['price']>0){?>
			   	<dl id="row3">
			   		<dt class="title1">购买信息 </dt>
			   		<dd>
			   			<ul class="mui-input-group">
			   				<?php if($info['iszengsong']=='赠送'){?>
			   				<li class="mui-input-row" flex="box:last">
			   					<label>数量</label>
			   					<div class="mui-numbox" data-numbox-min='1'>
									<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
									<input  class="mui-input-numbox" name="num" id="num" type="number" value="1" />
									<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
								</div>
			   				</li>
			   				<?php }?>
				   			<li class="mui-input-row" flex="box:justify">
				   				<label>邮箱</label>
				   				<input type="email" class="mui-input-clear tr" name="email" placeholder="电子邮箱，用于接收订单信息" />
				   			</li>
				   			<li class="mui-input-row" flex="box:justify">
				   				<label>手机</label>
				   				<input type="tel" class="mui-input-clear tr" name="mobile" placeholder="用手机接收订单信息要加收0.01元/笔" />
				   			</li>
			   			</ul>
			   		</dd>
			   	</dl>
			   	<dl id="row4">
			   		<dt class="title1">支付方式 </dt>
			   		<dd flex="box:mean">
			   			<?php
			   			$list_pay_way=get_pay_way(1,2);
						foreach ($list_pay_way as $k => $v) {
			   			?>
			   			<div class="mui-radio">
			   				<input checked="checked" name="pay_way" type="radio"  value="<?php echo $v['id'];?>" />
							<label for="radio1"><img src="/app/uhome/view/wap/images/<?php echo $v['name'];?>.jpg"  /></label>
			   			</div>
			   			<?php }?>
			   		</dd>
			   	</dl>
		   		<?php }?>
		   	</form>
		</div>
		<script src="/static/public/js/jquery.2.1.4.mui.3.7.0.angular.1.2.16.sonar.js" type="text/javascript" charset="utf-8"></script>
		<script src="/static/public/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
		<script src="/static/public/js/wap.1.0.0.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui(document).on("tap", "a[href]", function() {
			    if(this.getAttribute("href") != "") {
			        location.href = this.getAttribute("href");
			    }
			});
		</script>
		<?php if($info['price']>0){?>
			<script type="text/javascript">
			window.onerror=function(){return true;}
			jQuery(document).ready(function($){ 
			    try{
			        mui(document).on("tap",".btn_submit2",function () {
			        	var the=jQuery(this);
			        	if (jQuery("[name='email']").val()=='') {
			        		mui.alert('邮箱不能为空','温馨提示');
			        		return false;
			        	}
						jQuery("form#pay").submit();  
			        });
			    }catch(e){}
			});
			jQuery(document).on('change','[name="num"]',function () {
				var the=jQuery(this);
				jQuery.ajax({
					url: "<?php echo U('Pay/getPrice'); ?>",
					data: {
						pk1: '<?php echo $info['pk1']; ?>',
						pk4: '<?php echo $info['pk4']; ?>',
						num: the.val()
					},
					dataType: "json",
					type: "post",
					timeout: 10000,
					success: function(data) {
						jQuery("#amount").html(data.amount);
					},
					error: function() {
						mui.toast("网络连接超时");
					}
				}); 
			})
			</script>
		<?php }else{?>
			<script type="text/javascript">
			window.onerror=function(){return true;}
			jQuery(document).ready(function($){ 
			    try{
			        mui(document).on("tap",".btn_submit1,.btn_submit2",function () {
			        	var the=jQuery(this);
						var downloadnum=jQuery.cookie('download_<?php echo $info['pk'];?>')?jQuery.cookie('download_<?php echo $info['pk'];?>'):0;
						if(downloadnum<5){
							downloadnum++;
							var date = new Date();
							date.setTime(date.getTime()+3600*1000);
							jQuery.cookie('download_<?php echo $info['pk'];?>',downloadnum, { expires: date });
						    jQuery.ajax({
					       		url:"/file/download",
								data:{
									pk1:'<?php echo $info['pk1'];?>',
									pk2:'<?php echo $info['pk2'];?>',
									pk3:'<?php echo $info['pk3'];?>',
									pk4:'<?php echo $info['pk4'];?>',
									donwload_num:'<?php echo $info['donwload_num'];?>',
								},
								dataType: "json",
								type: "post",
								timeout: 10000,
								success: function(data) {
									if (data.status==1) {
										location.href = data.url;
									}
								},
								error: function() {
								}
					       });
						}else{
							alert('请不要恶意下载');
						}     
			        });
			    }catch(e){}
			});
			
			</script>
		<?php }?>
		
	</body>
</html>
