From 00fc854a64e63a35bb96ed4334c8f991e63f4fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B1=95=E9=B9=8F?= Date: Wed, 19 Nov 2025 01:45:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A2=84=E7=BA=A6=E7=B3=BB=E7=BB=9F):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BC=9A=E5=91=98=E7=B1=BB=E5=9E=8B=E5=92=8C?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=9D=A5=E6=BA=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在预约系统中新增会员类型(VIP/普通)和客户来源字段,包含数据库修改、表单添加和展示优化 --- bookings.php | 26 ++++++++++++++++++++++++++ carwash_db.sql | 14 +++++++++----- index.php | 29 ++++++++++++++++++++++++++--- 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/bookings.php b/bookings.php index 60f171b..d44ed52 100644 --- a/bookings.php +++ b/bookings.php @@ -110,6 +110,32 @@ try { 预约时间: - +
+ 会员类型: + + + 👑 VIP会员 + + 普通客户 + + +
+
+ 客户来源: + + '🎵', + '微信' => '💬', + '快手' => '⚡', + '朋友介绍' => '🤝', + '其他' => '📋' + ]; + $icon = $source_icons[$booking['source']] ?? '📋'; + echo $icon . ' ' . $booking['source']; + ?> + +
diff --git a/carwash_db.sql b/carwash_db.sql index 5ce2200..e964fd4 100644 --- a/carwash_db.sql +++ b/carwash_db.sql @@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS packages ( updated_at TIMESTAMP NULL ); --- 修改预约表支持时间段 +-- 修改预约表支持时间段、会员类型和来源 DROP TABLE IF EXISTS bookings; CREATE TABLE IF NOT EXISTS bookings ( id INT AUTO_INCREMENT PRIMARY KEY, @@ -31,6 +31,8 @@ CREATE TABLE IF NOT EXISTS bookings ( total_price DECIMAL(10,2) NOT NULL, notes TEXT, status ENUM('待确认', '已确认', '进行中', '已完成', '已取消') DEFAULT '待确认', + member_type ENUM('普通客户', 'VIP会员') DEFAULT '普通客户' COMMENT '会员类型', + source ENUM('抖音', '微信', '快手', '朋友介绍', '其他') DEFAULT '其他' COMMENT '客户来源', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP NULL, FOREIGN KEY (package_id) REFERENCES packages(id) ON DELETE SET NULL @@ -42,7 +44,9 @@ INSERT INTO packages (package_name, description, base_duration, price, services) ('精洗套餐', '全面深度清洗', 90, 150.00, '外观精洗,内饰深度清洁,轮胎清洁,打蜡'), ('VIP套餐', '顶级豪华洗护', 180, 300.00, '全套精洗,抛光打蜡,内饰护理,发动机清洁,真皮护理'); --- 插入示例预约数据 -INSERT INTO bookings (customer_name, phone, car_model, car_number, package_id, start_time, end_time, duration, total_price, notes) VALUES -('张三', '13800138001', '大众朗逸', '京A12345', 1, '2024-12-20 09:00:00', '2024-12-20 09:30:00', 30, 50.00, '第一次来'), -('李四', '13800138002', '丰田凯美瑞', '京B67890', 2, '2024-12-20 10:30:00', '2024-12-20 12:00:00', 90, 150.00, '需要特别清洗内饰'); \ No newline at end of file +-- 插入示例预约数据(包含会员类型和来源) +INSERT INTO bookings (customer_name, phone, car_model, car_number, package_id, start_time, end_time, duration, total_price, notes, member_type, source) VALUES +('张三', '13800138001', '大众朗逸', '京A12345', 1, '2024-12-20 09:00:00', '2024-12-20 09:30:00', 30, 50.00, '第一次来', '普通客户', '抖音'), +('李四', '13800138002', '丰田凯美瑞', '京B67890', 2, '2024-12-20 10:30:00', '2024-12-20 12:00:00', 90, 150.00, '需要特别清洗内饰', 'VIP会员', '朋友介绍'), +('王五', '13800138003', '宝马X3', '沪C88888', 3, '2024-12-21 14:00:00', '2024-12-21 17:00:00', 180, 300.00, 'VIP客户,定期保养', 'VIP会员', '微信'), +('赵六', '13800138004', '本田雅阁', '粤A66666', 1, '2024-12-21 09:30:00', '2024-12-21 10:00:00', 30, 50.00, '快手看到广告来的', '普通客户', '快手'); \ No newline at end of file diff --git a/index.php b/index.php index 3c38887..6e42aa9 100644 --- a/index.php +++ b/index.php @@ -18,6 +18,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $appointment_time = $_POST['appointment_time']; $duration = (int)$_POST['duration']; $notes = trim($_POST['notes'] ?? ''); + $member_type = $_POST['member_type']; + $source = $_POST['source']; // 验证必填字段 if (empty($customer_name) || empty($phone) || empty($car_model) || @@ -61,11 +63,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // 插入预约记录 $stmt = $pdo->prepare("INSERT INTO bookings (customer_name, phone, car_model, car_number, package_id, custom_services, - start_time, end_time, duration, total_price, notes) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + start_time, end_time, duration, total_price, notes, member_type, source) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->execute([$customer_name, $phone, $car_model, $car_number, $package_id, $custom_services, - $start_time, $end_time, $duration, $total_price, $notes]); + $start_time, $end_time, $duration, $total_price, $notes, $member_type, $source]); $success_message = "预约提交成功!我们会尽快联系您确认。"; @@ -296,6 +298,27 @@ $packages_json = json_encode(array_map(function($package) { +
+
+ + +
+ +
+ + +
+
+