|
|
|
@ -2665,6 +2665,47 @@ |
|
|
|
if (supply) { |
|
|
|
// console.log('找到对应的货源:', supply.id, supply.productName); |
|
|
|
|
|
|
|
// 检查是否是预创建货源的倒计时 |
|
|
|
if (supply.status === 'pending' && supply.pre_create) { |
|
|
|
// 计算到预创建时间的剩余时间 |
|
|
|
const preCreateTime = new Date(supply.pre_create); |
|
|
|
const now = new Date(); |
|
|
|
const timeDiff = preCreateTime - now; |
|
|
|
|
|
|
|
if (timeDiff > 0) { |
|
|
|
// 计算剩余上架时间 |
|
|
|
const days = Math.floor(timeDiff / (1000 * 60 * 60 * 24)); |
|
|
|
const hours = Math.floor((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); |
|
|
|
const minutes = Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60)); |
|
|
|
const seconds = Math.floor((timeDiff % (1000 * 60)) / 1000); |
|
|
|
|
|
|
|
// 更新显示 |
|
|
|
let countdownText = ''; |
|
|
|
if (days > 0) { |
|
|
|
countdownText = `${days}天${hours}时${minutes}分`; |
|
|
|
} else if (hours > 0) { |
|
|
|
countdownText = `${hours}时${minutes}分`; |
|
|
|
} else { |
|
|
|
countdownText = `${minutes}分${seconds}秒`; |
|
|
|
} |
|
|
|
|
|
|
|
if (element.classList.contains('countdown-badge')) { |
|
|
|
element.textContent = `⏰ ${countdownText}`; |
|
|
|
element.style.background = 'linear-gradient(135deg, #4ecdc4, #45b7aa)'; |
|
|
|
element.style.boxShadow = '0 2px 4px rgba(78, 205, 196, 0.3)'; |
|
|
|
} |
|
|
|
return; // 跳过后续处理 |
|
|
|
} else { |
|
|
|
// 预创建时间已到 |
|
|
|
if (element.classList.contains('countdown-badge')) { |
|
|
|
element.textContent = '⏰ 已上架'; |
|
|
|
element.style.background = '#52c41a'; |
|
|
|
element.style.boxShadow = '0 2px 4px rgba(82, 196, 26, 0.3)'; |
|
|
|
} |
|
|
|
return; // 跳过后续处理 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否有显式设置的自动下架时间 |
|
|
|
if (supply.autoOfflineHours && supply.autoOfflineHours !== '' && supply.autoOfflineHours !== null) { |
|
|
|
// console.log('有显式设置的自动下架时间'); |
|
|
|
@ -3276,7 +3317,7 @@ |
|
|
|
<input type="text" class="spec-value" placeholder="请选择规格" readonly onclick="showSpecSelectModalForPair(this, 'pair')"> |
|
|
|
<input type="text" class="form-input quantity-input" placeholder="请输入件数" onwheel="this.blur()"> |
|
|
|
<input type="text" class="form-input costprice-input" placeholder="请输入采购价" onwheel="this.blur()"> |
|
|
|
<input type="text" class="form-input spec-status-input" placeholder="规格状态" value="0" onwheel="this.blur()" style="width: 120px;" readonly> |
|
|
|
<input type="text" class="form-input spec-status-input" placeholder="规格状态" value="0" onwheel="this.blur()" style="width: 120px; display: none;" readonly> |
|
|
|
<button type="button" class="remove-quantity-btn" onclick="removeSpecQuantityPair(this)">×</button> |
|
|
|
`; |
|
|
|
container.appendChild(pair); |
|
|
|
@ -4725,8 +4766,14 @@ |
|
|
|
console.log(`下架状态货源数量: ${supplyData.draftSupplies.length}`); |
|
|
|
console.log(`总货源数量: ${supplyData.supplies.length}`); |
|
|
|
|
|
|
|
// 合并已上架和预创建(pending)状态的货源到已上架列表 |
|
|
|
const combinedPublishedSupplies = [ |
|
|
|
...supplyData.publishedSupplies, |
|
|
|
...supplyData.supplies.filter(item => item.status === 'pending') |
|
|
|
]; |
|
|
|
|
|
|
|
// 渲染各个状态的货源列表 |
|
|
|
renderSupplyList('published', supplyData.publishedSupplies); |
|
|
|
renderSupplyList('published', combinedPublishedSupplies); |
|
|
|
renderSupplyList('pending', supplyData.pendingSupplies); |
|
|
|
renderSupplyList('rejected', supplyData.rejectedSupplies); |
|
|
|
renderSupplyList('draft', supplyData.draftSupplies); |
|
|
|
@ -4850,7 +4897,7 @@ |
|
|
|
'sold_out': { text: '已下架', class: 'status-draft' } |
|
|
|
}; |
|
|
|
|
|
|
|
const status = statusMap[supply.status] || { text: '未知', class: 'status-draft' }; |
|
|
|
const status = supply.status === 'pending' ? { text: '预', class: 'status-pending' } : statusMap[supply.status] || { text: '未知', class: 'status-draft' }; |
|
|
|
|
|
|
|
// 处理媒体文件(图片和视频) |
|
|
|
let firstMediaUrl = ''; |
|
|
|
@ -5023,6 +5070,7 @@ |
|
|
|
${supply.productName} |
|
|
|
${(supply.status === 'hidden' || supply.status === 'sold_out') ? '' : `<span class="supply-status ${status.class}">${status.text}</span>`} |
|
|
|
${supply.status === 'published' && supply.autoOfflineHours && supply.autoOfflineHours !== '' && supply.autoOfflineHours !== null ? `<span class="countdown-badge" data-id="${supply.id}" style="margin-left: 8px; padding: 4px 12px; background: linear-gradient(135deg, #ff6b6b, #ee5a6f); color: white; border-radius: 16px; font-size: 12px; font-weight: 500; box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3); display: inline-flex; align-items: center; gap: 4px;">⏰ 计算中...</span>` : ''} |
|
|
|
${supply.status === 'pending' && supply.pre_create ? `<span class="countdown-badge" data-id="${supply.id}" data-pre-create="${supply.pre_create}" style="margin-left: 8px; padding: 4px 12px; background: linear-gradient(135deg, #4ecdc4, #45b7aa); color: white; border-radius: 16px; font-size: 12px; font-weight: 500; box-shadow: 0 2px 4px rgba(78, 205, 196, 0.3); display: inline-flex; align-items: center; gap: 4px;">⏰ 计算中...</span>` : ''} |
|
|
|
<button class="copy-supply-btn" onclick="copySupply('${supply.id}')">复制</button> |
|
|
|
</div> |
|
|
|
<!-- 详细信息和规格-件数对在同一行,水平对齐 --> |
|
|
|
@ -5040,7 +5088,8 @@ |
|
|
|
<div class="detail-item">${supply.description || '无'}</div> |
|
|
|
<div class="detail-item">${supply.region || '未设置'}</div> |
|
|
|
<!-- 隐藏独立价格字段,因为每个规格-件数对都有自己的采购价 --> |
|
|
|
<div class="detail-item" style="font-size: 12px; color: #999; grid-column: 1 / -1;">创建时间:${formatDate(supply.created_at)}</div> |
|
|
|
<div class="detail-item" style="font-size: 12px; color: #999; grid-column: 1 / -1;">创建时间:${supply.status === 'pending' ? '待创建' : formatDate(supply.created_at)}</div> |
|
|
|
${supply.status === 'pending' && supply.pre_create ? `<div class="detail-item" style="font-size: 12px; color: #1890ff; grid-column: 1 / -1;">预计创建时间:${formatDate(supply.pre_create)}</div>` : ''} |
|
|
|
${supply.status === 'published' ? `<div class="detail-item" style="font-size: 12px; color: #999; grid-column: 1 / -1;">上架时间:${formatDate(getPublishTime(supply))}</div>` : ''} |
|
|
|
${(supply.status === 'hidden' || supply.status === 'sold_out') && supply.updated_at ? `<div class="detail-item" style="font-size: 12px; color: #999; grid-column: 1 / -1;">下架时间:${formatDate(supply.updated_at)}</div>` : ''} |
|
|
|
</div> |
|
|
|
@ -5484,7 +5533,7 @@ |
|
|
|
<input type="text" class="spec-value" placeholder="请选择规格" readonly onclick="showSpecSelectModalForPair(this)" value="${specifications[i] || ''}"> |
|
|
|
<input type="text" class="form-input quantity-input" placeholder="请输入件数" onwheel="this.blur()" value="${quantities[i] || ''}"> |
|
|
|
<input type="text" class="form-input costprice-input" placeholder="请输入采购价" onwheel="this.blur()" value="${costprices[i] || ''}"> |
|
|
|
<input type="text" class="form-input spec-status-input" placeholder="规格状态" value="${specStatuses[i] || '0'}" onwheel="this.blur()" style="width: 120px;" readonly> |
|
|
|
<input type="text" class="form-input spec-status-input" placeholder="规格状态" value="${specStatuses[i] || '0'}" onwheel="this.blur()" style="width: 120px; display: none;" readonly> |
|
|
|
<button type="button" class="remove-quantity-btn" onclick="removeSpecQuantityPair(this)">×</button> |
|
|
|
`; |
|
|
|
specQuantityPairs.appendChild(pair); |
|
|
|
@ -7551,7 +7600,7 @@ |
|
|
|
<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="${qty}"> |
|
|
|
<input type="text" class="form-input costprice-input" placeholder="请输入采购价" onwheel="this.blur()" value="${costprice}"> |
|
|
|
<input type="text" class="form-input spec-status-input" placeholder="规格状态" value="${specStatus}" onwheel="this.blur()" style="width: 120px;" readonly> |
|
|
|
<input type="text" class="form-input spec-status-input" placeholder="规格状态" value="${specStatus}" onwheel="this.blur()" style="width: 120px; display: none;" readonly> |
|
|
|
<button type="button" class="remove-quantity-btn" onclick="removeEditSpecQuantityPair(this)">×</button> |
|
|
|
`; |
|
|
|
specQuantityPairs.appendChild(pair); |
|
|
|
@ -7898,7 +7947,7 @@ |
|
|
|
<input type="text" class="spec-value" placeholder="请选择规格" readonly onclick="showEditSpecSelectModalForPair(this, 'pair')"> |
|
|
|
<input type="text" class="form-input quantity-input" placeholder="请输入件数" onwheel="this.blur()"> |
|
|
|
<input type="text" class="form-input costprice-input" placeholder="请输入采购价" onwheel="this.blur()"> |
|
|
|
<input type="text" class="form-input spec-status-input" placeholder="规格状态" value="0" onwheel="this.blur()" style="width: 120px;" readonly> |
|
|
|
<input type="text" class="form-input spec-status-input" placeholder="规格状态" value="0" onwheel="this.blur()" style="width: 120px; display: none;" readonly> |
|
|
|
<button type="button" class="remove-quantity-btn" onclick="removeEditSpecQuantityPair(this)">×</button> |
|
|
|
`; |
|
|
|
container.appendChild(pair); |
|
|
|
|