<{import 
	file="mheader.html" 
	title="订单详情"
	full_screen="1"
}> 
<link rel="stylesheet" type="text/css" href="<{$__APP__}>public/mcss/order_detail.css?v=<{$js_version}>">  
<{uqcms m="order" c="get_one:order_no=smarty.get.oid" v="row"}>
<{if $row.error == '0'}>
<div class="main_bar">
	<div class="main">
		<div class="probox">
			<div class="ostatus_cn">
				<p> 订单号：<{$row.order.order_no}> </p>
				<{if $row.order.order_status == '1'}> 
					<p><span style="color:#f00;">等待付款</span></p>
					<div class="act">  
						<a class="abutton" href="<{$__URI__}>account/pay_order?order_no=<{$row.order.order_no}>">付款</a>
						<a class="abutton" href="javascript:;" onClick="cancel_order('取消订单','<{$__URI__}>order/cancel_order?oid=<{$row.order.order_no}>')">取消订单</a>
					</div>
				<{elseif $row.order.order_status == '2'}>	
					<div class="act"> 
						<p><span style="color:#f00;">支付成功</span></p> 
					</div>
				<{elseif $row.order.order_status == '3'}>
					<p><span style="color:#f00;">确认收货</span></p>
					<div class="act">   
						<a class="abutton recive_goods" href="javascript:;" data-oid="<{$row.order.order_no}>">确认收货</a>
					</div>
				<{elseif $row.order.order_status >= '4'}> 
					<p><span style="color:blue;">完成</span></p> 
					<div class="act">
						<{if $row.order.order_status == '4'}>
							<a class="abutton" href="<{$__URI__}>order/comment?oid=<{$row.order.order_no}>">点击评价</a>
						<{/if}>
					</div> 
				<{else}> 
					<p><span style="color:#999;">交易关闭</span></p> 
					<div class="statusDo">取消原因：<{$row.order.cancel_reason}></div> 
				<{/if}>
				<p><a href="javascript:;">打印订单</a></p>
			</div>
			
			<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>	
		<{if $row.order.order_status == '3' || $row.order.order_status == '4' || $row.order.order_status == '5'}> 
			<!--快递部分-->
			<div class="eps">
				<div class="l">
					<div class="img">	
						<{foreach item=i from=$row.glist}>
							<img src="<{$__IMG__}><{$i.images|img_size:100x100}>">
						<{/foreach}>
					</div>
					<div class="desc">
						<dl>
							<dt>送货方式：</dt><dd>普通快递</dd>
						</dl>
						<dl>
							<dt>承运人：</dt><dd><{$row.express.kd_name}></dd>
						</dl>
						<dl>
							<dt>货运单号：</dt><dd><{$row.express.kd_number}></dd>
						</dl> 
					</div>
				</div>
				<div class="r">
					<div class="exp_pro"> 
						<ul> </ul> 
					</div>
				</div>
			</div>
		<{/if}>	
		<!--收货信息--> 
		<div class="oStatus">
			
			<div class="oinfo">
				<div class="name"><span>收货地址</span></div>
				<div class="con">
					<dl>
						<dt>收货人：</dt>
						<dd><{$row.express.name}></dd>
					</dl>
					<dl>
						<dt>地址：</dt>
						<dd><{$row.express.prov_cn}><{$row.express.city_cn}><{$row.express.dist_cn}>,<{$row.express.address}></dd>
					</dl>
					<dl>
						<dt>手机号码：</dt>
						<dd><{$row.express.mobile}></dd>
					</dl>
					<{if $kd_row.zip}>
					<dl>
						<dt>邮编：</dt>
						<dd><{$row.express.zip}></dd>
					</dl>
					<{/if}>
					<{if $row.order.message}>
						<dl>
							<dt>买家留言：</dt>
							<dd><{$row.order.message}></dd>
						</dl>	
					<{/if}> 
				</div>
			</div>  
			
			<div class="oinfo">
				<div class="name"><span>配送信息</span></div>
				<div class="con">
					<dl>
						<dt>配送方式：</dt>
						<dd><{if $row.express.kd_name}><{$row.express.kd_name}><{else}>普通快递<{/if}></dd>
					</dl>
					<dl>
						<dt>运费：</dt>
						<dd>¥<{$row.order.express_price}></dd>
					</dl>
					<dl>
						<dt>期望送货日期：</dt>
						<dd>工作日、双休日与假日均可送货</dd>
					</dl> 
				</div>
			</div>  
			
			<div class="oinfo">
				<div class="name"><span>付款信息</span></div>
				<div class="con">
					<dl>
						<dt>付款方式：</dt>
						<dd>在线支付</dd>
					</dl>
					<dl>
						<dt>商品总额：</dt>
						<dd>¥<{$row.order.goods_price}></dd>
					</dl>
					<dl>
						<dt>运费：</dt>
						<dd>¥<{$row.order.express_price}></dd>
					</dl>
					<dl>
						<dt>优惠：</dt>
						<dd>¥-<{$row.order.coupon_price}></dd>
					</dl>
					<dl>
						<dt>支付金额：</dt>
						<dd>¥<{$row.order.total_price}></dd>
					</dl> 
				</div>
			</div> 
			 
			<div class="oinfo">
				<div class="name"><span>发票信息</span></div>
				<div class="con">
					<dl>
						<dt>发票类型：</dt>
						<dd>电子普通发票</dd>
					</dl>
					<dl>
						<dt>发票抬头：</dt>
						<dd>个人</dd>
					</dl>
					<dl>
						<dt>发票内容：</dt>
						<dd>商品明细</dd>
					</dl> 
				</div>
			</div>
			
		</div> 
		<div class="gcon"> 
			<table class="ltable">
				<thead>
					<tr>
						<th>商品信息</th>
						<th width="130">单价（元）</th>
						<th width="130">数量</th> 
						<th width="130">总价（元）</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="<{$__URI__}>goods/<{$i.gid}><{$__HTML__}>" target="blank"><img src="<{$__IMG__}><{$i.images|img_size:80x80}>" width="80"/></a>
								</div>
								<div class="desc">
									<div class="ttl"><a href="<{$__URI__}>goods/<{$i.gid}><{$__HTML__}>" 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"> 
					<dl>
						<dt>优&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;惠：</dt>
						<dd>￥<{if $row.order.discount_price}><{$row.order.discount_price}><{else}>0<{/if}></dd>
					</dl> 
					<dl>
						<dt>快&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;递：</dt>
						<dd>￥<{if $row.order.express_price > 0}><{$row.order.express_price}><{else}>0<{/if}></dd>
					</dl>
					<dl>
						<dt class="total">实际付款：</dt>
						<dd class="total">￥<{$row.order.total_price}></dd>
					</dl> 
				</div> 
			</div> 
		</div>
		
	</div>
</div> 
<{else}>
	<div class="">订单不存在</div>
<{/if}>
<{import file="mfooter.html"}>
<script type="text/javascript" src="<{$__PUBLIC__}>plug/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(URI+'order/receive', {oid:oid}, function(result){ 
				data = jQuery.parseJSON(result); 
				if(data.error == '0'){
					$.alert('确认成功', function(){
						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){ 
			$.get(URI+'ajax/express?code='+code+'&nu='+number, function(result){ 
				data = jQuery.parseJSON(result);
				if(data.error == '0'){
					html = '';
					$.each(data.msg, function(i, value){ 
						html += '<li><div class="con"><p class="msg">'+value.content+'</p><p class="time">'+value.time+'</p></div><i></i></li>';
					});
					$('.exp_pro ul').html(html);
				}else{
					$('.exp_pro ul').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>