172 lines
10 KiB
HTML
172 lines
10 KiB
HTML
{include file="Public:header2"/}
|
|
|
|
<body>
|
|
<div class="layui-fluid">
|
|
<div class="layui-card">
|
|
<div class="layui-card-header">
|
|
出货概览 - {$boxInfo.title|default='未知盒子'}
|
|
</div>
|
|
<div class="layui-card-body">
|
|
<div class="layui-row layui-col-space15">
|
|
<div class="layui-col-md12">
|
|
<?php
|
|
// 预先计算总出货数量
|
|
$totalCount = 0;
|
|
$totalValue = 0;
|
|
foreach($list as $item) {
|
|
$totalCount += isset($item['goods_count']) ? $item['goods_count'] : 0;
|
|
$sc_money = isset($item['sc_money']) ? $item['sc_money'] : 0;
|
|
$goods_count = isset($item['goods_count']) ? $item['goods_count'] : 0;
|
|
$totalValue += $sc_money * $goods_count;
|
|
}
|
|
?>
|
|
<table class="layui-table">
|
|
<thead>
|
|
<tr>
|
|
<th>奖品ID</th>
|
|
<th>奖品名称</th>
|
|
<th>奖品图片</th>
|
|
<th>出货数量</th>
|
|
<th>奖品单价</th>
|
|
<th>兑换金额</th>
|
|
<th>出货金额</th>
|
|
<th>理论概率</th>
|
|
<th>实际概率</th>
|
|
<th>概率偏差</th>
|
|
<th>总价值</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{volist name="list" id="vo"}
|
|
<tr>
|
|
<td>{$vo.goodslist_id}</td>
|
|
<td>{$vo.title}</td>
|
|
<td>
|
|
<img src="{$vo.imgurl}" style="height:50px;" onerror="this.src='/static/admin/images/nopic.jpg'">
|
|
</td>
|
|
<td>
|
|
<span class="layui-badge layui-bg-blue">{$vo.goods_count}</span>
|
|
</td>
|
|
<td>¥ {$vo.price|default="0"}</td>
|
|
<td>¥ {$vo.money|default="0"}</td>
|
|
<td>¥ {$vo.sc_money|default="0"}</td>
|
|
<td>
|
|
<span class="layui-badge layui-bg-green">{$vo.real_pro|default="0"}%</span>
|
|
</td>
|
|
<td>
|
|
<?php
|
|
$actual_percent = 0;
|
|
if(!empty($totalCount) && $totalCount > 0) {
|
|
$goods_count = isset($vo['goods_count']) ? $vo['goods_count'] : 0;
|
|
$actual_percent = round(($goods_count / $totalCount) * 100, 2);
|
|
}
|
|
?>
|
|
<span class="layui-badge layui-bg-orange">{$actual_percent}%</span>
|
|
</td>
|
|
<td>
|
|
<?php
|
|
$real_pro = isset($vo['real_pro']) ? $vo['real_pro'] : 0;
|
|
$diff = round($actual_percent - $real_pro, 2);
|
|
$color = $diff >= 0 ? '#5FB878' : '#FF5722';
|
|
$sign = $diff > 0 ? '+' : '';
|
|
?>
|
|
<span style="color: <?php echo $color; ?>; font-weight: bold;"><?php echo $sign.$diff; ?>%</span>
|
|
</td>
|
|
<td>
|
|
<?php
|
|
$sc_money = isset($vo['sc_money']) ? $vo['sc_money'] : 0;
|
|
$goods_count = isset($vo['goods_count']) ? $vo['goods_count'] : 0;
|
|
$total_value = $sc_money * $goods_count;
|
|
?>
|
|
¥ <?php echo round($total_value, 2); ?>
|
|
</td>
|
|
</tr>
|
|
{/volist}
|
|
{if condition="empty($list)"}
|
|
<tr>
|
|
<td colspan="9" style="text-align:center;">暂时没有数据!</td>
|
|
</tr>
|
|
{/if}
|
|
</tbody>
|
|
</table>
|
|
|
|
<!-- 统计摘要 -->
|
|
{if condition="!empty($list)"}
|
|
<div class="layui-card">
|
|
<div class="layui-card-header">统计摘要</div>
|
|
<div class="layui-card-body">
|
|
<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" style="font-size: 24px; color: #01AAED;">
|
|
{$totalCount}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-md6">
|
|
<div class="layui-card">
|
|
<div class="layui-card-header">总出货价值</div>
|
|
<div class="layui-card-body" style="font-size: 24px; color: #FF5722;">
|
|
¥ {$totalValue|round=2}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if($totalCount > 0): ?>
|
|
<div class="layui-row layui-col-space15" style="margin-top: 15px;">
|
|
<div class="layui-col-md6">
|
|
<div class="layui-card">
|
|
<div class="layui-card-header">平均每次出货价值</div>
|
|
<div class="layui-card-body" style="font-size: 24px; color: #01AAED;">
|
|
¥ <?php echo round($totalValue / $totalCount, 2); ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="layui-col-md6">
|
|
<div class="layui-card">
|
|
<div class="layui-card-header">数据分析</div>
|
|
<div class="layui-card-body">
|
|
<?php
|
|
// 寻找实际概率最高的奖品
|
|
$maxPercent = 0;
|
|
$maxItem = null;
|
|
foreach($list as $item) {
|
|
$goods_count = isset($item['goods_count']) ? $item['goods_count'] : 0;
|
|
$percent = round(($goods_count / $totalCount) * 100, 2);
|
|
if($percent > $maxPercent) {
|
|
$maxPercent = $percent;
|
|
$maxItem = $item;
|
|
}
|
|
}
|
|
|
|
if($maxItem) {
|
|
echo "<p>出货概率最高的奖品: <strong>".$maxItem['title']."</strong> (".$maxPercent."%)</p>";
|
|
$real_pro = isset($maxItem['real_pro']) ? $maxItem['real_pro'] : 0;
|
|
$diff = round($maxPercent - $real_pro, 2);
|
|
$diffText = $diff >= 0 ? "高于" : "低于";
|
|
$absDiff = abs($diff);
|
|
$diffColor = $diff >= 0 ? "#5FB878" : "#FF5722";
|
|
?>
|
|
<p>与理论概率相比: <span style="color: <?php echo $diffColor; ?>"><?php echo $diffText; ?>理论值 <?php echo $absDiff; ?>%</span></p>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{include file="Public:footer"/}
|
|
</body>
|
|
</html>
|