<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<title>{echo admin_title()}</title>
<!--header-->
{template _:header}
<style>
table.text-center th,table.text-center td{text-align: center;}
.bg-status-0{color:#666;background-color:#DDD;}
.bg-status-1{color:#FFF;background-color:#1E9FFF;}
.bg-status-2{color:#FFF;background-color:#1E9FFF;}
.bg-status-3{color:#FFF;background-color:#009688;}
.input-like{ height: 38px; line-height: 38px; padding: 0 10px; border-bottom: 1px solid #e6e6e6; box-sizing: border-box;}
</style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
<!--top-->
{template _main_top}
<!--nav-->
{template _main_nav}
	<div class="position">
		<h1>订单详情</h1>
	</div>
	<div class="layui-body admin-body" style="background: #f2f2f2;">
		<div class="admin-content" style="padding: 0;background: none;box-shadow: none;">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md6">
					<div class="layui-card">
						<div class="layui-card-header">订单信息</div>
						<div class="layui-card-body">
							<div class="layui-form-item layui-row">
								<div class="layui-col-md6">
									<label class="layui-form-label">订单号</label>
									<div class="layui-input-block">
										<div class="input-like">{$value[out_trade_no]}</div>
									</div>
								</div>
								<div class="layui-col-md6">
									<label class="layui-form-label">订单状态</label>
									<div class="layui-input-block">
										<div class="input-like"><span class="layui-badge bg-status-{$value[status]}">{echo model('Order')->getStatus($value['status'])}</span></div>
									</div>
								</div>
							</div>
							<div class="layui-form-item layui-row">
								<div class="layui-col-md6">
									<label class="layui-form-label">下单时间</label>
									<div class="layui-input-block">
										<div class="input-like">{echo gsdate('Y-m-d H:i:s', $value[time_create])}</div>
									</div>
								</div>
								<div class="layui-col-md6">
									<label class="layui-form-label">付款时间</label>
									<div class="layui-input-block">
										<div class="input-like">{echo $value['time_update'] ? gsdate('Y-m-d H:i:s', $value['time_update']) : ''}</div>
									</div>
								</div>
							</div>
							<div class="layui-form-item layui-row">
								<div class="layui-col-md4">
									<label class="layui-form-label">应付金额</label>
									<div class="layui-input-block">
										<div class="input-like">￥{$value[total_price]}</div>
									</div>
								</div>
								<div class="layui-col-md4">
									<label class="layui-form-label">实付金额</label>
									<div class="layui-input-block">
										<div class="input-like">￥{$value[pay_price]}</div>
									</div>
								</div>
								<div class="layui-col-md4">
									<label class="layui-form-label">支付方式</label>
									<div class="layui-input-block">
										<div class="input-like">{echo model('Order')->get_type($value['trade_type'])}</div>
									</div>
								</div>
							</div>
							<div class="layui-form-item layui-row">
									<label class="layui-form-label">订单备注</label>
									<div class="layui-input-block">
										<div class="input-like" style="height: 76px;">{$value[remark]}</div>
									</div>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-col-md6">
					<div class="layui-card">
						<div class="layui-card-header">交易信息</div>
						<div class="layui-card-body" style="min-height: 250px;">
							<div class="layui-form-item layui-row">
								<div class="layui-col-md6">
									<label class="layui-form-label">门店</label>
									<div class="layui-input-block">
										<div class="input-like">{$value[store_name]}</div>
									</div>
								</div>
								<div class="layui-col-md6">
									<label class="layui-form-label">店员</label>
									<div class="layui-input-block">
										<div class="input-like">{$value[per_name]}</div>
									</div>
								</div>
							</div>
							<div class="layui-form-item layui-row">
								<div class="layui-col-md12">
									<label class="layui-form-label">设备SN</label>
									<div class="layui-input-block">
										<div class="input-like">{$value[SN]}</div>
									</div>
								</div>
							</div>
							<div class="layui-form-item layui-row">
								<div class="layui-col-md6">
									<label class="layui-form-label">支付通道</label>
									<div class="layui-input-block">
										<div class="input-like">
											<!--{if $trade['trade_gate']=='weixin'}--><span class="layui-badge layui-bg-green">微信</span> <!--{/if}-->
											<!--{if $trade['trade_gate']=='alipay'}--><span class="layui-badge layui-bg-blue">支付宝</span> <!--{/if}-->
										</div>
									</div>
								</div>
								<div class="layui-col-md6">
									<label class="layui-form-label">交易状态</label>
									<div class="layui-input-block">
										<div class="input-like">
											<!--{if $trade['trade_status']=='SUCCESS'}--><span class="layui-badge layui-bg-green">{echo model('Trade')->getStatus($trade['trade_status'])}</span> <!--{/if}-->
											<!--{if $trade['trade_status']=='CLOSED'}--><span class="layui-badge layui-bg-gray">{echo model('Trade')->getStatus($trade['trade_status'])}</span> <!--{/if}-->
										</div>
									</div>
								</div>
							</div>
							<div class="layui-form-item layui-row">
								<div class="layui-col-md6">
									<label class="layui-form-label">会员卡号</label>
									<div class="layui-input-block">
										<div class="input-like">{echo empty($mch_user) ? '' : $mch_user['card_no']}</div>
									</div>
								</div>
								<div class="layui-col-md6">
									<label class="layui-form-label">积分/余额</label>
									<div class="layui-input-block">
										<div class="input-like">{echo empty($mch_user) ? '' : $mch_user['credit'].'/￥'.$mch_user['balance']}</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-header">商品明细</div>
						<div class="layui-card-body layui-col-space10">
							<div class="layui-form-item">
								<table class="layui-table text-center" lay-skin="line">
									<thead>
										<tr>
											<th>商品图片</th>
											<th>商品名称</th>
											<th>商品单价</th>
											<th>数量</th>
											<th>规格</th>
										</tr>
									</thead>
									<tbody>
										<!--{loop $goods $key $val}-->
										<tr>
											<td><div style="width:42px; height:42px; margin: 0 auto; background:url({$val[pic]}) center; background-size:cover;"></div></td>
											<td>{$val[goods_name]}</td>
											<td>{$val[price]}</td>
											<td>{$val[num]}</td>
											<td>{$val[attr]}</td>
										</tr>
										<!--{/loop}-->
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!--footer-->
{template _:footer}
<script>
$("a[op=status]").click(function(){
	op('确认' + $(this).text() + '？', $(this).attr('lay-url'), function(res){
		reload();
	})
});
layui.use('laydate', function(){
	var laydate = layui.laydate;
	laydate.render({ 
		elem: '#time_create',
		range: '~'
	});
});
</script>
</body>
</html>