<?php include_once(mvc::$cfg['PATH_TPL'].'public/headBase.php');?>
<link rel="stylesheet" type="text/css" href="<?php echo mvc::$cfg['ADMIN_URL'];?>static/css/user.css?ver=<?php echo mvc::$cfg['VER']['css'];?>">
<link rel="stylesheet" type="text/css" href="<?php echo mvc::$cfg['ADMIN_URL'];?>static/mobiscroll/css/mobiscroll.custom-2.5.2.min.css">
<div class="fibox topMenu">
	<div class="topMenuTitle">订单列表</div>
	<div class="topMenuRight"></div>
</div>
<div class="home_main" id="order-list-n">

	<div class="order-header">
		<ul>
			<li <?php if(empty($Params['status'])){?> class="active" <?php }?>>
				<a href="<?php echo mvc::$cfg['ADMIN_URI'];?>order/index">所有订单</a>
			</li>
			<li <?php if($Params['status']=='creat'){?> class="active" <?php }?>>
				<a href="<?php echo mvc::$cfg['ADMIN_URI'];?>order/index?status=creat">等待付款</a>
			</li>
			<li <?php if($Params['status']=='paied'){?> class="active" <?php }?>>
				<a href="<?php echo mvc::$cfg['ADMIN_URI'];?>order/index?status=paied">等待发货</a>
			</li>
			<li <?php if($Params['status']=='send'){?> class="active" <?php }?>>
				<a href="<?php echo mvc::$cfg['ADMIN_URI'];?>order/index?status=send">已发货</a>
			</li>
		</ul>
	</div>

	<div class="order-sea">
		<form class="form-horizontal" action="<?php echo mvc::$cfg['ADMIN_URI'];?>order/index" method='get' onsubmit="return orderList.submit();" id="order-search">
			<div class="input-group">
			    <input type="text" class="form-control" name="orderId" placeholder="订单ID" value="<?php echo $Params['orderId'];?>">
			    <span class="input-group-btn">
			        <button class="btn btn-primary" type="submit">搜索</button>
			    </span>
			</div>
		</form>
	</div>



	<div class="order_list" style="padding: 8px;">
		<?php if(!empty($orderList)){?>
		<?php foreach($orderList as $v){?>
		<table class="table" id="ord<?php echo $v['ord_id'];?>">
			<thead>
				<tr>
					<th width="80%">
						<span class="marr10">订单号：<?php echo $v['ord_id'];?></span>
					</th>
					<th class="ohead" width="20%">
						<?php if($v['ord_status']=='creat'){?>
						<span class="warn">等待付款</span>
						<?php }elseif($v['ord_status']=='paied'){?>
						<span class="warn">等待发货</span>
						<?php }elseif($v['ord_status']=='send'){?>
						<span class="warn">已发货</span>
						<?php }elseif($v['ord_status']=='completed'){?>
						<span class="warn">已完成</span>
						<?php }elseif($v['ord_status']=='cancel'){?>
						<span class="warn">已取消</span>
						<?php }?>
					</th>
				</tr>
			</thead>
			<tbody>
				<?php $index=0;?>
				<?php foreach($v['proArr'] as $i=> $pro){?>
				<tr>
					<td class="ord-ptitle" <?php if($v['ord_status']!='creat'){?> colspan="2"<?php }?>>
						<span class="marr5"><?php echo LibFc::CutStr($pro['orp_pro_name'],28);?></span>
						<span class="or-num">x<?php echo $pro['orp_count'];?></span>
					</td>
					<?php if($index==0&&$v['ord_status']=='creat'){?>
					<td rowspan="<?php echo count($v['proArr']);?>" align="center">
						<button type="button" class="btn btn-primary btn-xs edit-price" data-type="price" data-id="<?php echo $v['ord_id'];?>">改价格</button>
					</td>
					<?php }?>
				</tr>
				<?php $index++;?>
				<?php }?>
				<tr>
					<td colspan="2" class="right">
						合计：
						<span class="or-price-color">￥<span class="total-price"><?php echo sprintf('%.2f',$v['ord_pay_money']);?></span></span>
						<span class="hidden">(含邮费￥ <span class="frt-price"><?php echo sprintf('%.2f',$v['ord_freight_money']);?></span>)</span>
					</td>
				</tr>
			</tbody>
		</table>
		<?php }?>
		<?php }else{?>
		<div class="row">
			<div class="col-xs-12 col-sm-12 red text-center">未找到符合条件的订单</div>
		</div>
		<?php }?>
	</div>
</div>
<div class="modal" tabindex="-1" role="dialog" id="modal-layer-edit">
    <div class="modal-dialog clearfix" role="document">
	    <div class="modal-content clearfix">
		    <div class="modal-header">
		        <button type="button" class="close pull-left" data-dismiss="modal" aria-label="Close">
		        	<span class="glyphicon glyphicon-chevron-left glyphicon-wh"></span>
		        </button>
		        <button type="submit" class="btn btn-primary pull-right" onclick="EDITORDER.editOrder();return false;">保存</button>
		        <h4 class="modal-title"></h4>
		    </div>
		    <form class="form-horizontal" id="order-edit">
			    <div class="modal-body clearfix"></div>
		    </form>
	    </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal" tabindex="2" role="dialog" id="modal-layer-edit2">
    <div class="modal-dialog clearfix" role="document">
	    <div class="modal-content clearfix">
		    <div class="modal-header">
		        <button type="button" class="close pull-left" data-dismiss="modal" aria-label="Close">
		        	<span class="glyphicon glyphicon-chevron-left"></span>
		        </button>
		        <h4 class="modal-title"></h4>
		    </div>
		    <form class="form-horizontal" id="ord-edit">
			    <div class="modal-body clearfix">
			    	<div class="input-group">
				        <input type="text" class="form-control" id="temp">
				        <span class="input-group-btn">
					        <button class="btn btn-primary edit-price-sub" type="button">确定</button>
				        </span>
				    </div>
			    </div>
		    </form>
	    </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php include_once(mvc::$cfg['PATH_TPL'].'public/footMenu.php');?>
<script type="text/javascript" src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/js/user.js?ver=<?php echo mvc::$cfg['VER']['js'];?>"></script>
<script type="text/javascript">
	$(function(){
		orderList.isBool=<?php if($totalPage>1){echo 'true';}else{echo 'false';}?>;
		orderList.isEnd=<?php if($totalPage>1){echo 'false';}else{echo 'true';}?>;
		orderList.init();
	})
</script>