综述: 为商家端APP新增市场配置管理功能模块
- 更新大妈集市.rp原型文件,增加移动端相关功能设计 - 新增商家端APP/工作台/市场配置/目录,包含三个核心页面: - 移动端配送设置.html:提供配送范围、费用、时间等配置功能 - 移动端摊位创建.html:支持摊位信息录入、图片上传、资质设置等 - 移动端摊位列表.html:展示摊位管理、状态监控、批量操作等功能
This commit is contained in:
parent
a1c8146766
commit
4fcb212c07
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,870 @@
|
||||||
|
<!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: #f5f7fa;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 头部 */
|
||||||
|
.header {
|
||||||
|
background: linear-gradient(135deg, #409eff, #66b1ff);
|
||||||
|
color: white;
|
||||||
|
padding: 15px;
|
||||||
|
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.2);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-btn {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
font-size: 20px;
|
||||||
|
padding: 0 10px 0 0;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 500;
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
padding-right: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表单区域 */
|
||||||
|
.form-container {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-section {
|
||||||
|
background: white;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #303133;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-label {
|
||||||
|
display: block;
|
||||||
|
color: #606266;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-label.required::before {
|
||||||
|
content: "*";
|
||||||
|
color: #f56c6c;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input,
|
||||||
|
.form-select,
|
||||||
|
.form-textarea {
|
||||||
|
width: 100%;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
outline: none;
|
||||||
|
background: #f5f7fa;
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input:focus,
|
||||||
|
.form-select:focus,
|
||||||
|
.form-textarea:focus {
|
||||||
|
border-color: #409eff;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input::placeholder,
|
||||||
|
.form-textarea::placeholder {
|
||||||
|
color: #c0c4cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-textarea {
|
||||||
|
resize: vertical;
|
||||||
|
min-height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-hint {
|
||||||
|
color: #909399;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-top: 5px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 图片上传 */
|
||||||
|
.upload-container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-box {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
border: 1px dashed #dcdfe6;
|
||||||
|
border-radius: 8px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #fafafa;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-box:active {
|
||||||
|
transform: scale(0.95);
|
||||||
|
border-color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-icon {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-icon-plus {
|
||||||
|
font-size: 32px;
|
||||||
|
color: #909399;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-icon-text {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 开关 */
|
||||||
|
.switch-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 12px;
|
||||||
|
background: #f5f7fa;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-label-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-text {
|
||||||
|
color: #606266;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
width: 50px;
|
||||||
|
height: 28px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch input {
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-slider {
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #dcdfe6;
|
||||||
|
transition: 0.3s;
|
||||||
|
border-radius: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-slider:before {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
height: 22px;
|
||||||
|
width: 22px;
|
||||||
|
left: 3px;
|
||||||
|
bottom: 3px;
|
||||||
|
background-color: white;
|
||||||
|
transition: 0.3s;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch input:checked + .switch-slider {
|
||||||
|
background-color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch input:checked + .switch-slider:before {
|
||||||
|
transform: translateX(22px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 复选框组 */
|
||||||
|
.checkbox-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10px;
|
||||||
|
background: #f5f7fa;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-option input[type="checkbox"] {
|
||||||
|
margin: 0 10px 0 0;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-option label {
|
||||||
|
color: #606266;
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 权限配置 */
|
||||||
|
.permission-section {
|
||||||
|
background: #f9fafc;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permission-all {
|
||||||
|
padding: 12px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permission-sub-items {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permission-sub-items .checkbox-option {
|
||||||
|
padding-left: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 时间选择 */
|
||||||
|
.time-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-input {
|
||||||
|
flex: 1;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
background: #f5f7fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.time-separator {
|
||||||
|
color: #909399;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 单选框组 */
|
||||||
|
.radio-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 15px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-option input[type="radio"] {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-option label {
|
||||||
|
color: #606266;
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 底部按钮 */
|
||||||
|
.footer-btn {
|
||||||
|
padding: 0 15px 20px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
width: 100%;
|
||||||
|
padding: 14px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: linear-gradient(135deg, #67c23a, #85ce61);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:active {
|
||||||
|
transform: scale(0.98);
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 隐藏元素 */
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 业务时间标签 */
|
||||||
|
.business-time-tags {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.business-tag {
|
||||||
|
padding: 6px 12px;
|
||||||
|
background: #ecf5ff;
|
||||||
|
color: #409eff;
|
||||||
|
border-radius: 15px;
|
||||||
|
font-size: 13px;
|
||||||
|
border: 1px solid #d9ecff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.business-tag.active {
|
||||||
|
background: #409eff;
|
||||||
|
color: white;
|
||||||
|
border-color: #409eff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- 头部 -->
|
||||||
|
<div class="header">
|
||||||
|
<button class="back-btn" onclick="goBack()">←</button>
|
||||||
|
<h1 class="page-title" id="pageTitle">创建摊位</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form id="createBoothForm" class="form-container">
|
||||||
|
<!-- 绑定收益人账号 -->
|
||||||
|
<div class="form-section" id="beneficiarySection">
|
||||||
|
<div class="section-title">绑定收益人账号</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label required">操作类型</label>
|
||||||
|
<select class="form-select" id="operationType" onchange="handleOperationTypeChange()">
|
||||||
|
<option value="">请选择操作类型</option>
|
||||||
|
<option value="bind_market_manager">绑定收益人是市场经营者</option>
|
||||||
|
<option value="create_supplier">创建新收益人(供货商)</option>
|
||||||
|
<option value="bind_existing_supplier">绑定已存在的供货商账号</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group hidden" id="supplierAccountGroup">
|
||||||
|
<label class="form-label required">供货商手机号</label>
|
||||||
|
<input type="tel" class="form-input" id="supplierAccount" placeholder="请输入供货商手机号" maxlength="11">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group hidden" id="supplierNameGroup">
|
||||||
|
<label class="form-label required">供货商账号名称</label>
|
||||||
|
<input type="text" class="form-input" id="supplierName" placeholder="请输入供货商账号名称">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group hidden" id="supplierPasswordGroup">
|
||||||
|
<label class="form-label required">密码</label>
|
||||||
|
<input type="password" class="form-input" id="password" placeholder="请输入密码">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 权限配置 -->
|
||||||
|
<div class="form-section hidden" id="permissionSection">
|
||||||
|
<div class="section-title">权限配置</div>
|
||||||
|
|
||||||
|
<div class="permission-section">
|
||||||
|
<div class="permission-all">
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" id="permissionAll" onchange="toggleAllPermissions()">
|
||||||
|
<label for="permissionAll"><strong>账号权限管理</strong></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="permission-sub-items">
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm1">
|
||||||
|
<label for="perm1">订单权限管理</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm2">
|
||||||
|
<label for="perm2">订单管理</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm3">
|
||||||
|
<label for="perm3">商品管理</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm4">
|
||||||
|
<label for="perm4">数据分析</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm5">
|
||||||
|
<label for="perm5">内容管理</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm6">
|
||||||
|
<label for="perm6">运营管理</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm7">
|
||||||
|
<label for="perm7">银行卡管理</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm8">
|
||||||
|
<label for="perm8">优惠券统计工具管理</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm9">
|
||||||
|
<label for="perm9">营销工具管理</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm10">
|
||||||
|
<label for="perm10">等级规则</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm11">
|
||||||
|
<label for="perm11">会员营销工具管理</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm12">
|
||||||
|
<label for="perm12">钱包管理</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" class="sub-permission" id="perm13">
|
||||||
|
<label for="perm13">运营管理</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 店铺基础信息 -->
|
||||||
|
<div class="form-section">
|
||||||
|
<div class="section-title">店铺基础信息</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label required">摊位名称</label>
|
||||||
|
<input type="text" class="form-input" id="boothName" placeholder="请输入摊位名称">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label required">主营类目</label>
|
||||||
|
<select class="form-select" id="mainCategory">
|
||||||
|
<option value="">请选择主营类目</option>
|
||||||
|
<option value="seafood">海鲜水产</option>
|
||||||
|
<option value="meat">肉禽蛋</option>
|
||||||
|
<option value="vegetable">蔬菜</option>
|
||||||
|
<option value="fruit">水果</option>
|
||||||
|
<option value="grain">粮油调味</option>
|
||||||
|
<option value="other">其他</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label required">摊位背景图</label>
|
||||||
|
<div class="upload-container">
|
||||||
|
<div class="upload-box" onclick="uploadImage('background')">
|
||||||
|
<div class="upload-icon">
|
||||||
|
<div class="upload-icon-plus">+</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">摊位联系电话</label>
|
||||||
|
<input type="tel" class="form-input" id="boothPhone" placeholder="请输入联系电话/手机号">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">摊位照片</label>
|
||||||
|
<div class="upload-container">
|
||||||
|
<div class="upload-box" onclick="uploadImage('photo')">
|
||||||
|
<div class="upload-icon">
|
||||||
|
<div class="upload-icon-plus">+</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label required">摊位位置</label>
|
||||||
|
<input type="text" class="form-input" id="boothLocation" placeholder="请输入摊位位置">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label required">摊位详细地址</label>
|
||||||
|
<input type="text" class="form-input" id="boothDetailAddress" placeholder="请输入摊位详细地址">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">许可证</label>
|
||||||
|
<div class="upload-container">
|
||||||
|
<div class="upload-box" onclick="uploadImage('license1')">
|
||||||
|
<div class="upload-icon">
|
||||||
|
<div class="upload-icon-plus">+</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="upload-box" onclick="uploadImage('license2')">
|
||||||
|
<div class="upload-icon">
|
||||||
|
<div class="upload-icon-plus">+</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 店铺配置 -->
|
||||||
|
<div class="form-section">
|
||||||
|
<div class="section-title">店铺配置</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">是否自动开放</label>
|
||||||
|
<div class="switch-container">
|
||||||
|
<span class="switch-text">自动营业</span>
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" id="autoOpen" checked>
|
||||||
|
<span class="switch-slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="business-time-tags">
|
||||||
|
<span class="business-tag">00:00:00 至 23:59:00</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label required">服务自提点位置</label>
|
||||||
|
<input type="text" class="form-input" id="pickupLocation" placeholder="请输入服务自提点位置">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label required">自提点详细地址</label>
|
||||||
|
<input type="text" class="form-input" id="pickupDetailAddress" placeholder="请输入自提点详细地址">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">自提点示意图</label>
|
||||||
|
<div class="upload-container">
|
||||||
|
<div class="upload-box" onclick="uploadImage('pickup')">
|
||||||
|
<div class="upload-icon">
|
||||||
|
<div class="upload-icon-plus">+</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">承接送达承诺</label>
|
||||||
|
<div class="switch-container">
|
||||||
|
<span class="switch-text">是否自动承诺</span>
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" id="deliveryPromise" checked>
|
||||||
|
<span class="switch-slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">营业时间</label>
|
||||||
|
<div class="checkbox-group">
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" id="everyday" checked>
|
||||||
|
<label for="everyday">每天</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" id="workday">
|
||||||
|
<label for="workday">工作日</label>
|
||||||
|
</div>
|
||||||
|
<div class="checkbox-option">
|
||||||
|
<input type="checkbox" id="custom">
|
||||||
|
<label for="custom">自定义</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="time-group">
|
||||||
|
<input type="time" class="time-input" id="deliveryStartTime" value="00:00">
|
||||||
|
<span class="time-separator">至</span>
|
||||||
|
<input type="time" class="time-input" id="deliveryEndTime" value="23:59">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label">承诺送达时间</label>
|
||||||
|
<input type="number" class="form-input" id="deliveryTime" placeholder="请输入小时数">
|
||||||
|
<div class="form-hint">小时以内</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- 底部按钮 -->
|
||||||
|
<div class="footer-btn">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="submitForm()">保存</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// 返回上一页
|
||||||
|
function goBack() {
|
||||||
|
window.history.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面加载时检测URL参数
|
||||||
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const mode = urlParams.get('mode');
|
||||||
|
|
||||||
|
if (mode === 'edit') {
|
||||||
|
// 编辑模式:隐藏收益人账号部分,修改页面标题
|
||||||
|
document.getElementById('pageTitle').textContent = '编辑摊位';
|
||||||
|
document.getElementById('beneficiarySection').classList.add('hidden');
|
||||||
|
|
||||||
|
// 这里可以根据id参数加载摊位数据
|
||||||
|
const boothId = urlParams.get('id');
|
||||||
|
console.log('编辑摊位ID:', boothId);
|
||||||
|
// TODO: 调用后端API获取摊位详情并填充表单
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 处理操作类型变化
|
||||||
|
function handleOperationTypeChange() {
|
||||||
|
const operationType = document.getElementById('operationType').value;
|
||||||
|
const supplierAccountGroup = document.getElementById('supplierAccountGroup');
|
||||||
|
const supplierNameGroup = document.getElementById('supplierNameGroup');
|
||||||
|
const supplierPasswordGroup = document.getElementById('supplierPasswordGroup');
|
||||||
|
const permissionSection = document.getElementById('permissionSection');
|
||||||
|
|
||||||
|
if (operationType === 'create_supplier') {
|
||||||
|
// 创建新收益人 - 显示手机号、账号名称和密码
|
||||||
|
supplierAccountGroup.classList.remove('hidden');
|
||||||
|
supplierNameGroup.classList.remove('hidden');
|
||||||
|
supplierPasswordGroup.classList.remove('hidden');
|
||||||
|
permissionSection.classList.remove('hidden');
|
||||||
|
} else if (operationType === 'bind_existing_supplier') {
|
||||||
|
// 绑定已存在的供货商 - 只显示手机号
|
||||||
|
supplierAccountGroup.classList.remove('hidden');
|
||||||
|
supplierNameGroup.classList.add('hidden');
|
||||||
|
supplierPasswordGroup.classList.add('hidden');
|
||||||
|
permissionSection.classList.remove('hidden');
|
||||||
|
} else {
|
||||||
|
// 绑定市场经营者 - 隐藏所有
|
||||||
|
supplierAccountGroup.classList.add('hidden');
|
||||||
|
supplierNameGroup.classList.add('hidden');
|
||||||
|
supplierPasswordGroup.classList.add('hidden');
|
||||||
|
permissionSection.classList.add('hidden');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换所有权限
|
||||||
|
function toggleAllPermissions() {
|
||||||
|
const allCheckbox = document.getElementById('permissionAll');
|
||||||
|
const subCheckboxes = document.querySelectorAll('.sub-permission');
|
||||||
|
|
||||||
|
subCheckboxes.forEach(checkbox => {
|
||||||
|
checkbox.checked = allCheckbox.checked;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听子权限变化
|
||||||
|
document.querySelectorAll('.sub-permission').forEach(checkbox => {
|
||||||
|
checkbox.addEventListener('change', function() {
|
||||||
|
const allCheckbox = document.getElementById('permissionAll');
|
||||||
|
const subCheckboxes = document.querySelectorAll('.sub-permission');
|
||||||
|
const checkedCount = Array.from(subCheckboxes).filter(cb => cb.checked).length;
|
||||||
|
|
||||||
|
allCheckbox.checked = checkedCount === subCheckboxes.length;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 图片上传
|
||||||
|
function uploadImage(type) {
|
||||||
|
console.log('上传图片类型:', type);
|
||||||
|
alert('图片上传功能待实现');
|
||||||
|
// TODO: 实现图片上传功能
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
function submitForm() {
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const mode = urlParams.get('mode');
|
||||||
|
const isEditMode = mode === 'edit';
|
||||||
|
|
||||||
|
// 获取表单数据
|
||||||
|
const formData = {
|
||||||
|
boothName: document.getElementById('boothName').value,
|
||||||
|
mainCategory: document.getElementById('mainCategory').value,
|
||||||
|
boothPhone: document.getElementById('boothPhone').value,
|
||||||
|
boothLocation: document.getElementById('boothLocation').value,
|
||||||
|
boothDetailAddress: document.getElementById('boothDetailAddress').value,
|
||||||
|
autoOpen: document.getElementById('autoOpen').checked,
|
||||||
|
pickupLocation: document.getElementById('pickupLocation').value,
|
||||||
|
pickupDetailAddress: document.getElementById('pickupDetailAddress').value,
|
||||||
|
deliveryPromise: document.getElementById('deliveryPromise').checked,
|
||||||
|
deliveryTime: document.getElementById('deliveryTime').value
|
||||||
|
};
|
||||||
|
|
||||||
|
// 如果不是编辑模式,需要验证收益人账号
|
||||||
|
if (!isEditMode) {
|
||||||
|
const operationType = document.getElementById('operationType').value;
|
||||||
|
formData.operationType = operationType;
|
||||||
|
|
||||||
|
if (!operationType) {
|
||||||
|
alert('请选择操作类型');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operationType === 'create_supplier') {
|
||||||
|
const supplierAccount = document.getElementById('supplierAccount').value;
|
||||||
|
const supplierName = document.getElementById('supplierName').value;
|
||||||
|
const password = document.getElementById('password').value;
|
||||||
|
|
||||||
|
if (!supplierAccount) {
|
||||||
|
alert('请输入供货商手机号');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!/^1[3-9]\d{9}$/.test(supplierAccount)) {
|
||||||
|
alert('请输入正确的手机号');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!supplierName) {
|
||||||
|
alert('请输入供货商账号名称');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!password) {
|
||||||
|
alert('请输入密码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
formData.supplierAccount = supplierAccount;
|
||||||
|
formData.supplierName = supplierName;
|
||||||
|
formData.password = password;
|
||||||
|
} else if (operationType === 'bind_existing_supplier') {
|
||||||
|
const supplierAccount = document.getElementById('supplierAccount').value;
|
||||||
|
|
||||||
|
if (!supplierAccount) {
|
||||||
|
alert('请输入供货商手机号');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!/^1[3-9]\d{9}$/.test(supplierAccount)) {
|
||||||
|
alert('请输入正确的手机号');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
formData.supplierAccount = supplierAccount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证必填字段
|
||||||
|
if (!formData.boothName) {
|
||||||
|
alert('请输入摊位名称');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.mainCategory) {
|
||||||
|
alert('请选择主营类目');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.boothLocation) {
|
||||||
|
alert('请输入摊位位置');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.boothDetailAddress) {
|
||||||
|
alert('请输入摊位详细地址');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.pickupLocation) {
|
||||||
|
alert('请输入服务自提点位置');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formData.pickupDetailAddress) {
|
||||||
|
alert('请输入自提点详细地址');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取权限配置
|
||||||
|
const permissions = [];
|
||||||
|
document.querySelectorAll('.sub-permission:checked').forEach(checkbox => {
|
||||||
|
permissions.push(checkbox.nextElementSibling.textContent);
|
||||||
|
});
|
||||||
|
formData.permissions = permissions;
|
||||||
|
|
||||||
|
console.log('提交的表单数据:', formData);
|
||||||
|
|
||||||
|
// TODO: 调用后端API提交表单
|
||||||
|
if (isEditMode) {
|
||||||
|
alert('摊位修改成功!');
|
||||||
|
} else {
|
||||||
|
alert('摊位创建成功!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回摊位列表
|
||||||
|
setTimeout(() => {
|
||||||
|
goBack();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,972 @@
|
||||||
|
<!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">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
|
<title>同城配送设置</title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
color: #333;
|
||||||
|
line-height: 1.6;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 头部 */
|
||||||
|
.header {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 100;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px 16px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-btn {
|
||||||
|
font-size: 24px;
|
||||||
|
color: #333;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 4px 8px 4px 0;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 500;
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
margin-right: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 区块容器 */
|
||||||
|
.section {
|
||||||
|
background-color: #fff;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 16px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-help {
|
||||||
|
color: #999;
|
||||||
|
font-size: 13px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-help::after {
|
||||||
|
content: "?";
|
||||||
|
display: inline-block;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border: 1px solid #999;
|
||||||
|
border-radius: 50%;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 14px;
|
||||||
|
margin-left: 4px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表单项 */
|
||||||
|
.form-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 14px 16px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
min-height: 52px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-item:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-label {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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: 100px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #40a9ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-unit {
|
||||||
|
margin-left: 8px;
|
||||||
|
color: #666;
|
||||||
|
font-size: 14px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 开关 */
|
||||||
|
.switch {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
width: 46px;
|
||||||
|
height: 26px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider:before {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
left: 3px;
|
||||||
|
bottom: 3px;
|
||||||
|
background-color: white;
|
||||||
|
transition: .3s;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked + .slider {
|
||||||
|
background-color: #52c41a;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked + .slider:before {
|
||||||
|
transform: translateX(20px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-label {
|
||||||
|
color: #999;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked ~ .switch-label {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 自定义选择器 */
|
||||||
|
.custom-select {
|
||||||
|
position: relative;
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-trigger {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
background-color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-trigger::after {
|
||||||
|
content: "";
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-left: 4px solid transparent;
|
||||||
|
border-right: 4px solid transparent;
|
||||||
|
border-top: 5px solid #999;
|
||||||
|
margin-left: 8px;
|
||||||
|
transition: transform 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-trigger.active::after {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-trigger:active {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-options {
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
right: 0;
|
||||||
|
left: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-top: 4px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
||||||
|
z-index: 1000;
|
||||||
|
display: none;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-options.show {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-option {
|
||||||
|
padding: 10px 12px;
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-option:active {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-option.selected {
|
||||||
|
color: #006d3e;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-option.selected::after {
|
||||||
|
content: "✓";
|
||||||
|
font-size: 16px;
|
||||||
|
color: #006d3e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 复合输入 */
|
||||||
|
.compound-input {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compound-input .form-input {
|
||||||
|
width: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compound-input .form-unit {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 底部按钮 */
|
||||||
|
.footer {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 16px;
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
padding: 12px 20px;
|
||||||
|
font-size: 16px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #333;
|
||||||
|
border: 1px solid #d9d9d9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel:active {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-submit {
|
||||||
|
background-color: #006d3e;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-submit:active {
|
||||||
|
background-color: #00562f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 触摸反馈 */
|
||||||
|
.form-item:active {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 提示信息 */
|
||||||
|
.toast {
|
||||||
|
position: fixed;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
background-color: rgba(0, 0, 0, 0.75);
|
||||||
|
color: #fff;
|
||||||
|
padding: 12px 20px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 14px;
|
||||||
|
z-index: 9999;
|
||||||
|
display: none;
|
||||||
|
max-width: 80%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast.show {
|
||||||
|
display: block;
|
||||||
|
animation: fadeInOut 2s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeInOut {
|
||||||
|
0% { opacity: 0; }
|
||||||
|
10% { opacity: 1; }
|
||||||
|
90% { opacity: 1; }
|
||||||
|
100% { opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确认对话框 */
|
||||||
|
.dialog-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
display: none;
|
||||||
|
z-index: 9998;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-overlay.show {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
width: 80%;
|
||||||
|
max-width: 300px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-content {
|
||||||
|
padding: 20px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 15px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-actions {
|
||||||
|
display: flex;
|
||||||
|
border-top: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-btn {
|
||||||
|
flex: 1;
|
||||||
|
padding: 14px;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
font-size: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-btn:first-child {
|
||||||
|
border-right: 1px solid #e5e5e5;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-btn:last-child {
|
||||||
|
color: #006d3e;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-btn:active {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 遮罩层 */
|
||||||
|
.mask {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: transparent;
|
||||||
|
z-index: 999;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mask.show {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- 头部 -->
|
||||||
|
<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" onclick="showHelp('同城配送开关')">字段说明</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="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<div class="section-title">基础配置</div>
|
||||||
|
<div class="section-help" onclick="showHelp('基础配置')">字段说明</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-item">
|
||||||
|
<label class="form-label required">订单包装费</label>
|
||||||
|
<div class="form-value">
|
||||||
|
<input type="number" class="form-input" id="packagingFee" 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" id="minOrderAmount" 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" id="maxDistance" 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" id="deliveryTime" value="3" min="0" step="1">
|
||||||
|
<span class="form-unit">小时以内</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 运费收益方 -->
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<div class="section-title">运费收益方</div>
|
||||||
|
<div class="section-help" onclick="showHelp('运费收益方')">字段说明</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-item">
|
||||||
|
<label class="form-label required">运费收益方</label>
|
||||||
|
<div class="form-value">
|
||||||
|
<div class="custom-select" id="beneficiarySelect">
|
||||||
|
<div class="select-trigger" onclick="toggleSelect('beneficiarySelect')">
|
||||||
|
<span class="select-value">市场经营者</span>
|
||||||
|
</div>
|
||||||
|
<div class="select-options">
|
||||||
|
<div class="select-option selected" data-value="market" onclick="selectOption('beneficiarySelect', 'market', '市场经营者')">市场经营者</div>
|
||||||
|
<div class="select-option" data-value="courier" onclick="selectOption('beneficiarySelect', 'courier', '专员')">专员</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 运费计算 -->
|
||||||
|
<div class="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<div class="section-title">运费计算</div>
|
||||||
|
<div class="section-help" onclick="showHelp('运费计算')">字段说明</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-item">
|
||||||
|
<label class="form-label required">运费模式</label>
|
||||||
|
<div class="form-value">
|
||||||
|
<div class="custom-select" id="freightModeSelect">
|
||||||
|
<div class="select-trigger" onclick="toggleSelect('freightModeSelect')">
|
||||||
|
<span class="select-value">距离运费</span>
|
||||||
|
</div>
|
||||||
|
<div class="select-options">
|
||||||
|
<div class="select-option selected" data-value="distance" onclick="selectOption('freightModeSelect', 'distance', '距离运费')">距离运费</div>
|
||||||
|
<div class="select-option" data-value="fixed" onclick="selectOption('freightModeSelect', 'fixed', '固定费用')">固定费用</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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">
|
||||||
|
<span class="form-unit">公里内</span>
|
||||||
|
<input type="number" class="form-input" id="startPrice" value="1" min="0" step="0.1">
|
||||||
|
<span class="form-unit">元</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="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<div class="section-title">免运费条件</div>
|
||||||
|
<div class="section-help" onclick="showHelp('免运费条件')">字段说明</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-item">
|
||||||
|
<label class="form-label">订单满额免运费</label>
|
||||||
|
<div class="form-value">
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" id="freeShippingEnabled">
|
||||||
|
<span class="slider"></span>
|
||||||
|
</label>
|
||||||
|
<span class="switch-label" id="freeShippingLabel">已关闭</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-item" id="freeShippingAmountItem" style="display: none;">
|
||||||
|
<label class="form-label required">订单满</label>
|
||||||
|
<div class="form-value">
|
||||||
|
<input type="number" class="form-input" id="freeShippingAmount" value="50" min="0" step="0.1">
|
||||||
|
<span class="form-unit">元,免运费</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 底部按钮 -->
|
||||||
|
<div class="footer">
|
||||||
|
<button class="btn btn-cancel" onclick="handleCancel()">取消</button>
|
||||||
|
<button class="btn btn-submit" onclick="handleSubmit()">提交</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 提示信息 -->
|
||||||
|
<div class="toast" id="toast"></div>
|
||||||
|
|
||||||
|
<!-- 确认对话框 -->
|
||||||
|
<div class="dialog-overlay" id="dialogOverlay">
|
||||||
|
<div class="dialog">
|
||||||
|
<div class="dialog-content" id="dialogContent"></div>
|
||||||
|
<div class="dialog-actions">
|
||||||
|
<button class="dialog-btn" onclick="hideDialog()">取消</button>
|
||||||
|
<button class="dialog-btn" onclick="confirmDialog()">确定</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 遮罩层 -->
|
||||||
|
<div class="mask" id="mask" onclick="closeAllSelects()"></div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// 选择器数据存储
|
||||||
|
const selectData = {
|
||||||
|
beneficiarySelect: {
|
||||||
|
value: 'market',
|
||||||
|
text: '市场经营者'
|
||||||
|
},
|
||||||
|
freightModeSelect: {
|
||||||
|
value: 'distance',
|
||||||
|
text: '距离运费'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 切换选择器
|
||||||
|
function toggleSelect(selectId) {
|
||||||
|
const select = document.getElementById(selectId);
|
||||||
|
const trigger = select.querySelector('.select-trigger');
|
||||||
|
const options = select.querySelector('.select-options');
|
||||||
|
const mask = document.getElementById('mask');
|
||||||
|
|
||||||
|
// 关闭其他选择器
|
||||||
|
document.querySelectorAll('.select-options').forEach(opt => {
|
||||||
|
if (opt !== options) {
|
||||||
|
opt.classList.remove('show');
|
||||||
|
opt.parentElement.querySelector('.select-trigger').classList.remove('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 切换当前选择器
|
||||||
|
const isShow = options.classList.toggle('show');
|
||||||
|
trigger.classList.toggle('active');
|
||||||
|
|
||||||
|
if (isShow) {
|
||||||
|
mask.classList.add('show');
|
||||||
|
} else {
|
||||||
|
mask.classList.remove('show');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 选择选项
|
||||||
|
function selectOption(selectId, value, text) {
|
||||||
|
const select = document.getElementById(selectId);
|
||||||
|
const trigger = select.querySelector('.select-trigger');
|
||||||
|
const valueSpan = trigger.querySelector('.select-value');
|
||||||
|
const options = select.querySelector('.select-options');
|
||||||
|
const mask = document.getElementById('mask');
|
||||||
|
|
||||||
|
// 更新选中状态
|
||||||
|
select.querySelectorAll('.select-option').forEach(opt => {
|
||||||
|
opt.classList.remove('selected');
|
||||||
|
if (opt.getAttribute('data-value') === value) {
|
||||||
|
opt.classList.add('selected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 更新显示值
|
||||||
|
valueSpan.textContent = text;
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
selectData[selectId] = { value, text };
|
||||||
|
|
||||||
|
// 关闭选择器
|
||||||
|
options.classList.remove('show');
|
||||||
|
trigger.classList.remove('active');
|
||||||
|
mask.classList.remove('show');
|
||||||
|
|
||||||
|
// 运费模式切换逻辑
|
||||||
|
if (selectId === 'freightModeSelect') {
|
||||||
|
const distanceConfig = document.getElementById('distanceFreightConfig');
|
||||||
|
const fixedConfig = document.getElementById('fixedFreightConfig');
|
||||||
|
|
||||||
|
if (value === 'distance') {
|
||||||
|
distanceConfig.style.display = 'block';
|
||||||
|
fixedConfig.style.display = 'none';
|
||||||
|
} else {
|
||||||
|
distanceConfig.style.display = 'none';
|
||||||
|
fixedConfig.style.display = 'block';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭所有选择器
|
||||||
|
function closeAllSelects() {
|
||||||
|
document.querySelectorAll('.select-options').forEach(opt => {
|
||||||
|
opt.classList.remove('show');
|
||||||
|
opt.parentElement.querySelector('.select-trigger').classList.remove('active');
|
||||||
|
});
|
||||||
|
document.getElementById('mask').classList.remove('show');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Toast 提示
|
||||||
|
function showToast(message) {
|
||||||
|
const toast = document.getElementById('toast');
|
||||||
|
toast.textContent = message;
|
||||||
|
toast.classList.add('show');
|
||||||
|
setTimeout(() => {
|
||||||
|
toast.classList.remove('show');
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对话框
|
||||||
|
let dialogCallback = null;
|
||||||
|
|
||||||
|
function showDialog(message, callback) {
|
||||||
|
const overlay = document.getElementById('dialogOverlay');
|
||||||
|
const content = document.getElementById('dialogContent');
|
||||||
|
content.textContent = message;
|
||||||
|
overlay.classList.add('show');
|
||||||
|
dialogCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideDialog() {
|
||||||
|
document.getElementById('dialogOverlay').classList.remove('show');
|
||||||
|
dialogCallback = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmDialog() {
|
||||||
|
hideDialog();
|
||||||
|
if (dialogCallback) {
|
||||||
|
dialogCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 字段说明
|
||||||
|
function showHelp(section) {
|
||||||
|
let message = '';
|
||||||
|
switch(section) {
|
||||||
|
case '同城配送开关':
|
||||||
|
message = '控制是否启用同城配送功能';
|
||||||
|
break;
|
||||||
|
case '基础配置':
|
||||||
|
message = '设置配送的基本参数,包括包装费、起送价、配送距离和送达时间';
|
||||||
|
break;
|
||||||
|
case '运费收益方':
|
||||||
|
message = '设置运费收入归属于市场经营者还是配送专员';
|
||||||
|
break;
|
||||||
|
case '运费计算':
|
||||||
|
message = '设置运费的计算方式,可以按距离计费或固定费用';
|
||||||
|
break;
|
||||||
|
case '免运费条件':
|
||||||
|
message = '设置订单满额免运费的条件';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
showToast(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 同城配送开关
|
||||||
|
const deliveryEnabledSwitch = document.getElementById('deliveryEnabled');
|
||||||
|
const switchLabel = document.getElementById('switchLabel');
|
||||||
|
|
||||||
|
deliveryEnabledSwitch.addEventListener('change', function() {
|
||||||
|
if (this.checked) {
|
||||||
|
switchLabel.textContent = '已开启';
|
||||||
|
} else {
|
||||||
|
switchLabel.textContent = '已关闭';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 免运费条件开关
|
||||||
|
const freeShippingEnabledSwitch = document.getElementById('freeShippingEnabled');
|
||||||
|
const freeShippingLabel = document.getElementById('freeShippingLabel');
|
||||||
|
const freeShippingAmountItem = document.getElementById('freeShippingAmountItem');
|
||||||
|
|
||||||
|
freeShippingEnabledSwitch.addEventListener('change', function() {
|
||||||
|
if (this.checked) {
|
||||||
|
freeShippingLabel.textContent = '已开启';
|
||||||
|
freeShippingAmountItem.style.display = 'flex';
|
||||||
|
} else {
|
||||||
|
freeShippingLabel.textContent = '已关闭';
|
||||||
|
freeShippingAmountItem.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function handleCancel() {
|
||||||
|
showDialog('确定要取消吗?未保存的更改将丢失。', () => {
|
||||||
|
history.back();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单验证
|
||||||
|
function validateForm() {
|
||||||
|
const packagingFee = parseFloat(document.getElementById('packagingFee').value);
|
||||||
|
const minOrderAmount = parseFloat(document.getElementById('minOrderAmount').value);
|
||||||
|
const maxDistance = parseFloat(document.getElementById('maxDistance').value);
|
||||||
|
const deliveryTime = parseInt(document.getElementById('deliveryTime').value);
|
||||||
|
|
||||||
|
if (isNaN(packagingFee) || packagingFee < 0) {
|
||||||
|
showToast('请输入有效的订单包装费');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNaN(minOrderAmount) || minOrderAmount < 0) {
|
||||||
|
showToast('请输入有效的订单起送价');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNaN(maxDistance) || maxDistance <= 0) {
|
||||||
|
showToast('请输入有效的最大配送距离');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNaN(deliveryTime) || deliveryTime <= 0) {
|
||||||
|
showToast('请输入有效的送达时间');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mode = selectData.freightModeSelect.value;
|
||||||
|
if (mode === 'distance') {
|
||||||
|
const startDistance = parseFloat(document.getElementById('startDistance').value);
|
||||||
|
const startPrice = parseFloat(document.getElementById('startPrice').value);
|
||||||
|
const extraPrice = parseFloat(document.getElementById('extraPrice').value);
|
||||||
|
|
||||||
|
if (isNaN(startDistance) || startDistance <= 0) {
|
||||||
|
showToast('请输入有效的配送起步距离');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNaN(startPrice) || startPrice < 0) {
|
||||||
|
showToast('请输入有效的配送起步价');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNaN(extraPrice) || extraPrice < 0) {
|
||||||
|
showToast('请输入有效的加收费用');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const fixedPrice = parseFloat(document.getElementById('fixedPrice').value);
|
||||||
|
if (isNaN(fixedPrice) || fixedPrice < 0) {
|
||||||
|
showToast('请输入有效的配送费用');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (freeShippingEnabledSwitch.checked) {
|
||||||
|
const freeShippingAmount = parseFloat(document.getElementById('freeShippingAmount').value);
|
||||||
|
if (isNaN(freeShippingAmount) || freeShippingAmount <= 0) {
|
||||||
|
showToast('请输入有效的免运费金额');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交按钮
|
||||||
|
function handleSubmit() {
|
||||||
|
if (!validateForm()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const deliveryEnabled = deliveryEnabledSwitch.checked;
|
||||||
|
const freeShippingEnabled = freeShippingEnabledSwitch.checked;
|
||||||
|
|
||||||
|
// 收集表单数据
|
||||||
|
const formData = {
|
||||||
|
同城配送开关: {
|
||||||
|
是否开启: deliveryEnabled
|
||||||
|
},
|
||||||
|
基础配置: {
|
||||||
|
订单包装费: parseFloat(document.getElementById('packagingFee').value),
|
||||||
|
订单起送价: parseFloat(document.getElementById('minOrderAmount').value),
|
||||||
|
最大配送距离: parseFloat(document.getElementById('maxDistance').value),
|
||||||
|
承诺订单送达时间: parseInt(document.getElementById('deliveryTime').value)
|
||||||
|
},
|
||||||
|
运费收益方: {
|
||||||
|
收益方: selectData.beneficiarySelect.text
|
||||||
|
},
|
||||||
|
运费计算: {
|
||||||
|
运费模式: selectData.freightModeSelect.text
|
||||||
|
},
|
||||||
|
免运费条件: {
|
||||||
|
是否启用: freeShippingEnabled
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 根据模式添加不同的配置
|
||||||
|
if (selectData.freightModeSelect.value === '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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加免运费条件
|
||||||
|
if (freeShippingEnabled) {
|
||||||
|
formData.免运费条件.订单满额 = parseFloat(document.getElementById('freeShippingAmount').value);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('提交的数据:', formData);
|
||||||
|
|
||||||
|
// TODO: 这里添加实际的提交逻辑
|
||||||
|
showToast('配置已保存!');
|
||||||
|
|
||||||
|
// 延迟返回
|
||||||
|
setTimeout(() => {
|
||||||
|
history.back();
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单输入验证
|
||||||
|
document.querySelectorAll('.form-input').forEach(input => {
|
||||||
|
input.addEventListener('input', function(e) {
|
||||||
|
if (this.type === 'number' && this.value < 0) {
|
||||||
|
this.value = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 防止双击缩放
|
||||||
|
let lastTouchEnd = 0;
|
||||||
|
document.addEventListener('touchend', function (event) {
|
||||||
|
const now = Date.now();
|
||||||
|
if (now - lastTouchEnd <= 300) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
lastTouchEnd = now;
|
||||||
|
}, false);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue