Browse Source

Merge pull request 'Xfy' (#15) from Xfy into Main

Reviewed-on: http://8.137.125.67:4000/SwtTt29/Program-mini/pulls/15
pull/1/head
SwtTt29 3 months ago
parent
commit
69e8965fbf
  1. 26
      pages/buyer/index.js
  2. 163
      pages/seller/index.js
  3. 15
      pages/settlement/index.js
  4. 3
      pages/settlement/index.wxss

26
pages/buyer/index.js

@ -1211,6 +1211,19 @@ Page({
// 预览图片 // 预览图片
previewImage(e) { previewImage(e) {
// 登录验证
const userInfo = wx.getStorageSync('userInfo') || null
const userId = wx.getStorageSync('userId') || null
if (!userInfo || !userId) {
// 未登录,显示授权登录弹窗
this.setData({
showAuthModal: true,
pendingUserType: 'buyer'
})
return
}
// 已登录,执行图片预览
const { urls, index } = e.currentTarget.dataset const { urls, index } = e.currentTarget.dataset
this.setData({ this.setData({
showImagePreview: true, showImagePreview: true,
@ -1221,6 +1234,19 @@ Page({
// 预览图片 // 预览图片
previewImage(e) { previewImage(e) {
// 登录验证
const userInfo = wx.getStorageSync('userInfo') || null
const userId = wx.getStorageSync('userId') || null
if (!userInfo || !userId) {
// 未登录,显示授权登录弹窗
this.setData({
showAuthModal: true,
pendingUserType: 'buyer'
})
return
}
// 已登录,执行图片预览
const { urls, index } = e.currentTarget.dataset const { urls, index } = e.currentTarget.dataset
this.setData({ this.setData({
showImagePreview: true, showImagePreview: true,

163
pages/seller/index.js

@ -2795,39 +2795,134 @@ Page({
const id = e.currentTarget.dataset.id; const id = e.currentTarget.dataset.id;
console.log('显示审核失败原因,货源ID:', id); console.log('显示审核失败原因,货源ID:', id);
// 在所有货源列表中查找 // 显示加载提示
let supply = null; wx.showLoading({
const allSupplies = [ title: '获取最新审核原因...',
...this.data.publishedSupplies, mask: true
...this.data.pendingSupplies, });
...this.data.rejectedSupplies,
...this.data.draftSupplies // 重新获取审核失败商品列表,确保获取到最新的审核失败原因
]; API.getProductList('rejected', {
page: 1,
supply = allSupplies.find(s => s.id === id); pageSize: 20,
timestamp: new Date().getTime()
// 如果没找到,尝试在主列表中查找 }).then(data => {
if (!supply) { if (data && data.products && Array.isArray(data.products)) {
supply = this.data.supplies.find(s => s.id === id); // 从最新获取的列表中查找当前商品
} const supply = data.products.find(product => product.id === id);
if (!supply) { if (supply) {
console.error('未找到ID为', id, '的货源'); console.log('找到最新货源信息:', supply);
wx.showToast({ title: '未找到该货源', icon: 'none', duration: 2000 });
return; // 更新本地审核失败商品列表
} this.setData({
rejectedSupplies: data.products
console.log('找到货源信息:', supply); });
// 锁定页面滚动 // 锁定页面滚动
this.disablePageScroll(); this.disablePageScroll();
// 设置当前显示的货源和失败原因 // 设置当前显示的货源和最新的失败原因
this.setData({ this.setData({
currentRejectSupply: supply, currentRejectSupply: supply,
rejectReason: supply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。', rejectReason: supply.rejectReason || '暂无详细的审核失败原因,请联系客服了解详情。',
showRejectReasonModal: true 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();
}); });
}, },
@ -3572,7 +3667,7 @@ Page({
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
wx.makePhoneCall({ wx.makePhoneCall({
phoneNumber: '123456', phoneNumber: '18140203880',
success: () => { success: () => {
console.log('拨打电话成功'); console.log('拨打电话成功');
}, },

15
pages/settlement/index.js

@ -33,7 +33,7 @@ Page({
// 审核状态 // 审核状态
partnerstatus: '', // 合作商状态 (原auditStatus),初始为空而不是默认审核中 partnerstatus: '', // 合作商状态 (原auditStatus),初始为空而不是默认审核中
reasonforfailure: '营业执照图片不清晰,无法识别关键信息。请重新上传清晰的LICENSE照片。', reasonforfailure: '', // 审核失败原因,初始为空,由服务器数据填充
// 登录弹窗相关 // 登录弹窗相关
showAuthModal: false, showAuthModal: false,
@ -83,6 +83,8 @@ Page({
currentStep: 3, currentStep: 3,
partnerstatus: settlementStatus partnerstatus: settlementStatus
}); });
// 同步服务器状态,确保显示最新的审核失败原因
this.syncSettlementStatus();
return; // 直接返回,不执行后续逻辑 return; // 直接返回,不执行后续逻辑
} }
@ -1139,10 +1141,15 @@ Page({
console.log('用户完整数据:', res.data); console.log('用户完整数据:', res.data);
// 更新本地状态 // 更新本地状态
if (res.data && res.data.partnerstatus) { if (res.data) {
wx.setStorageSync('settlementStatus', res.data.partnerstatus); if (res.data.partnerstatus) {
wx.setStorageSync('settlementStatus', res.data.partnerstatus);
}
// 同步审核失败原因
const auditFailedReason = res.data.reasonforfailure || '';
this.setData({ this.setData({
partnerstatus: res.data.partnerstatus partnerstatus: res.data.partnerstatus || '',
auditFailedReason: auditFailedReason
}); });
} }

3
pages/settlement/index.wxss

@ -1357,6 +1357,9 @@ picker {
font-size: 26rpx; font-size: 26rpx;
color: #666; color: #666;
line-height: 1.4; line-height: 1.4;
white-space: normal;
word-wrap: break-word;
word-break: break-all;
} }
.btn-audit { .btn-audit {

Loading…
Cancel
Save