892 lines
27 KiB
HTML
892 lines
27 KiB
HTML
<!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', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
||
background-color: #f5f5f5;
|
||
color: #333;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
.container {
|
||
max-width: 1200px;
|
||
margin: 0 auto;
|
||
background-color: #fff;
|
||
min-height: 100vh;
|
||
}
|
||
|
||
.header {
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 20px;
|
||
background-color: #fff;
|
||
border-bottom: 1px solid #e5e5e5;
|
||
position: sticky;
|
||
top: 0;
|
||
z-index: 100;
|
||
}
|
||
|
||
.header .back-btn {
|
||
font-size: 24px;
|
||
cursor: pointer;
|
||
margin-right: 20px;
|
||
color: #333;
|
||
}
|
||
|
||
.header h1 {
|
||
font-size: 20px;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.content {
|
||
padding: 30px;
|
||
}
|
||
|
||
.section {
|
||
margin-bottom: 40px;
|
||
}
|
||
|
||
.section-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 20px;
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 16px;
|
||
color: #666;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.help-icon {
|
||
color: #999;
|
||
cursor: pointer;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.form-item {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
margin-bottom: 25px;
|
||
padding: 15px 0;
|
||
border-bottom: 1px solid #f0f0f0;
|
||
}
|
||
|
||
.form-item:last-child {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.form-label {
|
||
min-width: 200px;
|
||
font-size: 15px;
|
||
color: #333;
|
||
padding-top: 8px;
|
||
}
|
||
|
||
.form-label.required::before {
|
||
content: '*';
|
||
color: #ff4d4f;
|
||
margin-right: 4px;
|
||
}
|
||
|
||
.form-value {
|
||
flex: 1;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.image-upload-container {
|
||
display: flex;
|
||
gap: 15px;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.image-preview {
|
||
position: relative;
|
||
width: 120px;
|
||
height: 120px;
|
||
border-radius: 8px;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.image-preview img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
}
|
||
|
||
.image-delete {
|
||
position: absolute;
|
||
top: -8px;
|
||
right: -8px;
|
||
width: 24px;
|
||
height: 24px;
|
||
background-color: rgba(0, 0, 0, 0.6);
|
||
color: white;
|
||
border-radius: 50%;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
cursor: pointer;
|
||
font-size: 16px;
|
||
}
|
||
|
||
.image-upload-btn {
|
||
width: 120px;
|
||
height: 120px;
|
||
border: 2px dashed #ddd;
|
||
border-radius: 8px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
cursor: pointer;
|
||
background-color: #fafafa;
|
||
transition: all 0.3s;
|
||
}
|
||
|
||
.image-upload-btn:hover {
|
||
border-color: #1a6f3f;
|
||
background-color: #f0f9f4;
|
||
}
|
||
|
||
.image-upload-btn .camera-icon {
|
||
font-size: 32px;
|
||
color: #ccc;
|
||
margin-bottom: 5px;
|
||
}
|
||
|
||
.image-upload-btn .upload-text {
|
||
font-size: 12px;
|
||
color: #999;
|
||
}
|
||
|
||
.input-text {
|
||
font-size: 15px;
|
||
color: #333;
|
||
}
|
||
|
||
.input-link {
|
||
font-size: 15px;
|
||
color: #333;
|
||
cursor: pointer;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.input-link::after {
|
||
content: '›';
|
||
font-size: 20px;
|
||
margin-left: 8px;
|
||
color: #999;
|
||
}
|
||
|
||
.toggle-switch {
|
||
position: relative;
|
||
width: 52px;
|
||
height: 28px;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.toggle-switch input {
|
||
opacity: 0;
|
||
width: 0;
|
||
height: 0;
|
||
}
|
||
|
||
.toggle-slider {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
background-color: #ddd;
|
||
border-radius: 28px;
|
||
transition: 0.3s;
|
||
}
|
||
|
||
.toggle-slider:before {
|
||
position: absolute;
|
||
content: "";
|
||
height: 24px;
|
||
width: 24px;
|
||
left: 2px;
|
||
bottom: 2px;
|
||
background-color: white;
|
||
border-radius: 50%;
|
||
transition: 0.3s;
|
||
}
|
||
|
||
.toggle-switch input:checked + .toggle-slider {
|
||
background-color: #1a6f3f;
|
||
}
|
||
|
||
.toggle-switch input:checked + .toggle-slider:before {
|
||
transform: translateX(24px);
|
||
}
|
||
|
||
.toggle-labels {
|
||
display: flex;
|
||
gap: 15px;
|
||
margin-left: 15px;
|
||
font-size: 15px;
|
||
}
|
||
|
||
.toggle-labels span {
|
||
color: #999;
|
||
}
|
||
|
||
.toggle-labels span.active {
|
||
color: #333;
|
||
}
|
||
|
||
.number-input {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
}
|
||
|
||
.number-input input {
|
||
width: 80px;
|
||
height: 36px;
|
||
border: 1px solid #ddd;
|
||
border-radius: 4px;
|
||
padding: 0 12px;
|
||
font-size: 15px;
|
||
text-align: center;
|
||
}
|
||
|
||
.number-input .unit {
|
||
color: #666;
|
||
font-size: 15px;
|
||
}
|
||
|
||
.footer {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
background-color: #fff;
|
||
border-top: 1px solid #e5e5e5;
|
||
padding: 20px;
|
||
display: flex;
|
||
justify-content: center;
|
||
gap: 20px;
|
||
}
|
||
|
||
.btn {
|
||
padding: 12px 50px;
|
||
font-size: 16px;
|
||
border-radius: 25px;
|
||
border: none;
|
||
cursor: pointer;
|
||
transition: all 0.3s;
|
||
}
|
||
|
||
.btn-cancel {
|
||
background-color: #fff;
|
||
color: #333;
|
||
border: 1px solid #ddd;
|
||
}
|
||
|
||
.btn-cancel:hover {
|
||
background-color: #f5f5f5;
|
||
}
|
||
|
||
.btn-submit {
|
||
background-color: #1a6f3f;
|
||
color: white;
|
||
padding: 12px 80px;
|
||
}
|
||
|
||
.btn-submit:hover {
|
||
background-color: #155c34;
|
||
}
|
||
|
||
/* 地图弹窗样式 */
|
||
.modal-overlay {
|
||
display: none;
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
background-color: rgba(0, 0, 0, 0.5);
|
||
z-index: 1000;
|
||
animation: fadeIn 0.3s ease;
|
||
}
|
||
|
||
.modal-overlay.active {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
@keyframes fadeIn {
|
||
from {
|
||
opacity: 0;
|
||
}
|
||
to {
|
||
opacity: 1;
|
||
}
|
||
}
|
||
|
||
@keyframes slideUp {
|
||
from {
|
||
transform: translateY(50px);
|
||
opacity: 0;
|
||
}
|
||
to {
|
||
transform: translateY(0);
|
||
opacity: 1;
|
||
}
|
||
}
|
||
|
||
.modal-content {
|
||
background-color: #fff;
|
||
border-radius: 12px;
|
||
width: 90%;
|
||
max-width: 800px;
|
||
max-height: 80vh;
|
||
display: flex;
|
||
flex-direction: column;
|
||
animation: slideUp 0.3s ease;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.modal-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding: 20px 24px;
|
||
border-bottom: 1px solid #e5e5e5;
|
||
}
|
||
|
||
.modal-header h3 {
|
||
font-size: 18px;
|
||
font-weight: 500;
|
||
color: #333;
|
||
}
|
||
|
||
.modal-close {
|
||
font-size: 28px;
|
||
color: #999;
|
||
cursor: pointer;
|
||
line-height: 1;
|
||
transition: color 0.3s;
|
||
}
|
||
|
||
.modal-close:hover {
|
||
color: #333;
|
||
}
|
||
|
||
.modal-body {
|
||
padding: 24px;
|
||
flex: 1;
|
||
overflow-y: auto;
|
||
}
|
||
|
||
.map-container {
|
||
width: 100%;
|
||
height: 500px;
|
||
background-color: #f0f0f0;
|
||
border-radius: 8px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.map-placeholder {
|
||
text-align: center;
|
||
color: #999;
|
||
}
|
||
|
||
.map-placeholder .map-icon {
|
||
font-size: 64px;
|
||
margin-bottom: 16px;
|
||
opacity: 0.5;
|
||
}
|
||
|
||
.map-placeholder .map-text {
|
||
font-size: 16px;
|
||
margin-bottom: 8px;
|
||
}
|
||
|
||
.map-placeholder .map-address {
|
||
font-size: 14px;
|
||
color: #666;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.map-marker {
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 50%;
|
||
transform: translate(-50%, -50%);
|
||
font-size: 48px;
|
||
color: #ff4d4f;
|
||
animation: bounce 1s infinite;
|
||
}
|
||
|
||
@keyframes bounce {
|
||
0%, 100% {
|
||
transform: translate(-50%, -50%);
|
||
}
|
||
50% {
|
||
transform: translate(-50%, -60%);
|
||
}
|
||
}
|
||
|
||
.location-info {
|
||
margin-top: 20px;
|
||
padding: 16px;
|
||
background-color: #f9f9f9;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.location-info-item {
|
||
display: flex;
|
||
margin-bottom: 12px;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.location-info-item:last-child {
|
||
margin-bottom: 0;
|
||
}
|
||
|
||
.location-info-label {
|
||
color: #999;
|
||
min-width: 80px;
|
||
}
|
||
|
||
.location-info-value {
|
||
color: #333;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.modal-footer {
|
||
padding: 16px 24px;
|
||
border-top: 1px solid #e5e5e5;
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
gap: 12px;
|
||
}
|
||
|
||
.modal-btn {
|
||
padding: 10px 24px;
|
||
border-radius: 6px;
|
||
font-size: 14px;
|
||
cursor: pointer;
|
||
border: none;
|
||
transition: all 0.3s;
|
||
}
|
||
|
||
.modal-btn-cancel {
|
||
background-color: #f5f5f5;
|
||
color: #333;
|
||
}
|
||
|
||
.modal-btn-cancel:hover {
|
||
background-color: #e5e5e5;
|
||
}
|
||
|
||
.modal-btn-confirm {
|
||
background-color: #1a6f3f;
|
||
color: white;
|
||
}
|
||
|
||
.modal-btn-confirm:hover {
|
||
background-color: #155c34;
|
||
}
|
||
|
||
@media (max-width: 768px) {
|
||
.container {
|
||
max-width: 100%;
|
||
}
|
||
|
||
.content {
|
||
padding: 20px;
|
||
}
|
||
|
||
.form-item {
|
||
flex-direction: column;
|
||
}
|
||
|
||
.form-label {
|
||
min-width: auto;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.form-value {
|
||
width: 100%;
|
||
justify-content: flex-start;
|
||
}
|
||
|
||
.modal-content {
|
||
width: 95%;
|
||
max-height: 90vh;
|
||
}
|
||
|
||
.map-container {
|
||
height: 400px;
|
||
}
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<div class="header">
|
||
<span class="back-btn" onclick="history.back()">‹</span>
|
||
<h1>市场基础管理</h1>
|
||
</div>
|
||
|
||
<div class="content">
|
||
<!-- 基础配置 -->
|
||
<div class="section">
|
||
<div class="section-header">
|
||
<h2 class="section-title">基础配置</h2>
|
||
<span class="help-icon">字段说明 ⓘ</span>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label required">菜市场背景图</div>
|
||
<div class="form-value">
|
||
<div class="image-upload-container">
|
||
<div class="image-preview">
|
||
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Crect fill='%23f0f0f0' width='120' height='120'/%3E%3Ctext x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' fill='%23999' font-size='14'%3E背景图%3C/text%3E%3C/svg%3E" alt="菜市场背景图">
|
||
<div class="image-delete">×</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label required">菜市场营业执照(顾客可见)</div>
|
||
<div class="form-value">
|
||
<div class="image-upload-container">
|
||
<div class="image-preview">
|
||
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Crect fill='%23f0f0f0' width='120' height='120'/%3E%3Ctext x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' fill='%23999' font-size='14'%3E营业执照%3C/text%3E%3C/svg%3E" alt="营业执照">
|
||
<div class="image-delete">×</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label required">菜市场实拍图(顾客可见)</div>
|
||
<div class="form-value">
|
||
<div class="image-upload-container">
|
||
<div class="image-preview">
|
||
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Crect fill='%23f0f0f0' width='120' height='120'/%3E%3Ctext x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' fill='%23999' font-size='14'%3E实拍图%3C/text%3E%3C/svg%3E" alt="实拍图">
|
||
<div class="image-delete">×</div>
|
||
</div>
|
||
<div class="image-upload-btn">
|
||
<div class="camera-icon">📷</div>
|
||
<div class="upload-text">(1/5)</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label">市场联系电话(顾客可见)</div>
|
||
<div class="form-value">
|
||
<span class="input-text">13818776990</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label required">市场位置</div>
|
||
<div class="form-value">
|
||
<span class="input-link" onclick="openMapModal('market')">农家小炒(春申路店)</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label required">市场详细地址</div>
|
||
<div class="form-value">
|
||
<span class="input-text">闵行区春申路1501号</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label">是否自动营业</div>
|
||
<div class="form-value">
|
||
<label class="toggle-switch">
|
||
<input type="checkbox" id="autoOpen">
|
||
<span class="toggle-slider"></span>
|
||
</label>
|
||
<div class="toggle-labels">
|
||
<span id="closeLabel">关闭</span>
|
||
<span id="openLabel" class="active">开启</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 自提点配置 -->
|
||
<div class="section">
|
||
<div class="section-header">
|
||
<h2 class="section-title">自提点配置</h2>
|
||
<span class="help-icon">字段说明 ⓘ</span>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label required">顾客自提点位置</div>
|
||
<div class="form-value">
|
||
<span class="input-link" onclick="openMapModal('pickup')">农家小炒(春申路店)</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label required">自提点详细地址</div>
|
||
<div class="form-value">
|
||
<span class="input-text">春申菜市场一楼北门旁边</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label">自提点位置示意图</div>
|
||
<div class="form-value">
|
||
<div class="image-upload-container">
|
||
<div class="image-preview">
|
||
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Crect fill='%23f0f0f0' width='120' height='120'/%3E%3Ctext x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' fill='%23999' font-size='14'%3E示意图%3C/text%3E%3C/svg%3E" alt="示意图">
|
||
<div class="image-delete">×</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label required">承诺送达自提点时间</div>
|
||
<div class="form-value">
|
||
<div class="number-input">
|
||
<input type="number" value="1" min="1">
|
||
<span class="unit">小时以内</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 摊主入驻配置 -->
|
||
<div class="section">
|
||
<div class="section-header">
|
||
<h2 class="section-title">摊主入驻配置</h2>
|
||
<span class="help-icon">字段说明 ⓘ</span>
|
||
</div>
|
||
|
||
<div class="form-item">
|
||
<div class="form-label required">若有摊主想入驻菜市场是否允许摊主联系您</div>
|
||
<div class="form-value">
|
||
<label class="toggle-switch">
|
||
<input type="checkbox" id="allowContact" checked>
|
||
<span class="toggle-slider"></span>
|
||
</label>
|
||
<div class="toggle-labels">
|
||
<span id="forbidLabel">禁止</span>
|
||
<span id="allowLabel" class="active">允许</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div style="height: 80px;"></div>
|
||
</div>
|
||
|
||
<div class="footer">
|
||
<button class="btn btn-cancel" onclick="history.back()">取消</button>
|
||
<button class="btn btn-submit" onclick="handleSubmit()">提交</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 地图弹窗 -->
|
||
<div id="mapModal" class="modal-overlay" onclick="closeMapModal(event)">
|
||
<div class="modal-content" onclick="event.stopPropagation()">
|
||
<div class="modal-header">
|
||
<h3 id="modalTitle">选择位置</h3>
|
||
<span class="modal-close" onclick="closeMapModal()">×</span>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="map-container">
|
||
<div class="map-placeholder">
|
||
<div class="map-icon">📍</div>
|
||
<div class="map-text">地图占位符</div>
|
||
<div class="map-address" id="mapAddress">农家小炒(春申路店)</div>
|
||
</div>
|
||
<div class="map-marker">📍</div>
|
||
</div>
|
||
<div class="location-info">
|
||
<div class="location-info-item">
|
||
<span class="location-info-label">位置名称:</span>
|
||
<span class="location-info-value" id="locationName">农家小炒(春申路店)</span>
|
||
</div>
|
||
<div class="location-info-item">
|
||
<span class="location-info-label">详细地址:</span>
|
||
<span class="location-info-value" id="locationAddress">闵行区春申路1501号</span>
|
||
</div>
|
||
<div class="location-info-item">
|
||
<span class="location-info-label">经纬度:</span>
|
||
<span class="location-info-value">121.3826, 31.1226</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="modal-btn modal-btn-cancel" onclick="closeMapModal()">取消</button>
|
||
<button class="modal-btn modal-btn-confirm" onclick="confirmLocation()">确定</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
// 当前选择的位置类型
|
||
let currentLocationType = null;
|
||
|
||
// 打开地图弹窗
|
||
function openMapModal(type) {
|
||
currentLocationType = type;
|
||
const modal = document.getElementById('mapModal');
|
||
const modalTitle = document.getElementById('modalTitle');
|
||
const mapAddress = document.getElementById('mapAddress');
|
||
const locationName = document.getElementById('locationName');
|
||
const locationAddress = document.getElementById('locationAddress');
|
||
|
||
if (type === 'market') {
|
||
modalTitle.textContent = '选择市场位置';
|
||
mapAddress.textContent = '农家小炒(春申路店)';
|
||
locationName.textContent = '农家小炒(春申路店)';
|
||
locationAddress.textContent = '闵行区春申路1501号';
|
||
} else if (type === 'pickup') {
|
||
modalTitle.textContent = '选择自提点位置';
|
||
mapAddress.textContent = '农家小炒(春申路店)';
|
||
locationName.textContent = '农家小炒(春申路店)';
|
||
locationAddress.textContent = '春申菜市场一楼北门旁边';
|
||
}
|
||
|
||
modal.classList.add('active');
|
||
document.body.style.overflow = 'hidden';
|
||
}
|
||
|
||
// 关闭地图弹窗
|
||
function closeMapModal(event) {
|
||
if (event && event.target !== event.currentTarget) {
|
||
return;
|
||
}
|
||
const modal = document.getElementById('mapModal');
|
||
modal.classList.remove('active');
|
||
document.body.style.overflow = '';
|
||
currentLocationType = null;
|
||
}
|
||
|
||
// 确认选择位置
|
||
function confirmLocation() {
|
||
const locationName = document.getElementById('locationName').textContent;
|
||
console.log('选择的位置:', locationName, '类型:', currentLocationType);
|
||
alert('位置已选择: ' + locationName);
|
||
closeMapModal();
|
||
}
|
||
|
||
// 自动营业开关
|
||
const autoOpenSwitch = document.getElementById('autoOpen');
|
||
const closeLabel = document.getElementById('closeLabel');
|
||
const openLabel = document.getElementById('openLabel');
|
||
|
||
autoOpenSwitch.addEventListener('change', function() {
|
||
if (this.checked) {
|
||
closeLabel.classList.remove('active');
|
||
openLabel.classList.add('active');
|
||
} else {
|
||
closeLabel.classList.add('active');
|
||
openLabel.classList.remove('active');
|
||
}
|
||
});
|
||
|
||
// 摊主入驻开关
|
||
const allowContactSwitch = document.getElementById('allowContact');
|
||
const forbidLabel = document.getElementById('forbidLabel');
|
||
const allowLabel = document.getElementById('allowLabel');
|
||
|
||
allowContactSwitch.addEventListener('change', function() {
|
||
if (this.checked) {
|
||
forbidLabel.classList.remove('active');
|
||
allowLabel.classList.add('active');
|
||
} else {
|
||
forbidLabel.classList.add('active');
|
||
allowLabel.classList.remove('active');
|
||
}
|
||
});
|
||
|
||
// 图片上传处理
|
||
document.querySelectorAll('.image-upload-btn').forEach(btn => {
|
||
btn.addEventListener('click', function() {
|
||
const input = document.createElement('input');
|
||
input.type = 'file';
|
||
input.accept = 'image/*';
|
||
input.onchange = function(e) {
|
||
const file = e.target.files[0];
|
||
if (file) {
|
||
const reader = new FileReader();
|
||
reader.onload = function(e) {
|
||
console.log('图片已选择:', file.name);
|
||
// 这里可以添加图片预览逻辑
|
||
};
|
||
reader.readAsDataURL(file);
|
||
}
|
||
};
|
||
input.click();
|
||
});
|
||
});
|
||
|
||
// 删除图片
|
||
document.querySelectorAll('.image-delete').forEach(btn => {
|
||
btn.addEventListener('click', function(e) {
|
||
e.stopPropagation();
|
||
if (confirm('确定要删除这张图片吗?')) {
|
||
this.parentElement.remove();
|
||
}
|
||
});
|
||
});
|
||
|
||
// 提交表单
|
||
function handleSubmit() {
|
||
// 收集表单数据
|
||
const formData = {
|
||
autoOpen: autoOpenSwitch.checked,
|
||
allowContact: allowContactSwitch.checked,
|
||
deliveryTime: document.querySelector('.number-input input').value
|
||
};
|
||
|
||
console.log('提交表单数据:', formData);
|
||
alert('表单提交成功!');
|
||
}
|
||
|
||
// 初始化开关状态
|
||
window.addEventListener('DOMContentLoaded', function() {
|
||
// 自动营业默认关闭
|
||
autoOpenSwitch.checked = false;
|
||
closeLabel.classList.add('active');
|
||
openLabel.classList.remove('active');
|
||
|
||
// 摊主入驻默认允许
|
||
allowContactSwitch.checked = true;
|
||
forbidLabel.classList.remove('active');
|
||
allowLabel.classList.add('active');
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|