feat(套餐管理): 添加套餐专属预约信息字段
在套餐添加和编辑功能中新增package_reminder字段,用于存储套餐专属预约信息
This commit is contained in:
+23
-4
@@ -14,9 +14,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$base_duration = (int)$_POST['base_duration'];
|
||||
$price = (float)$_POST['price'];
|
||||
$services = implode(',', array_filter(array_map('trim', $_POST['services'] ?? [])));
|
||||
$package_reminder = trim($_POST['package_reminder']);
|
||||
|
||||
$stmt = $pdo->prepare("INSERT INTO packages (package_name, description, base_duration, price, services) VALUES (?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$package_name, $description, $base_duration, $price, $services]);
|
||||
$stmt = $pdo->prepare("INSERT INTO packages (package_name, description, base_duration, price, services, package_reminder) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$package_name, $description, $base_duration, $price, $services, $package_reminder]);
|
||||
$message = "套餐添加成功!";
|
||||
|
||||
} elseif ($action === 'update') {
|
||||
@@ -26,10 +27,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$base_duration = (int)$_POST['base_duration'];
|
||||
$price = (float)$_POST['price'];
|
||||
$services = implode(',', array_filter(array_map('trim', $_POST['services'] ?? [])));
|
||||
$package_reminder = trim($_POST['package_reminder']);
|
||||
$is_active = isset($_POST['is_active']) ? 1 : 0;
|
||||
|
||||
$stmt = $pdo->prepare("UPDATE packages SET package_name = ?, description = ?, base_duration = ?, price = ?, services = ?, is_active = ? WHERE id = ?");
|
||||
$stmt->execute([$package_name, $description, $base_duration, $price, $services, $is_active, $id]);
|
||||
$stmt = $pdo->prepare("UPDATE packages SET package_name = ?, description = ?, base_duration = ?, price = ?, services = ?, package_reminder = ?, is_active = ? WHERE id = ?");
|
||||
$stmt->execute([$package_name, $description, $base_duration, $price, $services, $package_reminder, $is_active, $id]);
|
||||
$message = "套餐更新成功!";
|
||||
|
||||
} elseif ($action === 'delete') {
|
||||
@@ -140,6 +142,11 @@ $packages = $stmt->fetchAll();
|
||||
<button type="button" class="btn-outline btn-sm" onclick="addService()" style="padding: 6px 12px; background: white; color: #1890ff; border: 1px solid #1890ff; border-radius: 4px; font-size: 12px; cursor: pointer;"><span>+ 添加服务项目</span></button>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-bottom: 16px;">
|
||||
<label for="package_reminder" style="display: block; font-weight: 600; margin-bottom: 6px; color: #333;">套餐专属预约信息</label>
|
||||
<textarea id="package_reminder" name="package_reminder" rows="4" placeholder="输入此套餐的专属预约信息,将在预约确认时显示" class="form-control" style="width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; resize: vertical;"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-actions" style="margin-top: 24px; display: flex; justify-content: flex-end;">
|
||||
<button type="submit" class="btn-primary btn-lg" style="padding: 10px 24px; background: #1890ff; color: white; border: none; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.3s;">
|
||||
<span>✨ 添加套餐</span>
|
||||
@@ -200,6 +207,13 @@ $packages = $stmt->fetchAll();
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($package['package_reminder'])): ?>
|
||||
<div class="package-reminder" style="margin-top: 12px; padding: 12px; background: #f8f9fa; border-radius: 4px; border-left: 4px solid #1890ff;">
|
||||
<div class="detail-label" style="font-weight: 600; margin-bottom: 8px; color: #333;">套餐专属预约信息</div>
|
||||
<div class="reminder-content" style="font-size: 14px; color: #666; line-height: 1.5;"><?= nl2br(htmlspecialchars($package['package_reminder'])) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="package-actions">
|
||||
<button class="btn-primary btn-sm" onclick="editPackage(<?= $package['id'] ?>)"><span>✏️ 编辑</span></button>
|
||||
<form method="POST" style="display: inline;" onsubmit="return confirmDelete()">
|
||||
@@ -264,6 +278,11 @@ $packages = $stmt->fetchAll();
|
||||
<button type="button" class="btn-outline btn-sm" onclick="addService()" style="padding: 6px 12px; background: white; color: #1890ff; border: 1px solid #1890ff; border-radius: 4px; font-size: 12px; cursor: pointer;"><span>+ 添加服务项目</span></button>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-bottom: 16px;">
|
||||
<label for="package_reminder" style="display: block; font-weight: 600; margin-bottom: 6px; color: #333;">套餐专属预约信息</label>
|
||||
<textarea id="package_reminder" name="package_reminder" rows="4" placeholder="输入此套餐的专属预约信息,将在预约确认时显示" class="form-control" style="width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; resize: vertical;"><?= htmlspecialchars($package['package_reminder'] ?? '') ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-bottom: 16px;">
|
||||
<label class="checkbox-label" style="display: flex; align-items: center; cursor: pointer;">
|
||||
<input type="checkbox" name="is_active" <?= $package['is_active'] ? 'checked' : '' ?> style="margin-right: 8px;">
|
||||
|
||||
Reference in New Issue
Block a user