<extend name="Public:base" />
<block name="content">
	<div class="page-header">
		<h1>
			{$breadcrumb2}
			<small>
				<i class="icon-double-angle-right"></i>
				{$crumbs}
			</small>
		</h1>
	</div>	
	<div class="page-content">
		<div class="panel panel-default">
				<div class="panel-heading">
					团信息
				</div>
				<div class="panel-body" style="">
					  <div class="detail-context">
						  <div style="padding-left:5px;padding-top:10px;padding-bottom:10px">
						  	拼团详情二维码：
						  		<img src="http://qr.topscan.com/api.php?text={$pin_url}" width="200" />
						  </div>
				  		  <table class="table table-hover">
					   			<thead class="navbar-inner">
					   				<tr>
							            <th>团购订单号</th>
							            <th>团购人数</th>
							            <th>创建时间</th>
							            <th>过期时间</th>
							            <th>团购状态</th>
						       		</tr>
						        </thead>
						         <tbody>
							         <tr>
							            <td>{$pin_info.pin_id}</td>
							            <td> {$pin_buy_count}/ {$pin_info.need_count}</td>
							            <td>
							                <?php echo date('Y-m-d H:i:s', $pin_info['begin_time']); ?>
							            </td>
							            <td>
							                <?php echo date('Y-m-d H:i:s', $pin_info['end_time']); ?>
							            </td>
							            <td>
							            <?php if($v['state'] == 0){ ?>
										<span class="blue">拼团中</span>
										<?php }else if($v['state'] == 1){ ?>
										<span class="red">已完成</span>
										<?php }else if($v['state'] == 2){ ?>
										<span class="grey">已过期</span>
										<?php } ?>
							            </td>                                                                                                                                                                                   </td>
							        </tr>   
							        
						    	</tbody>
				    	</table>
		    		</div>
				</div>
			<!--修改团状态-->
		</div>
		
		<div class="panel panel-default">
	   	<div class="panel-heading">
			用户信息
		</div>
	   	<div class="panel-body table-responsive">
	   		<table class="table table-hover">
	   			<thead class="navbar-inner">
	   				<tr>
	   					<th style="width:80px;">订单号</th>
	   					<th style="width:70px;">姓名</th>
	   					<th style="width:100px;">电话</th>
	   					<th style="">支付方式</th>
	   					<th style="width:80px;">订单状态</th>
	   					<th >拼团单价</th>
						<th >购买数量</th>
						<th style="">运费</th>
	   					<th style="width:60px;">总价</th>
	   					<th style="">下单时间</th>
	   					<th style="">收货地址</th>
	   					<th style="width:100px;">操作</th>
	   				</tr>
	   			</thead>
	   			<tbody>
	   				<volist name="list" id="v" empty="$empty">
	   				<tr>
	   					<td>{$v.order_num_alias}</td>
	   					<td>
	   					{$v.name}
	   					</td>
	   					<td>{$v.telephone}</td>
	   					<td>
	   						微信公众号支付																																																																				   					
						</td>
	   					<td>
	   						<span class="label label-default">																																																																																										
								<?php if($v['order_status_id'] == 1) {
											echo '已成团待发货';
										}else{
											echo $order_status_arr[$v['order_status_id']];
										}  
								?>
							</span>
	   					</td>
	   					<td> <?php echo round($v['price'],2); ?> 元</td>
	   					<td>
	   					{$v.quantity}
	   					</td>
	   					<td> <?php echo round($v['shipping_fare'],2); ?> 元</td>
	   					<td> <?php echo round($v['total'],2); ?> 元</td>
	   					<td><?php echo date('Y-m-d H:i:s',$v['date_added']); ?></td>
	   					<td>{$v.province_name}-{$v.city_name}-{$v.area_name}-{$v.shipping_address}</td>
	   					<td>
                          <a href="{:U('Order/show_order', array('id' => $v['order_id']))}" target="_blank" class="btn btn-success btn-sm">查看订单</a>
                	   	</td>
	   				 </tr>
	   				 </volist>
	   			</tbody>
	   		</table>
	   	</div>
	   	</div>
	   	
	   	<div class="panel panel-default">
			 <div class="panel-heading">
				商品信息
			</div> 
			<div class="panel-body table-responsive">
				<table class="table table-hover">
					<thead class="navbar-inner">
					<tr>
						<th style="width:5%;">ID</th>
						<th style="width:15%;">商品标题</th>
						<th style="width:15%;">商品图片</th>
					</tr>
					</thead>
					<tbody>				
					<tr>
						<td>{$order.goods_id}</td>
						<td>{$order.goods_name}</td>
						<td>
						<div style=" width:40px;height:40px;">
                            <img src="{$goods_images}" style=" width:40px;height:40px;" alt="" title="">
                        </div>  
						</td>
						
					</tr>
									</tbody></table>
			</div>
		</div>
		
	</div>
	
	
</block>
<block name="javascript">
<script>	
$('#history').load('<?php echo U("Order/history",array("id"=>I("id"))); ?>');
$('#button-history').live('click', function() {

	$.ajax({
		url: '<?php echo U("Order/history",array("id"=>I("id"))); ?>',
		type: 'post',
		dataType: 'html',
		data: 'shipping_no='+encodeURIComponent($('#shipping_no').val())+'&shipping_method='+encodeURIComponent($('#shipping_method').val())+'&order_status_id=' + encodeURIComponent($('select[name=\'order_status_id\']').val()) + '&notify=' + encodeURIComponent($('input[name=\'notify\']').attr('checked') ? 1 : 0)  + '&comment=' + encodeURIComponent($('textarea[name=\'comment\']').val()),
		beforeSend: function() {
			$('.success, .warning').remove();
			$('#button-history').attr('disabled', true);
			$('#history').prepend('<div class="attention"><img src="__IMG__/loading.gif" alt="" />加载中...</div>');
		},
		complete: function() {
			$('#button-history').attr('disabled', false);
			$('.attention').remove();
		},
		success: function(html) {
			$('#history').html(html);
			
			$('textarea[name=\'comment\']').val('');
			
			$('#order-status').html($('select[name=\'order_status_id\'] option:selected').text());
		}
	});
});
</script>
</block>