入住状态回显
This commit is contained in:
parent
0a8e130c33
commit
2ecd26d609
|
|
@ -73,7 +73,7 @@
|
||||||
v-if="!userInfo.servers_kill_arr || userInfo.servers_kill_arr.length === 0">
|
v-if="!userInfo.servers_kill_arr || userInfo.servers_kill_arr.length === 0">
|
||||||
</image>
|
</image>
|
||||||
<text style="margin-right: 16rpx;"
|
<text style="margin-right: 16rpx;"
|
||||||
:style="{ color: (userInfo.servers_kill_arr && userInfo.servers_kill_arr.length > 0) ? '#333333' : '#ec5d57' }">
|
:style="{ color: (userInfo.servers_kill_arr && userInfo.servers_kill_arr.length > 0) ? '#c9c9c9' : '#ec5d57' }">
|
||||||
{{ (userInfo.servers_kill_arr && userInfo.servers_kill_arr.length > 0) ? '已设置' :
|
{{ (userInfo.servers_kill_arr && userInfo.servers_kill_arr.length > 0) ? '已设置' :
|
||||||
'待完善' }}
|
'待完善' }}
|
||||||
</text>
|
</text>
|
||||||
|
|
@ -630,14 +630,12 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
navigateToQualification() { // 商家手艺人:资质信息
|
navigateToQualification() {
|
||||||
if (this.userInfo.credentials_state == '1') {
|
if (this.userInfo.credentials_state == '1') {
|
||||||
// 商家跳转到资质信息页面
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/ruzhu/ruzhu?type=1'
|
url: '/pages/ruzhu/ruzhu?type=1'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 手艺人跳转到资质信息页面
|
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/shop/qualification_sj_change'
|
url: '/pages/shop/qualification_sj_change'
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -176,8 +176,7 @@ export default {
|
||||||
{
|
{
|
||||||
title: "店铺装修",
|
title: "店铺装修",
|
||||||
url: "https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/4b558456-2e38-4185-8713-d1f0e6645820.png",
|
url: "https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/4b558456-2e38-4185-8713-d1f0e6645820.png",
|
||||||
// https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/e6e72039-eec4-414c-8a86-aad404602962.png
|
path: "/pages/artisan/profile",
|
||||||
path: "/pages/shop/qualification_sj_change",
|
|
||||||
go_id_type: 1,
|
go_id_type: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -654,6 +653,19 @@ export default {
|
||||||
request.post("/sj/user/getUser").then((result) => {
|
request.post("/sj/user/getUser").then((result) => {
|
||||||
this.userInfo = result.data;
|
this.userInfo = result.data;
|
||||||
uni.setStorageSync("syrId", result.data.id);
|
uni.setStorageSync("syrId", result.data.id);
|
||||||
|
const allReady = result.data.business_time
|
||||||
|
&& result.data.servers_kill_arr
|
||||||
|
&& result.data.servers_kill_arr.length > 0
|
||||||
|
&& result.data.credentials_state === 2;
|
||||||
|
const mgmtCard = this.cardList.find(c => c.title === "管理中心");
|
||||||
|
if (mgmtCard) {
|
||||||
|
const shopItem = mgmtCard.list.find(i => i.title === "店铺装修");
|
||||||
|
if (shopItem) {
|
||||||
|
shopItem.url = allReady
|
||||||
|
? "https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/e6e72039-eec4-414c-8a86-aad404602962.png"
|
||||||
|
: "https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/4b558456-2e38-4185-8713-d1f0e6645820.png";
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.getInviteList();
|
this.getInviteList();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -19,7 +19,8 @@
|
||||||
<text :class="formData.dependency ? 'picker-value' : 'placeholder'">
|
<text :class="formData.dependency ? 'picker-value' : 'placeholder'">
|
||||||
{{ formData.dependency || '请选择' }}
|
{{ formData.dependency || '请选择' }}
|
||||||
</text>
|
</text>
|
||||||
<image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/dccc4513-377c-4bfa-9fd2-a5cfdb9798f3"
|
<image
|
||||||
|
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/dccc4513-377c-4bfa-9fd2-a5cfdb9798f3"
|
||||||
class="arrow-right" mode="aspectFit"></image>
|
class="arrow-right" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -29,7 +30,8 @@
|
||||||
<text :class="formData.address ? 'picker-value' : 'placeholder'">
|
<text :class="formData.address ? 'picker-value' : 'placeholder'">
|
||||||
{{ formData.address || '请选择' }}
|
{{ formData.address || '请选择' }}
|
||||||
</text>
|
</text>
|
||||||
<image src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/dccc4513-377c-4bfa-9fd2-a5cfdb9798f3"
|
<image
|
||||||
|
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/dccc4513-377c-4bfa-9fd2-a5cfdb9798f3"
|
||||||
class="arrow-right" mode="aspectFit"></image>
|
class="arrow-right" mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -71,30 +73,63 @@
|
||||||
|
|
||||||
<view class="form-item-one box-cont">
|
<view class="form-item-one box-cont">
|
||||||
<text class="label required">联系人电话</text>
|
<text class="label required">联系人电话</text>
|
||||||
<input type="number" v-model="formData.contact_phone" placeholder="请输入联系电话" placeholder-class="placeholder"
|
<input type="number" v-model="formData.contact_phone" placeholder="请输入联系电话"
|
||||||
class="input" @input="saveFormDataToLocalDebounce" />
|
placeholder-class="placeholder" class="input" @input="saveFormDataToLocalDebounce" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="form-item-one box-cont">
|
<view class="form-item-one box-cont">
|
||||||
<text class="label">备用联系人电话</text>
|
<text class="label">备用联系人电话</text>
|
||||||
<input type="number" v-model="formData.backup_phone" placeholder="请输入备用联系电话" placeholder-class="placeholder"
|
<input type="number" v-model="formData.backup_phone" placeholder="请输入备用联系电话"
|
||||||
class="input" @input="saveFormDataToLocalDebounce" />
|
placeholder-class="placeholder" class="input" @input="saveFormDataToLocalDebounce" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="section">
|
<view class="form-item-one-yqr box-cont invite-code-container">
|
||||||
<view class="section-title">
|
<view class="invite-code-top">
|
||||||
<view class="title-bar"></view>
|
<view class="label-wrapper">
|
||||||
<text class="title-text">其他信息</text>
|
<text class="label required" >邀请码</text>
|
||||||
|
</view>
|
||||||
|
<input type="text" v-model="formData.invite_code_other" placeholder="请输入邀请码"
|
||||||
|
placeholder-class="placeholder" class="input" @input="handleInviteCodeInput" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="form-item-one box-cont">
|
<!-- 分割线 -->
|
||||||
<text class="label required">邀请码</text>
|
<view class="divider"></view>
|
||||||
<input type="text" v-model="formData.invite_code" placeholder="请输入邀请码" placeholder-class="placeholder"
|
|
||||||
class="input" @input="saveFormDataToLocalDebounce" />
|
<!-- 邀请人信息 -->
|
||||||
|
<view class="invite-info-container">
|
||||||
|
<!-- 默认提示 -->
|
||||||
|
<text v-if="!formData.invite_code_other" class="invite-tip">
|
||||||
|
请填写邀请人的邀请码,若没有邀请人请填写13131313
|
||||||
|
</text>
|
||||||
|
|
||||||
|
<!-- 验证中 -->
|
||||||
|
<view v-else-if="inviteCodeValidating" class="invite-validating">
|
||||||
|
<text>验证中...</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 验证失败 -->
|
||||||
|
<view v-else-if="inviteCodeError" class="invite-error" :class="{ 'shake-animation': shakeInviteError }">
|
||||||
|
<text>邀请码无效</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 特殊邀请码13131313 -->
|
||||||
|
<view v-else-if="formData.invite_code_other === '13131313' && !inviterInfo" class="invite-tip">
|
||||||
|
请填写邀请人的邀请码,若没有邀请人请填写13131313
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 显示邀请人信息 -->
|
||||||
|
<view v-else-if="inviterInfo" class="inviter-info">
|
||||||
|
<text class="inviter-label">邀请人:</text>
|
||||||
|
<text class="inviter-name">{{ inviterInfo.name || inviterInfo.nick_name }}</text>
|
||||||
|
<text class="inviter-divider">/</text>
|
||||||
|
<text class="inviter-phone">{{ inviterInfo.account }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 其他情况(接口返回成功但没有认证铁军的邀请码) -->
|
||||||
|
<view v-else class="invite-error" :class="{ 'shake-animation': shakeInviteError }">
|
||||||
|
<text>邀请码无效</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="invite-tip box-cont">
|
|
||||||
<text class="invite-tip-text">请填写邀请人的邀请码,若没有邀请人请填写13131313</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
@ -164,7 +199,9 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import request from '../../utils/request';
|
import request from '../../utils/request';
|
||||||
import { debounce } from '@/utils/debounce.js';
|
import {
|
||||||
|
debounce
|
||||||
|
} from '@/utils/debounce.js';
|
||||||
import ChinaCitys from '../../static/data/ChinaCitys.json';
|
import ChinaCitys from '../../static/data/ChinaCitys.json';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -179,7 +216,7 @@ export default {
|
||||||
contact_name: '',
|
contact_name: '',
|
||||||
contact_phone: '',
|
contact_phone: '',
|
||||||
backup_phone: '',
|
backup_phone: '',
|
||||||
invite_code: '',
|
invite_code_other: '',
|
||||||
dependency: '',
|
dependency: '',
|
||||||
address: '',
|
address: '',
|
||||||
dependency_code: '',
|
dependency_code: '',
|
||||||
|
|
@ -199,7 +236,16 @@ export default {
|
||||||
locatinCitys: [],
|
locatinCitys: [],
|
||||||
locationAreas: [],
|
locationAreas: [],
|
||||||
locationValue: [0, 0, 0],
|
locationValue: [0, 0, 0],
|
||||||
showLocationPopupFlag: false
|
showLocationPopupFlag: false,
|
||||||
|
// 抖动效果控制
|
||||||
|
shakeInviteError: false,
|
||||||
|
|
||||||
|
// 邀请码相关字段
|
||||||
|
inviteCodeValidating: false,
|
||||||
|
inviteCodeError: false,
|
||||||
|
inviterInfo: null,
|
||||||
|
currentValidatingCode: '',
|
||||||
|
inviteValidationTimer: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -219,7 +265,7 @@ export default {
|
||||||
'formData.backup_phone'(newVal) {
|
'formData.backup_phone'(newVal) {
|
||||||
this.saveFormDataToLocalDebounce();
|
this.saveFormDataToLocalDebounce();
|
||||||
},
|
},
|
||||||
'formData.invite_code'(newVal) {
|
'formData.invite_code_other'(newVal) {
|
||||||
this.saveFormDataToLocalDebounce();
|
this.saveFormDataToLocalDebounce();
|
||||||
},
|
},
|
||||||
'formData.dependency'(newVal) {
|
'formData.dependency'(newVal) {
|
||||||
|
|
@ -247,6 +293,12 @@ export default {
|
||||||
|
|
||||||
this.checkGlobalData();
|
this.checkGlobalData();
|
||||||
this.checkAddressData();
|
this.checkAddressData();
|
||||||
|
|
||||||
|
this.loadInviteStateFromLocal();
|
||||||
|
|
||||||
|
if (this.formData.invite_code_other) {
|
||||||
|
this.validateInviteCode(this.formData.invite_code_other);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onUnload() {
|
onUnload() {
|
||||||
|
|
@ -265,6 +317,10 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.locatinCitys = this.ChinaCitys[0].citys;
|
this.locatinCitys = this.ChinaCitys[0].citys;
|
||||||
this.locationAreas = this.locatinCitys[0].areas;
|
this.locationAreas = this.locatinCitys[0].areas;
|
||||||
|
|
||||||
|
if (this.formData.invite_code_other) {
|
||||||
|
this.validateInviteCode(this.formData.invite_code_other);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onHide() {
|
onHide() {
|
||||||
|
|
@ -272,6 +328,307 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
loadInviteStateFromLocal() {
|
||||||
|
try {
|
||||||
|
const inviteState = uni.getStorageSync('store_invite_state');
|
||||||
|
if (inviteState) {
|
||||||
|
console.log('加载邀请码验证状态:', inviteState);
|
||||||
|
|
||||||
|
// 恢复邀请码验证状态
|
||||||
|
this.inviterInfo = inviteState.inviterInfo || null;
|
||||||
|
this.inviteCodeError = inviteState.inviteCodeError || false;
|
||||||
|
this.currentValidatingCode = inviteState.currentValidatingCode || '';
|
||||||
|
|
||||||
|
// 特殊处理:如果当前邀请码是13131313,确保状态正确
|
||||||
|
if (this.formData.invite_code_other === '13131313') {
|
||||||
|
console.log('检测到特殊邀请码13131313,重置验证状态');
|
||||||
|
this.inviteCodeError = false;
|
||||||
|
this.inviterInfo = null;
|
||||||
|
this.currentValidatingCode = '13131313';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果正在验证的邀请码与当前表单中的一致,保持验证状态
|
||||||
|
if (this.currentValidatingCode === this.formData.invite_code_other) {
|
||||||
|
// 状态已恢复,无需额外操作
|
||||||
|
} else {
|
||||||
|
// 如果不一致,重新验证
|
||||||
|
if (this.formData.invite_code_other && this.formData.invite_code_other.trim() !== '') {
|
||||||
|
console.log('邀请码不一致,重新验证:', this.formData.invite_code_other);
|
||||||
|
this.handleInviteCodeInput({
|
||||||
|
detail: {
|
||||||
|
value: this.formData.invite_code_other
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果没有保存的状态,重置为初始状态
|
||||||
|
this.resetInviteCodeState();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('加载邀请码验证状态失败:', e);
|
||||||
|
this.resetInviteCodeState();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增方法:重置邀请码状态
|
||||||
|
resetInviteCodeState() {
|
||||||
|
this.inviteCodeValidating = false;
|
||||||
|
this.inviteCodeError = false;
|
||||||
|
this.inviterInfo = null;
|
||||||
|
this.currentValidatingCode = '';
|
||||||
|
this.shakeInviteError = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增方法:专门保存邀请码验证状态
|
||||||
|
saveInviteStateToLocal() {
|
||||||
|
try {
|
||||||
|
const inviteState = {
|
||||||
|
inviterInfo: this.inviterInfo,
|
||||||
|
inviteCodeError: this.inviteCodeError,
|
||||||
|
currentValidatingCode: this.currentValidatingCode || this.formData.invite_code_other || ''
|
||||||
|
};
|
||||||
|
uni.setStorageSync('store_invite_state', inviteState);
|
||||||
|
|
||||||
|
console.log('邀请码验证状态已保存:', {
|
||||||
|
hasInviterInfo: !!this.inviterInfo,
|
||||||
|
inviteCodeError: this.inviteCodeError,
|
||||||
|
currentValidatingCode: this.currentValidatingCode
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.log('保存邀请码验证状态失败:', e);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 触发邀请码错误抖动效果
|
||||||
|
triggerInviteErrorShake() {
|
||||||
|
// 触发抖动效果
|
||||||
|
this.shakeInviteError = true;
|
||||||
|
|
||||||
|
// 滚动到邀请码容器位置
|
||||||
|
this.$nextTick(() => {
|
||||||
|
// 使用uni.createSelectorQuery获取邀请码容器的位置
|
||||||
|
const query = uni.createSelectorQuery().in(this);
|
||||||
|
query.select('.invite-code-container').boundingClientRect((rect) => {
|
||||||
|
if (rect) {
|
||||||
|
// 获取当前窗口高度
|
||||||
|
const windowHeight = uni.getSystemInfoSync().windowHeight;
|
||||||
|
|
||||||
|
// 判断邀请码容器是否已经在可视区域内
|
||||||
|
// 计算容器在屏幕中的位置比例(0-1之间)
|
||||||
|
const containerTopRatio = rect.top / windowHeight;
|
||||||
|
const containerBottomRatio = (rect.top + rect.height) / windowHeight;
|
||||||
|
|
||||||
|
// 如果容器已经在屏幕中上部(顶部在屏幕中间以上),就不需要滚动
|
||||||
|
// 或者容器整体都在屏幕内,也不需要滚动
|
||||||
|
if (containerTopRatio >= 0 && containerTopRatio < 0.7 &&
|
||||||
|
containerBottomRatio <= 1) {
|
||||||
|
console.log('邀请码容器已在可视区域内,不需要滚动');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 滚动到邀请码容器位置,减去一些偏移量让用户体验更好
|
||||||
|
uni.pageScrollTo({
|
||||||
|
scrollTop: rect.top - 50,
|
||||||
|
duration: 300
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).exec();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 0.5秒后重置抖动状态
|
||||||
|
setTimeout(() => {
|
||||||
|
this.shakeInviteError = false;
|
||||||
|
}, 500);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理邀请码输入
|
||||||
|
handleInviteCodeInput(e) {
|
||||||
|
const code = e.detail ? e.detail.value : this.formData.invite_code_other;
|
||||||
|
|
||||||
|
console.log('邀请码输入:', code);
|
||||||
|
|
||||||
|
// 立即重置状态
|
||||||
|
this.inviteCodeValidating = false;
|
||||||
|
this.inviteCodeError = false;
|
||||||
|
this.inviterInfo = null;
|
||||||
|
|
||||||
|
// 如果邀请码为空,不进行验证
|
||||||
|
if (!code || code.trim() === '') {
|
||||||
|
this.formData.invite_code_other = '';
|
||||||
|
this.saveFormDataToLocalDebounce();
|
||||||
|
// 保存空状态
|
||||||
|
this.saveInviteStateToLocal();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.formData.invite_code_other = code;
|
||||||
|
this.saveFormDataToLocalDebounce();
|
||||||
|
|
||||||
|
// 【关键修复】如果是13131313,立即通过验证并取消任何正在进行的验证
|
||||||
|
if (code === '13131313') {
|
||||||
|
console.log('检测到特殊邀请码13131313,立即通过');
|
||||||
|
|
||||||
|
// 清除任何可能的定时器
|
||||||
|
if (this.inviteValidationTimer) {
|
||||||
|
clearTimeout(this.inviteValidationTimer);
|
||||||
|
this.inviteValidationTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 立即更新状态
|
||||||
|
this.inviteCodeValidating = false;
|
||||||
|
this.inviteCodeError = false;
|
||||||
|
this.inviterInfo = null;
|
||||||
|
this.currentValidatingCode = code;
|
||||||
|
|
||||||
|
// 特殊邀请码也需要保存状态
|
||||||
|
const inviteState = {
|
||||||
|
inviterInfo: null,
|
||||||
|
inviteCodeError: false,
|
||||||
|
currentValidatingCode: code
|
||||||
|
};
|
||||||
|
uni.setStorageSync('store_invite_state', inviteState);
|
||||||
|
|
||||||
|
// 强制更新视图
|
||||||
|
this.$forceUpdate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 记录当前正在验证的邀请码
|
||||||
|
this.currentValidatingCode = code;
|
||||||
|
|
||||||
|
// 立即保存状态(验证中)
|
||||||
|
this.saveInviteStateToLocal();
|
||||||
|
|
||||||
|
// 清除之前的定时器
|
||||||
|
if (this.inviteValidationTimer) {
|
||||||
|
clearTimeout(this.inviteValidationTimer);
|
||||||
|
this.inviteValidationTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置新的定时器
|
||||||
|
this.inviteValidationTimer = setTimeout(() => {
|
||||||
|
// 检查邀请码是否变化
|
||||||
|
if (this.formData.invite_code_other !== this.currentValidatingCode) {
|
||||||
|
console.log('邀请码已变化,取消验证');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 再次检查是否是13131313(双重检查)
|
||||||
|
if (this.formData.invite_code_other === '13131313') {
|
||||||
|
console.log('双重检查:检测到特殊邀请码13131313');
|
||||||
|
this.inviteCodeValidating = false;
|
||||||
|
this.inviteCodeError = false;
|
||||||
|
this.inviterInfo = null;
|
||||||
|
this.currentValidatingCode = '13131313';
|
||||||
|
|
||||||
|
const inviteState = {
|
||||||
|
inviterInfo: null,
|
||||||
|
inviteCodeError: false,
|
||||||
|
currentValidatingCode: '13131313'
|
||||||
|
};
|
||||||
|
uni.setStorageSync('store_invite_state', inviteState);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('开始验证邀请码:', this.formData.invite_code_other);
|
||||||
|
this.validateInviteCode(this.formData.invite_code_other);
|
||||||
|
|
||||||
|
// 清理定时器
|
||||||
|
this.inviteValidationTimer = null;
|
||||||
|
}, 600); // 适当增加延迟时间
|
||||||
|
},
|
||||||
|
|
||||||
|
// 验证邀请码
|
||||||
|
async validateInviteCode(code) {
|
||||||
|
console.log('开始验证邀请码:', code);
|
||||||
|
|
||||||
|
// 特殊邀请码13131313直接通过
|
||||||
|
if (code === '13131313') {
|
||||||
|
console.log('特殊邀请码13131313,直接通过');
|
||||||
|
this.inviteCodeValidating = false;
|
||||||
|
this.inviteCodeError = false;
|
||||||
|
this.inviterInfo = null;
|
||||||
|
this.currentValidatingCode = code;
|
||||||
|
// 特殊邀请码也需要保存状态
|
||||||
|
const inviteState = {
|
||||||
|
inviterInfo: null,
|
||||||
|
inviteCodeError: false,
|
||||||
|
currentValidatingCode: code
|
||||||
|
};
|
||||||
|
uni.setStorageSync('store_invite_state', inviteState);
|
||||||
|
|
||||||
|
// 强制更新视图
|
||||||
|
this.$forceUpdate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果邀请码为空
|
||||||
|
if (!code || code.trim() === '') {
|
||||||
|
this.inviteCodeValidating = false;
|
||||||
|
this.inviteCodeError = false;
|
||||||
|
this.inviterInfo = null;
|
||||||
|
this.currentValidatingCode = '';
|
||||||
|
const inviteState = {
|
||||||
|
inviterInfo: null,
|
||||||
|
inviteCodeError: false,
|
||||||
|
currentValidatingCode: ''
|
||||||
|
};
|
||||||
|
uni.setStorageSync('store_invite_state', inviteState);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置验证中状态
|
||||||
|
this.inviteCodeValidating = true;
|
||||||
|
this.inviteCodeError = false;
|
||||||
|
this.inviterInfo = null;
|
||||||
|
this.currentValidatingCode = code;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 调用接口验证邀请码
|
||||||
|
const response = await request.post('/user/user/getInvite', {
|
||||||
|
invite_code: code
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('邀请码验证响应:', response);
|
||||||
|
|
||||||
|
// 验证完成
|
||||||
|
this.inviteCodeValidating = false;
|
||||||
|
|
||||||
|
if (response && (response.state === 1 || response.code === 200) && response.data) {
|
||||||
|
const userData = response.data;
|
||||||
|
|
||||||
|
if (userData.account) {
|
||||||
|
// 邀请码有效,保存邀请人信息
|
||||||
|
this.inviterInfo = userData;
|
||||||
|
this.inviteCodeError = false;
|
||||||
|
console.log('邀请码验证通过,邀请人:', userData);
|
||||||
|
} else {
|
||||||
|
// 接口返回数据但没有account字段,说明不是有效邀请人
|
||||||
|
console.log('接口返回数据无效,没有account字段:', userData);
|
||||||
|
this.inviterInfo = null;
|
||||||
|
this.inviteCodeError = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 接口返回错误或数据为空
|
||||||
|
console.log('接口返回错误:', response?.msg || '未知错误');
|
||||||
|
this.inviterInfo = null;
|
||||||
|
this.inviteCodeError = true;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('验证邀请码失败:', error);
|
||||||
|
this.inviteCodeValidating = false;
|
||||||
|
this.inviteCodeError = true;
|
||||||
|
this.inviterInfo = null;
|
||||||
|
} finally {
|
||||||
|
// 无论成功失败都保存状态
|
||||||
|
const inviteState = {
|
||||||
|
inviterInfo: this.inviterInfo,
|
||||||
|
inviteCodeError: this.inviteCodeError,
|
||||||
|
currentValidatingCode: this.currentValidatingCode
|
||||||
|
};
|
||||||
|
uni.setStorageSync('store_invite_state', inviteState);
|
||||||
|
}
|
||||||
|
},
|
||||||
checkGlobalData() {
|
checkGlobalData() {
|
||||||
if (getApp().globalData.qualificationData) {
|
if (getApp().globalData.qualificationData) {
|
||||||
this.formData = {
|
this.formData = {
|
||||||
|
|
@ -288,6 +645,15 @@ export default {
|
||||||
const stored = uni.getStorageSync('qualification_form_data');
|
const stored = uni.getStorageSync('qualification_form_data');
|
||||||
if (stored) {
|
if (stored) {
|
||||||
console.log('从本地存储加载数据:', stored);
|
console.log('从本地存储加载数据:', stored);
|
||||||
|
|
||||||
|
const inviteState = uni.getStorageSync('store_invite_state');
|
||||||
|
if (inviteState) {
|
||||||
|
this.inviterInfo = inviteState.inviterInfo;
|
||||||
|
this.inviteCodeError = inviteState.inviteCodeError || false;
|
||||||
|
this.currentValidatingCode = inviteState.currentValidatingCode || '';
|
||||||
|
console.log('加载邀请码验证状态:', inviteState);
|
||||||
|
}
|
||||||
|
|
||||||
return stored;
|
return stored;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -303,6 +669,13 @@ export default {
|
||||||
saveFormDataToLocal() {
|
saveFormDataToLocal() {
|
||||||
try {
|
try {
|
||||||
uni.setStorageSync('qualification_form_data', this.formData);
|
uni.setStorageSync('qualification_form_data', this.formData);
|
||||||
|
|
||||||
|
const inviteState = {
|
||||||
|
inviterInfo: this.inviterInfo,
|
||||||
|
inviteCodeError: this.inviteCodeError,
|
||||||
|
currentValidatingCode: this.currentValidatingCode
|
||||||
|
};
|
||||||
|
uni.setStorageSync('store_invite_state', inviteState);
|
||||||
console.log('数据已保存到本地存储');
|
console.log('数据已保存到本地存储');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('保存数据失败:', e);
|
console.log('保存数据失败:', e);
|
||||||
|
|
@ -337,36 +710,59 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
getFormData() {
|
getFormData() {
|
||||||
return { ...this.formData };
|
return {
|
||||||
|
...this.formData
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
saveFormData() {
|
saveFormData() {
|
||||||
if (!this.formData.name) {
|
if (!this.formData.name) {
|
||||||
uni.showToast({ title: '请输入店铺名称', icon: 'none' });
|
uni.showToast({
|
||||||
|
title: '请输入店铺名称',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.formData.dependency) {
|
if (!this.formData.dependency) {
|
||||||
uni.showToast({ title: '请选择门店所在地', icon: 'none' });
|
uni.showToast({
|
||||||
|
title: '请选择门店所在地',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.formData.address) {
|
if (!this.formData.address) {
|
||||||
uni.showToast({ title: '请选择门店详细地址', icon: 'none' });
|
uni.showToast({
|
||||||
|
title: '请选择门店详细地址',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.formData.contact_name) {
|
if (!this.formData.contact_name) {
|
||||||
uni.showToast({ title: '请输入联系人', icon: 'none' });
|
uni.showToast({
|
||||||
|
title: '请输入联系人',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.formData.contact_phone) {
|
if (!this.formData.contact_phone) {
|
||||||
uni.showToast({ title: '请输入联系人电话', icon: 'none' });
|
uni.showToast({
|
||||||
|
title: '请输入联系人电话',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!/^1[3-9]\d{9}$/.test(this.formData.contact_phone)) {
|
if (!/^1[3-9]\d{9}$/.test(this.formData.contact_phone)) {
|
||||||
uni.showToast({ title: '请输入正确的手机号码', icon: 'none' });
|
uni.showToast({
|
||||||
|
title: '请输入正确的手机号码',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!this.formData.invite_code) {
|
if (!this.formData.invite_code) {
|
||||||
uni.showToast({ title: '请输入邀请码', icon: 'none' });
|
uni.showToast({
|
||||||
|
title: '请输入邀请码',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.saveFormDataToLocal();
|
this.saveFormDataToLocal();
|
||||||
|
|
@ -566,7 +962,8 @@ export default {
|
||||||
|
|
||||||
const regionParts = [];
|
const regionParts = [];
|
||||||
if (addressData.pname) regionParts.push(addressData.pname);
|
if (addressData.pname) regionParts.push(addressData.pname);
|
||||||
if (addressData.cityname && addressData.cityname !== addressData.pname) regionParts.push(addressData.cityname);
|
if (addressData.cityname && addressData.cityname !== addressData.pname) regionParts.push(addressData
|
||||||
|
.cityname);
|
||||||
if (addressData.adname) regionParts.push(addressData.adname);
|
if (addressData.adname) regionParts.push(addressData.adname);
|
||||||
|
|
||||||
const regionText = regionParts.join('');
|
const regionText = regionParts.join('');
|
||||||
|
|
@ -678,6 +1075,14 @@ export default {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invite-code-top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 24rpx;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
.label-wrapper {
|
.label-wrapper {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -999,4 +1404,50 @@ export default {
|
||||||
.tip-btn .btn-text {
|
.tip-btn .btn-text {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invite-info-container {
|
||||||
|
padding: 20rpx 24rpx;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-height: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-tip {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-validating {
|
||||||
|
font-size: 20rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite-error {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #E8101E;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inviter-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inviter-label {
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inviter-name {
|
||||||
|
color: #333333;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inviter-divider {
|
||||||
|
color: #666666;
|
||||||
|
margin: 0 5rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inviter-phone {
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue