From 3e3b6279db6afe90c67c5504f5113e727bc92515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Fri, 5 Dec 2025 09:35:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A1=E6=A0=B8=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=8E=9F=E5=9B=A0=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E4=BF=9D=E4=B8=8E=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/seller/index.js | 161 +++++++++++++++++++++++++++++++++--------- 1 file changed, 128 insertions(+), 33 deletions(-) diff --git a/pages/seller/index.js b/pages/seller/index.js index 66af0ba..f6c5eea 100644 --- a/pages/seller/index.js +++ b/pages/seller/index.js @@ -2795,39 +2795,134 @@ Page({ const id = e.currentTarget.dataset.id; console.log('显示审核失败原因,货源ID:', id); - - // 在所有货源列表中查找 - let supply = null; - const allSupplies = [ - ...this.data.publishedSupplies, - ...this.data.pendingSupplies, - ...this.data.rejectedSupplies, - ...this.data.draftSupplies - ]; - - supply = allSupplies.find(s => s.id === id); - - // 如果没找到,尝试在主列表中查找 - if (!supply) { - supply = this.data.supplies.find(s => s.id === id); - } - - if (!supply) { - console.error('未找到ID为', id, '的货源'); - wx.showToast({ title: '未找到该货源', icon: 'none', duration: 2000 }); - return; - } - - console.log('找到货源信息:', supply); - - // 锁定页面滚动 - this.disablePageScroll(); - - // 设置当前显示的货源和失败原因 - this.setData({ - currentRejectSupply: supply, - rejectReason: supply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。', - showRejectReasonModal: true + + // 显示加载提示 + wx.showLoading({ + title: '获取最新审核原因...', + mask: true + }); + + // 重新获取审核失败商品列表,确保获取到最新的审核失败原因 + API.getProductList('rejected', { + page: 1, + pageSize: 20, + timestamp: new Date().getTime() + }).then(data => { + if (data && data.products && Array.isArray(data.products)) { + // 从最新获取的列表中查找当前商品 + const supply = data.products.find(product => product.id === id); + + if (supply) { + console.log('找到最新货源信息:', supply); + + // 更新本地审核失败商品列表 + this.setData({ + rejectedSupplies: data.products + }); + + // 锁定页面滚动 + this.disablePageScroll(); + + // 设置当前显示的货源和最新的失败原因 + this.setData({ + currentRejectSupply: supply, + rejectReason: supply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。', + showRejectReasonModal: true + }); + } else { + // 如果在最新列表中没找到,尝试在本地所有列表中查找 + let localSupply = null; + const allSupplies = [ + ...this.data.publishedSupplies, + ...this.data.pendingSupplies, + ...this.data.rejectedSupplies, + ...this.data.draftSupplies, + ...this.data.supplies + ]; + + localSupply = allSupplies.find(s => s.id === id); + + if (localSupply) { + console.log('在本地列表中找到货源信息:', localSupply); + + // 锁定页面滚动 + this.disablePageScroll(); + + // 设置当前显示的货源和失败原因 + this.setData({ + currentRejectSupply: localSupply, + rejectReason: localSupply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。', + showRejectReasonModal: true + }); + } else { + console.error('未找到ID为', id, '的货源'); + wx.showToast({ title: '未找到该货源', icon: 'none', duration: 2000 }); + } + } + } else { + // 如果获取列表失败,尝试在本地所有列表中查找 + let supply = null; + const allSupplies = [ + ...this.data.publishedSupplies, + ...this.data.pendingSupplies, + ...this.data.rejectedSupplies, + ...this.data.draftSupplies, + ...this.data.supplies + ]; + + supply = allSupplies.find(s => s.id === id); + + if (supply) { + console.log('在本地列表中找到货源信息:', supply); + + // 锁定页面滚动 + this.disablePageScroll(); + + // 设置当前显示的货源和失败原因 + this.setData({ + currentRejectSupply: supply, + rejectReason: supply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。', + showRejectReasonModal: true + }); + } else { + console.error('未找到ID为', id, '的货源'); + wx.showToast({ title: '未找到该货源', icon: 'none', duration: 2000 }); + } + } + }).catch(err => { + console.error('获取审核失败商品列表失败:', err); + + // 失败时,尝试在本地所有列表中查找 + let supply = null; + const allSupplies = [ + ...this.data.publishedSupplies, + ...this.data.pendingSupplies, + ...this.data.rejectedSupplies, + ...this.data.draftSupplies, + ...this.data.supplies + ]; + + supply = allSupplies.find(s => s.id === id); + + if (supply) { + console.log('在本地列表中找到货源信息:', supply); + + // 锁定页面滚动 + this.disablePageScroll(); + + // 设置当前显示的货源和失败原因 + this.setData({ + currentRejectSupply: supply, + rejectReason: supply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。', + showRejectReasonModal: true + }); + } else { + console.error('未找到ID为', id, '的货源'); + wx.showToast({ title: '未找到该货源', icon: 'none', duration: 2000 }); + } + }).finally(() => { + // 隐藏加载提示 + wx.hideLoading(); }); },