综述: 优化商家注册流程,新增两种商家类型初始化页面

- 删除原有的创建摊位.html页面,简化注册流程
- 新增受邀摊主初始化店铺.html页面,支持受邀摊主的店铺初始化流程
- 新增自主经营者初始化店铺.html页面,为自主经营者提供专门的初始化界面
- 更新大妈集市.rp原型文件,反映最新的商家注册流程设计
This commit is contained in:
linbin 2025-10-27 02:23:45 +08:00
parent c7dca284ce
commit e20862384e
2 changed files with 885 additions and 75 deletions

View File

@ -3,7 +3,7 @@
<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>
<title>创建店铺</title>
<style>
* {
margin: 0;
@ -137,11 +137,23 @@
padding: 12px 0;
}
.switch-group {
display: flex;
align-items: center;
justify-content: space-between;
}
.switch-labels {
display: flex;
gap: 15px;
}
.switch {
position: relative;
display: inline-block;
width: 50px;
height: 28px;
flex-shrink: 0;
}
.switch input {
@ -157,7 +169,7 @@
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
background-color: #dcdfe6;
transition: .3s;
border-radius: 28px;
}
@ -182,6 +194,16 @@
transform: translateX(22px);
}
.switch-label {
color: #606266;
font-size: 14px;
}
.switch-label.active {
color: #4CAF50;
font-weight: 500;
}
.time-input-group {
display: flex;
align-items: center;
@ -293,11 +315,58 @@
line-height: 1;
padding: 0;
}
/* 地图位置选择 */
.map-placeholder {
width: 100%;
height: 200px;
border: 1px solid #ddd;
border-radius: 4px;
background-color: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background-color 0.3s;
}
.map-placeholder:active {
background-color: #e8ebf0;
}
.map-placeholder-content {
text-align: center;
}
.map-icon {
font-size: 48px;
margin-bottom: 10px;
}
.map-text {
color: #999;
font-size: 14px;
}
.location-text {
font-size: 12px;
margin-top: 5px;
color: #f44336;
}
.location-text.selected {
color: #4CAF50;
}
/* 隐藏元素 */
.hidden {
display: none !important;
}
</style>
</head>
<body>
<div class="header">
<h1>创建摊位</h1>
<h1>创建店铺</h1>
</div>
<div class="section">
@ -310,6 +379,7 @@
<input type="text" class="form-input" placeholder="请输入摊位名称" required>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>主营类目
@ -338,11 +408,6 @@
</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">
@ -355,18 +420,34 @@
</div>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>摊位位置
</label>
<input type="text" class="form-input" placeholder="请输入摊位位置" required>
<label class="form-label">摊位联系电话</label>
<input type="tel" class="form-input" placeholder="请输入联系电话/手机号">
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>摊位详细地址
<span class="required">*</span>摊位位置
</label>
<input type="text" class="form-input" placeholder="请输入摊位详细地址" required>
<input type="text" class="form-input" placeholder="请输入摊位位置A区-01号" required>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>摊位地图定位
</label>
<div class="map-placeholder" onclick="selectLocation()">
<div class="map-placeholder-content">
<div class="map-icon">📍</div>
<div class="map-text">点击选择地图定位</div>
<div class="location-text" id="selectedLocationText">请选择定位</div>
</div>
</div>
<input type="hidden" id="locationLat" value="">
<input type="hidden" id="locationLng" value="">
</div>
<div class="form-item">
@ -392,64 +473,22 @@
<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="form-label">
<span class="required">*</span>摊位营业时间
</label>
<div class="switch-group">
<div class="switch-labels">
<span class="switch-label">手动营业</span>
<span class="switch-label active" id="autoLabel">自动营业</span>
</div>
<label class="switch">
<input type="checkbox" id="autoOpen" onchange="toggleBusinessMode()">
<input type="checkbox" id="autoBusinessTime" checked onchange="toggleBusinessTimeOptions()">
<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-group" id="businessDayOptions">
<div class="checkbox-item">
<input type="checkbox" id="everyday" checked>
<input type="checkbox" id="everyday">
<label for="everyday">每天</label>
</div>
<div class="checkbox-item">
@ -461,10 +500,10 @@
<label for="custom">自定义</label>
</div>
</div>
<div class="time-range">
<input type="time" class="time-input" value="00:00">
<div class="time-range" id="businessTimeRange">
<input type="time" class="form-input time-input" id="startTime" placeholder="开始营业时间">
<span></span>
<input type="time" class="time-input" value="23:59">
<input type="time" class="form-input time-input" id="endTime" placeholder="结束营业时间">
</div>
</div>
@ -517,14 +556,69 @@
event.target.value = '';
}
function handleMarketPhotos(event) {
const files = event.target.files;
const container = document.getElementById('marketPhotoContainer');
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 toggleBusinessTimeOptions() {
const autoBusinessTime = document.getElementById('autoBusinessTime');
const businessDayOptions = document.getElementById('businessDayOptions');
const businessTimeRange = document.getElementById('businessTimeRange');
const autoLabel = document.getElementById('autoLabel');
const manualLabel = autoLabel.previousElementSibling;
if (autoBusinessTime.checked) {
// 自动营业,显示时间范围和日期选项
businessDayOptions.classList.remove('hidden');
businessTimeRange.classList.remove('hidden');
autoLabel.classList.add('active');
manualLabel.classList.remove('active');
} else {
// 手动营业,隐藏时间范围和日期选项
businessDayOptions.classList.add('hidden');
businessTimeRange.classList.add('hidden');
autoLabel.classList.remove('active');
manualLabel.classList.add('active');
}
}
// 选择地图定位
function selectLocation() {
// 这里应该打开地图选择器实际应调用地图API
alert('此处应打开地图选择器实际开发时需要集成地图API如高德地图、百度地图等');
// 模拟选择了一个位置
const mockLat = 31.230416;
const mockLng = 121.473701;
document.getElementById('locationLat').value = mockLat;
document.getElementById('locationLng').value = mockLng;
document.getElementById('selectedLocationText').textContent = '已选择: ' + mockLat + ', ' + mockLng;
document.getElementById('selectedLocationText').classList.add('selected');
}
function handleSubmit() {
@ -561,6 +655,12 @@
}, 300);
});
});
// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', function() {
// 初始化营业时间选项显示状态
toggleBusinessTimeOptions();
});
</script>
</body>
</html>

