dm-design/商家端APP/注册/创建摊位.html

566 lines
18 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<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;
}
.header {
background-color: #fff;
padding: 16px;
border-bottom: 1px solid #e5e5e5;
}
.header h1 {
font-size: 18px;
font-weight: 500;
color: #333;
}
.section {
background-color: #fff;
margin-top: 10px;
padding: 16px;
}
.section-title {
font-size: 16px;
font-weight: 500;
color: #333;
margin-bottom: 16px;
padding-bottom: 8px;
border-bottom: 2px solid #4CAF50;
}
.form-item {
margin-bottom: 20px;
}
.form-label {
display: block;
font-size: 14px;
color: #666;
margin-bottom: 8px;
}
.form-label .required {
color: #f44336;
margin-right: 4px;
}
.form-input {
width: 100%;
padding: 12px;
font-size: 15px;
border: 1px solid #ddd;
border-radius: 4px;
background-color: #fff;
-webkit-appearance: none;
}
.form-input:focus {
outline: none;
border-color: #4CAF50;
}
.form-input::placeholder {
color: #bbb;
}
select.form-input {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 12px center;
padding-right: 36px;
}
.image-upload {
width: 120px;
height: 120px;
border: 1px dashed #ddd;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
background-color: #fafafa;
cursor: pointer;
position: relative;
}
.image-upload-large {
width: 100%;
height: 160px;
}
.image-upload svg {
width: 40px;
height: 40px;
color: #bbb;
}
.image-upload input {
position: absolute;
width: 100%;
height: 100%;
opacity: 0;
cursor: pointer;
}
.image-preview {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 4px;
}
.image-upload-container {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.switch-container {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 0;
}
.switch {
position: relative;
display: inline-block;
width: 50px;
height: 28px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .3s;
border-radius: 28px;
}
.slider:before {
position: absolute;
content: "";
height: 22px;
width: 22px;
left: 3px;
bottom: 3px;
background-color: white;
transition: .3s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #4CAF50;
}
input:checked + .slider:before {
transform: translateX(22px);
}
.time-input-group {
display: flex;
align-items: center;
gap: 10px;
}
.time-input {
flex: 1;
padding: 12px;
font-size: 15px;
border: 1px solid #ddd;
border-radius: 4px;
}
.checkbox-group {
display: flex;
gap: 20px;
margin-bottom: 12px;
}
.checkbox-item {
display: flex;
align-items: center;
gap: 6px;
}
.checkbox-item input[type="checkbox"] {
width: 18px;
height: 18px;
cursor: pointer;
}
.radio-group {
display: flex;
gap: 20px;
margin-top: 12px;
}
.radio-item {
display: flex;
align-items: center;
gap: 6px;
}
.radio-item input[type="radio"] {
width: 18px;
height: 18px;
cursor: pointer;
}
.time-range {
display: flex;
align-items: center;
gap: 10px;
margin-top: 12px;
}
.time-range input {
flex: 1;
}
.submit-btn {
padding: 16px;
background-color: #fff;
border-top: 1px solid #e5e5e5;
margin-top: 10px;
}
.submit-btn button {
width: 100%;
padding: 14px;
font-size: 16px;
font-weight: 500;
color: #fff;
background-color: #4CAF50;
border: none;
border-radius: 4px;
cursor: pointer;
-webkit-appearance: none;
}
.submit-btn button:active {
background-color: #45a049;
}
.form-hint {
font-size: 12px;
color: #999;
margin-top: 6px;
}
.image-item {
position: relative;
display: inline-block;
}
.image-item .remove-btn {
position: absolute;
top: -8px;
right: -8px;
width: 24px;
height: 24px;
background-color: #f44336;
color: white;
border: none;
border-radius: 50%;
cursor: pointer;
font-size: 16px;
line-height: 1;
padding: 0;
}
</style>
</head>
<body>
<div class="header">
<h1>创建摊位</h1>
</div>
<div class="section">
<div class="section-title">店铺基础信息</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>摊位名称
</label>
<input type="text" class="form-input" placeholder="请输入摊位名称" required>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>主营类目
</label>
<select class="form-input" required>
<option value="">请选择主营类目</option>
<option value="vegetable">蔬菜</option>
<option value="fruit">水果</option>
<option value="meat">肉类</option>
<option value="seafood">海鲜</option>
<option value="grain">粮油</option>
<option value="other">其他</option>
</select>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>摊位背景图
</label>
<div class="image-upload image-upload-large" id="bgImageUpload">
<input type="file" accept="image/*" onchange="handleImageUpload(event, 'bgImagePreview')">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
<img id="bgImagePreview" class="image-preview" style="display: none;">
</div>
</div>
<div class="form-item">
<label class="form-label">摊位联系电话</label>
<input type="tel" class="form-input" placeholder="请输入联系电话/手机号">
</div>
<div class="form-item">
<label class="form-label">摊位照片</label>
<div class="image-upload-container" id="photoContainer">
<div class="image-upload">
<input type="file" accept="image/*" multiple onchange="handleMultipleImages(event)">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
</div>
</div>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>摊位位置
</label>
<input type="text" class="form-input" placeholder="请输入摊位位置" required>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>摊位详细地址
</label>
<input type="text" class="form-input" placeholder="请输入摊位详细地址" required>
</div>
<div class="form-item">
<label class="form-label">许可证</label>
<div class="image-upload-container">
<div class="image-upload">
<input type="file" accept="image/*" onchange="handleImageUpload(event, 'license1Preview')">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
<img id="license1Preview" class="image-preview" style="display: none;">
</div>
<div class="image-upload">
<input type="file" accept="image/*" onchange="handleImageUpload(event, 'license2Preview')">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
<img id="license2Preview" class="image-preview" style="display: none;">
</div>
</div>
</div>
</div>
<div class="section">
<div class="form-item">
<div class="switch-container">
<label class="form-label" style="margin: 0;">是否自动开放</label>
<div style="display: flex; align-items: center; gap: 12px;">
<span style="font-size: 14px; color: #666;">手动营业</span>
<label class="switch">
<input type="checkbox" id="autoOpen" onchange="toggleBusinessMode()">
<span class="slider"></span>
</label>
<span style="font-size: 14px; color: #4CAF50;">自动营业</span>
</div>
</div>
<div class="radio-group" id="timeRadioGroup" style="display: none;">
<div class="radio-item">
<input type="radio" name="timeMode" value="all" id="timeAll">
<label for="timeAll">00:00:00</label>
</div>
<div class="radio-item">
<span></span>
</div>
<div class="radio-item">
<input type="radio" name="timeMode" value="end" id="timeEnd">
<label for="timeEnd">23:59:00</label>
</div>
</div>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>服务目摊点位置
</label>
<input type="text" class="form-input" placeholder="请输入服务目摊点位置" required>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>目摊点详细地址
</label>
<input type="text" class="form-input" placeholder="请输入目摊点详细地址" required>
</div>
<div class="form-item">
<label class="form-label">目摊点示意图</label>
<div class="image-upload image-upload-large">
<input type="file" accept="image/*" onchange="handleImageUpload(event, 'mapPreview')">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
</svg>
<img id="mapPreview" class="image-preview" style="display: none;">
</div>
</div>
</div>
<div class="section">
<div class="form-item">
<label class="form-label">营业时间</label>
<div class="checkbox-group">
<div class="checkbox-item">
<input type="checkbox" id="everyday" checked>
<label for="everyday">每天</label>
</div>
<div class="checkbox-item">
<input type="checkbox" id="workday">
<label for="workday">工作日</label>
</div>
<div class="checkbox-item">
<input type="checkbox" id="custom">
<label for="custom">自定义</label>
</div>
</div>
<div class="time-range">
<input type="time" class="time-input" value="00:00">
<span></span>
<input type="time" class="time-input" value="23:59">
</div>
</div>
<div class="form-item">
<label class="form-label">承诺送达时间</label>
<input type="number" class="form-input" placeholder="请输入小时数" min="0" step="1">
<div class="form-hint">小时以内</div>
</div>
</div>
<div class="submit-btn">
<button type="button" onclick="handleSubmit()">保存</button>
</div>
<script>
function handleImageUpload(event, previewId) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
const preview = document.getElementById(previewId);
preview.src = e.target.result;
preview.style.display = 'block';
event.target.style.display = 'none';
}
reader.readAsDataURL(file);
}
}
function handleMultipleImages(event) {
const files = event.target.files;
const container = document.getElementById('photoContainer');
Array.from(files).forEach(file => {
const reader = new FileReader();
reader.onload = function(e) {
const imageItem = document.createElement('div');
imageItem.className = 'image-item';
imageItem.innerHTML = `
<div class="image-upload">
<img src="${e.target.result}" class="image-preview" style="display: block;">
</div>
<button class="remove-btn" onclick="removeImage(this)">×</button>
`;
container.insertBefore(imageItem, container.firstChild);
}
reader.readAsDataURL(file);
});
event.target.value = '';
}
function removeImage(btn) {
btn.parentElement.remove();
}
function toggleBusinessMode() {
const autoOpen = document.getElementById('autoOpen');
const timeRadioGroup = document.getElementById('timeRadioGroup');
timeRadioGroup.style.display = autoOpen.checked ? 'flex' : 'none';
}
function handleSubmit() {
const requiredFields = document.querySelectorAll('[required]');
let isValid = true;
requiredFields.forEach(field => {
if (!field.value.trim()) {
isValid = false;
field.style.borderColor = '#f44336';
} else {
field.style.borderColor = '#ddd';
}
});
if (isValid) {
alert('表单提交成功!');
// 这里添加实际的提交逻辑
} else {
alert('请填写所有必填项!');
}
}
// 防止页面缩放
document.addEventListener('gesturestart', function(e) {
e.preventDefault();
});
// 优化移动端输入体验
document.querySelectorAll('.form-input').forEach(input => {
input.addEventListener('focus', function() {
setTimeout(() => {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}, 300);
});
});
</script>
</body>
</html>