仰望星辰工作室

better-staridc-MNBT

Z zfhsh first commit 2 天前
1<?php
2if (!defined('IN_CRONLITE')) { exit; }
3$page_title = $page_title ?? '我的订单';
4$orders = $orders ?? ['list' => [], 'total' => 0, 'page' => 1, 'per_page' => 15];
5$status_labels = ['pending'=>'待支付','paid'=>'已支付','opened'=>'已开通','failed'=>'失败','cancelled'=>'已取消'];
6ob_start();
7?>
8<div class="hs-section"><h1>我的订单</h1><p>主机购买订单记录</p></div>
9
10<div class="layui-card">
11 <div class="layui-card-body" style="padding:0;">
12 <?php if (empty($orders['list'])): ?>
13 <p style="text-align:center;padding:40px;color:#999;">暂无订单,<a href="<?= hosting_url('shop') ?>" style="color:#1e9fff;">去购买主机</a></p>
14 <?php else: ?>
15 <table class="ly-table">
16 <thead><tr><th>订单号</th><th>套餐</th><th>周期</th><th>金额</th><th>状态</th><th>下单时间</th><th>备注</th></tr></thead>
17 <tbody>
18 <?php foreach ($orders['list'] as $o): ?>
19 <tr>
20 <td class="ly-mono"><?= htmlspecialchars($o['order_no']) ?></td>
21 <td><?= htmlspecialchars($o['plan_name']) ?></td>
22 <td><?= $o['period']==='year'?'年付':'月付' ?></td>
23 <td>¥<?= hosting_format_cents($o['amount_cents']) ?></td>
24 <td><span class="ly-status ly-status-<?= $o['status'] ?>"><?= $status_labels[$o['status']] ?? $o['status'] ?></span></td>
25 <td><?= htmlspecialchars($o['created_at']) ?></td>
26 <td><?= htmlspecialchars($o['remark']?:'-') ?></td>
27 </tr>
28 <?php endforeach; ?>
29 </tbody>
30 </table>
31 <?php $tp=max(1,(int)ceil($orders['total']/$orders['per_page']));$cp=(int)$orders['page'];
32 if($tp>1): ?>
33 <div class="ly-pager">
34 <?php if($cp>1):?><a href="<?=hosting_url('shop/orders?page='.($cp-1))?>">上一页</a><?php endif;?>
35 <span class="ly-pager-info">第<?=$cp?>/<?=$tp?>页</span>
36 <?php if($cp<$tp):?><a href="<?=hosting_url('shop/orders?page='.($cp+1))?>">下一页</a><?php endif;?>
37 </div>
38 <?php endif;?>
39 <?php endif; ?>
40 </div>
41</div>
42<?php
43$content = ob_get_clean();
44include __DIR__ . '/layout.php';