From e79c8eda8a0bb32c8366327e7401ce240d833fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=81=E6=9D=B0?= <727475508@qq.com> Date: Mon, 1 Jun 2026 13:53:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E9=A9=BB=E6=B5=81=E7=A8=8B=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/artisan/profile.vue | 1162 ++++++++++----------- pages/ruzhu/ruzhu.vue | 1279 ++++++++++++------------ pages/ruzhu/sj-info.vue | 191 +++- pages/shop/qualification_sj_change.vue | 621 ++++++++---- 4 files changed, 1836 insertions(+), 1417 deletions(-) diff --git a/pages/artisan/profile.vue b/pages/artisan/profile.vue index 629d01d..7c9d35d 100644 --- a/pages/artisan/profile.vue +++ b/pages/artisan/profile.vue @@ -191,645 +191,645 @@ \ No newline at end of file diff --git a/pages/ruzhu/ruzhu.vue b/pages/ruzhu/ruzhu.vue index 46efb3b..aa64e95 100644 --- a/pages/ruzhu/ruzhu.vue +++ b/pages/ruzhu/ruzhu.vue @@ -95,712 +95,719 @@ + .submit-text { + color: #ffffff; + font-size: 32rpx; + font-weight: 500; + } + + .showziliao { + width: 690rpx; + height: 98rpx; + background: #FF4767; + border-radius: 49rpx; + } + + .showziliaotext { + height: 40rpx; + font-family: PingFangSC, PingFang SC; + font-weight: 500; + font-size: 32rpx; + color: #FFFFFF; + line-height: 96rpx; + font-style: normal; + margin: 0 0 0 281rpx; + align-items: center; + } + \ No newline at end of file diff --git a/pages/ruzhu/sj-info.vue b/pages/ruzhu/sj-info.vue index b0cdc2d..b5496e2 100644 --- a/pages/ruzhu/sj-info.vue +++ b/pages/ruzhu/sj-info.vue @@ -55,11 +55,14 @@ - + 注册详细地址 - + + {{ formData.uscc_address || '请选择' }} + + @@ -295,6 +298,11 @@ export default { uscc_name: '', uscc_dependency: '', uscc_address: '', + uscc_province: '', + uscc_city: '', + uscc_area: '', + longitude: '', + latitude: '', legal_idcard_positive: '', legal_idcard_negative: '', legal_name: '', @@ -318,7 +326,9 @@ export default { isRecognizing: false, recognizeType: '', userId: null, - identity: 3 + identity: 3, + addressListener: null, + sjAddressListener: null } }, @@ -344,6 +354,10 @@ export default { await this.getUserInfo(); this.regionCitys = this.ChinaCitys[0].citys; this.regionAreas = this.regionCitys[0].areas; + this.setupAddressListener(); + }, + beforeDestroy() { + this.removeAddressListener(); }, methods: { @@ -495,6 +509,18 @@ export default { let city = this.regionCitys[index2].city; let area = this.regionAreas[index3].area; this.formData.uscc_dependency = province + '-' + city + '-' + area; + if (this.ChinaCitys[index1] && this.ChinaCitys[index1].code) { + this.formData.uscc_province = String(this.ChinaCitys[index1].code).substring(0, 6); + } + if (this.regionCitys[index2] && this.regionCitys[index2].code) { + this.formData.uscc_city = String(this.regionCitys[index2].code).substring(0, 6); + } + if (this.regionAreas[index3] && this.regionAreas[index3].code) { + this.formData.uscc_area = String(this.regionAreas[index3].code).substring(0, 6); + } + this.formData.uscc_address = ''; + this.formData.longitude = ''; + this.formData.latitude = ''; this.hideRegionPopup(); }, @@ -543,6 +569,163 @@ export default { this.hideDatePicker(); }, + buildRegionTextForSearch() { + const dependency = String(this.formData.uscc_dependency || '').trim(); + if (!dependency) return ''; + const parts = dependency.split('-'); + const province = parts[0] || ''; + const city = parts[1] || ''; + const district = parts[2] || ''; + let regionText = ''; + if (province) regionText += province; + if (city && city !== province) regionText += city; + if (district) regionText += district; + return regionText; + }, + + getAddressValueForSearch() { + const rawAddress = String(this.formData.uscc_address || '').trim(); + if (!rawAddress) return ''; + const dependencyText = String(this.formData.uscc_dependency || '').trim(); + const regionText = this.buildRegionTextForSearch(); + let detail = rawAddress; + if (regionText && detail.indexOf(regionText) === 0) { + detail = detail.slice(regionText.length).trim(); + } else if (dependencyText && detail.indexOf(dependencyText) === 0) { + detail = detail.slice(dependencyText.length).trim(); + } + detail = detail.replace(/^[\s,-]+/, '').trim(); + return detail || rawAddress; + }, + + getAddressInfo() { + const dependency = String(this.formData.uscc_dependency || '').trim(); + const dependencyCode = String(this.formData.uscc_area || '').trim(); + const address = this.getAddressValueForSearch(); + const longitude = String(this.formData.longitude || '').trim(); + const latitude = String(this.formData.latitude || '').trim(); + + const hasDependency = !!dependency; + const hasAddress = !!address; + const hasLocation = !!(longitude && latitude); + + let params = 'source=sj_info'; + + if (hasDependency) { + params += `&dependency=${encodeURIComponent(dependency)}`; + if (dependencyCode) { + params += `&dependency_code=${dependencyCode}`; + } + } + if (hasAddress) { + params += `&address=${encodeURIComponent(address)}`; + } + if (hasLocation) { + params += `&longitude=${longitude}&latitude=${latitude}`; + } + if (!hasDependency && !hasAddress && !hasLocation) { + params += '&init_current_location=1&silent_locate=1'; + } + + uni.navigateTo({ + url: `/pages/address/search?${params}` + }); + }, + + setupAddressListener() { + this.addressListener = (addressData) => { + this.handleAddressSelected(addressData); + }; + this.sjAddressListener = (addressData) => { + this.handleAddressSelected(addressData); + }; + uni.$on('address-selected', this.addressListener); + uni.$on('address-selected-for-sj', this.sjAddressListener); + }, + + removeAddressListener() { + if (this.addressListener) { + uni.$off('address-selected', this.addressListener); + this.addressListener = null; + } + if (this.sjAddressListener) { + uni.$off('address-selected-for-sj', this.sjAddressListener); + this.sjAddressListener = null; + } + }, + + checkAddressData() { + try { + const storedAddress = uni.getStorageSync('sj_selected_address'); + if (storedAddress) { + this.handleAddressSelected(storedAddress); + uni.removeStorageSync('sj_selected_address'); + return; + } + } catch (e) { } + + if (getApp().globalData && getApp().globalData.selectedAddress) { + this.handleAddressSelected(getApp().globalData.selectedAddress); + delete getApp().globalData.selectedAddress; + } + + try { + const selectedAddress = uni.getStorageSync('selectedAddress'); + if (selectedAddress) { + this.handleAddressSelected(selectedAddress); + uni.removeStorageSync('selectedAddress'); + } + } catch (e) { } + }, + + handleAddressSelected(addressData) { + if (!addressData) return; + + let detailAddress = ''; + if (addressData.address) { + detailAddress = String(addressData.address).trim(); + } else if (addressData.name) { + detailAddress = String(addressData.name).trim(); + const regionParts = []; + if (addressData.pname) regionParts.push(addressData.pname); + if (addressData.cityname && addressData.cityname !== addressData.pname) regionParts.push(addressData.cityname); + if (addressData.adname) regionParts.push(addressData.adname); + const regionText = regionParts.join(''); + if (regionText && detailAddress.indexOf(regionText) === 0) { + detailAddress = detailAddress.slice(regionText.length).trim(); + } + detailAddress = detailAddress.replace(/^[\s,-]+/, '').trim(); + } + + this.$set(this.formData, 'uscc_address', detailAddress); + + if (addressData.location) { + const [longitude, latitude] = String(addressData.location).split(','); + this.$set(this.formData, 'longitude', longitude || ''); + this.$set(this.formData, 'latitude', latitude || ''); + } + + if (addressData.pname || addressData.cityname || addressData.adname) { + const locationParts = []; + if (addressData.pname) locationParts.push(addressData.pname); + if (addressData.cityname) locationParts.push(addressData.cityname); + if (addressData.adname) locationParts.push(addressData.adname); + this.$set(this.formData, 'uscc_dependency', locationParts.join('-')); + } + + if (addressData.provinceCode) { + this.$set(this.formData, 'uscc_province', String(addressData.provinceCode).substring(0, 6)); + } + if (addressData.cityCode) { + this.$set(this.formData, 'uscc_city', String(addressData.cityCode).substring(0, 6)); + } + if (addressData.districtCode) { + this.$set(this.formData, 'uscc_area', String(addressData.districtCode).substring(0, 6)); + } + + this.$forceUpdate(); + }, + async recognizeBusinessLicense(imageUrl) { try { this.isRecognizing = true; diff --git a/pages/shop/qualification_sj_change.vue b/pages/shop/qualification_sj_change.vue index 9bc58e9..de7f180 100644 --- a/pages/shop/qualification_sj_change.vue +++ b/pages/shop/qualification_sj_change.vue @@ -6,7 +6,7 @@ 请变更您需要变更的信息 - + @@ -23,8 +23,11 @@ - - + + 请上传营业执照原件 @@ -36,27 +39,31 @@ 商户类型 - + 证件号码 - + - + 企业名称 - + - + @@ -72,12 +79,17 @@ - + 注册详细地址 - + + + {{ displayData.uscc_address || '请选择' }} + + + @@ -94,25 +106,31 @@ 身份证照片 请保证图片上的文字清晰、无遮挡、证件边角可见 - + - - + + 请上传身份证正面(人像面) - + - - + + 请上传身份证反面(国徽面) @@ -125,22 +143,24 @@ 法人代表 - + - + 法人联系方式 - + 法人身份证号 - + @@ -149,13 +169,17 @@ - + 长久有效 - + 指定日期有效 @@ -169,23 +193,25 @@ 开始日期 - {{formatDateForDisplay(displayData.idcard_start_date) || '请选择日期'}} + {{ formatDateForDisplay(displayData.idcard_start_date) || '请选择日期' }} - + 结束日期 - + - {{formatDateForDisplay(displayData.idcard_end_date) || '请选择日期'}} + {{ formatDateForDisplay(displayData.idcard_end_date) || '请选择日期' }} - @@ -200,10 +226,11 @@ 其他信息 - + 行业资质 - + × @@ -231,7 +258,7 @@ - + @@ -283,12 +310,14 @@ - + - + - {{item.label}} + {{ item.label }} @@ -310,16 +339,16 @@ 确定 - + - {{year}}年 + {{ year }}年 - {{month}}月 + {{ month }}月 - {{day}}日 + {{ day }}日 @@ -331,8 +360,10 @@ - - + + {{ tipTitle }} @@ -392,13 +423,13 @@ - 美融融plus 对储存空间/照片权限申请说明 - 便于您使用该功能上传您的照片/图片/视频以及用于更换头像、发布商品等场景中读取相册和文件内容。 + 美融融plus 对储存空间/照片权限申请说明 + 便于您使用该功能上传您的照片/图片/视频以及用于更换头像、发布商品等场景中读取相册和文件内容。 - 美融融plus 对相机拍摄权限申请说明 - 便于您使用该功能上传您的照片/图片/视频以及用于更换头像、发布商品等场景中所需内容。 + 美融融plus 对相机拍摄权限申请说明 + 便于您使用该功能上传您的照片/图片/视频以及用于更换头像、发布商品等场景中所需内容。 @@ -416,10 +447,10 @@ export default { data() { const currentDate = new Date(); const currentYear = new Date().getFullYear(); - const years = Array.from({length: 130}, (_, i) => 1970 + i); - const months = Array.from({length: 12}, (_, i) => i + 1); - const days = Array.from({length: 31}, (_, i) => i + 1); - + const years = Array.from({ length: 130 }, (_, i) => 1970 + i); + const months = Array.from({ length: 12 }, (_, i) => i + 1); + const days = Array.from({ length: 31 }, (_, i) => i + 1); + return { // 页面状态 editable: false, @@ -432,7 +463,7 @@ export default { buttonAreaHeight: 120, backText: '', hasResubmitted: false, - + // 数据管理 originalData: {}, pendingData: {}, @@ -471,6 +502,8 @@ export default { regionCitys: [], regionAreas: [], regionValue: [0, 0, 0], + addressListener: null, + sjAddressListener: null, } }, computed: { @@ -481,13 +514,15 @@ export default { onLoad(options) { console.log('资质信息变更页面开始加载...'); this.identity = getApp().globalData.artisanType; - + this.hasResubmitted = false; this.backText = ''; - + this.regionCitys = this.ChinaCitys[0].citys; this.regionAreas = this.regionCitys[0].areas; - + + this.setupAddressListener(); + this.getUserInfo().then(() => { this.loadApplyDetails(); }); @@ -496,19 +531,18 @@ export default { this.getButtonAreaHeight(); }, onShow() { - // 只有在非编辑状态下才重新加载数据 + this.checkAddressData(); if (!this.editable) { - console.log('非编辑状态,刷新数据'); this.loadApplyDetails(); - if (this.auditStatus !== 3) { this.backText = ''; this.hasResubmitted = false; } - } else { - console.log('编辑状态,保持当前状态不刷新'); } }, + onUnload() { + this.removeAddressListener(); + }, methods: { /** * 识别营业执照 @@ -517,7 +551,7 @@ export default { try { this.isRecognizing = true; this.recognizeType = 'business_license'; - + // 调用OCR接口 const result = await recognizeBusinessLicense(imageUrl); console.log('营业执照识别结果:', result); @@ -532,7 +566,7 @@ export default { this.isRecognizing = false; return; } - + // 填充营业执照信息 let recognizedFields = 0; @@ -544,12 +578,12 @@ export default { // 如果是"无"或空值,设置为空字符串 this.displayData.uscc_name = ''; } - + if (result.uscc_num && result.uscc_num.trim()) { this.displayData.uscc_num = result.uscc_num; recognizedFields++; } - + // if (result.legal_name && result.legal_name.trim()) { // this.displayData.legal_name = result.legal_name; // recognizedFields++; @@ -570,14 +604,14 @@ export default { duration: 3000 }); } - + } catch (error) { uni.showToast({ title: error.message || '识别失败,请手动填写', icon: 'none', }); console.error('营业执照识别失败:', error); - + } finally { this.isRecognizing = false; } @@ -586,16 +620,16 @@ export default { // 检查营业执照识别结果是否有效 checkBusinessLicenseRecognition(result) { const requiredFields = ['uscc_num', 'uscc_name', 'legal_name', 'uscc_type']; - + for (const field of requiredFields) { if (result[field] && result[field].trim()) { return true; } } - + return false; }, - + /** * 识别身份证正面 */ @@ -603,18 +637,18 @@ export default { try { this.isRecognizing = true; this.recognizeType = 'idcard_front'; - + uni.showLoading({ title: '正在识别身份证正面...', mask: true }); - + // 调用OCR接口 const result = await recognizeIdCard(imageUrl, 1); // 验证是否真的识别到了数据 const hasRecognizedData = this.checkIdCardFrontRecognition(result); - + if (!hasRecognizedData) { uni.hideLoading(); uni.showToast({ @@ -625,22 +659,22 @@ export default { this.isRecognizing = false; return; } - + // 填充身份证正面信息 if (result.name) { this.displayData.legal_name = result.name; } - + if (result.id_number) { this.displayData.legal_idcard_num = result.id_number; } - + uni.hideLoading(); uni.showToast({ title: '身份证正面识别成功', icon: 'none' }); - + } catch (error) { console.error('身份证正面识别失败:', error); uni.hideLoading(); @@ -658,7 +692,7 @@ export default { checkIdCardFrontRecognition(result) { return (result.name && result.name.trim()) || (result.id_number && result.id_number.trim()); }, - + /** * 识别身份证反面 */ @@ -666,18 +700,18 @@ export default { try { this.isRecognizing = true; this.recognizeType = 'idcard_back'; - + uni.showLoading({ title: '正在识别身份证反面...', mask: true }); - + // 调用OCR接口 const result = await recognizeIdCard(imageUrl, 2); // 验证是否真的识别到了数据 const hasRecognizedData = this.checkIdCardBackRecognition(result); - + if (!hasRecognizedData) { uni.hideLoading(); uni.showToast({ @@ -688,15 +722,15 @@ export default { this.isRecognizing = false; return; } - + // 解析有效期 const validPeriod = parseValidPeriod(result.start_date, result.end_date); - + // 填充有效期数据 if (validPeriod.startDate) { this.displayData.idcard_start_date = validPeriod.startDate; } - + if (validPeriod.isPermanent) { this.displayData.legal_idcard_expiry_type = 1; this.displayData.idcard_end_date = '长久有效'; @@ -704,20 +738,20 @@ export default { this.displayData.legal_idcard_expiry_type = 2; this.displayData.idcard_end_date = validPeriod.endDate; } - + // 如果是长期有效,自动选择对应的选项 if (validPeriod.isPermanent) { this.setIdcardValidType('permanent'); } else { this.setIdcardValidType('date'); } - + uni.hideLoading(); uni.showToast({ title: '身份证反面识别成功', icon: 'none' }); - + } catch (error) { console.error('身份证反面识别失败:', error); uni.hideLoading(); @@ -733,8 +767,8 @@ export default { // 检查身份证反面识别结果是否有效 checkIdCardBackRecognition(result) { - return (result.start_date && result.start_date.trim()) || - (result.end_date && result.end_date.trim()); + return (result.start_date && result.start_date.trim()) || + (result.end_date && result.end_date.trim()); }, // 获取商户类型文本 @@ -751,7 +785,7 @@ export default { if (result.state === 1) { this.userId = result.data.id; console.log('用户ID获取成功:', this.userId); - + this.populateFormDataFromUserInfo(result.data); resolve(this.userId); } else { @@ -768,7 +802,7 @@ export default { // 从用户信息中填充表单数据 populateFormDataFromUserInfo(userData) { console.log('从用户信息填充表单数据:', userData); - + // 初始化老数据 this.originalData = { uscc_type: userData.uscc_type ? String(userData.uscc_type) : null, @@ -777,6 +811,11 @@ export default { uscc_name: userData.uscc_name || '', uscc_dependency: userData.uscc_dependency || '', uscc_address: userData.uscc_address || '', + uscc_province: userData.uscc_province || '', + uscc_city: userData.uscc_city || '', + uscc_area: userData.uscc_area || '', + longitude: userData.longitude || '', + latitude: userData.latitude || '', uscc_expiry_type: userData.uscc_expiry_type || null, uscc_expiry: userData.uscc_expiry || '', license_start_date: '', @@ -831,18 +870,18 @@ export default { // 处理营业执照有效期 processLicenseExpiry(expiry, targetData) { if (!expiry) return; - + console.log('处理营业执照有效期:', expiry); - + // 处理多种可能的分隔符 if (expiry.includes('——') || expiry.includes('--') || expiry.includes('-')) { const separator = expiry.includes('——') ? '——' : (expiry.includes('--') ? '--' : '-'); const [startStr, endStr] = expiry.split(separator); const startDate = startStr.trim(); const endDate = endStr.trim(); - + console.log('营业执照开始日期:', startDate, '结束日期:', endDate); - + if (endDate === '长久' || !endDate) { targetData.uscc_expiry_type = 1; targetData.license_start_date = this.formatDateFromBackend(startDate); @@ -861,18 +900,18 @@ export default { // 处理身份证有效期 processIdcardExpiry(expiry, targetData) { if (!expiry) return; - + console.log('处理身份证有效期:', expiry); - + // 处理多种可能的分隔符 if (expiry.includes('——') || expiry.includes('--') || expiry.includes('-')) { const separator = expiry.includes('——') ? '——' : (expiry.includes('--') ? '--' : '-'); const [startStr, endStr] = expiry.split(separator); const startDate = startStr.trim(); const endDate = endStr.trim(); - + console.log('身份证开始日期:', startDate, '结束日期:', endDate); - + if (endDate === '长久' || !endDate) { targetData.legal_idcard_expiry_type = 1; targetData.idcard_start_date = this.formatDateFromBackend(startDate); @@ -907,19 +946,19 @@ export default { }); console.log('资质信息申请详情接口返回:', res); - + if (res.code === 200) { if (res.data) { const detail = res.data; console.log('找到申请记录:', detail); - + const statusCheck = this.intelligentStatusCheck(detail); - + if (statusCheck.isValid) { this.applyId = detail.id; this.auditStatus = statusCheck.status; this.backText = statusCheck.backText; - + console.log('申请记录状态:', { auditStatus: this.auditStatus, backText: this.backText @@ -930,9 +969,9 @@ export default { this.backText = ''; this.hasResubmitted = false; } - + this.updatePendingDataFromDetail(detail); - + if (this.auditStatus === 2) { this.originalData = { ...this.pendingData }; console.log('审核通过,同步originalData到pendingData'); @@ -959,10 +998,10 @@ export default { this.backText = ''; this.applyId = null; } - + await this.refreshUserData(); this.updatePageStatus(); - + } catch (error) { console.error('加载申请详情失败:', error); this.backText = ''; @@ -974,7 +1013,7 @@ export default { // 从申请记录详情更新 pendingData updatePendingDataFromDetail(detail) { console.log('从申请记录更新pendingData:', detail); - + this.pendingData = { uscc_type: detail.uscc_type ? String(detail.uscc_type) : this.originalData.uscc_type, uscc_photo: detail.uscc_photo || this.originalData.uscc_photo, @@ -982,6 +1021,11 @@ export default { uscc_name: detail.uscc_name || this.originalData.uscc_name, uscc_dependency: detail.uscc_dependency || this.originalData.uscc_dependency, uscc_address: detail.uscc_address || this.originalData.uscc_address, + uscc_province: detail.uscc_province || this.originalData.uscc_province, + uscc_city: detail.uscc_city || this.originalData.uscc_city, + uscc_area: detail.uscc_area || this.originalData.uscc_area, + longitude: detail.longitude || this.originalData.longitude || '', + latitude: detail.latitude || this.originalData.latitude || '', uscc_expiry_type: detail.uscc_expiry_type || this.originalData.uscc_expiry_type, uscc_expiry: detail.uscc_expiry || this.originalData.uscc_expiry, license_start_date: '', @@ -1042,9 +1086,9 @@ export default { if (result.state === 1 && result.data) { const userData = result.data; console.log('获取到商家最新数据:', userData); - + this.updateOriginalDataFromUser(userData); - + // 只有在审核通过时才同步 pendingData 到 originalData if (this.auditStatus === 2) { this.pendingData = { ...this.originalData }; @@ -1052,7 +1096,7 @@ export default { } else { console.log('非审核通过状态,保持pendingData不变'); } - + console.log('刷新后的数据状态:', { originalData: this.originalData, pendingData: this.pendingData, @@ -1076,7 +1120,7 @@ export default { // 从用户数据更新原始数据 updateOriginalDataFromUser(userData) { console.log('从用户数据更新原始数据:', userData); - + this.originalData = { uscc_type: userData.uscc_type ? String(userData.uscc_type) : null, uscc_photo: userData.uscc_photo || '', @@ -1084,6 +1128,11 @@ export default { uscc_name: userData.uscc_name || '', uscc_dependency: userData.uscc_dependency || '', uscc_address: userData.uscc_address || '', + uscc_province: userData.uscc_province || '', + uscc_city: userData.uscc_city || '', + uscc_area: userData.uscc_area || '', + longitude: userData.longitude || '', + latitude: userData.latitude || '', uscc_expiry_type: userData.uscc_expiry_type || null, uscc_expiry: userData.uscc_expiry || '', license_start_date: '', @@ -1139,12 +1188,12 @@ export default { backText: '' }; } - + if (detail.apply_time) { const applyDate = new Date(detail.apply_time); const now = new Date(); const daysDiff = (now - applyDate) / (1000 * 60 * 60 * 24); - + if (daysDiff > 7 && this.originalData.uscc_name !== detail.uscc_name) { console.log('智能判断:申请记录已过期,忽略历史记录'); return { @@ -1154,7 +1203,7 @@ export default { }; } } - + return { isValid: true, status: detail.apply_state, @@ -1206,7 +1255,7 @@ export default { } this.updateNavTitle(); - + console.log('最终页面状态:', { auditStatus: this.auditStatus, backText: this.backText, @@ -1230,7 +1279,7 @@ export default { startChange() { this.editable = true; this.buttonType = 'edit'; - this.displayData = { ...this.pendingData }; + this.displayData = { ...this.pendingData }; this.updateNavTitle(); }, @@ -1246,7 +1295,7 @@ export default { togglePendingData() { this.showPendingData = !this.showPendingData; console.log('切换显示待审核数据:', this.showPendingData); - + if (this.showPendingData) { // 显示待审核数据 this.displayData = { ...this.pendingData }; @@ -1262,11 +1311,11 @@ export default { // 提交变更 async submitChange() { console.log('开始提交资质信息变更...'); - + if (!this.validateForm()) { return; } - + try { uni.showLoading({ title: '提交中...' @@ -1277,7 +1326,7 @@ export default { name: this.displayData.legal_name, idcard: this.displayData.legal_idcard_num }); - + if (checkRes.Code == '401') { uni.hideLoading(); uni.showToast({ @@ -1286,7 +1335,7 @@ export default { }); return; } - + if (checkRes.ResultObject?.BizCode != '1') { uni.hideLoading(); uni.showToast({ @@ -1295,7 +1344,7 @@ export default { }); return; } - + const submitData = { apply_type: this.applyType, uscc_type: this.displayData.uscc_type, @@ -1304,6 +1353,9 @@ export default { uscc_name: this.displayData.uscc_name, uscc_dependency: this.displayData.uscc_dependency, uscc_address: this.displayData.uscc_address, + uscc_province: this.displayData.uscc_province, + uscc_city: this.displayData.uscc_city, + uscc_area: this.displayData.uscc_area, uscc_expiry_type: this.displayData.uscc_expiry_type, uscc_expiry: this.displayData.uscc_expiry, legal_name: this.displayData.legal_name, @@ -1336,17 +1388,17 @@ export default { } console.log('提交的数据:', submitData); - + const res = await request.post('/sj/userSjAuth/apply', submitData); - + uni.hideLoading(); - + if (res.code === 200) { uni.showToast({ title: '提交成功', icon: 'none' }); - + // 先更新 pendingData,再设置其他状态 this.pendingData = { ...this.displayData }; console.log('提交成功,更新pendingData:', this.pendingData); @@ -1355,21 +1407,21 @@ export default { this.backText = ''; this.hasResubmitted = true; this.applyId = res.data?.id || this.applyId; - + console.log('申请ID:', this.applyId); - + this.editable = false; this.buttonType = 'view'; this.showAuditTip = true; this.showPendingData = false; this.displayData = { ...this.originalData }; - + this.updateNavTitle(); - + setTimeout(() => { this.loadApplyDetails(); }, 1500); - + } else { uni.showToast({ title: res.msg || '提交失败', @@ -1387,16 +1439,16 @@ export default { }, showPermissionDialog(title, content) { - return new Promise((resolve) => { - uni.showModal({ - title, - content, - confirmText: '去开启', - success(res) { - resolve(res.confirm); - } - }); + return new Promise((resolve) => { + uni.showModal({ + title, + content, + confirmText: '去开启', + success(res) { + resolve(res.confirm); + } }); + }); }, showRegionPicker() { @@ -1426,6 +1478,18 @@ export default { let city = this.regionCitys[index2].city; let area = this.regionAreas[index3].area; this.$set(this.displayData, 'uscc_dependency', province + '-' + city + '-' + area); + if (this.ChinaCitys[index1] && this.ChinaCitys[index1].code) { + this.$set(this.displayData, 'uscc_province', String(this.ChinaCitys[index1].code).substring(0, 6)); + } + if (this.regionCitys[index2] && this.regionCitys[index2].code) { + this.$set(this.displayData, 'uscc_city', String(this.regionCitys[index2].code).substring(0, 6)); + } + if (this.regionAreas[index3] && this.regionAreas[index3].code) { + this.$set(this.displayData, 'uscc_area', String(this.regionAreas[index3].code).substring(0, 6)); + } + this.$set(this.displayData, 'uscc_address', ''); + this.$set(this.displayData, 'longitude', ''); + this.$set(this.displayData, 'latitude', ''); this.hideRegionPopup(); }, @@ -1480,13 +1544,13 @@ export default { { field: 'legal_name', message: '请输入法人代表' }, { field: 'legal_phone', message: '请输入法人联系方式' }, { field: 'legal_idcard_num', message: '请输入法人身份证号' }, - { - condition: () => !this.displayData.legal_idcard_expiry_type, - message: '请选择身份证有效期类型' + { + condition: () => !this.displayData.legal_idcard_expiry_type, + message: '请选择身份证有效期类型' }, - { - condition: () => !this.displayData.idcard_start_date, - message: '请选择身份证开始日期' + { + condition: () => !this.displayData.idcard_start_date, + message: '请选择身份证开始日期' }, { condition: () => { @@ -1496,14 +1560,14 @@ export default { // 如果选择长久有效,则不需要结束日期 return false; }, - message: '请选择身份证结束日期' + message: '请选择身份证结束日期' }, ]; for (let rule of validationRules) { let isValid = true; - + if (rule.field) { if (!this.displayData[rule.field]) { isValid = false; @@ -1513,7 +1577,7 @@ export default { isValid = false; } } - + if (!isValid) { uni.showToast({ title: rule.message, @@ -1522,7 +1586,7 @@ export default { return false; } } - + // 验证手机号格式 if (!/^1[3-9]\d{9}$/.test(this.displayData.legal_phone)) { uni.showToast({ @@ -1531,7 +1595,7 @@ export default { }); return false; } - + // 验证身份证格式 if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(this.displayData.legal_idcard_num)) { uni.showToast({ @@ -1540,7 +1604,7 @@ export default { }); return false; } - + return true; }, @@ -1568,7 +1632,7 @@ export default { } } }, - + // 设置身份证有效期类型 setIdcardValidType(type) { if (type === 'permanent') { @@ -1586,12 +1650,12 @@ export default { formatDateForDisplay(dateStr) { if (!dateStr) return ''; if (dateStr === '长久有效') return '长久有效'; - + if (dateStr.includes('-')) { const [year, month, day] = dateStr.split('-'); return `${year}年${parseInt(month)}月${parseInt(day)}日`; } - + return dateStr; }, @@ -1599,7 +1663,7 @@ export default { formatDateForBackend(dateStr) { if (!dateStr) return ''; if (dateStr === '长久有效') return ''; - + const match = dateStr.match(/(\d+)年(\d+)月(\d+)日/); if (match) { const year = match[1]; @@ -1607,17 +1671,17 @@ export default { const day = match[3].padStart(2, '0'); return `${year}-${month}-${day}`; } - + return dateStr; }, // 打开日期选择器 openDatePicker(field) { this.currentDateField = field; - + const currentDate = new Date(); let initialDate = currentDate; - + if (this.displayData[field] && this.displayData[field] !== '长久有效') { const dateStr = this.displayData[field]; const match = dateStr.match(/(\d+)年(\d+)月(\d+)日/); @@ -1625,28 +1689,28 @@ export default { initialDate = new Date(parseInt(match[1]), parseInt(match[2]) - 1, parseInt(match[3])); } } - + const yearIndex = this.years.indexOf(initialDate.getFullYear()); const monthIndex = initialDate.getMonth(); const dayIndex = initialDate.getDate() - 1; - + this.dateValue = [ yearIndex >= 0 ? yearIndex : 0, monthIndex, dayIndex ]; - + this.showDatePickerFlag = true; }, - + hideDatePicker() { this.showDatePickerFlag = false; }, - + bindDateChange(e) { this.dateValue = e.detail.value; }, - + confirmDate() { const [yearIndex, monthIndex, dayIndex] = this.dateValue; const year = this.years[yearIndex]; @@ -1656,7 +1720,7 @@ export default { const selectedDate = new Date(year, month - 1, day); const today = new Date(); today.setHours(0, 0, 0, 0); - + if (this.currentDateField.endsWith('_start_date')) { if (selectedDate > today) { uni.showToast({ @@ -1665,7 +1729,7 @@ export default { }); return; } - + const relatedEndField = this.currentDateField.replace('_start_date', '_end_date'); if (this.displayData[relatedEndField] && this.displayData[relatedEndField] !== '长久有效') { const endDateStr = this.displayData[relatedEndField]; @@ -1681,7 +1745,7 @@ export default { } } } - + // 如果是身份证开始日期,自动计算20年后的结束日期 if (this.currentDateField === 'idcard_start_date') { const endYear = year + 20; @@ -1714,7 +1778,7 @@ export default { } } } - + this.displayData[this.currentDateField] = dateStr; this.hideDatePicker(); }, @@ -1723,15 +1787,15 @@ export default { showMerchantTypePicker() { this.showMerchantTypePickerFlag = true; }, - + hideMerchantTypePicker() { this.showMerchantTypePickerFlag = false; }, - + selectMerchantType(item) { this.displayData.uscc_type = item.value; }, - + confirmMerchantType() { this.hideMerchantTypePicker(); }, @@ -1752,7 +1816,7 @@ export default { image: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/24859872-da37-4beb-8e33-7743813bb5a1' } }; - + if (tipConfig[field]) { this.tipTitle = tipConfig[field].title; this.tipImage = tipConfig[field].image; @@ -1764,6 +1828,163 @@ export default { this.showTipPopupFlag = false; }, + buildRegionTextForSearch() { + const dependency = String(this.displayData.uscc_dependency || '').trim(); + if (!dependency) return ''; + const parts = dependency.split('-'); + const province = parts[0] || ''; + const city = parts[1] || ''; + const district = parts[2] || ''; + let regionText = ''; + if (province) regionText += province; + if (city && city !== province) regionText += city; + if (district) regionText += district; + return regionText; + }, + + getAddressValueForSearch() { + const rawAddress = String(this.displayData.uscc_address || '').trim(); + if (!rawAddress) return ''; + const dependencyText = String(this.displayData.uscc_dependency || '').trim(); + const regionText = this.buildRegionTextForSearch(); + let detail = rawAddress; + if (regionText && detail.indexOf(regionText) === 0) { + detail = detail.slice(regionText.length).trim(); + } else if (dependencyText && detail.indexOf(dependencyText) === 0) { + detail = detail.slice(dependencyText.length).trim(); + } + detail = detail.replace(/^[\s,-]+/, '').trim(); + return detail || rawAddress; + }, + + getAddressInfo() { + const dependency = String(this.displayData.uscc_dependency || '').trim(); + const dependencyCode = String(this.displayData.uscc_area || '').trim(); + const address = this.getAddressValueForSearch(); + const longitude = String(this.displayData.longitude || '').trim(); + const latitude = String(this.displayData.latitude || '').trim(); + + const hasDependency = !!dependency; + const hasAddress = !!address; + const hasLocation = !!(longitude && latitude); + + let params = 'source=sj_change'; + + if (hasDependency) { + params += `&dependency=${encodeURIComponent(dependency)}`; + if (dependencyCode) { + params += `&dependency_code=${dependencyCode}`; + } + } + if (hasAddress) { + params += `&address=${encodeURIComponent(address)}`; + } + if (hasLocation) { + params += `&longitude=${longitude}&latitude=${latitude}`; + } + if (!hasDependency && !hasAddress && !hasLocation) { + params += '&init_current_location=1&silent_locate=1'; + } + + uni.navigateTo({ + url: `/pages/address/search?${params}` + }); + }, + + setupAddressListener() { + this.addressListener = (addressData) => { + this.handleAddressSelected(addressData); + }; + this.sjAddressListener = (addressData) => { + this.handleAddressSelected(addressData); + }; + uni.$on('address-selected', this.addressListener); + uni.$on('address-selected-for-sj', this.sjAddressListener); + }, + + removeAddressListener() { + if (this.addressListener) { + uni.$off('address-selected', this.addressListener); + this.addressListener = null; + } + if (this.sjAddressListener) { + uni.$off('address-selected-for-sj', this.sjAddressListener); + this.sjAddressListener = null; + } + }, + + checkAddressData() { + try { + const storedAddress = uni.getStorageSync('sj_selected_address'); + if (storedAddress) { + this.handleAddressSelected(storedAddress); + uni.removeStorageSync('sj_selected_address'); + return; + } + } catch (e) { } + + if (getApp().globalData && getApp().globalData.selectedAddress) { + this.handleAddressSelected(getApp().globalData.selectedAddress); + delete getApp().globalData.selectedAddress; + } + + try { + const selectedAddress = uni.getStorageSync('selectedAddress'); + if (selectedAddress) { + this.handleAddressSelected(selectedAddress); + uni.removeStorageSync('selectedAddress'); + } + } catch (e) { } + }, + + handleAddressSelected(addressData) { + if (!addressData) return; + + let detailAddress = ''; + if (addressData.address) { + detailAddress = String(addressData.address).trim(); + } else if (addressData.name) { + detailAddress = String(addressData.name).trim(); + const regionParts = []; + if (addressData.pname) regionParts.push(addressData.pname); + if (addressData.cityname && addressData.cityname !== addressData.pname) regionParts.push(addressData.cityname); + if (addressData.adname) regionParts.push(addressData.adname); + const regionText = regionParts.join(''); + if (regionText && detailAddress.indexOf(regionText) === 0) { + detailAddress = detailAddress.slice(regionText.length).trim(); + } + detailAddress = detailAddress.replace(/^[\s,-]+/, '').trim(); + } + + this.$set(this.displayData, 'uscc_address', detailAddress); + + if (addressData.location) { + const [longitude, latitude] = String(addressData.location).split(','); + this.$set(this.displayData, 'longitude', longitude || ''); + this.$set(this.displayData, 'latitude', latitude || ''); + } + + if (addressData.pname || addressData.cityname || addressData.adname) { + const locationParts = []; + if (addressData.pname) locationParts.push(addressData.pname); + if (addressData.cityname) locationParts.push(addressData.cityname); + if (addressData.adname) locationParts.push(addressData.adname); + this.$set(this.displayData, 'uscc_dependency', locationParts.join('-')); + } + + if (addressData.provinceCode) { + this.$set(this.displayData, 'uscc_province', String(addressData.provinceCode).substring(0, 6)); + } + if (addressData.cityCode) { + this.$set(this.displayData, 'uscc_city', String(addressData.cityCode).substring(0, 6)); + } + if (addressData.districtCode) { + this.$set(this.displayData, 'uscc_area', String(addressData.districtCode).substring(0, 6)); + } + + this.$forceUpdate(); + }, + // 图片上传方法 async chooseImage(type) { if (!this.editable) return; @@ -1862,12 +2083,12 @@ export default { console.log('_openCamera - 开始上传图片,字段类型:', type, '用户ID:', this.userId); const result = await this.directUpload(file, this.userId, 3, type); - + uni.hideLoading(); if (result) { this.displayData[type] = result; - + // 上传成功后自动识别 if (type === 'uscc_photo') { await this.recognizeBusinessLicense(result); @@ -1880,7 +2101,7 @@ export default { } catch (err) { uni.hideLoading(); console.log('上传图片错误:', err); - + if (!err.errMsg || !err.errMsg.includes('cancel')) { uni.showToast({ title: '上传失败,请重试', @@ -1897,7 +2118,7 @@ export default { let artisan = type == 1 ? 'yh' : type == 2 ? 'syr' : type == 3 ? 'sj' : ''; console.log('directUpload - artisan类型:', artisan, '原始type:', type); - + let fileExtension = 'jpg'; if (file.path.includes('.')) { let parts = file.path.split('.'); @@ -1906,15 +2127,15 @@ export default { fileExtension = ext; } } - + // 添加时间戳确保文件名唯一 const timestamp = Date.now(); const random = Math.floor(Math.random() * 10000); let name = `${userId}_${artisan}_${fieldName}_${timestamp}_${random}.${fileExtension}`; console.log('唯一文件名(包含时间戳):', name); - const ossConfig = await request.post('/user/getalioss', {type: type, kind: 1}); - + const ossConfig = await request.post('/user/getalioss', { type: type, kind: 1 }); + return await new Promise((resolve, reject) => { uni.uploadFile({ url: ossConfig.host, @@ -1939,7 +2160,7 @@ export default { fail: reject }); }); - + } catch (error) { console.error('直接上传失败:', error); throw error; @@ -2196,8 +2417,13 @@ export default { } @keyframes spin { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } } .picker-content { @@ -2385,7 +2611,9 @@ export default { margin-top: 20rpx; } -.change-info-btn, .view-change-btn, .resubmit-btn { +.change-info-btn, +.view-change-btn, +.resubmit-btn { background: linear-gradient(180deg, #f52540 0%, #e8101e 100%); } @@ -2513,7 +2741,8 @@ export default { color: #FFFFFF; } -.cancel-text, .confirm-text { +.cancel-text, +.confirm-text { font-size: 32rpx; padding: 16rpx; } @@ -2643,9 +2872,9 @@ export default { } .permission.transform { - top: calc(var(--status-bar-height) + 88rpx + 20rpx); - opacity: 1; - visibility: visible; + top: calc(var(--status-bar-height) + 88rpx + 20rpx); + opacity: 1; + visibility: visible; } .image-list {