567 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			HTML
		
	
	
	
			
		
		
	
	
			567 lines
		
	
	
		
			17 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", Roboto, "Helvetica Neue", Arial, sans-serif;
 | ||
|             background-color: #f5f5f5;
 | ||
|             color: #333;
 | ||
|             line-height: 1.6;
 | ||
|         }
 | ||
| 
 | ||
|         .container {
 | ||
|             max-width: 900px;
 | ||
|             margin: 0 auto;
 | ||
|             padding: 20px;
 | ||
|             background-color: #fff;
 | ||
|             min-height: 100vh;
 | ||
|         }
 | ||
| 
 | ||
|         .header {
 | ||
|             display: flex;
 | ||
|             align-items: center;
 | ||
|             padding: 15px 0;
 | ||
|             border-bottom: 1px solid #e5e5e5;
 | ||
|             margin-bottom: 20px;
 | ||
|         }
 | ||
| 
 | ||
|         .back-btn {
 | ||
|             font-size: 24px;
 | ||
|             color: #333;
 | ||
|             text-decoration: none;
 | ||
|             margin-right: 20px;
 | ||
|             cursor: pointer;
 | ||
|         }
 | ||
| 
 | ||
|         .header-title {
 | ||
|             font-size: 20px;
 | ||
|             font-weight: 500;
 | ||
|             flex: 1;
 | ||
|             text-align: center;
 | ||
|             margin-right: 44px; /* 平衡返回按钮的宽度 */
 | ||
|         }
 | ||
| 
 | ||
|         .section {
 | ||
|             margin-bottom: 30px;
 | ||
|         }
 | ||
| 
 | ||
|         .section-header {
 | ||
|             display: flex;
 | ||
|             justify-content: space-between;
 | ||
|             align-items: center;
 | ||
|             margin-bottom: 20px;
 | ||
|         }
 | ||
| 
 | ||
|         .section-title {
 | ||
|             font-size: 16px;
 | ||
|             font-weight: 500;
 | ||
|             color: #333;
 | ||
|         }
 | ||
| 
 | ||
|         .section-help {
 | ||
|             color: #999;
 | ||
|             font-size: 14px;
 | ||
|             display: flex;
 | ||
|             align-items: center;
 | ||
|             cursor: pointer;
 | ||
|         }
 | ||
| 
 | ||
|         .section-help::after {
 | ||
|             content: "?";
 | ||
|             display: inline-block;
 | ||
|             width: 18px;
 | ||
|             height: 18px;
 | ||
|             border: 1px solid #999;
 | ||
|             border-radius: 50%;
 | ||
|             text-align: center;
 | ||
|             line-height: 16px;
 | ||
|             margin-left: 5px;
 | ||
|             font-size: 12px;
 | ||
|         }
 | ||
| 
 | ||
|         .form-item {
 | ||
|             display: flex;
 | ||
|             align-items: center;
 | ||
|             padding: 15px 0;
 | ||
|             border-bottom: 1px solid #f0f0f0;
 | ||
|         }
 | ||
| 
 | ||
|         .form-item:last-child {
 | ||
|             border-bottom: none;
 | ||
|         }
 | ||
| 
 | ||
|         .form-label {
 | ||
|             flex: 0 0 200px;
 | ||
|             font-size: 15px;
 | ||
|             color: #333;
 | ||
|         }
 | ||
| 
 | ||
|         .form-label.required::before {
 | ||
|             content: "*";
 | ||
|             color: #ff4d4f;
 | ||
|             margin-right: 4px;
 | ||
|         }
 | ||
| 
 | ||
|         .form-value {
 | ||
|             flex: 1;
 | ||
|             display: flex;
 | ||
|             align-items: center;
 | ||
|             justify-content: flex-end;
 | ||
|         }
 | ||
| 
 | ||
|         .form-input {
 | ||
|             width: 120px;
 | ||
|             padding: 8px 12px;
 | ||
|             border: 1px solid #d9d9d9;
 | ||
|             border-radius: 4px;
 | ||
|             font-size: 15px;
 | ||
|             text-align: right;
 | ||
|         }
 | ||
| 
 | ||
|         .form-input:focus {
 | ||
|             outline: none;
 | ||
|             border-color: #40a9ff;
 | ||
|         }
 | ||
| 
 | ||
