mrr.sj.front/pages/ruzhu/ruzhu.vue

960 lines
27 KiB
Vue
Raw Normal View History

2026-03-24 11:45:13 +08:00
<template>
<view class="ruzhu-page">
<!-- 顶部导航栏 - 根据身份动态显示标题 -->
<custom-navbar :title="navTitle" :showBack="true"></custom-navbar>
<!-- 步骤切换 -->
<step-tab :currentStep="currentStep" :identity="identity"></step-tab>
<!-- 内容区域根据身份和步骤显示不同内容 -->
<view class="content">
<!-- 入驻协议内容 -->
<view class="xieyi_content" v-if="currentStep === 0">
<rich-text :nodes="textData.text"></rich-text>
</view>
<!-- 步骤1: 根据身份显示不同内容 -->
<view v-else-if="currentStep === 1">
<!-- 手艺人显示个人信息商家显示资质信息 -->
2026-03-25 13:29:04 +08:00
<qualification-info ref="qualificationInfo"></qualification-info>
2026-03-24 11:45:13 +08:00
</view>
<!-- 步骤2: 根据身份显示不同内容 -->
<view v-else-if="currentStep === 2">
<!-- 手艺人显示资质信息商家显示门店信息 -->
2026-03-25 13:29:04 +08:00
<store-info ref="storeInfo"></store-info>
2026-03-24 11:45:13 +08:00
</view>
</view>
<view class="kong"></view>
<!-- 底部按钮区域 -->
<view class="bottom-fixed">
<!-- 步骤0: 入驻协议 - 只显示下一步 -->
<view v-if="currentStep === 0" class="step-0-buttons">
<view class="agree">
<image v-if="!isAgree" src="/static/images/agree_n.png" class="agree-btn" mode="aspectFit"
@click="isAgree = true"></image>
<image v-else src="/static/images/agree_y.png" class="agree-btn" mode="aspectFit"
@click="isAgree = false"></image>
<text class="agree-tip">我已阅读并同意以上协议</text>
</view>
<view class="next-btn" @click="goNext">
2026-03-25 13:29:04 +08:00
<text class="next-text">下一步填写资质信息</text>
2026-03-24 11:45:13 +08:00
</view>
</view>
<!-- 步骤1: 资质信息 - 显示上一步和下一步 -->
<view v-else-if="currentStep === 1" class="step-1-buttons">
<view class="button-row">
<view class="prev-btn" @click="goPrev">
<text class="prev-text">上一步</text>
</view>
<view class="next-btn" @click="goNext">
2026-03-25 13:29:04 +08:00
<text class="next-text">下一步填写门店信息</text>
2026-03-24 11:45:13 +08:00
</view>
</view>
</view>
<!-- 步骤2: 门店信息 - 显示上一步和提交申请 -->
<view v-else-if="currentStep === 2" class="step-2-buttons">
<view class="button-row">
<view class="prev-btn" @click="goPrev">
<text class="prev-text">上一步</text>
</view>
<view class="submit-btn" @click="submitApplication">
<text class="submit-text">提交申请</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import request from '../../utils/request';
import StepTab from '@/components/step-tab/step-tab.vue';
import QualificationInfo from './qualification_sj.vue';
import StoreInfo from './sj-info.vue';
export default {
components: {
StepTab,
QualificationInfo,
StoreInfo,
},
data() {
return {
currentStep: 0, // 当前步骤索引
isAgree: false,
identity: null,
textData: {},
loading: false,
error: null,
navTitle: '商家入驻', // 默认标题
qualificationData: null, // 新增:保存资质信息
storeInfoData: null, // 新增:保存门店信息
// 新增:缓存手艺人数据
artisanDataCache: {
personalInfo: null,
qualificationInfo: null
}
}
},
async onLoad(options) {
2026-03-25 13:29:04 +08:00
this.identity = 2;
2026-03-24 11:45:13 +08:00
await this.getUserInfoSync()
// 确保子组件也能访问到 identity
2026-03-25 13:29:04 +08:00
this.getXieyi(1);
2026-03-24 11:45:13 +08:00
},
onShow() {
console.log('入驻页面 onShow - 检查地址数据');
// 检查商家地址数据
this.checkAndPassAddressToSj();
},
methods: {
// 获取用户信息(复用不可服务时间页面的方法)
async getUserInfoSync() {
2026-03-25 13:29:04 +08:00
await request.post('/sj/userSjAuth/details', {
type: 1
2026-03-24 11:45:13 +08:00
}).then(result => {
2026-03-25 13:29:04 +08:00
if (result.code == 200 && result.data) {
2026-03-24 11:45:13 +08:00
let data = result.data
2026-03-25 13:29:04 +08:00
if (getApp().globalData.artisanType == 2) {
2026-03-24 11:45:13 +08:00
//储存已有的商家入驻信息
let qualification_form_data = {
2026-03-25 13:29:04 +08:00
"uscc_num": data.uscc_num,
"uscc_name": data.uscc_name,
"legal_name": data.legal_name,
2026-03-24 11:45:13 +08:00
"legal_phone": data.legal_phone,
2026-03-25 13:29:04 +08:00
"legal_idcard_num": data.legal_idcard_num,
"uscc_photo": data.uscc_photo,
"legal_idcard_positive": data.legal_idcard_positive,
"legal_idcard_negative": data.legal_idcard_negative,
"uscc_type": data.uscc_type,
2026-03-24 11:45:13 +08:00
"license_valid_type": data.uscc_expiry_type,
}
if (data.uscc_expiry) {
let expirys = data.uscc_expiry.split(' —— ')
qualification_form_data.license_start_date = expirys[0]
qualification_form_data.license_end_date = expirys[1]
}
if (data.legal_idcard_expiry) {
let expirys = data.legal_idcard_expiry.split(' —— ')
qualification_form_data.idcard_start_date = expirys[0]
if (expirys[1]) {
2026-03-25 13:29:04 +08:00
qualification_form_data.legal_idcard_expiry_type = "date"
2026-03-24 11:45:13 +08:00
qualification_form_data.idcard_end_date = expirys[1]
} else {
2026-03-25 13:29:04 +08:00
qualification_form_data.legal_idcard_expiry_type = "permanent"
2026-03-24 11:45:13 +08:00
qualification_form_data.idcard_end_date = ""
}
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
}
uni.setStorageSync('qualification_form_data', qualification_form_data);
let store_invite_state = {
"currentValidatingCode": data.invite_code_other
}
uni.setStorageSync('store_invite_state', store_invite_state);
let store_info_form_data = {
2026-03-25 13:29:04 +08:00
"head_photo": data.head_photo,
"name": data.name,
"business_time": data.business_time,
"servers_kill": data.servers_kill,
"dependency": data.dependency,
"address": data.address,
"apply_state": data.apply_state,
"invite_code_other": data.invite_code_other,
"major": data.major,
2026-03-24 11:45:13 +08:00
"dependency_code": data.dependency_code,
"dependency_province": data.dependency_province,
"dependency_city": data.dependency_city,
"longitude": data.longitude,
"latitude": data.latitude
}
2026-03-25 13:29:04 +08:00
console.log(111111111, store_info_form_data)
2026-03-24 11:45:13 +08:00
uni.setStorageSync('store_info_form_data', store_info_form_data);
}
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
}
}).catch(error => {
console.error('获取用户信息接口错误:', error);
});
},
/**
* 解析身份证有效期字符串转换为中文日期格式兼容低版本iOS支持结束日期为空/长期
* @param {string} expiryStr 原有效期字符串格式如"2016-01-29 —— 2026-01-29" | "2016-01-29 —— " | "2016-01-29 —— 长期"
* @returns {Object} 包含开始和结束日期的对象
*/
parseIdCardExpiry(expiryStr) {
// 初始化默认值
let id_card_start_date = '';
let id_card_end_date = '';
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
try {
// 1. 分割字符串:兼容多种分隔符(——、--、—、-),并去除前后空格
const dateParts = expiryStr.split(/\s*[-—]{1,2}\s*/).map(str => str.trim());
// 提取开始和结束日期部分(处理分割后长度不足的情况)
const startStr = dateParts[0] || '';
const endStr = dateParts[1] || '';
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
// 2. 日期解析函数核心兼容低版本iOS
const formatDateToChinese = (dateStr) => {
// 若为空,直接返回空
if (!dateStr) return '';
// 若为“长期”,直接返回“长期”
if (dateStr === '长期') return '长期';
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
// 关键低版本iOS不支持“yyyy-mm-dd”替换为“yyyy/mm/dd”
const compatibleStr = dateStr.replace(/-/g, '/');
const date = new Date(compatibleStr);
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
// 检查日期是否有效
if (isNaN(date.getTime())) {
return ''; // 解析失败则返回空
}
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
// 获取年、月、日(去掉前导零)
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
return `${year}${month}${day}`;
};
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
// 3. 解析开始日期(必须有值,否则置空)
if (startStr) {
id_card_start_date = formatDateToChinese(startStr);
}
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
// 4. 解析结束日期(支持空、长期、正常日期)
id_card_end_date = formatDateToChinese(endStr);
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
} catch (err) {
console.error('解析身份证有效期失败:', err);
}
2026-03-25 13:29:04 +08:00
2026-03-24 11:45:13 +08:00
// 5. 返回结果
return {
id_card_start_date,
id_card_end_date
};
},
// 检查并传递地址给商家组件
checkAndPassAddressToSj() {
try {
const sjAddress = uni.getStorageSync('sj_selected_address');
if (sjAddress) {
console.log('找到商家地址数据,准备传递:', sjAddress);
// 延迟执行,确保组件已渲染
setTimeout(() => {
if (this.identity === 2 && this.$refs.storeInfo) {
console.log('传递地址给商家组件');
// 传递给商家组件
if (typeof this.$refs.storeInfo.handleAddressSelected === 'function') {
this.$refs.storeInfo.handleAddressSelected(sjAddress);
} else if (this.$refs.storeInfo.formData) {
// 直接设置数据
2026-03-25 13:29:04 +08:00
this.$refs.storeInfo.formData.address = sjAddress.address || sjAddress
2026-03-24 11:45:13 +08:00
.name;
this.$refs.storeInfo.formData.longitude = sjAddress.longitude;
this.$refs.storeInfo.formData.latitude = sjAddress.latitude;
// 设置省市区信息
if (sjAddress.pname || sjAddress.cityname || sjAddress.adname) {
const locationParts = [];
if (sjAddress.pname) locationParts.push(sjAddress.pname);
if (sjAddress.cityname) locationParts.push(sjAddress.cityname);
if (sjAddress.adname) locationParts.push(sjAddress.adname);
2026-03-25 13:29:04 +08:00
this.$refs.storeInfo.formData.dependency = locationParts.join('-');
2026-03-24 11:45:13 +08:00
}
this.$refs.storeInfo.saveFormDataToLocal();
this.$refs.storeInfo.$forceUpdate();
}
// 清理存储
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('步骤切换时发现地址数据,传递给组件');
// 传递给组件
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);
}
},
// 检查用户信息
checkUserInfo() {
console.log('检查用户信息...');
// 从多种可能的存储位置检查用户信息
2026-03-25 13:29:04 +08:00
const sources = [{
2026-03-24 11:45:13 +08:00
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);
});
// 检查是否有token确认登录状态
const token = uni.getStorageSync('token');
if (!token) {
console.warn('未检测到登录token');
uni.showToast({
title: '请先登录',
icon: 'none'
});
}
},
// 获取用户信息(复用不可服务时间页面的方法)
getUserInfo() {
return new Promise((resolve, reject) => {
2026-03-25 13:29:04 +08:00
request.post('/sj/User/getUser', {
2026-03-24 11:45:13 +08:00
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;
}
// 如果没有,则调用接口获取
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;
}
uni.showLoading({
title: '提交中...'
});
try {
console.log('=== 提交审核调试信息 ===');
console.log('身份类型:', this.identity);
console.log('门店信息数据:', this.storeInfoData);
console.log('资质信息数据:', this.qualificationData);
console.log('个人信息数据:', this.personalInfoData);
let apiUrl = '';
let formData = {};
if (this.identity === 2) {
// 商家入驻
2026-03-25 13:29:04 +08:00
apiUrl = '/sj/userSjAuth/apply';
2026-03-24 11:45:13 +08:00
// 确保重新获取最新数据
if (this.$refs.storeInfo) {
if (!this.$refs.storeInfo.saveFormData()) {
uni.hideLoading();
return;
}
this.storeInfoData = this.$refs.storeInfo.getFormData();
console.log('重新获取的门店信息:', this.storeInfoData);
}
// 验证服务技能是否存在
2026-03-25 13:29:04 +08:00
if (!this.storeInfoData || !this.storeInfoData.servers_kill || this.storeInfoData
.servers_kill.length === 0) {
2026-03-24 11:45:13 +08:00
uni.hideLoading();
uni.showToast({
title: '请选择服务技能',
icon: 'none'
});
return;
}
formData = this.buildBusinessData(this.qualificationData, this.storeInfoData);
}
console.log('提交的数据:', formData);
console.log('API URL:', apiUrl);
2026-03-25 13:29:04 +08:00
formData.type = 1
formData.id_type = 1
2026-03-24 11:45:13 +08:00
const res = await request.post(apiUrl, formData);
uni.hideLoading();
2026-03-25 13:29:04 +08:00
if (res.state == 1 || res.code == 200) {
2026-03-24 11:45:13 +08:00
// 提交成功后清除缓存数据
uni.showToast({
title: '提交成功',
icon: 'none',
duration: 1500,
success: () => {
setTimeout(() => {
uni.redirectTo({
url: `./submitres?identity=${this.identity}&applyState=1`
});
}, 1500);
}
});
} else {
uni.showToast({
title: res.msg || '提交失败',
icon: 'none'
});
}
} catch (error) {
uni.hideLoading();
console.error('提交审核失败:', error);
uni.showToast({
title: '提交失败,请重试',
icon: 'none'
});
}
},
// 优化日期格式化方法
formatDateForBackend(dateStr) {
if (!dateStr) return '';
if (dateStr === '长久有效' || dateStr === '长久有效') return '';
// 将 年月日 格式转换为 YYYY-MM-DD
const match = dateStr.match(/(\d+)年(\d+)月(\d+)日/);
if (match) {
const year = match[1];
const month = match[2].padStart(2, '0');
const day = match[3].padStart(2, '0');
return `${year}-${month}-${day}`;
}
// 如果已经是 YYYY-MM-DD 格式,直接返回
return dateStr;
},
// 构建商家数据
buildBusinessData(qualificationData, storeData) {
// 根据接口文档构建数据
const formData = {};
// 服务技能处理 - 添加更严格的验证
2026-03-25 13:29:04 +08:00
if (storeData && storeData.servers_kill && storeData.servers_kill.length > 0) {
// 确保 servers_kill 是数组
formData.servers_kill = Array.isArray(storeData.servers_kill) ?
storeData.servers_kill : [storeData.servers_kill];
2026-03-24 11:45:13 +08:00
console.log('服务技能数组:', formData.servers_kill);
} else {
console.warn('警告:没有服务技能数据');
formData.servers_kill = [];
}
// 营业执照信息
2026-03-25 13:29:04 +08:00
if (qualificationData.uscc_type) {
formData.uscc_type = qualificationData.uscc_type === 'individual' ? 1 : 2;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
if (qualificationData.uscc_photo) {
formData.uscc_photo = qualificationData.uscc_photo;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
if (qualificationData.uscc_num) {
formData.uscc_num = qualificationData.uscc_num;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
if (qualificationData.uscc_name) {
formData.uscc_name = qualificationData.uscc_name;
2026-03-24 11:45:13 +08:00
}
if (qualificationData.license_valid_type) {
formData.uscc_expiry_type = qualificationData.license_valid_type === 'permanent' ? 1 : 2;
}
// 格式化有效期
if (qualificationData.license_start_date) {
const startDate = this.formatDateForBackend(qualificationData.license_start_date);
if (qualificationData.license_valid_type === 'permanent') {
// 长久有效格式:开始日期 + " —— "
formData.uscc_expiry = `${startDate} —— `;
} else if (qualificationData.license_end_date) {
// 指定日期格式:开始日期 + " —— " + 结束日期
const endDate = this.formatDateForBackend(qualificationData.license_end_date);
formData.uscc_expiry = `${startDate} —— ${endDate}`;
}
}
// 法人信息
2026-03-25 13:29:04 +08:00
if (qualificationData.legal_name) {
formData.legal_name = qualificationData.legal_name;
2026-03-24 11:45:13 +08:00
}
if (qualificationData.legal_phone) {
formData.legal_phone = qualificationData.legal_phone;
}
2026-03-25 13:29:04 +08:00
if (qualificationData.legal_idcard_num) {
formData.legal_idcard_num = qualificationData.legal_idcard_num;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
if (qualificationData.legal_idcard_expiry_type) {
formData.legal_idcard_expiry_type = qualificationData.legal_idcard_expiry_type === 'permanent' ? 1 : 2;
2026-03-24 11:45:13 +08:00
}
// 格式化有效期
if (qualificationData.idcard_start_date) {
const idcardStartDate = this.formatDateForBackend(qualificationData.idcard_start_date);
2026-03-25 13:29:04 +08:00
if (qualificationData.legal_idcard_expiry_type === 'permanent') {
2026-03-24 11:45:13 +08:00
formData.legal_idcard_expiry = `${idcardStartDate} —— `;
} else if (qualificationData.idcard_end_date) {
const idcardEndDate = this.formatDateForBackend(qualificationData.idcard_end_date);
formData.legal_idcard_expiry = `${idcardStartDate} —— ${idcardEndDate}`;
}
}
2026-03-25 13:29:04 +08:00
if (qualificationData.legal_idcard_positive) {
formData.legal_idcard_positive = qualificationData.legal_idcard_positive;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
if (qualificationData.legal_idcard_negative) {
formData.legal_idcard_negative = qualificationData.legal_idcard_negative;
2026-03-24 11:45:13 +08:00
}
// 门店信息
2026-03-25 13:29:04 +08:00
if (storeData.head_photo) {
formData.head_photo = storeData.head_photo;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
if (storeData.name) {
formData.name = storeData.name;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
if (storeData.business_time) {
formData.business_time = storeData.business_time;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
if (storeData.servers_kill && storeData.servers_kill.length > 0) {
2026-03-24 11:45:13 +08:00
// 直接传递数组
2026-03-25 13:29:04 +08:00
formData.servers_kill = storeData.servers_kill;
2026-03-24 11:45:13 +08:00
console.log('服务技能数组:', formData.servers_kill);
} else {
formData.servers_kill = [];
console.warn('警告:没有服务技能数据');
}
console.log('最终 formData 中的 servers_kill:', formData.servers_kill);
console.log('=== 调试结束 ===');
2026-03-25 13:29:04 +08:00
if (storeData.dependency) {
formData.dependency = storeData.dependency;
2026-03-24 11:45:13 +08:00
// 地址编码
if (storeData.dependency_code) {
formData.dependency_code = storeData.dependency_code;
}
if (storeData.dependency_province) {
formData.dependency_province = storeData.dependency_province;
}
if (storeData.dependency_city) {
formData.dependency_city = storeData.dependency_city;
}
}
2026-03-25 13:29:04 +08:00
if (storeData.address) {
formData.address = storeData.address;
2026-03-24 11:45:13 +08:00
}
// 经纬度
if (storeData.longitude) formData.longitude = storeData.longitude;
if (storeData.latitude) formData.latitude = storeData.latitude;
// 其他信息
2026-03-25 13:29:04 +08:00
if (storeData.apply_state) {
formData.get_msg_method = storeData.apply_state;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
if (storeData.invite_code_other) {
formData.invite_code_other = storeData.invite_code_other;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
if (storeData.major) {
formData.major = storeData.major;
2026-03-24 11:45:13 +08:00
}
// 账号信息 - 直接从登录时输入的手机号获取
// 注意:这里使用 qualificationData 或 storeData 中的手机号,或者从全局获取
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.legal_phone) {
formData.account = qualificationData.legal_phone;
} else {
console.error('无法获取账号信息');
uni.showToast({
title: '无法获取用户账号',
icon: 'none'
});
return null;
}
}
}
console.log('使用的账号:', formData.account);
return formData;
},
async goNext() {
console.log('当前步骤:', this.currentStep);
console.log('身份类型:', this.identity);
// 步骤0需要同意协议
if (this.currentStep === 0 && !this.isAgree) {
uni.showToast({
title: '请阅读并同意以上协议',
icon: 'none'
});
return;
}
// 步骤1需要验证信息
if (this.currentStep === 1) {
2026-03-25 13:29:04 +08:00
console.log('商家验证资质信息');
// 商家验证资质信息
if (this.$refs.qualificationInfo) {
const isValid = await this.$refs.qualificationInfo.saveFormData();
if (!isValid) {
console.log('商家资质信息验证失败');
return;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
this.qualificationData = this.$refs.qualificationInfo.getFormData();
console.log(' 商家资质信息验证通过 ');
2026-03-24 11:45:13 +08:00
}
}
// 步骤2需要验证信息
if (this.currentStep === 2) {
2026-03-25 13:29:04 +08:00
// 商家验证门店信息
if (this.$refs.storeInfo) {
const isValid = await this.$refs.storeInfo.saveFormData();
if (!isValid) {
console.log('商家门店信息验证失败');
return;
2026-03-24 11:45:13 +08:00
}
2026-03-25 13:29:04 +08:00
this.storeInfoData = this.$refs.storeInfo.getFormData();
console.log('商家门店信息验证通过');
2026-03-24 11:45:13 +08:00
}
}
if (this.currentStep < 2) {
this.currentStep++;
console.log('切换到步骤:', this.currentStep);
// 步骤切换后滚动到顶部
setTimeout(() => {
this.scrollToTop();
}, 100);
} else {
this.completeRegistration();
}
},
submitApplication() {
// 商家验证门店信息
if (this.$refs.storeInfo) {
if (!this.$refs.storeInfo.saveFormData()) {
return;
}
this.storeInfoData = this.$refs.storeInfo.getFormData();
console.log('商家门店信息数据:', this.storeInfoData);
}
// 执行提交逻辑
this.completeRegistration();
},
goPrev() {
if (this.currentStep > 0) {
this.currentStep--;
}
},
completeRegistration() {
// 提交审核的逻辑
this.submitForReview();
},
// 添加滚动到顶部的方法
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;
}
},
}
}
</script>
<style>
.ruzhu-page {
background: #f5f5f5;
}
.content {
padding: 20rpx 20rpx 50rpx 20rpx;
box-sizing: border-box;
}
.xieyi_content {
padding: 20rpx;
background: #ffffff;
border-radius: 20rpx;
}
.ruzhu-cont {
padding: 24rpx;
background-color: #fff;
}
.ruzhu-text {
font-size: 28rpx;
color: #3D3D3D;
font-weight: 400;
}
.kong {
width: 100vw;
height: 180rpx;
}
/* 底部按钮区域样式 */
.bottom-fixed {
position: fixed;
left: 0;
bottom: 0;
right: 0;
background-color: #ffffff;
padding: 24rpx 0;
}
/* 步骤0按钮布局 */
.step-0-buttons {
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
}
/* 步骤0中的下一步按钮*/
.step-0-buttons .next-btn {
width: 702rpx;
height: 98rpx !important;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(180deg, #f52540 0%, #e8101e 100%);
border-radius: 49rpx;
}
.step-0-buttons .next-text {
color: #ffffff;
font-size: 32rpx;
font-weight: 500;
}
/* 步骤1和步骤2按钮布局 */
.step-1-buttons,
.step-2-buttons {
display: flex;
justify-content: center;
align-items: center;
}
/* 步骤1中的按钮 */
.step-1-buttons .next-btn {
flex: 1;
height: 98rpx;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(180deg, #f52540 0%, #e8101e 100%);
border-radius: 49rpx;
}
.step-1-buttons .next-text {
color: #ffffff;
font-size: 32rpx;
font-weight: 500;
}
/* 步骤2中的提交按钮 */
.step-2-buttons .submit-btn {
flex: 1;
height: 98rpx;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(180deg, #f52540 0%, #e8101e 100%);
border-radius: 49rpx;
}
.step-2-buttons .submit-text {
color: #ffffff;
font-size: 32rpx;
font-weight: 500;
}
/* 上一步按钮 - 统一所有步骤中的样式 */
.prev-btn {
width: 249rpx;
height: 98rpx;
display: flex;
justify-content: center;
align-items: center;
background-color: #f8f8f8;
border-radius: 60rpx;
}
.prev-text {
color: #E8101E;
font-size: 36rpx;
font-weight: 500;
}
.button-row {
display: flex;
justify-content: space-between;
align-items: center;
width: 702rpx;
height: 147rpx;
gap: 20rpx;
}
.agree {
display: flex;
flex-flow: row nowrap;
justify-content: center;
align-items: center;
margin-bottom: 24rpx;
}
.agree-btn {
width: 32rpx;
height: 32rpx;
margin-right: 13rpx;
}
.agree-tip {
font-size: 26rpx;
font-weight: 400;
color: #666666;
}
.next-text {
color: #ffffff;
font-size: 32rpx;
font-weight: 500;
}
.prev-text {
color: #333;
font-size: 32rpx;
font-weight: 500;
}
.submit-text {
color: #ffffff;
font-size: 32rpx;
font-weight: 500;
}
</style>