|
|
|
@ -993,52 +993,9 @@ |
|
|
|
</div> |
|
|
|
<div id="publishedList" class="supply-list"> |
|
|
|
<div class="empty-state">暂无已上架的货源</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 产品包装选择弹窗 --> |
|
|
|
<div id="productingSelectModal" class="select-modal"> |
|
|
|
<div class="select-content"> |
|
|
|
<div class="select-header"> |
|
|
|
<h3>选择产品包装</h3> |
|
|
|
<button class="close-btn" onclick="hideProductingSelectModal()">×</button> |
|
|
|
</div> |
|
|
|
<div class="select-search"> |
|
|
|
<input type="text" id="productingSearchInput" placeholder="搜索产品包装" oninput="filterProductingOptions()" style="width: 100%; padding: 10px; border: 1px solid #d9d9d9; border-radius: 8px; font-size: 14px;"> |
|
|
|
</div> |
|
|
|
<div class="select-body"> |
|
|
|
<div id="productingOptionsList" 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="hideProductingSelectModal()" 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="confirmProductingSelection()" 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 id="editProductingSelectModal" class="select-modal"> |
|
|
|
<div class="select-content"> |
|
|
|
<div class="select-header"> |
|
|
|
<h3>选择产品包装</h3> |
|
|
|
<button class="close-btn" onclick="hideEditProductingSelectModal()">×</button> |
|
|
|
</div> |
|
|
|
<div class="select-search"> |
|
|
|
<input type="text" id="editProductingSearchInput" placeholder="搜索产品包装" oninput="filterEditProductingOptions()" style="width: 100%; padding: 10px; border: 1px solid #d9d9d9; border-radius: 8px; font-size: 14px;"> |
|
|
|
</div> |
|
|
|
<div class="select-body"> |
|
|
|
<div id="editProductingOptionsList" 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="hideEditProductingSelectModal()" 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="confirmEditProductingSelection()" 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 class="supply-section"> |
|
|
|
<div class="section-header" onclick="toggleSection('pending')"> |
|
|
|
@ -1163,15 +1120,6 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 产品包装 --> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="form-label">产品包装</label> |
|
|
|
<div class="form-select" id="producting" onclick="showProductingSelectModal()" style="cursor: pointer; position: relative; padding-right: 30px;"> |
|
|
|
<span id="productingDisplayText">请选择产品包装</span> |
|
|
|
<input type="hidden" id="productingValue" name="producting"> |
|
|
|
<span style="position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #999;">▼</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 地区 --> |
|
|
|
<div class="form-group"> |
|
|
|
@ -1509,16 +1457,6 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 产品包装 --> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="form-label">产品包装</label> |
|
|
|
<div class="form-select" id="editProducting" onclick="showEditProductingSelectModal()" style="cursor: pointer; position: relative; padding-right: 30px;"> |
|
|
|
<span id="editProductingDisplayText">请选择产品包装</span> |
|
|
|
<input type="hidden" id="editProductingValue" name="producting"> |
|
|
|
<span style="position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #999;">▼</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 地区 --> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="form-label">地区</label> |
|
|
|
@ -2030,145 +1968,6 @@ |
|
|
|
} |
|
|
|
hideSpecSelectModal(); |
|
|
|
} |
|
|
|
|
|
|
|
// 产品包装相关变量 |
|
|
|
const allProductingOptions = ['1*360枚新包装', '1*360枚旧包新拖', '1*360枚旧包旧拖', '1*420枚新包装', '1*480枚新包装', '30枚蛋托散装', '360枚散托']; |
|
|
|
let filteredProductingOptions = []; |
|
|
|
let selectedProducting = ''; |
|
|
|
|
|
|
|
// 显示产品包装选择弹窗 |
|
|
|
function showProductingSelectModal() { |
|
|
|
const productingSelectModal = document.getElementById('productingSelectModal'); |
|
|
|
productingSelectModal.classList.add('active'); |
|
|
|
// 重置搜索输入 |
|
|
|
document.getElementById('productingSearchInput').value = ''; |
|
|
|
filteredProductingOptions = [...allProductingOptions]; |
|
|
|
generateProductingOptions(); |
|
|
|
} |
|
|
|
|
|
|
|
// 隐藏产品包装选择弹窗 |
|
|
|
function hideProductingSelectModal() { |
|
|
|
const productingSelectModal = document.getElementById('productingSelectModal'); |
|
|
|
productingSelectModal.classList.remove('active'); |
|
|
|
} |
|
|
|
|
|
|
|
// 生成产品包装选项 |
|
|
|
function generateProductingOptions() { |
|
|
|
const productingOptionsList = document.getElementById('productingOptionsList'); |
|
|
|
productingOptionsList.innerHTML = ''; |
|
|
|
|
|
|
|
filteredProductingOptions.forEach(producting => { |
|
|
|
const option = document.createElement('div'); |
|
|
|
option.className = 'select-item'; |
|
|
|
option.textContent = producting; |
|
|
|
option.onclick = () => { |
|
|
|
// 移除所有选项的选中状态 |
|
|
|
document.querySelectorAll('.select-item').forEach(item => { |
|
|
|
item.classList.remove('selected'); |
|
|
|
}); |
|
|
|
// 添加当前选项的选中状态 |
|
|
|
option.classList.add('selected'); |
|
|
|
selectedProducting = producting; |
|
|
|
}; |
|
|
|
option.ondblclick = () => { |
|
|
|
// 双击直接确认选择 |
|
|
|
document.getElementById('productingDisplayText').textContent = producting; |
|
|
|
document.getElementById('productingValue').value = producting; |
|
|
|
hideProductingSelectModal(); |
|
|
|
}; |
|
|
|
productingOptionsList.appendChild(option); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 过滤产品包装选项 |
|
|
|
function filterProductingOptions() { |
|
|
|
const searchInput = document.getElementById('productingSearchInput'); |
|
|
|
const searchKeyword = searchInput.value.toLowerCase(); |
|
|
|
|
|
|
|
filteredProductingOptions = allProductingOptions.filter(producting => { |
|
|
|
return producting.toLowerCase().includes(searchKeyword); |
|
|
|
}); |
|
|
|
|
|
|
|
generateProductingOptions(); |
|
|
|
} |
|
|
|
|
|
|
|
// 确认产品包装选择 |
|
|
|
function confirmProductingSelection() { |
|
|
|
if (selectedProducting) { |
|
|
|
document.getElementById('productingDisplayText').textContent = selectedProducting; |
|
|
|
document.getElementById('productingValue').value = selectedProducting; |
|
|
|
} |
|
|
|
hideProductingSelectModal(); |
|
|
|
} |
|
|
|
|
|
|
|
// 编辑产品包装相关变量 |
|
|
|
let editFilteredProductingOptions = []; |
|
|
|
let editSelectedProducting = ''; |
|
|
|
|
|
|
|
// 显示编辑产品包装选择弹窗 |
|
|
|
function showEditProductingSelectModal() { |
|
|
|
const editProductingSelectModal = document.getElementById('editProductingSelectModal'); |
|
|
|
editProductingSelectModal.classList.add('active'); |
|
|
|
// 重置搜索输入 |
|
|
|
document.getElementById('editProductingSearchInput').value = ''; |
|
|
|
editFilteredProductingOptions = [...allProductingOptions]; |
|
|
|
generateEditProductingOptions(); |
|
|
|
} |
|
|
|
|
|
|
|
// 隐藏编辑产品包装选择弹窗 |
|
|
|
function hideEditProductingSelectModal() { |
|
|
|
const editProductingSelectModal = document.getElementById('editProductingSelectModal'); |
|
|
|
editProductingSelectModal.classList.remove('active'); |
|
|
|
} |
|
|
|
|
|
|
|
// 生成编辑产品包装选项 |
|
|
|
function generateEditProductingOptions() { |
|
|
|
const editProductingOptionsList = document.getElementById('editProductingOptionsList'); |
|
|
|
editProductingOptionsList.innerHTML = ''; |
|
|
|
|
|
|
|
editFilteredProductingOptions.forEach(producting => { |
|
|
|
const option = document.createElement('div'); |
|
|
|
option.className = 'select-item'; |
|
|
|
option.textContent = producting; |
|
|
|
option.onclick = () => { |
|
|
|
// 移除所有选项的选中状态 |
|
|
|
document.querySelectorAll('.select-item').forEach(item => { |
|
|
|
item.classList.remove('selected'); |
|
|
|
}); |
|
|
|
// 添加当前选项的选中状态 |
|
|
|
option.classList.add('selected'); |
|
|
|
editSelectedProducting = producting; |
|
|
|
}; |
|
|
|
option.ondblclick = () => { |
|
|
|
// 双击直接确认选择 |
|
|
|
document.getElementById('editProductingDisplayText').textContent = producting; |
|
|
|
document.getElementById('editProductingValue').value = producting; |
|
|
|
hideEditProductingSelectModal(); |
|
|
|
}; |
|
|
|
editProductingOptionsList.appendChild(option); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 过滤编辑产品包装选项 |
|
|
|
function filterEditProductingOptions() { |
|
|
|
const searchInput = document.getElementById('editProductingSearchInput'); |
|
|
|
const searchKeyword = searchInput.value.toLowerCase(); |
|
|
|
|
|
|
|
editFilteredProductingOptions = allProductingOptions.filter(producting => { |
|
|
|
return producting.toLowerCase().includes(searchKeyword); |
|
|
|
}); |
|
|
|
|
|
|
|
generateEditProductingOptions(); |
|
|
|
} |
|
|
|
|
|
|
|
// 确认编辑产品包装选择 |
|
|
|
function confirmEditProductingSelection() { |
|
|
|
if (editSelectedProducting) { |
|
|
|
document.getElementById('editProductingDisplayText').textContent = editSelectedProducting; |
|
|
|
document.getElementById('editProductingValue').value = editSelectedProducting; |
|
|
|
} |
|
|
|
hideEditProductingSelectModal(); |
|
|
|
} |
|
|
|
|
|
|
|
// 显示货源类型选择弹窗 |
|
|
|
function showSourceTypeSelectModal() { |
|
|
|
@ -3489,7 +3288,7 @@ |
|
|
|
<div class="detail-item">货源状态: ${supply.supplyStatus || '未设置'}</div> |
|
|
|
<div class="detail-item">货源描述: ${supply.description || '无'}</div> |
|
|
|
<div class="detail-item">件数: ${supply.quantity || '0'}件</div> |
|
|
|
<div class="detail-item" style="display: none;">斤重: ${supply.grossWeight || ''}斤</div> |
|
|
|
<div class="detail-item">斤重: ${supply.grossWeight || ''}斤</div> |
|
|
|
<div class="detail-item">地区: ${supply.region || '未设置'}</div> |
|
|
|
<div class="detail-item" style="color: #f5222d;">价格: ¥${supply.price || '0'}</div> |
|
|
|
<div class="detail-item" style="font-size: 12px; color: #999;">创建时间: ${formatDate(supply.created_at)}</div> |
|
|
|
@ -3640,7 +3439,7 @@ |
|
|
|
const productName = document.getElementById('productName'); |
|
|
|
const price = document.getElementById('price'); |
|
|
|
const quantity = document.getElementById('quantity'); |
|
|
|
const grossWeight = null; // 斤重功能已隐藏 |
|
|
|
const grossWeight = document.getElementById('grossWeight'); |
|
|
|
const yolk = document.getElementById('yolk'); |
|
|
|
const specValue = document.getElementById('specValue'); |
|
|
|
const supplyStatus = document.getElementById('supplyStatus'); |
|
|
|
@ -3655,7 +3454,7 @@ |
|
|
|
if (productName) productName.value = formData.productName || ''; |
|
|
|
if (price) price.value = formData.price || ''; |
|
|
|
if (quantity) quantity.value = formData.quantity || ''; |
|
|
|
// 斤重功能已隐藏 |
|
|
|
if (grossWeight) grossWeight.value = formData.grossWeight || ''; |
|
|
|
if (yolk) yolk.value = formData.yolk || ''; |
|
|
|
if (specValue) specValue.value = formData.specification || ''; |
|
|
|
if (supplyStatus) supplyStatus.value = formData.supplyStatus || ''; |
|
|
|
@ -3871,7 +3670,7 @@ |
|
|
|
// 设置表单自动保存 |
|
|
|
function setupAutoSave() { |
|
|
|
// 为所有输入字段添加输入事件监听 |
|
|
|
const formFields = ['productName', 'price', 'quantity', 'grossWeight', 'yolk', 'specValue', 'supplyStatus', 'description', 'regionValue', 'contactId', 'sourceType', 'productingValue']; |
|
|
|
const formFields = ['productName', 'price', 'quantity', 'grossWeight', 'yolk', 'specValue', 'supplyStatus', 'description', 'regionValue', 'contactId', 'sourceType']; |
|
|
|
|
|
|
|
formFields.forEach(fieldId => { |
|
|
|
const element = document.getElementById(fieldId); |
|
|
|
@ -3901,8 +3700,7 @@ |
|
|
|
'sourceTypeDisplayText', |
|
|
|
'productNameDisplayText', |
|
|
|
'yolkDisplayText', |
|
|
|
'contactIdDisplayText', |
|
|
|
'productingDisplayText' |
|
|
|
'contactIdDisplayText' |
|
|
|
]; |
|
|
|
|
|
|
|
customDisplays.forEach(displayId => { |
|
|
|
@ -3942,7 +3740,7 @@ |
|
|
|
const productName = document.getElementById('productName'); |
|
|
|
const price = document.getElementById('price'); |
|
|
|
const quantity = document.getElementById('quantity'); |
|
|
|
const grossWeight = null; // 斤重功能已隐藏 |
|
|
|
const grossWeight = document.getElementById('grossWeight'); |
|
|
|
const yolk = document.getElementById('yolk'); |
|
|
|
const specValue = document.getElementById('specValue'); |
|
|
|
const supplyStatus = document.getElementById('supplyStatus'); |
|
|
|
@ -3958,8 +3756,6 @@ |
|
|
|
const yolkDisplayText = document.getElementById('yolkDisplayText'); |
|
|
|
const contactIdDisplayText = document.getElementById('contactIdDisplayText'); |
|
|
|
const categoryDisplayText = document.getElementById('categoryDisplayText'); |
|
|
|
const productingValue = document.getElementById('productingValue'); |
|
|
|
const productingDisplayText = document.getElementById('productingDisplayText'); |
|
|
|
|
|
|
|
// 确保所有字段都是安全获取的 |
|
|
|
const formData = { |
|
|
|
@ -3967,7 +3763,7 @@ |
|
|
|
category: category ? category.value : '', |
|
|
|
price: price ? price.value : '', |
|
|
|
quantity: quantity ? quantity.value : '', |
|
|
|
grossWeight: '', // 斤重功能已隐藏 |
|
|
|
grossWeight: grossWeight ? grossWeight.value : '', |
|
|
|
yolk: yolk ? yolk.value : '', |
|
|
|
specification: specValue ? specValue.value : '', |
|
|
|
specificationDisplay: specDisplayText ? specDisplayText.textContent : '请选择规格', |
|
|
|
@ -3977,8 +3773,6 @@ |
|
|
|
region: regionValue ? regionValue.value : '', |
|
|
|
regionDisplay: regionDisplayText ? regionDisplayText.textContent : '请选择地区', |
|
|
|
contactId: contactId ? contactId.value : '', |
|
|
|
producting: productingValue ? productingValue.value : '', |
|
|
|
productingDisplay: productingDisplayText ? productingDisplayText.textContent : '请选择产品包装', |
|
|
|
// 保存其他自定义下拉框显示文本 |
|
|
|
sourceTypeDisplay: sourceTypeDisplayText ? sourceTypeDisplayText.textContent : '请选择货源类型', |
|
|
|
productNameDisplay: productNameDisplayText ? productNameDisplayText.textContent : '请选择商品名称', |
|
|
|
@ -4028,7 +3822,7 @@ |
|
|
|
category: document.getElementById('category').value, |
|
|
|
price: document.getElementById('price').value, |
|
|
|
quantity: document.getElementById('quantity').value, |
|
|
|
grossWeight: '', // 斤重功能已隐藏 |
|
|
|
grossWeight: document.getElementById('grossWeight').value, |
|
|
|
yolk: document.getElementById('yolk').value, |
|
|
|
specification: document.getElementById('specValue').value, |
|
|
|
supplyStatus: document.getElementById('supplyStatus').value, |
|
|
|
@ -4036,7 +3830,6 @@ |
|
|
|
description: document.getElementById('description').value, |
|
|
|
region: document.getElementById('regionValue').value, |
|
|
|
contactId: document.getElementById('contactId').value, |
|
|
|
producting: document.getElementById('productingValue').value, |
|
|
|
imageUrls: supplyData.uploadedImages, |
|
|
|
sellerId: userInfo.userId // 添加当前登录用户的userId作为sellerId |
|
|
|
}; |
|
|
|
@ -4587,11 +4380,7 @@ |
|
|
|
document.getElementById('editRegionValue').value = supply.region || ''; |
|
|
|
document.getElementById('editPrice').value = supply.price || ''; |
|
|
|
document.getElementById('editQuantity').value = supply.quantity || ''; |
|
|
|
// 斤重功能已隐藏 |
|
|
|
|
|
|
|
// 产品包装 |
|
|
|
document.getElementById('editProductingDisplayText').textContent = supply.producting || '请选择产品包装'; |
|
|
|
document.getElementById('editProductingValue').value = supply.producting || ''; |
|
|
|
document.getElementById('editGrossWeight').value = supply.grossWeight || ''; |
|
|
|
|
|
|
|
// 显示商品图片 |
|
|
|
const editUploadImages = document.getElementById('editUploadImages'); |
|
|
|
@ -5256,15 +5045,14 @@ |
|
|
|
category: document.getElementById('editCategory').value, |
|
|
|
price: document.getElementById('editPrice').value, |
|
|
|
quantity: document.getElementById('editQuantity').value, |
|
|
|
grossWeight: '', // 斤重功能已隐藏 |
|
|
|
grossWeight: document.getElementById('editGrossWeight').value, |
|
|
|
yolk: document.getElementById('editYolk').value, |
|
|
|
specification: document.getElementById('editSpecValue').value, |
|
|
|
supplyStatus: document.getElementById('editSupplyStatus').value, |
|
|
|
description: document.getElementById('editDescription').value, |
|
|
|
region: document.getElementById('editRegionValue').value, |
|
|
|
contactId: document.getElementById('editContactId').value, |
|
|
|
producting: document.getElementById('editProductingValue').value |
|
|
|
}; |
|
|
|
contactId: document.getElementById('editContactId').value |
|
|
|
}; |
|
|
|
|
|
|
|
// 验证表单 |
|
|
|
if (!formData.productName) { |
|
|
|
|