|         .form-unit {
 | ||
|             margin-left: 10px;
 | ||
|             color: #666;
 | ||
|             font-size: 15px;
 | ||
|             min-width: 60px;
 | ||
|         }
 | ||
| 
 | ||
|         .switch {
 | ||
|             position: relative;
 | ||
|             display: inline-block;
 | ||
|             width: 50px;
 | ||
|             height: 28px;
 | ||
|             margin-right: 12px;
 | ||
|         }
 | ||
| 
 | ||
|         .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: .4s;
 | ||
|             border-radius: 28px;
 | ||
|         }
 | ||
| 
 | ||
|         .slider:before {
 | ||
|             position: absolute;
 | ||
|             content: "";
 | ||
|             height: 22px;
 | ||
|             width: 22px;
 | ||
|             left: 3px;
 | ||
|             bottom: 3px;
 | ||
|             background-color: white;
 | ||
|             transition: .4s;
 | ||
|             border-radius: 50%;
 | ||
|         }
 | ||
| 
 | ||
|         input:checked + .slider {
 | ||
|             background-color: #52c41a;
 | ||
|         }
 | ||
| 
 | ||
|         input:checked + .slider:before {
 | ||
|             transform: translateX(22px);
 | ||
|         }
 | ||
| 
 | ||
|         .switch-label {
 | ||
|             color: #999;
 | ||
|             font-size: 15px;
 | ||
|         }
 | ||
| 
 | ||
|         input:checked ~ .switch-label {
 | ||
|             color: #333;
 | ||
|         }
 | ||
| 
 | ||
|         .form-text {
 | ||
|             font-size: 15px;
 | ||
|             color: #333;
 | ||
|         }
 | ||
| 
 | ||
|         .form-select {
 | ||
|             flex: 1;
 | ||
|             display: flex;
 | ||
|             align-items: center;
 | ||
|             justify-content: flex-end;
 | ||
|             color: #333;
 | ||
|             cursor: pointer;
 | ||
|         }
 | ||
| 
 | ||
|         .form-select::after {
 | ||
|             content: "›";
 | ||
|             font-size: 24px;
 | ||
|             margin-left: 8px;
 | ||
|             color: #ccc;
 | ||
|         }
 | ||
| 
 | ||
|         .section-description {
 | ||
|             padding: 15px;
 | ||
|             background-color: #f9f9f9;
 | ||
|             border-radius: 4px;
 | ||
|             font-size: 14px;
 | ||
|             color: #666;
 | ||
|             line-height: 1.8;
 | ||
|             margin-top: 10px;
 | ||
|         }
 | ||
| 
 | ||
|         .footer {
 | ||
|             position: fixed;
 | ||
|             bottom: 0;
 | ||
|             left: 0;
 | ||
|             right: 0;
 | ||
|             background-color: #fff;
 | ||
|             padding: 15px 20px;
 | ||
|             box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
 | ||
|             display: flex;
 | ||
|             justify-content: center;
 | ||
|             gap: 15px;
 | ||
|         }
 | ||
| 
 | ||
|         .btn {
 | ||
|             padding: 12px 40px;
 | ||
|             font-size: 16px;
 | ||
|             border: none;
 | ||
|             border-radius: 25px;
 | ||
|             cursor: pointer;
 | ||
|             min-width: 120px;
 | ||
|             transition: all 0.3s;
 | ||
|         }
 | ||
| 
 | ||
|         .btn-cancel {
 | ||
|             background-color: #fff;
 | ||
|             color: #333;
 | ||
|             border: 1px solid #d9d9d9;
 | ||
|         }
 | ||
| 
 | ||
|         .btn-cancel:hover {
 | ||
|             border-color: #40a9ff;
 | ||
|             color: #40a9ff;
 | ||
|         }
 | ||
| 
 | ||
|         .btn-submit {
 | ||
|             background-color: #006d3e;
 | ||
|             color: #fff;
 | ||
|         }
 | ||
| 
 | ||
|         .btn-submit:hover {
 | ||
|             background-color: #00562f;
 | ||
|         }
 | ||
| 
 | ||
|         .divider {
 | ||
|             height: 10px;
 | ||
|             background-color: #f5f5f5;
 | ||
|             margin: 0 -20px;
 | ||
|         }
 | ||
| 
 | ||
|         .compound-input {
 | ||
|             display: flex;
 | ||
|             align-items: center;
 | ||
|             gap: 10px;
 | ||
|         }
 | ||
