<?php
/** @var array $order */
/** @var array $payments */
$ok = $order['status'] === 'paid';
?>
<section class="page-hero"><div class="container"><h1><?php echo $ok ? '支付成功' : '订单已创建'; ?></h1></div></section>
<div class="container">
 <div class="form-card">
   <div class="alert alert-<?php echo $ok ? 'ok' : 'err'; ?>">
     <?php echo $ok ? '✓ 您的付款已成功，我们会尽快与您联系。' : '订单已创建，请完成支付。'; ?>
   </div>
   <table class="spec-table">
     <tr><td>订单号</td><td><?php echo e($order['order_no']); ?></td></tr>
     <tr><td>商品</td><td><?php echo e($order['product_name']); ?></td></tr>
     <tr><td>数量</td><td><?php echo e($order['qty']); ?> 套</td></tr>
     <tr><td>金额</td><td>¥<?php echo e($order['amount']); ?></td></tr>
     <tr><td>状态</td><td><?php echo $ok ? '已支付' : '待支付'; ?></td></tr>
     <tr><td>下单人</td><td><?php echo e($order['customer_name']); ?>（<?php echo e($order['phone']); ?>）</td></tr>
   </table>
   <?php if ($ok && $payments): ?>
     <h4 style="margin:22px 0 10px">付款记录</h4>
     <table class="spec-table">
       <?php foreach ($payments as $p): ?>
       <tr><td>支付通道</td><td><?php echo $p['channel'] === 'wechat' ? '微信支付' : '支付宝'; ?></td></tr>
       <tr><td>交易流水号</td><td><?php echo e($p['trade_no']); ?></td></tr>
       <tr><td>付款时间</td><td><?php echo e($p['paid_at']); ?></td></tr>
       <?php endforeach; ?>
     </table>
   <?php endif; ?>
   <div class="form-actions" style="margin-top:20px">
     <a class="btn btn-primary" href="<?php echo site_url('order/query'); ?>">查询我的订单</a>
     <a class="btn btn-ghost" href="<?php echo site_url(); ?>">返回首页</a>
   </div>
 </div>
</div>
