Files
coolcoth.com/app/Views/product/show.php
T
2026-08-08 16:26:31 +08:00

86 lines
4.1 KiB
PHP

<?php
$layoutArr = [];
if (!empty($p['layout'])) { $d = json_decode($p['layout'], true); if (is_array($d)) $layoutArr = $d; }
$hasCanvas = !empty($layoutArr);
?>
<section class="page-hero">
<div class="container">
<h1><?php echo e($p['name']); ?></h1>
<p><?php echo e($cat['name'] ?? '降温服'); ?></p>
</div>
</section>
<div class="container">
<nav class="breadcrumb">
<a href="<?php echo site_url(); ?>">首页</a> / <a href="<?php echo site_url('products'); ?>">产品中心</a> /
<?php echo e($p['name']); ?>
</nav>
</div>
<?php if ($hasCanvas): ?>
<?php echo \Core\View::buffer('parts/canvas', ['layout' => $layoutArr, 'item' => $p, 'module' => 'product']); ?>
<?php else: ?>
<section class="section detail-sec" style="padding-top:20px">
<div class="container">
<div class="detail-wrap">
<div>
<div class="detail-thumb" style="background:<?php echo gradient($p['id']); ?>">❄</div>
<div class="gallery">
<div class="detail-thumb" style="aspect-ratio:1/1;font-size:28px;background:<?php echo gradient($p['id'] + 1); ?>">❄</div>
<div class="detail-thumb" style="aspect-ratio:1/1;font-size:28px;background:<?php echo gradient($p['id'] + 2); ?>">❄</div>
<div class="detail-thumb" style="aspect-ratio:1/1;font-size:28px;background:<?php echo gradient($p['id'] + 3); ?>">❄</div>
</div>
</div>
<div class="detail-info">
<h1><?php echo e($p['name']); ?></h1>
<div class="detail-price">¥<?php echo e($p['price']); ?> <small style="font-size:14px;color:var(--c-muted)">起 / 套</small></div>
<p class="detail-sum"><?php echo e($p['summary']); ?></p>
<?php if (!empty($specs)): ?>
<table class="spec-table">
<?php foreach ($specs as $s): ?><tr><td><?php echo e($s['k']); ?></td><td><?php echo e($s['v']); ?></td></tr><?php endforeach; ?>
</table>
<?php endif; ?>
<p class="detail-desc"><?php echo e($p['description']); ?></p>
<div style="display:flex;gap:12px;margin-top:24px;flex-wrap:wrap">
<a class="btn btn-primary magnetic" href="<?php echo site_url('order/checkout/' . $p['slug']); ?>">立即购买</a>
<a class="btn btn-ghost" href="<?php echo site_url('contact'); ?>">咨询报价</a>
<a class="btn btn-ghost" href="<?php echo site_url('products'); ?>">返回列表</a>
</div>
</div>
</div>
</div>
</section>
<?php endif; ?>
<?php if (!empty($related)): ?>
<section class="section" style="padding-top:30px">
<div class="container">
<h3 style="margin:0 0 20px;font-size:22px">相关推荐</h3>
<div class="product-grid">
<?php foreach ($related as $r): ?>
<a class="product-card" href="<?php echo site_url('products/' . $r['slug']); ?>">
<div class="product-thumb" style="background:<?php echo gradient($r['id']); ?>">❄</div>
<div class="product-body">
<div class="product-name"><?php echo e($r['name']); ?></div>
<div class="product-sum"><?php echo e($r['summary']); ?></div>
</div>
</a>
<?php endforeach; ?>
</div>
</div>
</section>
<?php endif; ?>
<!-- 吸底购买栏:始终展示价格与立即购买 -->
<div class="buy-bar">
<div class="container buy-bar-inner">
<div class="buy-bar-info">
<span class="buy-bar-name"><?php echo e($p['name']); ?></span>
<span class="buy-bar-price">¥<?php echo e($p['price']); ?> <small>起 / 套</small></span>
</div>
<div class="buy-bar-actions">
<a class="btn btn-primary magnetic" href="<?php echo site_url('order/checkout/' . $p['slug']); ?>">立即购买</a>
<a class="btn btn-ghost" href="<?php echo site_url('contact'); ?>">咨询报价</a>
</div>
</div>
</div>