960 lines
27 KiB
Vue
960 lines
27 KiB
Vue
<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">
|
||
<!-- 手艺人显示个人信息,商家显示资质信息 -->
|
||
<qualification-info ref="qualificationInfo"></qualification-info>
|
||
</view>
|
||
<!-- 步骤2: 根据身份显示不同内容 -->
|
||
<view v-else-if="currentStep === 2">
|
||
<!-- 手艺人显示资质信息,商家显示门店信息 -->
|
||
<store-info ref="storeInfo"></store-info>
|
||
</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">
|
||
<text class="next-text">下一步,填写资质信息</text>
|
||
</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">
|
||
<text class="next-text">下一步,填写门店信息</text>
|
||
</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) {
|
||
this.identity = 2;
|
||
await this.getUserInfoSync()
|
||
// 确保子组件也能访问到 identity
|
||
this.getXieyi(1);
|
||
},
|
||
|
||
onShow() {
|
||
console.log('入驻页面 onShow - 检查地址数据');
|
||
// 检查商家地址数据
|
||
this.checkAndPassAddressToSj();
|
||
},
|
||
|
||
methods: {
|
||
// 获取用户信息(复用不可服务时间页面的方法)
|
||
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_num": data.uscc_num,
|
||
"uscc_name": data.uscc_name,
|
||
"legal_name": data.legal_name,
|
||
"legal_phone": data.legal_phone,
|
||
"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,
|
||
"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]) {
|
||
qualification_form_data.legal_idcard_expiry_type = "date"
|
||
qualification_form_data.idcard_end_date = expirys[1]
|
||
} else {
|
||
qualification_form_data.legal_idcard_expiry_type = "permanent"
|
||
qualification_form_data.idcard_end_date = ""
|
||
}
|
||
|
||
}
|
||
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 = {
|
||
"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,
|
||
"dependency_code": data.dependency_code,
|
||
"dependency_province": data.dependency_province,
|
||
"dependency_city": data.dependency_city,
|
||
"longitude": data.longitude,
|
||
"latitude": data.latitude
|
||
}
|
||
console.log(111111111, store_info_form_data)
|
||
uni.setStorageSync('store_info_form_data', store_info_form_data);
|
||
}
|
||
|
||
}
|
||
}).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 = '';
|
||
|
||
try {
|
||
// 1. 分割字符串:兼容多种分隔符(——、--、—、-),并去除前后空格
|
||
const dateParts = expiryStr.split(/\s*[-—]{1,2}\s*/).map(str => str.trim());
|
||
// 提取开始和结束日期部分(处理分割后长度不足的情况)
|
||
const startStr = dateParts[0] || '';
|
||
const endStr = dateParts[1] || '';
|
||
|
||
// 2. 日期解析函数(核心:兼容低版本iOS)
|
||
const formatDateToChinese = (dateStr) => {
|
||
// 若为空,直接返回空
|
||
if (!dateStr) return '';
|
||
// 若为“长期”,直接返回“长期”
|
||
if (dateStr === '长期') return '长期';
|
||
|
||
// 关键:低版本iOS不支持“yyyy-mm-dd”,替换为“yyyy/mm/dd”
|
||
const compatibleStr = dateStr.replace(/-/g, '/');
|
||
const date = new Date(compatibleStr);
|
||
|
||
// 检查日期是否有效
|
||
if (isNaN(date.getTime())) {
|
||
return ''; // 解析失败则返回空
|
||
}
|
||
|
||
// 获取年、月、日(去掉前导零)
|
||
const year = date.getFullYear();
|
||
const month = date.getMonth() + 1;
|
||
const day = date.getDate();
|
||
|
||
return `${year}年${month}月${day}日`;
|
||
};
|
||
|
||
// 3. 解析开始日期(必须有值,否则置空)
|
||
if (startStr) {
|
||
id_card_start_date = formatDateToChinese(startStr);
|
||
}
|
||
|
||
// 4. 解析结束日期(支持空、长期、正常日期)
|
||
id_card_end_date = formatDateToChinese(endStr);
|
||
|
||
} catch (err) {
|
||
console.error('解析身份证有效期失败:', err);
|
||
}
|
||
|
||
// 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) {
|
||
// 直接设置数据
|
||
this.$refs.storeInfo.formData.address = sjAddress.address || sjAddress
|
||
.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);
|
||
this.$refs.storeInfo.formData.dependency = locationParts.join('-');
|
||
}
|
||
|
||
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('检查用户信息...');
|
||
|
||
// 从多种可能的存储位置检查用户信息
|
||
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);
|
||
});
|
||
|
||
// 检查是否有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);
|
||
});
|
||
});
|
||
},
|
||
|
||
// 检查并获取用户信息
|
||
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) {
|
||
// 商家入驻
|
||
apiUrl = '/sj/userSjAuth/apply';
|
||
|
||
// 确保重新获取最新数据
|
||
if (this.$refs.storeInfo) {
|
||
if (!this.$refs.storeInfo.saveFormData()) {
|
||
uni.hideLoading();
|
||
return;
|
||
}
|
||
this.storeInfoData = this.$refs.storeInfo.getFormData();
|
||
console.log('重新获取的门店信息:', this.storeInfoData);
|
||
}
|
||
|
||
// 验证服务技能是否存在
|
||
if (!this.storeInfoData || !this.storeInfoData.servers_kill || this.storeInfoData
|
||
.servers_kill.length === 0) {
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '请选择服务技能',
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
|
||
formData = this.buildBusinessData(this.qualificationData, this.storeInfoData);
|
||
}
|
||
|
||
console.log('提交的数据:', formData);
|
||
console.log('API URL:', apiUrl);
|
||
|
||
formData.type = 1
|
||
formData.id_type = 1
|
||
|
||
const res = await request.post(apiUrl, formData);
|
||
|
||
uni.hideLoading();
|
||
|
||
if (res.state == 1 || res.code == 200) {
|
||
// 提交成功后清除缓存数据
|
||
|
||
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 = {};
|
||
|
||
// 服务技能处理 - 添加更严格的验证
|
||
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];
|
||
|
||
console.log('服务技能数组:', formData.servers_kill);
|
||
} else {
|
||
console.warn('警告:没有服务技能数据');
|
||
formData.servers_kill = [];
|
||
}
|
||
|
||
// 营业执照信息
|
||
if (qualificationData.uscc_type) {
|
||
formData.uscc_type = qualificationData.uscc_type === 'individual' ? 1 : 2;
|
||
}
|
||
if (qualificationData.uscc_photo) {
|
||
formData.uscc_photo = qualificationData.uscc_photo;
|
||
}
|
||
if (qualificationData.uscc_num) {
|
||
formData.uscc_num = qualificationData.uscc_num;
|
||
}
|
||
if (qualificationData.uscc_name) {
|
||
formData.uscc_name = qualificationData.uscc_name;
|
||
}
|
||
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}`;
|
||
}
|
||
}
|
||
|
||
// 法人信息
|
||
if (qualificationData.legal_name) {
|
||
formData.legal_name = qualificationData.legal_name;
|
||
}
|
||
if (qualificationData.legal_phone) {
|
||
formData.legal_phone = qualificationData.legal_phone;
|
||
}
|
||
if (qualificationData.legal_idcard_num) {
|
||
formData.legal_idcard_num = qualificationData.legal_idcard_num;
|
||
}
|
||
if (qualificationData.legal_idcard_expiry_type) {
|
||
formData.legal_idcard_expiry_type = qualificationData.legal_idcard_expiry_type === 'permanent' ? 1 : 2;
|
||
}
|
||
|
||
// 格式化有效期
|
||
if (qualificationData.idcard_start_date) {
|
||
const idcardStartDate = this.formatDateForBackend(qualificationData.idcard_start_date);
|
||
|
||
if (qualificationData.legal_idcard_expiry_type === 'permanent') {
|
||
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}`;
|
||
}
|
||
}
|
||
|
||
if (qualificationData.legal_idcard_positive) {
|
||
formData.legal_idcard_positive = qualificationData.legal_idcard_positive;
|
||
}
|
||
if (qualificationData.legal_idcard_negative) {
|
||
formData.legal_idcard_negative = qualificationData.legal_idcard_negative;
|
||
}
|
||
|
||
// 门店信息
|
||
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.servers_kill && storeData.servers_kill.length > 0) {
|
||
// 直接传递数组
|
||
formData.servers_kill = storeData.servers_kill;
|
||
console.log('服务技能数组:', formData.servers_kill);
|
||
} else {
|
||
formData.servers_kill = [];
|
||
console.warn('警告:没有服务技能数据');
|
||
}
|
||
|
||
console.log('最终 formData 中的 servers_kill:', formData.servers_kill);
|
||
console.log('=== 调试结束 ===');
|
||
|
||
if (storeData.dependency) {
|
||
formData.dependency = storeData.dependency;
|
||
|
||
// 地址编码
|
||
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;
|
||
}
|
||
}
|
||
if (storeData.address) {
|
||
formData.address = storeData.address;
|
||
}
|
||
// 经纬度
|
||
if (storeData.longitude) formData.longitude = storeData.longitude;
|
||
if (storeData.latitude) formData.latitude = storeData.latitude;
|
||
|
||
// 其他信息
|
||
if (storeData.apply_state) {
|
||
formData.get_msg_method = storeData.apply_state;
|
||
}
|
||
if (storeData.invite_code_other) {
|
||
formData.invite_code_other = storeData.invite_code_other;
|
||
}
|
||
if (storeData.major) {
|
||
formData.major = storeData.major;
|
||
}
|
||
|
||
// 账号信息 - 直接从登录时输入的手机号获取
|
||
// 注意:这里使用 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) {
|
||
console.log('商家验证资质信息');
|
||
// 商家验证资质信息
|
||
if (this.$refs.qualificationInfo) {
|
||
const isValid = await this.$refs.qualificationInfo.saveFormData();
|
||
if (!isValid) {
|
||
console.log('商家资质信息验证失败');
|
||
return;
|
||
}
|
||
this.qualificationData = this.$refs.qualificationInfo.getFormData();
|
||
console.log(' 商家资质信息验证通过 ');
|
||
}
|
||
}
|
||
|
||
// 步骤2需要验证信息
|
||
if (this.currentStep === 2) {
|
||
// 商家验证门店信息
|
||
if (this.$refs.storeInfo) {
|
||
const isValid = await this.$refs.storeInfo.saveFormData();
|
||
if (!isValid) {
|
||
console.log('商家门店信息验证失败');
|
||
return;
|
||
}
|
||
this.storeInfoData = this.$refs.storeInfo.getFormData();
|
||
console.log('商家门店信息验证通过');
|
||
}
|
||
}
|
||
|
||
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> |