Files
2026-08-08 18:28:49 +08:00

66 lines
3.4 KiB
PHP

<?php
include APP_PATH . 'app/views/layouts/admin_header.php';
?>
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><i class="fa fa-list"></i> 销售订单列表</h3>
<div class="box-tools">
<a href="<?php echo BASE_URL; ?>/Inventory/salesAdd" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> 新建销售单</a>
</div>
</div>
<div class="box-body table-responsive no-padding">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>序号</th>
<th>销售单号</th>
<th>客户名称</th>
<th>销售日期</th>
<th>总金额</th>
<th>状态</th>
<th>操作人</th>
<th style="width:180px">操作</th>
</tr>
</thead>
<tbody>
<?php if (!empty($orders)): ?>
<?php foreach ($orders as $o): ?>
<tr>
<td><?php echo $o['id']; ?></td>
<td><code><?php echo htmlspecialchars($o['order_no']); ?></code></td>
<td><?php echo htmlspecialchars($o['customer_name']); ?></td>
<td><?php echo htmlspecialchars($o['order_date']); ?></td>
<td>&yen;<?php echo number_format($o['total_amount'], 2); ?></td>
<td>
<?php
$statusLabels = ['pending'=>'待发货','shipped'=>'已发货','completed'=>'已完成','cancelled'=>'已取消'];
$statusColors = ['pending'=>'warning','shipped'=>'info','completed'=>'success','cancelled'=>'default'];
$st = $o['status'] ?? 'pending';
?>
<span class="label label-<?php echo $statusColors[$st] ?? 'default'; ?>">
<?php echo $statusLabels[$st] ?? $st; ?>
</span>
</td>
<td><?php echo htmlspecialchars($o['operator']); ?></td>
<td>
<a href="<?php echo BASE_URL; ?>/Inventory/salesDetail?id=<?php echo $o['id']; ?>" class="btn btn-xs btn-primary"><i class="fa fa-eye"></i> 详情</a>
<a href="<?php echo BASE_URL; ?>/Inventory/salesEdit?id=<?php echo $o['id']; ?>" class="btn btn-xs btn-info"><i class="fa fa-edit"></i> 编辑</a>
<form method="post" action="<?php echo BASE_URL; ?>/Inventory/salesDelete" style="display:inline" onsubmit="return confirm('确定删除该销售单吗?');">
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($csrfToken ?? ''); ?>">
<input type="hidden" name="id" value="<?php echo $o['id']; ?>">
<button type="submit" class="btn btn-xs btn-danger"><i class="fa fa-trash"></i> 删除</button>
</form>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td colspan="8" class="text-center text-muted">暂无销售订单</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<?php include APP_PATH . 'app/views/layouts/admin_footer.php'; ?>