View File

@ -0,0 +1,710 @@
<!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-group {
display: flex;
align-items: center;
justify-content: space-between;
}
.switch-labels {
display: flex;
gap: 15px;
}
.switch {
position: relative;
display: inline-block;
width: 50px;
height: 28px;
flex-shrink: 0;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #dcdfe6;
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);
}
.switch-label {
color: #606266;
font-size: 14px;
}
.switch-label.active {
color: #4CAF50;
font-weight: 500;
}
.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;
}
/* 地图位置选择 */
.map-placeholder {
width: 100%;
height: 200px;
border: 1px solid #ddd;
border-radius: 4px;
background-color: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background-color 0.3s;
}
.map-placeholder:active {
background-color: #e8ebf0;
}
.map-placeholder-content {
text-align: center;
}
.map-icon {
font-size: 48px;
margin-bottom: 10px;
}
.map-text {
color: #999;
font-size: 14px;
}
.location-text {
font-size: 12px;
margin-top: 5px;
color: #f44336;
}
.location-text.selected {
color: #4CAF50;
}
/* 隐藏元素 */
.hidden {
display: none !important;
}
</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>
<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>
<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>
<div class="image-upload image-upload-large" id="marketBgImageUpload">
<input type="file" accept="image/*" onchange="handleImageUpload(event, 'marketBgImagePreview')">
<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="marketBgImagePreview" class="image-preview" style="display: none;">
</div>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>营业执照
</label>
<div class="image-upload image-upload-large" id="businessLicenseUpload">
<input type="file" accept="image/*" onchange="handleImageUpload(event, 'businessLicensePreview')">
<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="businessLicensePreview" class="image-preview" style="display: none;">
</div>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>菜市场实拍图
</label>
<div class="image-upload-container" id="marketPhotoContainer">
<div class="image-upload">
<input type="file" accept="image/*" multiple onchange="handleMarketPhotos(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 class="form-hint">支持上传多张图片</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">
<span class="required">*</span>摊位位置
</label>
<input type="text" class="form-input" placeholder="请输入摊位位置A区-01号" required>
</div>
<div class="form-item">
<label class="form-label">
<span class="required">*</span>摊位地图定位
</label>
<div class="map-placeholder" onclick="selectLocation()">
<div class="map-placeholder-content">
<div class="map-icon">📍</div>
<div class="map-text">点击选择地图定位</div>
<div class="location-text" id="selectedLocationText">请选择定位</div>
</div>
</div>
<input type="hidden" id="locationLat" value="">
<input type="hidden" id="locationLng" value="">
</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">
<label class="form-label">
<span class="required">*</span>摊位营业时间
</label>
<div class="switch-group">
<div class="switch-labels">
<span class="switch-label">手动营业</span>
<span class="switch-label active" id="autoLabel">自动营业</span>
</div>
<label class="switch">
<input type="checkbox" id="autoBusinessTime" checked onchange="toggleBusinessTimeOptions()">
<span class="slider"></span>
</label>
</div>
<div class="checkbox-group" id="businessDayOptions">
<div class="checkbox-item">
<input type="checkbox" id="everyday">
<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" id="businessTimeRange">
<input type="time" class="form-input time-input" id="startTime" placeholder="开始营业时间">
<span></span>
<input type="time" class="form-input time-input" id="endTime" placeholder="结束营业时间">
</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 handleMarketPhotos(event) {
const files = event.target.files;
const container = document.getElementById('marketPhotoContainer');
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 toggleBusinessTimeOptions() {
const autoBusinessTime = document.getElementById('autoBusinessTime');
const businessDayOptions = document.getElementById('businessDayOptions');
const businessTimeRange = document.getElementById('businessTimeRange');
const autoLabel = document.getElementById('autoLabel');
const manualLabel = autoLabel.previousElementSibling;
if (autoBusinessTime.checked) {
// 自动营业,显示时间范围和日期选项
businessDayOptions.classList.remove('hidden');
businessTimeRange.classList.remove('hidden');
autoLabel.classList.add('active');
manualLabel.classList.remove('active');
} else {
// 手动营业,隐藏时间范围和日期选项
businessDayOptions.classList.add('hidden');
businessTimeRange.classList.add('hidden');
autoLabel.classList.remove('active');
manualLabel.classList.add('active');
}
}
// 选择地图定位
function selectLocation() {
// 这里应该打开地图选择器实际应调用地图API
alert('此处应打开地图选择器实际开发时需要集成地图API如高德地图、百度地图等');
// 模拟选择了一个位置
const mockLat = 31.230416;
const mockLng = 121.473701;
document.getElementById('locationLat').value = mockLat;
document.getElementById('locationLng').value = mockLng;
document.getElementById('selectedLocationText').textContent = '已选择: ' + mockLat + ', ' + mockLng;
document.getElementById('selectedLocationText').classList.add('selected');
}
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);
});
});
// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', function() {
// 初始化营业时间选项显示状态
toggleBusinessTimeOptions();
});
</script>
</body>
</html>