|
|
@ -666,6 +666,18 @@ |
|
|
background-color: #ff4d4f; |
|
|
background-color: #ff4d4f; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* 禁用按钮样式 */ |
|
|
|
|
|
.btn-disabled { |
|
|
|
|
|
background-color: #d9d9d9; |
|
|
|
|
|
color: #999; |
|
|
|
|
|
cursor: not-allowed; |
|
|
|
|
|
pointer-events: none; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.btn-disabled:hover { |
|
|
|
|
|
background-color: #d9d9d9; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/* 模态框按钮样式 */ |
|
|
/* 模态框按钮样式 */ |
|
|
.modal-btn { |
|
|
.modal-btn { |
|
|
padding: 10px 24px; |
|
|
padding: 10px 24px; |
|
|
@ -1107,7 +1119,29 @@ |
|
|
<button onclick="contactCustomerService()">联系客服</button> |
|
|
<button onclick="contactCustomerService()">联系客服</button> |
|
|
<button class="apply-settlement-btn">已入驻</button> |
|
|
<button class="apply-settlement-btn">已入驻</button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 新鲜程度选择弹窗 --> |
|
|
|
|
|
<div id="freshnessSelectModal" class="select-modal"> |
|
|
|
|
|
<div class="select-content"> |
|
|
|
|
|
<div class="select-header"> |
|
|
|
|
|
<h3>选择新鲜程度</h3> |
|
|
|
|
|
<button class="close-btn" onclick="hideFreshnessSelectModal()">×</button> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="select-search"> |
|
|
|
|
|
<input type="text" id="freshnessSearchInput" placeholder="搜索新鲜程度" oninput="filterFreshnessOptions()" style="width: 100%; padding: 10px; border: 1px solid #d9d9d9; border-radius: 8px; font-size: 14px; box-sizing: border-box;"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="select-body"> |
|
|
|
|
|
<div id="freshnessOptionsList" class="select-list"> |
|
|
|
|
|
<!-- 新鲜程度选项将通过JavaScript动态生成 --> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="select-footer" style="padding: 16px 20px; display: flex; justify-content: space-between; border-top: 1px solid #f0f0f0; background-color: #fafafa;"> |
|
|
|
|
|
<button onclick="hideFreshnessSelectModal()" style="padding: 10px 24px; background-color: #f5f5f5; color: #666; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.3s ease;">取消</button> |
|
|
|
|
|
<button onclick="confirmFreshnessSelection()" style="padding: 10px 24px; background-color: #1677ff; color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.3s ease;">确定</button> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<!-- 搜索框 --> |
|
|
<!-- 搜索框 --> |
|
|
<div class="search-container"> |
|
|
<div class="search-container"> |
|
|
@ -1259,6 +1293,16 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 新鲜程度 --> |
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="form-label">新鲜程度</label> |
|
|
|
|
|
<div class="form-select" id="freshnessSelect" onclick="showFreshnessSelectModal()" style="cursor: pointer; position: relative; padding-right: 30px;"> |
|
|
|
|
|
<span id="freshnessDisplayText">请选择新鲜程度</span> |
|
|
|
|
|
<input type="hidden" id="freshness" name="freshness"> |
|
|
|
|
|
<span style="position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #999;">▼</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<!-- 地区 --> |
|
|
<!-- 地区 --> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="form-label">地区</label> |
|
|
<label class="form-label">地区</label> |
|
|
@ -1663,6 +1707,16 @@ |
|
|
<span style="position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #999;">▼</span> |
|
|
<span style="position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #999;">▼</span> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 新鲜程度 --> |
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="form-label">新鲜程度</label> |
|
|
|
|
|
<div class="form-select" id="editFreshnessSelect" onclick="showEditFreshnessSelectModal()" style="cursor: pointer; position: relative; padding-right: 30px;"> |
|
|
|
|
|
<span id="editFreshnessDisplayText">请选择新鲜程度</span> |
|
|
|
|
|
<input type="hidden" id="editFreshness" name="freshness"> |
|
|
|
|
|
<span style="position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #999;">▼</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<!-- 地区 --> |
|
|
<!-- 地区 --> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
@ -3060,6 +3114,84 @@ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 新鲜程度选择功能 |
|
|
|
|
|
let allFreshnessOptions = ['正常质量(1-4天)', '一般质量(3天以内)', '一般质量(4天以上)', '精品']; |
|
|
|
|
|
let filteredFreshnessOptions = [...allFreshnessOptions]; |
|
|
|
|
|
let selectedFreshness = ''; |
|
|
|
|
|
|
|
|
|
|
|
// 显示新鲜程度选择弹窗 |
|
|
|
|
|
function showFreshnessSelectModal() { |
|
|
|
|
|
const freshnessSelectModal = document.getElementById('freshnessSelectModal'); |
|
|
|
|
|
freshnessSelectModal.classList.add('active'); |
|
|
|
|
|
// 重置搜索输入 |
|
|
|
|
|
document.getElementById('freshnessSearchInput').value = ''; |
|
|
|
|
|
filteredFreshnessOptions = [...allFreshnessOptions]; |
|
|
|
|
|
generateFreshnessOptions(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 隐藏新鲜程度选择弹窗 |
|
|
|
|
|
function hideFreshnessSelectModal() { |
|
|
|
|
|
const freshnessSelectModal = document.getElementById('freshnessSelectModal'); |
|
|
|
|
|
freshnessSelectModal.classList.remove('active'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 生成新鲜程度选项 |
|
|
|
|
|
function generateFreshnessOptions() { |
|
|
|
|
|
const freshnessOptionsList = document.getElementById('freshnessOptionsList'); |
|
|
|
|
|
freshnessOptionsList.innerHTML = ''; |
|
|
|
|
|
|
|
|
|
|
|
filteredFreshnessOptions.forEach(freshness => { |
|
|
|
|
|
const option = document.createElement('div'); |
|
|
|
|
|
option.className = 'select-item'; |
|
|
|
|
|
option.textContent = freshness; |
|
|
|
|
|
option.onclick = () => { |
|
|
|
|
|
// 移除所有选项的选中状态 |
|
|
|
|
|
document.querySelectorAll('#freshnessOptionsList .select-item').forEach(item => { |
|
|
|
|
|
item.classList.remove('selected'); |
|
|
|
|
|
}); |
|
|
|
|
|
// 添加当前选项的选中状态 |
|
|
|
|
|
option.classList.add('selected'); |
|
|
|
|
|
selectedFreshness = freshness; |
|
|
|
|
|
}; |
|
|
|
|
|
option.ondblclick = () => { |
|
|
|
|
|
// 双击直接确认选择 |
|
|
|
|
|
const freshnessDisplayText = document.getElementById('freshnessDisplayText'); |
|
|
|
|
|
const freshnessInput = document.getElementById('freshness'); |
|
|
|
|
|
|
|
|
|
|
|
freshnessDisplayText.textContent = freshness; |
|
|
|
|
|
freshnessInput.value = freshness; |
|
|
|
|
|
hideFreshnessSelectModal(); |
|
|
|
|
|
saveFormData(); // 保存选择 |
|
|
|
|
|
}; |
|
|
|
|
|
freshnessOptionsList.appendChild(option); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 过滤新鲜程度选项 |
|
|
|
|
|
function filterFreshnessOptions() { |
|
|
|
|
|
const searchInput = document.getElementById('freshnessSearchInput'); |
|
|
|
|
|
const searchKeyword = searchInput.value.toLowerCase(); |
|
|
|
|
|
|
|
|
|
|
|
filteredFreshnessOptions = allFreshnessOptions.filter(freshness => { |
|
|
|
|
|
return freshness.toLowerCase().includes(searchKeyword); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
generateFreshnessOptions(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 确认新鲜程度选择 |
|
|
|
|
|
function confirmFreshnessSelection() { |
|
|
|
|
|
if (selectedFreshness) { |
|
|
|
|
|
const freshnessDisplayText = document.getElementById('freshnessDisplayText'); |
|
|
|
|
|
const freshnessInput = document.getElementById('freshness'); |
|
|
|
|
|
|
|
|
|
|
|
freshnessDisplayText.textContent = selectedFreshness; |
|
|
|
|
|
freshnessInput.value = selectedFreshness; |
|
|
|
|
|
hideFreshnessSelectModal(); |
|
|
|
|
|
saveFormData(); // 保存选择 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 地区选择功能 |
|
|
// 地区选择功能 |
|
|
let allRegionOptions = [ |
|
|
let allRegionOptions = [ |
|
|
{ province: '北京市', cities: [ |
|
|
{ province: '北京市', cities: [ |
|
|
@ -4077,13 +4209,13 @@ |
|
|
`; |
|
|
`; |
|
|
} else if (supply.status === 'rejected') { |
|
|
} else if (supply.status === 'rejected') { |
|
|
actionsHTML = ` |
|
|
actionsHTML = ` |
|
|
<button class="btn-success" onclick="preparePublishSupply('${supply.id}')">上架</button> |
|
|
<button class="${supply.label === 1 ? 'btn-disabled' : 'btn-success'}" ${supply.label === 1 ? '' : `onclick="preparePublishSupply('${supply.id}')"`}>上架</button> |
|
|
<button class="btn-danger" onclick="deleteSupply('${supply.id}')">删除</button> |
|
|
<button class="btn-danger" onclick="deleteSupply('${supply.id}')">删除</button> |
|
|
<button class="btn-primary" onclick="showRejectReason('${supply.id}')">查看原因</button> |
|
|
<button class="btn-primary" onclick="showRejectReason('${supply.id}')">查看原因</button> |
|
|
`; |
|
|
`; |
|
|
} else if (supply.status === 'hidden' || supply.status === 'sold_out') { |
|
|
} else if (supply.status === 'hidden' || supply.status === 'sold_out') { |
|
|
actionsHTML = ` |
|
|
actionsHTML = ` |
|
|
<button class="btn-primary" onclick="preparePublishSupply('${supply.id}')">上架</button> |
|
|
<button class="${supply.label === 1 ? 'btn-disabled' : 'btn-primary'}" ${supply.label === 1 ? '' : `onclick="preparePublishSupply('${supply.id}')"`}>上架</button> |
|
|
<button class="btn-danger" onclick="deleteSupply('${supply.id}')">删除</button> |
|
|
<button class="btn-danger" onclick="deleteSupply('${supply.id}')">删除</button> |
|
|
`; |
|
|
`; |
|
|
} |
|
|
} |
|
|
@ -5294,6 +5426,7 @@ |
|
|
description: document.getElementById('description').value, |
|
|
description: document.getElementById('description').value, |
|
|
region: document.getElementById('regionValue').value, |
|
|
region: document.getElementById('regionValue').value, |
|
|
contactId: document.getElementById('contactId').value, |
|
|
contactId: document.getElementById('contactId').value, |
|
|
|
|
|
freshness: document.getElementById('freshness').value, |
|
|
imageUrls: supplyData.uploadedImages, |
|
|
imageUrls: supplyData.uploadedImages, |
|
|
sellerId: userInfo.userId, // 添加当前登录用户的userId作为sellerId |
|
|
sellerId: userInfo.userId, // 添加当前登录用户的userId作为sellerId |
|
|
autoOfflineDays: null, // 不再使用天数,设置为null |
|
|
autoOfflineDays: null, // 不再使用天数,设置为null |
|
|
@ -5910,11 +6043,14 @@ |
|
|
let specifications = []; |
|
|
let specifications = []; |
|
|
let quantities = []; |
|
|
let quantities = []; |
|
|
|
|
|
|
|
|
// 解析规格(中文逗号分隔字符串) |
|
|
// 解析规格(支持中英文逗号分隔字符串) |
|
|
try { |
|
|
try { |
|
|
if (supply.specification) { |
|
|
if (supply.specification) { |
|
|
if (typeof supply.specification === 'string') { |
|
|
if (typeof supply.specification === 'string') { |
|
|
specifications = supply.specification.split(',').filter(spec => spec.trim()); |
|
|
specifications = supply.specification |
|
|
|
|
|
.split(/[,,]/) // 同时处理中英文逗号 |
|
|
|
|
|
.map(spec => spec.trim()) |
|
|
|
|
|
.filter(spec => spec); |
|
|
} else if (Array.isArray(supply.specification)) { |
|
|
} else if (Array.isArray(supply.specification)) { |
|
|
specifications = supply.specification; |
|
|
specifications = supply.specification; |
|
|
} else { |
|
|
} else { |
|
|
@ -5952,12 +6088,16 @@ |
|
|
addEditSpecQuantityPair(); |
|
|
addEditSpecQuantityPair(); |
|
|
} else { |
|
|
} else { |
|
|
// 根据规格数量生成相应的规格-件数对 |
|
|
// 根据规格数量生成相应的规格-件数对 |
|
|
for (let i = 0; i < specifications.length; i++) { |
|
|
for (let i = 0; i < Math.max(specifications.length, quantities.length); i++) { |
|
|
|
|
|
// 确保即使数量不匹配,也能正确显示对应的数据 |
|
|
|
|
|
const spec = specifications[i] || ''; |
|
|
|
|
|
const qty = quantities[i] || ''; |
|
|
|
|
|
|
|
|
const pair = document.createElement('div'); |
|
|
const pair = document.createElement('div'); |
|
|
pair.className = 'spec-quantity-pair'; |
|
|
pair.className = 'spec-quantity-pair'; |
|
|
pair.innerHTML = ` |
|
|
pair.innerHTML = ` |
|
|
<input type="text" class="spec-value" placeholder="请选择规格" readonly onclick="showEditSpecSelectModalForPair(this, 'pair')" value="${specifications[i]}"> |
|
|
<input type="text" class="spec-value" placeholder="请选择规格" readonly onclick="showEditSpecSelectModalForPair(this, 'pair')" value="${spec}"> |
|
|
<input type="text" class="form-input quantity-input" placeholder="请输入件数" onwheel="this.blur()" value="${quantities[i] || ''}"> |
|
|
<input type="text" class="form-input quantity-input" placeholder="请输入件数" onwheel="this.blur()" value="${qty}"> |
|
|
<button type="button" class="remove-quantity-btn" onclick="removeEditSpecQuantityPair(this)">×</button> |
|
|
<button type="button" class="remove-quantity-btn" onclick="removeEditSpecQuantityPair(this)">×</button> |
|
|
`; |
|
|
`; |
|
|
specQuantityPairs.appendChild(pair); |
|
|
specQuantityPairs.appendChild(pair); |
|
|
@ -6325,6 +6465,76 @@ |
|
|
hideEditProductingSelectModal(); |
|
|
hideEditProductingSelectModal(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 编辑新鲜程度选择功能 |
|
|
|
|
|
let editAllFreshnessOptions = ['正常质量(1-4天)', '一般质量(3天以内)', '一般质量(4天以上)', '精品']; |
|
|
|
|
|
let editFilteredFreshnessOptions = [...editAllFreshnessOptions]; |
|
|
|
|
|
let editSelectedFreshness = ''; |
|
|
|
|
|
|
|
|
|
|
|
// 显示编辑新鲜程度选择弹窗 |
|
|
|
|
|
function showEditFreshnessSelectModal() { |
|
|
|
|
|
const editFreshnessSelectModal = document.getElementById('editFreshnessSelectModal'); |
|
|
|
|
|
editFreshnessSelectModal.classList.add('active'); |
|
|
|
|
|
// 重置搜索输入 |
|
|
|
|
|
document.getElementById('editFreshnessSearchInput').value = ''; |
|
|
|
|
|
editFilteredFreshnessOptions = [...editAllFreshnessOptions]; |
|
|
|
|
|
generateEditFreshnessOptions(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 隐藏编辑新鲜程度选择弹窗 |
|
|
|
|
|
function hideEditFreshnessSelectModal() { |
|
|
|
|
|
const editFreshnessSelectModal = document.getElementById('editFreshnessSelectModal'); |
|
|
|
|
|
editFreshnessSelectModal.classList.remove('active'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 生成编辑新鲜程度选项 |
|
|
|
|
|
function generateEditFreshnessOptions() { |
|
|
|
|
|
const editFreshnessOptionsList = document.getElementById('editFreshnessOptionsList'); |
|
|
|
|
|
editFreshnessOptionsList.innerHTML = ''; |
|
|
|
|
|
|
|
|
|
|
|
editFilteredFreshnessOptions.forEach(freshness => { |
|
|
|
|
|
const option = document.createElement('div'); |
|
|
|
|
|
option.className = 'select-item'; |
|
|
|
|
|
option.textContent = freshness; |
|
|
|
|
|
option.onclick = () => { |
|
|
|
|
|
// 移除所有选项的选中状态 |
|
|
|
|
|
document.querySelectorAll('#editFreshnessOptionsList .select-item').forEach(item => { |
|
|
|
|
|
item.classList.remove('selected'); |
|
|
|
|
|
}); |
|
|
|
|
|
// 添加当前选项的选中状态 |
|
|
|
|
|
option.classList.add('selected'); |
|
|
|
|
|
editSelectedFreshness = freshness; |
|
|
|
|
|
}; |
|
|
|
|
|
option.ondblclick = () => { |
|
|
|
|
|
// 双击直接确认选择 |
|
|
|
|
|
document.getElementById('editFreshnessDisplayText').textContent = freshness; |
|
|
|
|
|
document.getElementById('editFreshness').value = freshness; |
|
|
|
|
|
hideEditFreshnessSelectModal(); |
|
|
|
|
|
}; |
|
|
|
|
|
editFreshnessOptionsList.appendChild(option); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 过滤编辑新鲜程度选项 |
|
|
|
|
|
function filterEditFreshnessOptions() { |
|
|
|
|
|
const searchInput = document.getElementById('editFreshnessSearchInput'); |
|
|
|
|
|
const searchKeyword = searchInput.value.toLowerCase(); |
|
|
|
|
|
|
|
|
|
|
|
editFilteredFreshnessOptions = editAllFreshnessOptions.filter(freshness => { |
|
|
|
|
|
return freshness.toLowerCase().includes(searchKeyword); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
generateEditFreshnessOptions(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 确认编辑新鲜程度选择 |
|
|
|
|
|
function confirmEditFreshnessSelection() { |
|
|
|
|
|
if (editSelectedFreshness) { |
|
|
|
|
|
document.getElementById('editFreshnessDisplayText').textContent = editSelectedFreshness; |
|
|
|
|
|
document.getElementById('editFreshness').value = editSelectedFreshness; |
|
|
|
|
|
} |
|
|
|
|
|
hideEditFreshnessSelectModal(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 编辑地区选择功能 |
|
|
// 编辑地区选择功能 |
|
|
// 显示编辑地区选择弹窗 |
|
|
// 显示编辑地区选择弹窗 |
|
|
function showEditRegionSelectModal() { |
|
|
function showEditRegionSelectModal() { |
|
|
@ -6898,10 +7108,10 @@ |
|
|
const specValue = pair.querySelector('.spec-value').value.trim(); |
|
|
const specValue = pair.querySelector('.spec-value').value.trim(); |
|
|
const quantityValue = pair.querySelector('.quantity-input').value.trim(); |
|
|
const quantityValue = pair.querySelector('.quantity-input').value.trim(); |
|
|
|
|
|
|
|
|
if (specValue && quantityValue) { |
|
|
// 保存所有添加的规格和件数对,即使其中一个为空 |
|
|
specifications.push(specValue); |
|
|
// 这样可以保持记忆功能,下次编辑时还能看到之前添加的对 |
|
|
quantities.push(quantityValue); |
|
|
specifications.push(specValue); |
|
|
} |
|
|
quantities.push(quantityValue); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -6933,7 +7143,7 @@ |
|
|
description: document.getElementById('editDescription').value, |
|
|
description: document.getElementById('editDescription').value, |
|
|
region: document.getElementById('editRegionValue').value, |
|
|
region: document.getElementById('editRegionValue').value, |
|
|
contactId: document.getElementById('editContactId').value, |
|
|
contactId: document.getElementById('editContactId').value, |
|
|
|
|
|
freshness: document.getElementById('editFreshness').value, |
|
|
imageUrls: editCurrentImages, // 添加编辑后的图片列表 |
|
|
imageUrls: editCurrentImages, // 添加编辑后的图片列表 |
|
|
autoOfflineTime: autoOfflineTime, // 自动下架时间 |
|
|
autoOfflineTime: autoOfflineTime, // 自动下架时间 |
|
|
autoOfflineDays: null, // 不再使用天数,设置为null |
|
|
autoOfflineDays: null, // 不再使用天数,设置为null |
|
|
|