dm-design/web/会员管理/等级设置/优惠券.html

393 lines
12 KiB
HTML
Raw Normal View History

2025-08-05 09:53:36 +00:00
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>添加优惠券 - 线框图原型</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: #f5f5f5;
color: #333;
line-height: 1.6;
}
/* Modal Overlay */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}
/* Modal Container */
.modal {
background: white;
border: 2px dashed #ccc;
border-radius: 8px;
width: 90%;
max-width: 500px;
max-height: 90vh;
overflow: auto;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
/* Modal Header */
.modal-header {
padding: 20px 24px 16px;
border-bottom: 1px dashed #e0e0e0;
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-title {
font-size: 18px;
font-weight: 600;
color: #333;
}
.close-button {
background: none;
border: 1px dashed #ccc;
font-size: 20px;
color: #666;
cursor: pointer;
width: 32px;
height: 32px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}
.close-button:hover {
background-color: #f5f5f5;
border-color: #999;
}
/* Modal Body */
.modal-body {
padding: 24px;
}
/* Form Styles */
.form-group {
margin-bottom: 20px;
}
.form-label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #333;
font-size: 14px;
}
.required {
color: #e74c3c;
margin-left: 2px;
}
.form-input {
width: 100%;
padding: 12px 16px;
border: 1px dashed #ccc;
border-radius: 6px;
font-size: 14px;
background-color: white;
transition: all 0.2s;
}
.form-input:focus {
outline: none;
border-color: #666;
background-color: #fafafa;
}
.form-input::placeholder {
color: #999;
}
.form-select {
width: 100%;
padding: 12px 16px;
border: 1px dashed #ccc;
border-radius: 6px;
font-size: 14px;
background-color: white;
cursor: pointer;
transition: all 0.2s;
}
.form-select:focus {
outline: none;
border-color: #666;
background-color: #fafafa;
}
/* Modal Footer */
.modal-footer {
padding: 16px 24px 24px;
display: flex;
justify-content: flex-end;
gap: 12px;
}
.btn {
padding: 10px 24px;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
border: 1px dashed #ccc;
background: white;
}
.btn-cancel {
color: #666;
}
.btn-cancel:hover {
background-color: #f5f5f5;
border-color: #999;
}
.btn-primary {
background-color: #007bff;
color: white;
border-color: #007bff;
}
.btn-primary:hover {
background-color: #0056b3;
border-color: #0056b3;
}
/* Background Page Content */
.page-content {
padding: 40px 20px;
text-align: center;
color: #666;
}
.page-title {
font-size: 24px;
margin-bottom: 16px;
color: #333;
}
.page-description {
font-size: 16px;
margin-bottom: 32px;
}
.demo-button {
padding: 12px 24px;
background: white;
border: 2px dashed #ccc;
border-radius: 6px;
font-size: 14px;
cursor: pointer;
color: #666;
transition: all 0.2s;
}
.demo-button:hover {
border-color: #999;
background-color: #f5f5f5;
}
/* Responsive Design */
@media (max-width: 768px) {
.modal {
width: 95%;
margin: 20px;
}
.modal-header {
padding: 16px 20px 12px;
}
.modal-body {
padding: 20px;
}
.modal-footer {
padding: 12px 20px 20px;
flex-direction: column;
}
.btn {
width: 100%;
margin-bottom: 8px;
}
}
</style>
</head>
<body>
<!-- Background Page Content -->
<div class="page-content">
<h1 class="page-title">优惠券管理系统原型</h1>
<p class="page-description">这是一个线框图风格的优惠券添加表单原型演示</p>
<button class="demo-button" onclick="showModal()">打开添加优惠券弹窗</button>
</div>
<!-- Modal Overlay (initially visible for demo) -->
<div class="modal-overlay" id="modalOverlay">
<div class="modal">
<!-- Modal Header -->
<div class="modal-header">
<h2 class="modal-title">添加优惠券</h2>
<button class="close-button" onclick="closeModal()" title="关闭">×</button>
</div>
<!-- Modal Body -->
<div class="modal-body">
<form id="couponForm">
<!-- 优惠券名称 -->
<div class="form-group">
<label class="form-label" for="couponName">
优惠券名称<span class="required">*</span>
</label>
<input
type="text"
id="couponName"
class="form-input"
placeholder="生日优惠券"
required
>
</div>
<!-- 优惠券门槛金额 -->
<div class="form-group">
<label class="form-label" for="thresholdAmount">
优惠券门槛金额<span class="required">*</span>
</label>
<select id="thresholdAmount" class="form-select" required>
<option value="">请选择门槛金额</option>
<option value="0">无门槛</option>
<option value="10" selected>10元</option>
<option value="20">20元</option>
<option value="50">50元</option>
<option value="100">100元</option>
<option value="200">200元</option>
<option value="500">500元</option>
</select>
</div>
<!-- 优惠券减免金额 -->
<div class="form-group">
<label class="form-label" for="discountAmount">
优惠券减免金额<span class="required">*</span>
</label>
<select id="discountAmount" class="form-select" required>
<option value="">请选择减免金额</option>
<option value="1" selected>1元</option>
<option value="2">2元</option>
<option value="5">5元</option>
<option value="10">10元</option>
<option value="20">20元</option>
<option value="50">50元</option>
<option value="100">100元</option>
</select>
</div>
<!-- 优惠券有效时间 -->
<div class="form-group">
<label class="form-label" for="validTime">
优惠券有效时间<span class="required">*</span>
</label>
<select id="validTime" class="form-select" required>
<option value="">请选择有效时间</option>
<option value="1" selected>1天</option>
<option value="3">3天</option>
<option value="7">7天</option>
<option value="15">15天</option>
<option value="30">30天</option>
<option value="60">60天</option>
<option value="90">90天</option>
</select>
</div>
</form>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<button type="button" class="btn btn-cancel" onclick="closeModal()">
取消
</button>
<button type="button" class="btn btn-primary" onclick="submitForm()">
确认添加
</button>
</div>
</div>
</div>
<script>
// Simple demo functionality
function showModal() {
document.getElementById('modalOverlay').style.display = 'flex';
}
function closeModal() {
document.getElementById('modalOverlay').style.display = 'none';
}
function submitForm() {
const form = document.getElementById('couponForm');
const formData = new FormData(form);
// Get form values
const couponName = document.getElementById('couponName').value;
const thresholdAmount = document.getElementById('thresholdAmount').value;
const discountAmount = document.getElementById('discountAmount').value;
const validTime = document.getElementById('validTime').value;
// Simple validation
if (!couponName || !thresholdAmount || !discountAmount || !validTime) {
alert('请填写所有必填字段');
return;
}
// Demo success message
alert(`优惠券添加成功!\n名称: ${couponName}\n门槛: ${thresholdAmount}元\n减免: ${discountAmount}元\n有效期: ${validTime}天`);
closeModal();
// Reset form
form.reset();
document.getElementById('thresholdAmount').value = '10';
document.getElementById('discountAmount').value = '1';
document.getElementById('validTime').value = '1';
}
// Close modal when clicking overlay
document.getElementById('modalOverlay').addEventListener('click', function(e) {
if (e.target === this) {
closeModal();
}
});
// Close modal with Escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closeModal();
}
});
</script>
</body>
</html>