| 
 | ||
|         /* PC端优化 */
 | ||
|         @media (min-width: 768px) {
 | ||
|             .container {
 | ||
|                 margin-top: 20px;
 | ||
|                 border-radius: 8px;
 | ||
|                 box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
 | ||
|             }
 | ||
| 
 | ||
|             .footer {
 | ||
|                 position: static;
 | ||
|                 box-shadow: none;
 | ||
|                 border-top: 1px solid #e5e5e5;
 | ||
|                 margin-top: 30px;
 | ||
|                 padding-bottom: 0;
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         /* 移动端优化 */
 | ||
|         @media (max-width: 767px) {
 | ||
|             .container {
 | ||
|                 padding: 15px;
 | ||
|             }
 | ||
| 
 | ||
|             .form-label {
 | ||
|                 flex: 0 0 140px;
 | ||
|             }
 | ||
| 
 | ||
|             .form-input {
 | ||
|                 width: 100px;
 | ||
|             }
 | ||
| 
 | ||
|             body {
 | ||
|                 padding-bottom: 80px;
 | ||
|             }
 | ||
|         }
 | ||
|     </style>
 | ||
| </head>
 | ||
| <body>
 | ||
|     <div class="container">
 | ||
|         <!-- 头部 -->
 | ||
|         <div class="header">
 | ||
|             <a href="javascript:history.back()" class="back-btn">‹</a>
 | ||
|             <h1 class="header-title">同城配送设置</h1>
 | ||
|         </div>
 | ||
| 
 | ||
|         <!-- 同城配送开关 -->
 | ||
|         <div class="section">
 | ||
|             <div class="section-header">
 | ||
|                 <div class="section-title">同城配送开关</div>
 | ||
|                 <div class="section-help">字段说明</div>
 | ||
|             </div>
 | ||
| 
 | ||
|             <div class="form-item">
 | ||
|                 <label class="form-label">是否开启同城配送</label>
 | ||
|                 <div class="form-value">
 | ||
|                     <label class="switch">
 | ||
|                         <input type="checkbox" id="deliveryEnabled" checked>
 | ||
|                         <span class="slider"></span>
 | ||
|                     </label>
 | ||
|                     <span class="switch-label" id="switchLabel">已开启</span>
 | ||
|                 </div>
 | ||
|             </div>
 | ||
|         </div>
 | ||
| 
 | ||
|         <div class="divider"></div>
 | ||
| 
 | ||
|         <!-- 基础配置 -->
 | ||
|         <div class="section">
 | ||
|             <div class="section-header">
 | ||
|                 <div class="section-title">基础配置</div>
 | ||
|                 <div class="section-help">字段说明</div>
 | ||
|             </div>
 | ||
| 
 | ||
|             <div class="form-item">
 | ||
|                 <label class="form-label required">订单包装费</label>
 | ||
|                 <div class="form-value">
 | ||
|                     <input type="number" class="form-input" value="1" min="0" step="0.1">
 | ||
|                     <span class="form-unit">元/单</span>
 | ||
|                 </div>
 | ||
|             </div>
 | ||
| 
 | ||
|             <div class="form-item">
 | ||
|                 <label class="form-label required">订单起送价</label>
 | ||
|                 <div class="form-value">
 | ||
|                     <input type="number" class="form-input" value="1" min="0" step="0.1">
 | ||
|                     <span class="form-unit">元/单</span>
 | ||
|                 </div>
 | ||
|             </div>
 | ||
| 
 | ||
|             <div class="form-item">
 | ||
|                 <label class="form-label required">最大配送距离</label>
 | ||
|                 <div class="form-value">
 | ||
|                     <input type="number" class="form-input" value="5" min="0" step="0.1">
 | ||
|                     <span class="form-unit">公里</span>
 | ||
|                 </div>
 | ||
|             </div>
 | ||
| 
 | ||
|             <div class="form-item">
 | ||
|                 <label class="form-label required">承诺订单送达时间</label>
 | ||
|                 <div class="form-value">
 | ||
|                     <input type="number" class="form-input" value="3" min="0" step="1">
 | ||
|                     <span class="form-unit">小时以内</span>
 | ||
|                 </div>
 | ||
|             </div>
 | ||
|         </div>
 | ||
| 
 | ||
|         <div class="divider"></div>
 | ||
| 
 | ||
|         <!-- 运费收益方 -->
 | ||
|         <div class="section">
 | ||
|             <div class="section-header">
 | ||
|                 <div class="section-title">运费收益方</div>
 | ||
|                 <div class="section-help">字段说明</div>
 | ||
|             </div>
 | ||
| 
 | ||
|             <div class="form-item">
 | ||
|                 <label class="form-label required">运费收益方</label>
 | ||
|                 <div class="form-value">
 | ||
|                     <select id="beneficiary" class="form-input" style="width: 200px; text-align: left;">
 | ||
|                         <option value="market">市场经营者</option>
 | ||
|                         <option value="courier">专员</option>
 | ||
|                     </select>
 | ||
|                 </div>
 | ||
|             </div>
 | ||
|         </div>
 | ||
| 
 | ||
|         <div class="divider"></div>
 | ||
| 
 | ||
|         <!-- 运费计算 -->
 | ||
|         <div class="section">
 | ||
|             <div class="section-header">
 | ||
|                 <div class="section-title">运费计算</div>
 | ||
|                 <div class="section-help">字段说明</div>
 | ||
|             </div>
 | ||
| 
 | ||
|             <div class="form-item">
 | ||
|                 <label class="form-label required">运费模式</label>
 | ||
|                 <div class="form-value">
 | ||
|                     <select id="freightMode" class="form-input" style="width: 200px; text-align: left;">
 | ||
|                         <option value="distance">距离运费</option>
 | ||
|                         <option value="fixed">固定费用</option>
 | ||
|                     </select>
 | ||
|                 </div>
 | ||
|             </div>
 | ||
| 
 | ||
|             <!-- 距离运费配置 -->
 | ||
|             <div id="distanceFreightConfig">
 | ||
|                 <div class="form-item">
 | ||
|                     <label class="form-label required">配送起步价</label>
 | ||
|                     <div class="form-value">
 | ||
|                         <div class="compound-input">
 | ||
|                             <input type="number" class="form-input" id="startDistance" value="3" min="0" step="0.1" style="width: 80px;">
 | ||
|                             <span class="form-unit" style="margin: 0; min-width: auto;">公里内</span>
 | ||
|                             <input type="number" class="form-input" id="startPrice" value="1" min="0" step="0.1" style="width: 80px;">
 | ||
|                             <span class="form-unit" style="margin: 0 0 0 10px;">元</span>
 | ||
|                         </div>
 | ||
|                     </div>
 | ||
|                 </div>
 | ||
| 
 | ||
|                 <div class="form-item">
 | ||
|                     <label class="form-label required">每+0.1公里加收</label>
 | ||
|                     <div class="form-value">
 | ||
|                         <input type="number" class="form-input" id="extraPrice" value="0" min="0" step="0.1">
 | ||
|                         <span class="form-unit">元</span>
 | ||
|                     </div>
 | ||
|                 </div>
 | ||
|             </div>
 | ||
| 
 | ||
|             <!-- 固定费用配置 -->
 | ||
|             <div id="fixedFreightConfig" style="display: none;">
 | ||
|                 <div class="form-item">
 | ||
|                     <label class="form-label required">配送费用</label>
 | ||
|                     <div class="form-value">
 | ||
|                         <input type="number" class="form-input" id="fixedPrice" value="5" min="0" step="0.1">
 | ||
|                         <span class="form-unit">元</span>
 | ||
|                     </div>
 | ||
|                 </div>
 | ||
|             </div>
 | ||
|         </div>
 | ||
| 
 | ||
| 
 | ||
|         <!-- 底部按钮 -->
 | ||
|         <div class="footer">
 | ||
|             <button class="btn btn-cancel" onclick="handleCancel()">取消</button>
 | ||
|             <button class="btn btn-submit" onclick="handleSubmit()">提交</button>
 | ||
|         </div>
 | ||
|     </div>
 | ||
| 
 | ||
|     <script>
 | ||
|         // 同城配送开关
 | ||
|         const deliveryEnabledSwitch = document.getElementById('deliveryEnabled');
 | ||
|         const switchLabel = document.getElementById('switchLabel');
 | ||
| 
 | ||
|         deliveryEnabledSwitch.addEventListener('change', function() {
 | ||
|             if (this.checked) {
 | ||
|                 switchLabel.textContent = '已开启';
 | ||
|                 console.log('同城配送已开启');
 | ||
|             } else {
 | ||
|                 switchLabel.textContent = '已关闭';
 | ||
|                 console.log('同城配送已关闭');
 | ||
|             }
 | ||
|         });
 | ||
| 
 | ||
|         // 运费模式切换
 | ||
|         const freightModeSelect = document.getElementById('freightMode');
 | ||
|         const distanceFreightConfig = document.getElementById('distanceFreightConfig');
 | ||
|         const fixedFreightConfig = document.getElementById('fixedFreightConfig');
 | ||
| 
 | ||
|         freightModeSelect.addEventListener('change', function(e) {
 | ||
|             const mode = e.target.value;
 | ||
|             if (mode === 'distance') {
 | ||
|                 distanceFreightConfig.style.display = 'block';
 | ||
|                 fixedFreightConfig.style.display = 'none';
 | ||
|             } else if (mode === 'fixed') {
 | ||
|                 distanceFreightConfig.style.display = 'none';
 | ||
|                 fixedFreightConfig.style.display = 'block';
 | ||
|             }
 | ||
|             console.log('运费模式切换为:', mode === 'distance' ? '距离运费' : '固定费用');
 | ||
|         });
 | ||
| 
 | ||
|         // 运费收益方切换
 | ||
|         const beneficiarySelect = document.getElementById('beneficiary');
 | ||
|         beneficiarySelect.addEventListener('change', function(e) {
 | ||
|             const beneficiary = e.target.value;
 | ||
|             console.log('运费收益方切换为:', beneficiary === 'market' ? '市场经营者' : '专员');
 | ||
|         });
 | ||
| 
 | ||
|         // 取消按钮
 | ||
|         function handleCancel() {
 | ||
|             if (confirm('确定要取消吗?未保存的更改将丢失。')) {
 | ||
|                 history.back();
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         // 提交按钮
 | ||
|         function handleSubmit() {
 | ||
|             const mode = freightModeSelect.value;
 | ||
|             const beneficiary = document.getElementById('beneficiary').value;
 | ||
|             const deliveryEnabled = deliveryEnabledSwitch.checked;
 | ||
| 
 | ||
|             // 收集表单数据
 | ||
|             const formData = {
 | ||
|                 同城配送开关: {
 | ||
|                     是否开启: deliveryEnabled
 | ||
|                 },
 | ||
|                 基础配置: {
 | ||
|                     订单包装费: parseFloat(document.querySelectorAll('.form-input')[0].value),
 | ||
|                     订单起送价: parseFloat(document.querySelectorAll('.form-input')[1].value),
 | ||
|                     最大配送距离: parseFloat(document.querySelectorAll('.form-input')[2].value),
 | ||
|                     承诺订单送达时间: parseInt(document.querySelectorAll('.form-input')[3].value)
 | ||
|                 },
 | ||
|                 运费收益方: {
 | ||
|                     收益方: beneficiary === 'market' ? '市场经营者' : '专员'
 | ||
|                 },
 | ||
|                 运费计算: {
 | ||
|                     运费模式: mode === 'distance' ? '距离运费' : '固定费用'
 | ||
|                 }
 | ||
|             };
 | ||
| 
 | ||
|             // 根据模式添加不同的配置
 | ||
|             if (mode === 'distance') {
 | ||
|                 formData.运费计算.配送起步距离 = parseFloat(document.getElementById('startDistance').value);
 | ||
|                 formData.运费计算.配送起步价 = parseFloat(document.getElementById('startPrice').value);
 | ||
|                 formData.运费计算.每01公里加收 = parseFloat(document.getElementById('extraPrice').value);
 | ||
|             } else {
 | ||
|                 formData.运费计算.配送费用 = parseFloat(document.getElementById('fixedPrice').value);
 | ||
|             }
 | ||
| 
 | ||
|             console.log('提交的数据:', formData);
 | ||
| 
 | ||
|             // TODO: 这里添加实际的提交逻辑
 | ||
|             alert('配置已保存!');
 | ||
|         }
 | ||
| 
 | ||
|         // 表单验证
 | ||
|         document.querySelectorAll('.form-input').forEach(input => {
 | ||
|             input.addEventListener('input', function(e) {
 | ||
|                 if (this.type === 'number' && this.value < 0) {
 | ||
|                     this.value = 0;
 | ||
|                 }
 | ||
|             });
 | ||
|         });
 | ||
|     </script>
 | ||
| </body>
 | ||
| </html> |