diff --git a/pages/ruzhu/qualification_sj.vue b/pages/ruzhu/qualification_sj.vue index 4fd57a0..c0e8734 100644 --- a/pages/ruzhu/qualification_sj.vue +++ b/pages/ruzhu/qualification_sj.vue @@ -197,1262 +197,1555 @@ - + + + + + 请确认邀请信息 + + + + 邀请码 + {{ existingInviterInfo && (existingInviterInfo.invite_code || existingInviterInfo.invite_code_other) }} + + + 邀请人 + {{ (existingInviterInfo && (existingInviterInfo.name || existingInviterInfo.nick_name)) || '' }} + + + + 关闭 + 确认 + + + + + \ No newline at end of file diff --git a/pages/ruzhu/ruzhu.vue b/pages/ruzhu/ruzhu.vue index 41efe32..f11b01a 100644 --- a/pages/ruzhu/ruzhu.vue +++ b/pages/ruzhu/ruzhu.vue @@ -101,354 +101,353 @@ import StoreInfo from './sj-info.vue'; import successruzhu from './successruzhu.vue'; - export default { - components: { - StepTab, - QualificationInfo, - StoreInfo, - successruzhu - }, - data() { - return { - currentStep: 0, // 当前步骤索引 - isAgree: false, - identity: null, - textData: {}, - loading: false, - error: null, - navTitle: '商家入驻', // 默认标题 - qualificationData: null, // 新增:保存资质信息 - storeInfoData: null, // 新增:保存门店信息 - successData: {}, //入驻提示 - // 新增:缓存手艺人数据 - artisanDataCache: { - personalInfo: null, - qualificationInfo: null - } - } - }, - computed: { - mappedStep() { - if (this.currentStep === 0) return 0; - if (this.currentStep === 1) return 1; - if (this.currentStep === 3) return 2; - if (this.currentStep === 4) return 2; - return 0; - } - }, - async onLoad(options) { - console.log(options, 'options---'); - if (options.type == 1) { - this.currentStep = 4 - } + export default { + components: { + StepTab, + QualificationInfo, + StoreInfo, + successruzhu + }, + data() { + return { + currentStep: 0, // 当前步骤索引 + isAgree: false, + identity: null, + textData: {}, + loading: false, + error: null, + navTitle: '商家入驻', // 默认标题 + qualificationData: null, // 新增:保存资质信息 + storeInfoData: null, // 新增:保存门店信息 + successData: {}, //入驻提示 + // 新增:缓存手艺人数据 + artisanDataCache: { + personalInfo: null, + qualificationInfo: null + } + } + }, + computed: { + mappedStep() { + if (this.currentStep === 0) return 0; + if (this.currentStep === 1) return 1; + if (this.currentStep === 3) return 2; + if (this.currentStep === 4) return 2; + return 0; + } + }, + async onLoad(options) { + console.log(options, 'options---'); + if (options.type == 1) { + this.currentStep = 4 + } - // 如果首页传了 step 参数,就直接空降到对应的流程 - if (options.step) { - this.currentStep = Number(options.step); - } + // 如果首页传了 step 参数,就直接空降到对应的流程 + if (options.step) { + this.currentStep = Number(options.step); + } - this.identity = 2; - await this.getUserInfoSync() - // 确保子组件也能访问到 identity - this.getXieyi(1); - }, + this.identity = 2; + await this.getUserInfoSync() + // 确保子组件也能访问到 identity + this.getXieyi(1); + }, - onShow() { - console.log('入驻页面 onShow - 检查地址数据'); - // 检查商家地址数据 - this.checkAndPassAddressToSj(); - }, + onShow() { + console.log('入驻页面 onShow - 检查地址数据'); + // 检查商家地址数据 + this.checkAndPassAddressToSj(); + }, - methods: { - topt() { - uni.switchTab({ - url: '/pages/home/home' - }) - }, - // 获取用户信息(复用不可服务时间页面的方法) - async getUserInfoSync() { - await request.post('/sj/userSjAuth/details', { - type: 1 - }).then(result => { - if (result.code == 200 && result.data) { - let data = result.data - if (getApp().globalData.artisanType == 2) { + methods: { + topt() { + uni.switchTab({ + url: '/pages/home/home' + }) + }, + // 获取用户信息(复用不可服务时间页面的方法) + async getUserInfoSync() { + await request.post('/sj/userSjAuth/details', { + type: 1 + }).then(result => { + if (result.code == 200 && result.data) { + let data = result.data + if (getApp().globalData.artisanType == 2) { - let qualification_form_data = { - "uscc_type": data.uscc_type || '', + let qualification_form_data = { + "uscc_type": data.uscc_type || '', // "contact_identity": 'legal', // "contact_name": data.legal_name || data.contact_name || '', - "contact_phone": data.legal_phone || data.contact_phone || '', - "backup_phone": data.backup_phone || '', - "invite_code": data.invite_code_other || '', - "dependency": data.dependency || '', - "address": data.address || '', - "dependency_code": data.dependency_code || '', - "dependency_province": data.dependency_province || '', - "dependency_city": data.dependency_city || '', - "longitude": data.longitude || '', - "latitude": data.latitude || '', - "name": data.name || '', - "contact_type": data.contact_type || '' - - } - uni.setStorageSync('qualification_form_data', qualification_form_data); - let store_info_form_data = { - "head_photo": data.head_photo, - "name": data.name, - "business_time": data.business_time, + "contact_phone": data.legal_phone || data.contact_phone || '', + "backup_phone": data.backup_phone || '', + "invite_code": data.invite_code_other || '', + "dependency": data.dependency || '', + "address": data.address || '', + "dependency_code": data.dependency_code || '', + "dependency_province": data.dependency_province || '', + "dependency_city": data.dependency_city || '', + "longitude": data.longitude || '', + "latitude": data.latitude || '', + "name": data.name || '', + "contact_type": data.contact_type || '' + } + uni.setStorageSync('qualification_form_data', qualification_form_data); + let store_info_form_data = { + "head_photo": data.head_photo, + "name": data.name, + "business_time": data.business_time, // "servers_kill": data.servers_kill, - "apply_state": data.apply_state, - "invite_code_other": data.invite_code_other, - "major": data.major - } - console.log(111111111, store_info_form_data) - uni.setStorageSync('store_info_form_data', store_info_form_data); - } + "apply_state": data.apply_state, + "invite_code_other": data.invite_code_other, + "major": data.major + } + console.log(111111111, store_info_form_data) + uni.setStorageSync('store_info_form_data', store_info_form_data); + } - } - }).catch(error => { - console.error('获取用户信息接口错误:', error); - }); - }, - // 检查并传递地址给商家组件 - checkAndPassAddressToSj() { - try { - const sjAddress = uni.getStorageSync('sj_selected_address'); - if (sjAddress) { - console.log('找到商家地址数据,准备传递:', sjAddress); + } + }).catch(error => { + console.error('获取用户信息接口错误:', error); + }); + }, + // 检查并传递地址给商家组件 + checkAndPassAddressToSj() { + try { + const sjAddress = uni.getStorageSync('sj_selected_address'); + if (sjAddress) { + console.log('找到商家地址数据,准备传递:', sjAddress); - setTimeout(() => { - if (this.identity === 2 && this.$refs.qualificationInfo) { - console.log('传递地址给资质组件'); - if (typeof this.$refs.qualificationInfo.handleAddressSelected === 'function') { - this.$refs.qualificationInfo.handleAddressSelected(sjAddress); - } - } - uni.removeStorageSync('sj_selected_address'); - }, 300); - } - } catch (e) { - console.error('处理商家地址失败:', e); - } - }, + setTimeout(() => { + if (this.identity === 2 && this.$refs.qualificationInfo) { + console.log('传递地址给资质组件'); + if (typeof this.$refs.qualificationInfo.handleAddressSelected === 'function') { + this.$refs.qualificationInfo.handleAddressSelected(sjAddress); + } + } + uni.removeStorageSync('sj_selected_address'); + }, 300); + } + } catch (e) { + console.error('处理商家地址失败:', e); + } + }, - // 新增方法:检查并传递地址数据 - checkAndPassAddressData() { - try { - const syrAddress = uni.getStorageSync('syr_selected_address'); - if (syrAddress && this.$refs.personalInfo) { - console.log('步骤切换时发现地址数据,传递给组件'); + // 新增方法:检查并传递地址数据 + checkAndPassAddressData() { + try { + const syrAddress = uni.getStorageSync('syr_selected_address'); + if (syrAddress && this.$refs.personalInfo) { + console.log('步骤切换时发现地址数据,传递给组件'); - // 传递给组件 - if (typeof this.$refs.personalInfo.handleAddressSelected === 'function') { - this.$refs.personalInfo.handleAddressSelected(syrAddress); - } else { - // 直接设置 - this.$refs.personalInfo.formData.detail_address = syrAddress.address; - this.$refs.personalInfo.formData.longitude = syrAddress.longitude; - this.$refs.personalInfo.formData.latitude = syrAddress.latitude; - this.$refs.personalInfo.saveFormDataToLocal(); - this.$refs.personalInfo.$forceUpdate(); - } + // 传递给组件 + if (typeof this.$refs.personalInfo.handleAddressSelected === 'function') { + this.$refs.personalInfo.handleAddressSelected(syrAddress); + } else { + // 直接设置 + this.$refs.personalInfo.formData.detail_address = syrAddress.address; + this.$refs.personalInfo.formData.longitude = syrAddress.longitude; + this.$refs.personalInfo.formData.latitude = syrAddress.latitude; + this.$refs.personalInfo.saveFormDataToLocal(); + this.$refs.personalInfo.$forceUpdate(); + } - // 清理 - uni.removeStorageSync('syr_selected_address'); - } - } catch (e) { - console.error('检查地址数据失败:', e); - } - }, + // 清理 + uni.removeStorageSync('syr_selected_address'); + } + } catch (e) { + console.error('检查地址数据失败:', e); + } + }, - // 检查用户信息 - checkUserInfo() { - console.log('检查用户信息...'); + // 检查用户信息 + checkUserInfo() { + console.log('检查用户信息...'); - // 从多种可能的存储位置检查用户信息 - const sources = [{ - name: '本地存储-userInfo', - data: uni.getStorageSync('userInfo') - }, - { - name: '本地存储-loginInfo', - data: uni.getStorageSync('loginInfo') - }, - { - name: '本地存储-token', - data: uni.getStorageSync('token') - } - ]; + // 从多种可能的存储位置检查用户信息 + const sources = [{ + name: '本地存储-userInfo', + data: uni.getStorageSync('userInfo') + }, + { + name: '本地存储-loginInfo', + data: uni.getStorageSync('loginInfo') + }, + { + name: '本地存储-token', + data: uni.getStorageSync('token') + } + ]; - sources.forEach(source => { - console.log(`${source.name}:`, source.data); - }); + sources.forEach(source => { + console.log(`${source.name}:`, source.data); + }); - // 检查是否有token(确认登录状态) - const token = uni.getStorageSync('token'); - if (!token) { - console.warn('未检测到登录token'); - uni.showToast({ - title: '请先登录', - icon: 'none' - }); - } - }, + // 检查是否有token(确认登录状态) + const token = uni.getStorageSync('token'); + if (!token) { + console.warn('未检测到登录token'); + uni.showToast({ + title: '请先登录', + icon: 'none' + }); + } + }, - // 获取用户信息(复用不可服务时间页面的方法) - getUserInfo() { - return new Promise((resolve, reject) => { - request.post('/sj/User/getUser', { - type: 1 - }).then(result => { - if (result.state == 1) { - // 保存用户信息到全局数据和本地存储 - uni.setStorageSync('userInfo', result.data); - console.log('用户信息获取成功:', result.data); - resolve(result.data); - } else { - console.error('获取用户信息失败:', result.msg); - reject(result.msg); - } - }).catch(error => { - console.error('获取用户信息接口错误:', error); - reject(error); - }); - }); - }, + // 获取用户信息(复用不可服务时间页面的方法) + getUserInfo() { + return new Promise((resolve, reject) => { + request.post('/sj/User/getUser', { + type: 1 + }).then(result => { + if (result.state == 1) { + // 保存用户信息到全局数据和本地存储 + uni.setStorageSync('userInfo', result.data); + console.log('用户信息获取成功:', result.data); + resolve(result.data); + } else { + console.error('获取用户信息失败:', result.msg); + reject(result.msg); + } + }).catch(error => { + console.error('获取用户信息接口错误:', error); + reject(error); + }); + }); + }, - // 检查并获取用户信息 - async checkAndGetUserInfo() { - // 先检查是否已有用户信息 - const existingUserInfo = uni.getStorageSync('userInfo'); - if (existingUserInfo && existingUserInfo.account) { - console.log('已有用户信息:', existingUserInfo); - return existingUserInfo; - } + // 检查并获取用户信息 + async checkAndGetUserInfo() { + // 先检查是否已有用户信息 + const existingUserInfo = uni.getStorageSync('userInfo'); + if (existingUserInfo && existingUserInfo.account) { + console.log('已有用户信息:', existingUserInfo); + return existingUserInfo; + } - // 如果没有,则调用接口获取 - try { - const userInfo = await this.getUserInfo(); - return userInfo; - } catch (error) { - console.error('获取用户信息失败:', error); - uni.showModal({ - title: '提示', - content: '获取用户信息失败,请重新登录', - showCancel: false, - success: () => { - uni.navigateTo({ - url: '/pages/login/login' - }); - } - }); - return null; - } - }, + // 如果没有,则调用接口获取 + try { + const userInfo = await this.getUserInfo(); + return userInfo; + } catch (error) { + console.error('获取用户信息失败:', error); + uni.showModal({ + title: '提示', + content: '获取用户信息失败,请重新登录', + showCancel: false, + success: () => { + uni.navigateTo({ + url: '/pages/login/login' + }); + } + }); + return null; + } + }, - // 审核提交方法 - async submitForReview() { - const userInfo = await this.checkAndGetUserInfo(); - if (!userInfo) { - return; - } + // 审核提交方法 + async submitForReview() { + const userInfo = await this.checkAndGetUserInfo(); + if (!userInfo) { + return; + } - uni.showLoading({ - title: '提交中...' - }); + uni.showLoading({ + title: '提交中...' + }); - try { - let formData = this.buildBusinessData(this.qualificationData, {}); - formData.type = 1; - formData.id_type = 1; - if (Array.isArray(formData.qualifications_sector)) { - formData.qualifications_sector = JSON.stringify(formData.qualifications_sector); - } - if (Array.isArray(formData.qualifications_other)) { - formData.qualifications_other = JSON.stringify(formData.qualifications_other); - } - const res = await request.post('/sj/userSjAuth/applyOne', formData); - uni.hideLoading(); + try { + let formData = this.buildBusinessData(this.qualificationData, {}); + formData.type = 1; + formData.id_type = 1; + if (Array.isArray(formData.qualifications_sector)) { + formData.qualifications_sector = JSON.stringify(formData.qualifications_sector); + } + if (Array.isArray(formData.qualifications_other)) { + formData.qualifications_other = JSON.stringify(formData.qualifications_other); + } + const res = await request.post('/sj/userSjAuth/applyOne', formData); + uni.hideLoading(); - if (res.state == 1 || res.code == 200) { - this.successData = res.data.customer_service - console.log(this.successData, - 'this.successDatathis.successDatathis.successDatathis.successData======='); - uni.showToast({ - title: '提交成功', - icon: 'none', - duration: 1500 - }); - setTimeout(() => { - this.currentStep = 2; - }, 1500); - } else { - uni.showToast({ - title: res.msg || '提交失败', - icon: 'none' - }); - } - } catch (error) { - uni.hideLoading(); - uni.showToast({ - title: '提交失败,请重试', - icon: 'none' - }); - } - }, + if (res.state == 1 || res.code == 200) { + this.successData = res.data.customer_service + console.log(this.successData, + 'this.successDatathis.successDatathis.successDatathis.successData======='); + uni.showToast({ + title: '提交成功', + icon: 'none', + duration: 1500 + }); + setTimeout(() => { + this.currentStep = 2; + }, 1500); + } else { + uni.showToast({ + title: res.msg || '提交失败', + icon: 'none' + }); + } + } catch (error) { + uni.hideLoading(); + uni.showToast({ + title: '提交失败,请重试', + icon: 'none' + }); + } + }, - // 构建商家数据 - buildBusinessData(qualificationData, storeData) { - qualificationData = qualificationData || {}; - storeData = storeData || {}; - console.log(qualificationData, 'storeDatastoreDatastoreData'); - const formData = {}; - Object.assign(formData, storeData); + // 构建商家数据 + buildBusinessData(qualificationData, storeData) { + qualificationData = qualificationData || {}; + storeData = storeData || {}; + console.log(qualificationData, 'storeDatastoreDatastoreData'); + const formData = {}; + Object.assign(formData, storeData); - if (qualificationData.uscc_type) { - formData.uscc_type = qualificationData.uscc_type; - } + if (qualificationData.uscc_type) { + formData.uscc_type = qualificationData.uscc_type; + } // if (qualificationData.contact_identity) { // formData.contact_identity = qualificationData.contact_identity; // } // if (qualificationData.contact_name) { // formData.contact_name = qualificationData.contact_name; // } - if (qualificationData.contact_phone) { - formData.contact_phone = qualificationData.contact_phone; - } - if (qualificationData.backup_phone) { - formData.backup_phone = qualificationData.backup_phone; - } - if (qualificationData.contact_type) { - formData.contact_type = qualificationData.contact_type; - } - if (qualificationData.invite_code_other) { - formData.invite_code_other = qualificationData.invite_code_other; - } - if (qualificationData.contact_name) { - formData.contact_name = qualificationData.contact_name; - } + if (qualificationData.contact_phone) { + formData.contact_phone = qualificationData.contact_phone; + } + if (qualificationData.backup_phone) { + formData.backup_phone = qualificationData.backup_phone; + } + if (qualificationData.contact_type) { + formData.contact_type = qualificationData.contact_type; + } + if (qualificationData.invite_code_other) { + formData.invite_code_other = qualificationData.invite_code_other; + } + if (qualificationData.contact_name) { + formData.contact_name = qualificationData.contact_name; + } - if (qualificationData.dependency) { - formData.dependency = qualificationData.dependency; - } - if (qualificationData.dependency_code) { - formData.dependency_code = qualificationData.dependency_code; - } - if (qualificationData.dependency_province) { - formData.dependency_province = qualificationData.dependency_province; - } - if (qualificationData.dependency_city) { - formData.dependency_city = qualificationData.dependency_city; - } - if (qualificationData.name) { - formData.name = qualificationData.name; - } - if (qualificationData.address) { - formData.address = qualificationData.address; - } - if (qualificationData.longitude) formData.longitude = qualificationData.longitude; - if (qualificationData.latitude) formData.latitude = qualificationData.latitude; + if (qualificationData.dependency) { + formData.dependency = qualificationData.dependency; + } + if (qualificationData.dependency_code) { + formData.dependency_code = qualificationData.dependency_code; + } + if (qualificationData.dependency_province) { + formData.dependency_province = qualificationData.dependency_province; + } + if (qualificationData.dependency_city) { + formData.dependency_city = qualificationData.dependency_city; + } + if (qualificationData.name) { + formData.name = qualificationData.name; + } + if (qualificationData.address) { + formData.address = qualificationData.address; + } + if (qualificationData.longitude) formData.longitude = qualificationData.longitude; + if (qualificationData.latitude) formData.latitude = qualificationData.latitude; // if (storeData && storeData.servers_kill && storeData.servers_kill.length > 0) { // // formData.servers_kill = Array.isArray(storeData.servers_kill) ? @@ -456,364 +455,367 @@ // } else { // formData.servers_kill = []; // } - if (storeData.head_photo) { - formData.head_photo = storeData.head_photo; - } - if (storeData.name) { - formData.name = storeData.name; - } - if (storeData.business_time) { - formData.business_time = storeData.business_time; - } - if (storeData.apply_state) { - formData.get_msg_method = storeData.apply_state; - } - if (storeData.major) { - formData.major = storeData.major; - } + if (storeData.head_photo) { + formData.head_photo = storeData.head_photo; + } + if (storeData.name) { + formData.name = storeData.name; + } + if (storeData.business_time) { + formData.business_time = storeData.business_time; + } + if (storeData.apply_state) { + formData.get_msg_method = storeData.apply_state; + } + if (storeData.major) { + formData.major = storeData.major; + } - const userInfo = uni.getStorageSync('userInfo'); - if (userInfo && userInfo.account) { - formData.account = userInfo.account; - } else { - const loginAccount = uni.getStorageSync('loginAccount'); - if (loginAccount) { - formData.account = loginAccount; - } else if (qualificationData.contact_phone) { - formData.contact_name = qualificationData.contact_name; - } else { - console.error('无法获取账号信息'); - uni.showToast({ - title: '无法获取用户账号', - icon: 'none' - }); - return null; - } - } + const userInfo = uni.getStorageSync('userInfo'); + if (userInfo && userInfo.account) { + formData.account = userInfo.account; + } else { + const loginAccount = uni.getStorageSync('loginAccount'); + if (loginAccount) { + formData.account = loginAccount; + } else if (qualificationData.contact_phone) { + formData.contact_name = qualificationData.contact_name; + } else { + console.error('无法获取账号信息'); + uni.showToast({ + title: '无法获取用户账号', + icon: 'none' + }); + return null; + } + } - return formData; + return formData; - }, + }, - async goNext() { - if (this.currentStep === 0 && !this.isAgree) { - uni.showToast({ - title: '请阅读并同意以上协议', - icon: 'none' - }); - return; - } + async goNext() { + if (this.currentStep === 0 && !this.isAgree) { + uni.showToast({ + title: '请阅读并同意以上协议', + icon: 'none' + }); + return; + } - if (this.currentStep === 1) { - if (this.$refs.qualificationInfo) { - const isValid = await this.$refs.qualificationInfo.saveFormData(); - if (!isValid) { - return; - } - this.qualificationData = this.$refs.qualificationInfo.getFormData(); - } - await this.submitForReview(); - return; - } + if (this.currentStep === 1) { + if (this.$refs.qualificationInfo) { + const isValid = await this.$refs.qualificationInfo.saveFormData(); + if (!isValid) { + return; + } + this.qualificationData = this.$refs.qualificationInfo.getFormData(); + } + await this.submitForReview(); + return; + } - if (this.currentStep < 3) { - this.currentStep++; - setTimeout(() => { - this.scrollToTop(); - }, 100); - } - }, + if (this.currentStep < 3) { + this.currentStep++; + setTimeout(() => { + this.scrollToTop(); + }, 100); + } + }, - async submitApplication() { - if (this.$refs.storeInfo) { - if (!this.$refs.storeInfo.saveFormData()) { - return; - } - this.storeInfoData = this.$refs.storeInfo.getFormData(); - } + async submitApplication() { + if (this.$refs.storeInfo) { + // 增加了 await 进行异步表单验证,等待弹窗确认结果 + const isValid = await this.$refs.storeInfo.saveFormData(); + if (!isValid) { + return; + } + this.storeInfoData = this.$refs.storeInfo.getFormData(); + } - uni.showLoading({ - title: '提交中...' - }); - try { - const formData = this.buildBusinessData(this.qualificationData, this.storeInfoData); - if (!formData) { - uni.hideLoading(); - return; - } - formData.type = 1; - formData.id_type = 1; - console.log(formData, '-----------'); - if (formData.legal_idcard_expiry_start && formData.legal_idcard_expiry_end) { - formData.legal_idcard_expiry = - formData.legal_idcard_expiry_end === '长久有效' ? - `${formData.legal_idcard_expiry_start} —— 长久` : - `${formData.legal_idcard_expiry_start} —— ${formData.legal_idcard_expiry_end}`; - } - delete formData.legal_idcard_expiry_start - delete formData.legal_idcard_expiry_end - delete formData.contact_phone - delete formData.contact_type - delete formData.contact_name - delete formData.invite_code_other - if (Array.isArray(formData.qualifications_sector)) { - formData.qualifications_sector = JSON.stringify(formData.qualifications_sector); - } - if (Array.isArray(formData.qualifications_other)) { - formData.qualifications_other = JSON.stringify(formData.qualifications_other); - } - console.log(formData, 'formData请求参数'); - const res = await request.post('/sj/userSjAuth/apply', formData); - uni.hideLoading(); - if (res.state == 1 || res.code == 200) { - this.successData = res.data ? (res.data.customer_service || {}) : {}; - uni.showToast({ - title: '提交成功', - icon: 'none' - }); - setTimeout(() => { - this.currentStep = 4; - }, 1500); - } else { - uni.showToast({ - title: res.msg || '提交失败了', - icon: 'none' - }); - } - } catch (error) { - console.error('提交失败:', error); - uni.hideLoading(); - uni.showToast({ - title: '提交失败,请重试', - icon: 'none' - }); - } - }, + uni.showLoading({ + title: '提交中...' + }); + try { + const formData = this.buildBusinessData(this.qualificationData, this.storeInfoData); + if (!formData) { + uni.hideLoading(); + return; + } + formData.type = 1; + formData.id_type = 1; + console.log(formData, '-----------'); + if (formData.legal_idcard_expiry_start && formData.legal_idcard_expiry_end) { + formData.legal_idcard_expiry = + formData.legal_idcard_expiry_end === '长久有效' ? + `${formData.legal_idcard_expiry_start} —— 长久` : + `${formData.legal_idcard_expiry_start} —— ${formData.legal_idcard_expiry_end}`; + } + delete formData.legal_idcard_expiry_start + delete formData.legal_idcard_expiry_end + delete formData.contact_phone + delete formData.contact_type + delete formData.contact_name + delete formData.invite_code_other + if (Array.isArray(formData.qualifications_sector)) { + formData.qualifications_sector = JSON.stringify(formData.qualifications_sector); + } + if (Array.isArray(formData.qualifications_other)) { + formData.qualifications_other = JSON.stringify(formData.qualifications_other); + } + console.log(formData, 'formData请求参数'); + const res = await request.post('/sj/userSjAuth/apply', formData); + uni.hideLoading(); + if (res.state == 1 || res.code == 200) { + this.successData = res.data ? (res.data.customer_service || {}) : {}; + uni.showToast({ + title: '提交成功', + icon: 'none' + }); + setTimeout(() => { + this.currentStep = 4; + }, 1500); + } else { + uni.showToast({ + title: res.msg || '提交失败了', + icon: 'none' + }); + } + } catch (error) { + console.error('提交失败:', error); + uni.hideLoading(); + uni.showToast({ + title: '提交失败,请重试', + icon: 'none' + }); + } + }, - goPrev() { - if (this.currentStep > 0) { - this.currentStep--; - } - }, - scrollToTop() { - uni.pageScrollTo({ - scrollTop: 0, - duration: 0 - }); - }, - async getXieyi(type) { - this.loading = true; - this.error = null; - try { - const res = await request.post('/user/getsystemtext', { - type - }); - this.textData = res.data; - } catch (err) { - console.error('获取协议失败:', err); - this.error = '获取协议内容失败,请重试'; - uni.showToast({ - title: '获取协议内容失败', - icon: 'none' - }); - } finally { - this.loading = false; - } - }, - } - } + goPrev() { + if (this.currentStep > 0) { + this.currentStep--; + } + }, + scrollToTop() { + uni.pageScrollTo({ + scrollTop: 0, + duration: 0 + }); + }, + async getXieyi(type) { + this.loading = true; + this.error = null; + try { + const res = await request.post('/user/getsystemtext', { + type + }); + this.textData = res.data; + } catch (err) { + console.error('获取协议失败:', err); + this.error = '获取协议内容失败,请重试'; + uni.showToast({ + title: '获取协议内容失败', + icon: 'none' + }); + } finally { + this.loading = false; + } + }, + } + } \ No newline at end of file diff --git a/utils/request.js b/utils/request.js index f0bec35..de82905 100644 --- a/utils/request.js +++ b/utils/request.js @@ -135,13 +135,13 @@ const request = async (options, isUpdate) => { if (process.env.NODE_ENV === 'development') { baseURL = url; // 发布到生产环境时,此处代码会被摇树移除掉。 - baseURL = 'http://116.63.163.121:93'; // 发布到生产环境时,此处代码会被摇树移除掉。 - //baseURL = 'http://116.63.163.121:96'; // 发布到生产环境时,此处代码会被摇树移除掉。 + baseURL = 'http://test.mrrwlkj.top'; // 发布到生产环境时,此处代码会被摇树移除掉。 + //baseURL = 'http://dev.mrrwlkj.top'; // 发布到生产环境时,此处代码会被摇树移除掉。 //baseURL = 'https://app.mrrweb.com.cn'; } else { baseURL = url; // 发布到生产环境时,此处代码会被摇树移除掉。 - baseURL = 'http://116.63.163.121:93'; // 发布到生产环境时,此处代码会被摇树移除掉。 - //baseURL = 'http://116.63.163.121:96'; // 发布到生产环境时,此处代码会被摇树移除掉。 + baseURL = 'http://test.mrrwlkj.top'; // 发布到生产环境时,此处代码会被摇树移除掉。 + //baseURL = 'http://dev.mrrwlkj.top'; // 发布到生产环境时,此处代码会被摇树移除掉。 //baseURL = 'https://app.mrrweb.com.cn'; console.log('生产环境');