diff --git a/pages/seller/index.js b/pages/seller/index.js index 1d53273..32272fb 100644 --- a/pages/seller/index.js +++ b/pages/seller/index.js @@ -46,6 +46,8 @@ Page({ grossWeight: '', // 【新增】毛重字段,支持中文 imageUrls: [] // 图片URL数组,支持多张图片 }, + newSupplyRegionArray: [], // 新创建货源的省市区数组 + editSupplyRegionArray: [], // 编辑货源的省市区数组, editSupply: { yolkIndex: 0, specIndex: 0 @@ -1315,6 +1317,37 @@ Page({ } }) }, + + // 新创建货源地区选择处理 + onNewSupplyRegionChange(e) { + const regionArray = e.detail.value + const region = regionArray.join(' ') + + this.setData({ + newSupplyRegionArray: regionArray, + newSupply: { + ...this.data.newSupply, + region: region + } + }) + + // 实时保存到本地存储 + wx.setStorageSync('newSupplyDraft', this.data.newSupply); + }, + + // 编辑货源地区选择处理 + onEditSupplyRegionChange(e) { + const regionArray = e.detail.value + const region = regionArray.join(' ') + + this.setData({ + editSupplyRegionArray: regionArray, + editSupply: { + ...this.data.editSupply, + region: region + } + }) + }, // 处理蛋黄选择变更 onYolkChange(e) { @@ -2182,9 +2215,18 @@ Page({ specIndex: specIndex }; + // 解析地区字符串为省市区数组,用于初始化三级下拉框 + let editSupplyRegionArray = []; + if (supply.region) { + // 尝试将地区字符串拆分为省市区数组 + // 假设地区格式为 "省份 城市 区县" + editSupplyRegionArray = supply.region.split(' ').filter(item => item.trim() !== ''); + } + console.log('【调试】编辑弹窗数据设置:', { supplyRegion: supply.region, - editSupplyRegion: supplyWithFormattedTime.region + editSupplyRegion: supplyWithFormattedTime.region, + editSupplyRegionArray: editSupplyRegionArray }); // 如果是上架操作,设置自动上架标志 @@ -2202,6 +2244,7 @@ Page({ this.setData({ editSupply: supplyWithFormattedTime, + editSupplyRegionArray: editSupplyRegionArray, showEditModal: true }); diff --git a/pages/seller/index.wxml b/pages/seller/index.wxml index 955270f..d7fa512 100644 --- a/pages/seller/index.wxml +++ b/pages/seller/index.wxml @@ -538,7 +538,15 @@ 地区 - + + {{newSupply.region || '请选择省市区'}} + @@ -613,7 +621,15 @@ 地区 - + + {{editSupply.region || '请选择省市区'}} + diff --git a/pages/seller/index.wxss b/pages/seller/index.wxss index dc94f92..ddf5b6f 100644 --- a/pages/seller/index.wxss +++ b/pages/seller/index.wxss @@ -645,9 +645,9 @@ button { text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2); } -/* 半页空白页样式 */ +/* 四分之一页空白页样式 */ .half-page-blank { - height: 50vh; + height: 25vh; background-color: transparent; } diff --git a/pages/settlement/index.js b/pages/settlement/index.js index 1811290..9bc1034 100644 --- a/pages/settlement/index.js +++ b/pages/settlement/index.js @@ -183,22 +183,34 @@ Page({ await this.syncSettlementStatus(); // 根据入驻状态处理 - if (this.data.partnerstatus === 'approved' || this.data.partnerstatus === 'underreview') { - console.log('用户已入驻或审核中,直接进入相应页面'); + if (this.data.partnerstatus === 'approved') { + console.log('用户已入驻成功,直接进入审核状态页面'); + this.setData({ + showGuidePage: false, + currentStep: 3 // 审核状态页面 + }); + } else if (this.data.partnerstatus === 'underreview') { + console.log('用户申请正在审核中,直接进入审核状态页面'); this.setData({ showGuidePage: false, currentStep: 3 // 审核状态页面 }); } else { - console.log('用户未入驻,正常进行入驻流程'); + console.log('用户未入驻或审核失败,开始入驻流程'); this.setData({ - showGuidePage: false + showGuidePage: false, + currentStep: 0 // 进入第一步:选择身份 }); } } catch (error) { console.error('检查入驻状态时出错:', error); + // 出错时仍允许用户开始入驻流程 + this.setData({ + showGuidePage: false, + currentStep: 0 // 进入第一步:选择身份 + }); wx.showToast({ - title: '系统繁忙,请稍后再试', + title: '获取状态失败,已进入入驻流程', icon: 'none' }); } @@ -1048,7 +1060,7 @@ Page({ }, // 重新提交备案 - async resubmitApplication() { + resubmitApplication() { try { // 检查用户是否已登录 const openid = wx.getStorageSync('openid'); @@ -1061,52 +1073,51 @@ Page({ return; // 取消重新提交申请 } - const API = require('../../utils/api.js'); - const applicationId = wx.getStorageSync('applicationId'); - - if (!applicationId) { - wx.showToast({ - title: '未找到申请记录', - icon: 'none' - }); - return; - } - - wx.showLoading({ - title: '正在重新提交...', - mask: true - }); - - const result = await API.resubmitSettlementApplication(applicationId); - - wx.hideLoading(); + // 更新本地状态 + wx.setStorageSync('settlementStatus', ''); + wx.removeStorageSync('applicationId'); - if (result && result.success) { - // 更新本地状态 - wx.setStorageSync('settlementStatus', ''); + // 重置表单数据,让用户重新开始入驻流程 + this.setData({ + // 重置步骤 + currentStep: 0, + partnerstatus: null, + showGuidePage: true, - // 让用户重新走一遍入驻流程,但保留初始填写的数据 - this.setData({ - currentStep: 0, // 重置为第一步,让用户重新填写 - partnerstatus: null, // 将合作商状态设置为Null - showGuidePage: true // 显示引导页面 - }); + // 重置身份选择 + collaborationid: '', + showIdentityError: false, - wx.showToast({ - title: '重新提交成功,请重新填写并提交申请', - icon: 'success' - }); - } else { - wx.showToast({ - title: result.message || '重新提交失败', - icon: 'none' - }); - } + // 重置基本信息 + company: '', + showCompanyNameError: false, + companyNameError: '', + province: '', + city: '', + district: '', + detailedaddress: '', + showRegionError: false, + regionError: '', + cooperation: '', + showCooperationError: false, + cooperationError: '', + + // 重置上传资料 + businesslicenseurl: null, + proofurl: null, + + // 重置审核相关 + auditFailedReason: '' + }); + + wx.showToast({ + title: '已进入重新申请流程', + icon: 'success' + }); } catch (error) { - wx.hideLoading(); - console.error('重新提交申请失败:', error); + console.error('重新开始申请失败:', error); wx.showToast({ - title: '重新提交失败,请重试', + title: '操作失败,请重试', icon: 'none' }); } @@ -1190,7 +1201,7 @@ Page({ console.log('已同步服务器入驻状态:', userData.partnerstatus); // 根据partnerstatus更新页面步骤 - if (userData.partnerstatus === 'approved' || userData.partnerstatus === 'reviewfailed') { + if (userData.partnerstatus === 'approved' || userData.partnerstatus === 'underreview' || userData.partnerstatus === 'reviewfailed') { this.setData({ showGuidePage: false, currentStep: 3