<{import file="index/header.html" title="订单详情"}> 
<link href="<{$__APP__}>public/css/order_detail.css" rel="stylesheet" type="text/css"> 
<style type="text/css">
.process ul li{ width:205px; }
.odStatus{ width:705px; }
</style>
<{uqcms m="order" c="get_detail:order_no=smarty.get.oid" v="row"}>
<div class="lbox">
	<div class="process">
		<ul>
			<li class="step <{if $row.order.order_status >= 1}>step1<{else}>step0<{/if}>">
				<div class="ttl">买家下单</div>
				<div class="number">√</div>
				<div class="meta"><{if $row.order.addtime}><{$row.order.addtime}><{/if}></div>
			</li>
			<li class="step <{if $row.order.order_status >= 2}> step1<{else}>step0<{/if}>">
				<div class="ttl">已经付款</div>
				<div class="number">√</div>
				<div class="meta"><{if $row.order.pay_time}><{$row.order.pay_time}><{/if}></div>
			</li>
			<li class="step <{if $row.order.order_status >= 3}> step1<{else}>step0<{/if}>">
				<div class="ttl">卖家发货</div>
				<div class="number">√</div>
				<div class="meta"><{if $row.order.deliver_time}><{$row.order.deliver_time}><{/if}></div>
			</li>
			<li class="step <{if $row.order.order_status >= 4}> step1<{else}>step0<{/if}>">
				<div class="ttl">等待收货</div>
				<div class="number">√</div>
				<div class="meta"><{if $row.order.receipt_time}><{$row.order.receipt_time}><{/if}></div>
			</li>
			<li class="step <{if $row.order.order_status >= 5}> step1<{else}>step0<{/if}>">
				<div class="ttl">互相评价</div>
				<div class="number">√</div>
				<div class="meta"><{if $row.order.comment_time}><{$row.order.comment_time}><{/if}></div>
			</li>
		</ul>
	</div>
	<div class="oStatus">
		<!--收货信息--> 
		<div class="adrbox">
			<div class="gname"><span>订单信息</span></div>
			<div class="gcon address">
				<div class="addD"><h3>订单编号：</h3> <span><{$row.order.order_no}></span> </div> 
				<div class="addD"><h3>收货姓名：</h3> <span><{$row.express.name}></span> </div> 
				<div class="addD">
					<h3>收货信息： </h3>
					<span><{$row.express.prov_cn}> <{$row.express.city_cn}> <{$row.express.dist_cn}> , <{$row.express.address}> </span>
				</div> 
				<{if $kd_row.zip != '' }>
					<div class="addD"><h3>地址邮编：</h3> <span> <{$row.express.zip}></span></div>
				<{/if}>
				<div class="addD"><h3>联系电话：</h3> <span><{$row.express.mobile}></span></div>
				<div class="addD"><h3>买家留言：</h3> <span><{$row.order.message}></span></div> 
			</div>
		</div> 
		
		<!--订单状态-->
		<div class="odStatus"> 
			<{if $row.order.order_status == '1'}> 
				<div class="statusNm"><h3>商品已拍下，等待买家付款</h3></div>
				<div class="statusDo">
					<span>你还可以：</span> 
					<a class="abutton" href="member.php?m=buy&a=pay_trade&oid=<{$row.order.order_no}>">支付订单</a>
					<a class="abutton" href="javascript:;" onClick="cancel_order('取消订单','?m=buy&a=cancel_order&oid=<{$row.order.order_no}>')">取消订单</a>
				</div>
			<{elseif $row.order.order_status == '2'}>  
				<div class="statusNm"><h3>
					<{if $row.order.otype == '2'}>
						拼团成功，
					<{else}>
						购买成功，
					<{/if}>
					等待卖家发货。</h3>
				</div> 
				<div class="statusDo">
					<span>未收到货，您支付的钱款将不会被打给卖家。</span>  
				</div>
			<{elseif $row.order.order_status == '3'}>  
				<div class="statusNm"><h3>已发货,等待确认收货</h3></div>
				<div class="statusDo">
					<span>你还可以：</span> 
					<a class="abutton recive_goods" href="javascript:;" data-oid="<{$row.order.order_no}>">确认收货</a>
				</div>
			<{elseif $row.order.order_status == '4'}> 
				<div class="statusNm"><h3>已经收货,对商品评价</h3></div>
				<div class="statusDo">
					<span>你还可以：</span> 
					<a class="abutton" href="?m=buy&a=comment&oid=<{$row.order.order_no}>">点击评价</a>
				</div> 
			<{elseif $row.order.order_status == '5'}>
				<div class="statusNm"><h3>已经评价</h3></div>  
			<{elseif $row.order.order_status == '8'}>
				<div class="statusNm"><h3>拼单还未成功</h3></div> 
				<div class="statusDo"><span>待分享，还差2人，剩余： <a href="#">邀请好友</a></span></div> 
			<{else}> 
				<div class="statusNm"><h3>交易关闭</h3></div>
				<div class="statusDo"><span>取消原因：<{$row.order.cancel_reason}></span></div> 
			<{/if}>
			
			<!--物流跟踪-->
			<{if $row.order.order_status == '3' || $row.order.order_status == '4' || $row.order.order_status == '5'}>
				<div class="wl"> 
					<span>快递信息</span>
					<dl>
						<dt>快递公司：</dt>
						<dd><{if $row.express.kd_name}><{$row.express.kd_name}><{else}>--<{/if}></dd>
					</dl>
					<dl>
						<dt>运单号码：</dt>
						<dd><{if $row.express.kd_number}><{$row.express.kd_number}><{else}>--<{/if}></dd>
					</dl>
					<{if $row.express.code == 'uqcms'}>
						<dl> <div><ul>商家自行配送</ul></div></dl> 
					<{else}>
						<dl>
							 <div class="exp_pro"><ul>加载中...</ul></div>
						</dl> 
					<{/if}> 
				</div> 
			<{/if}> 
		</div> 
	</div> 
	<div class="gcon"> 
		<table class="ltable">
			<thead>
				<tr>
					<th>商品信息</th>
					<th width="100">单价（元）</th>
					<th width="100">数量</th> 
					<th width="100">总价（元）</th>
				</tr>
			</thead>
			<tbody>
				<{foreach item=i from=$row.glist}>
				<tr>
					<td style="text-align:left;">
						<div class="box_content">
							<div class="img">
								<a href="index.php?m=goods&a=detail&id=<{$i.gid}>" target="blank"><img src="<{$__IMG__}><{$i.images|img_size:80x80}>" width="80"/></a>
							</div>
							<div class="desc">
								<div class="ttl"><a href="index.php?m=goods&a=detail&id=<{$i.gid}>" target="blank"><{$i.title}></a></div>
								<div class="sku">
									<{if $i.sku}>
										<{foreach item=k from=$i.sku}>		
											<span><{$k.0}> : <{$k.1}> &nbsp;&nbsp; </span> 
										<{/foreach}>
									<{/if}>
								</div>
							</div>
						</div>
					</td>
					<td>￥<{$i.price}></td>
					<td><{$i.buy_num}></td> 
					<td>￥<{$i.total_price}></td> 
				</tr>
				<{/foreach}>		
			</tbody>
		</table> 
		<div class="total_price">
			<div class="srit">
				<{if $row.order.discount_price}>
					<dl><dt>优&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;惠：</dt> <dd>￥<{$row.order.discount_price}></dd></dl>
				<{/if}>	
				<{if $row.order.express_price > 0}>
					<dl><dt>快&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;递：</dt><dd>￥<{$row.order.express_price}></dd></dl>
				<{/if}>
				<dl><dt class="total">实际付款：</dt><dd class="total">￥<{$row.order.total_price}></dd></dl> 
			</div> 
		</div>
	</div> 
</div> 
<{include file="index/footer.html"}>
<script type="text/javascript" src="<{$__PUBLIC__}>js/jquery.nicescroll.js"></script>
<script type="text/javascript"> 
<{if $row.order.order_status == '1'}>
// 取消订单  	
function cancel_order(name, url){ 
	ajax_dialog(name, url, 350); 
}
<{/if}>
<{if $row.order.order_status == '3'}>	// 确认收货
	$(document).on('click', ".recive_goods", function(event){
		if(!confirm("确认收货，你的钱款则会打到对方账户？")) { 
			if(window.event){
				window.event.returnValue = false;
			}else{  
				event.preventDefault();	//for firefox
			}
		}else{
			var oid = $(this).attr('data-oid');
			$.post('member.php?m=buy&a=receive',{oid:oid},function(result){
				var data = jQuery.parseJSON(result); 
				if(data.error == '0'){
					$.alert('确认成功');
					location.reload();
				}else{
					$.alert(data.msg);
				}
			});
		}
	});	
<{/if}>
<{if $row.order.order_status == '3' || $row.order.order_status == '4' || $row.order.order_status == '5'}>
	// 快递流程
	$(function(){  
		get_express_pro('<{$row.express.kd_code}>', '<{$row.express.kd_number}>');
		function get_express_pro(code,number){ 
			$.getJSON('index.php?m=ajax&a=express&code='+code+'&nu='+number, function(data){
				html = '';
				$.each(data.result, function(i,value){ 
					html += '<li><div class="con"><p class="msg">'+value.msg+'</p><p class="time">'+value.time+'</p></div><i></i></li>';
				});
				$('.exp_pro ul').html(html);
			});
		}
		$('.exp_pro').niceScroll({
			cursorcolor: "#ccc", 
			cursoropacitymax: 1, 
			touchbehavior: false, 
			cursorwidth: "5px", 
			cursorborder: "0", 
			cursorborderradius: "5px", 
			autohidemode: false, 
			horizrailenabled: false,
			hidecursordelay: 10, 
			boxzoom:true
		}); 
	});
<{/if}>
</script>