商家邀请码弹窗bug
This commit is contained in:
parent
ad97d5683c
commit
7b54ba6749
|
|
@ -742,8 +742,16 @@
|
||||||
console.log('商家门店信息数据:', this.storeInfoData);
|
console.log('商家门店信息数据:', this.storeInfoData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行提交逻辑
|
// 提交前确认邀请码
|
||||||
|
if (this.$refs.storeInfo && this.$refs.storeInfo.confirmInviteCodeBeforeSubmit) {
|
||||||
|
this.$refs.storeInfo.confirmInviteCodeBeforeSubmit(() => {
|
||||||
|
// 确认后执行提交逻辑
|
||||||
this.completeRegistration();
|
this.completeRegistration();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 不支持邀请码确认,直接提交
|
||||||
|
this.completeRegistration();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
goPrev() {
|
goPrev() {
|
||||||
|
|
|
||||||
|
|
@ -6,29 +6,6 @@
|
||||||
<text>门店信息</text>
|
<text>门店信息</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 邀请码确认弹窗 -->
|
|
||||||
<uni-popup ref="existingInvitePopup" type="center" :mask-click="false">
|
|
||||||
<view class="invite-popup-content">
|
|
||||||
<view class="invite-popup-header">
|
|
||||||
<text class="invite-popup-title">请确认邀请信息</text>
|
|
||||||
</view>
|
|
||||||
<view class="invite-popup-body">
|
|
||||||
<view class="invite-item">
|
|
||||||
<text class="invite-label">邀请码</text>
|
|
||||||
<text class="invite-value">{{ existingInviterInfo && existingInviterInfo.invite_code }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="invite-item">
|
|
||||||
<text class="invite-label">邀请人</text>
|
|
||||||
<text class="invite-value">{{ (existingInviterInfo && (existingInviterInfo.name || existingInviterInfo.nick_name)) || '' }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="invite-popup-footer">
|
|
||||||
<view class="invite-btn cancel" @click="hideExistingInviteTipPopup">关闭</view>
|
|
||||||
<view class="invite-btn confirm" @click="useExistingInviteCode">确认</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</uni-popup>
|
|
||||||
|
|
||||||
<!-- 店铺logo -->
|
<!-- 店铺logo -->
|
||||||
<view class="form-item box-cont">
|
<view class="form-item box-cont">
|
||||||
<view class="label-wrapper">
|
<view class="label-wrapper">
|
||||||
|
|
@ -325,6 +302,29 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 邀请码确认弹窗 -->
|
||||||
|
<uni-popup ref="existingInvitePopup" type="center" :mask-click="false">
|
||||||
|
<view class="invite-popup-content">
|
||||||
|
<view class="invite-popup-header">
|
||||||
|
<text class="invite-popup-title">请确认邀请信息</text>
|
||||||
|
</view>
|
||||||
|
<view class="invite-popup-body">
|
||||||
|
<view class="invite-item">
|
||||||
|
<text class="invite-label">邀请码</text>
|
||||||
|
<text class="invite-value">{{ existingInviterInfo && existingInviterInfo.invite_code }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="invite-item">
|
||||||
|
<text class="invite-label">邀请人</text>
|
||||||
|
<text class="invite-value">{{ (existingInviterInfo && (existingInviterInfo.name || existingInviterInfo.nick_name)) || '' }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="invite-popup-footer">
|
||||||
|
<view class="invite-btn cancel" @click="cancelInviteConfirm">取消</view>
|
||||||
|
<view class="invite-btn confirm" @click="useExistingInviteCode">确认</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -592,8 +592,7 @@ export default {
|
||||||
this.saveInviteStateToLocal();
|
this.saveInviteStateToLocal();
|
||||||
this.saveFormDataToLocal();
|
this.saveFormDataToLocal();
|
||||||
|
|
||||||
// 弹窗提示
|
// 不在页面加载时弹窗,改为在提交申请时弹窗
|
||||||
this.showExistingInviteTipPopup();
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
console.error('获取邀请人信息失败,邀请码可能无效');
|
console.error('获取邀请人信息失败,邀请码可能无效');
|
||||||
|
|
@ -612,6 +611,7 @@ export default {
|
||||||
|
|
||||||
// 显示已有邀请人确认弹窗(复用原有方法,但内容更准确)
|
// 显示已有邀请人确认弹窗(复用原有方法,但内容更准确)
|
||||||
showExistingInviteTipPopup() {
|
showExistingInviteTipPopup() {
|
||||||
|
this.$nextTick(() => {
|
||||||
if (this.$refs.existingInvitePopup) {
|
if (this.$refs.existingInvitePopup) {
|
||||||
this.$refs.existingInvitePopup.open();
|
this.$refs.existingInvitePopup.open();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -635,6 +635,7 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 确认使用已有邀请码(用户点击确认)
|
// 确认使用已有邀请码(用户点击确认)
|
||||||
|
|
@ -650,6 +651,12 @@ export default {
|
||||||
this.saveFormDataToLocal();
|
this.saveFormDataToLocal();
|
||||||
}
|
}
|
||||||
this.hideExistingInviteTipPopup();
|
this.hideExistingInviteTipPopup();
|
||||||
|
|
||||||
|
// 执行提交回调
|
||||||
|
if (this.submitCallback) {
|
||||||
|
this.submitCallback();
|
||||||
|
this.submitCallback = null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 隐藏已有邀请人确认弹窗
|
// 隐藏已有邀请人确认弹窗
|
||||||
|
|
@ -659,6 +666,68 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 取消邀请码确认
|
||||||
|
cancelInviteConfirm() {
|
||||||
|
// 如果是系统自动替换的邀请码,取消后允许用户手动输入
|
||||||
|
if (this.hasAutoReplacedInvite) {
|
||||||
|
this.hasAutoReplacedInvite = false;
|
||||||
|
this.hasExistingInviter = false;
|
||||||
|
// 保存状态
|
||||||
|
this.saveInviteStateToLocal();
|
||||||
|
this.saveFormDataToLocal();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
this.hideExistingInviteTipPopup();
|
||||||
|
},
|
||||||
|
|
||||||
|
// 显示邀请码确认弹窗
|
||||||
|
showInviteConfirmPopup(inviterData) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
// 使用 existingInvitePopup 组件显示确认弹窗
|
||||||
|
if (this.$refs.existingInvitePopup) {
|
||||||
|
// 将邀请人信息存入 existingInviterInfo 以便弹窗显示
|
||||||
|
this.existingInviterInfo = inviterData;
|
||||||
|
this.$refs.existingInvitePopup.open();
|
||||||
|
} else {
|
||||||
|
// 降级方案
|
||||||
|
uni.showModal({
|
||||||
|
title: '请确认邀请信息',
|
||||||
|
content: `邀请码:${inviterData?.invite_code}\n邀请人:${inviterData?.name || inviterData?.nick_name}`,
|
||||||
|
confirmText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
// 确认使用该邀请码
|
||||||
|
this.saveInviteStateToLocal();
|
||||||
|
} else {
|
||||||
|
// 取消,清空邀请码
|
||||||
|
this.formData.invite_code_other = '';
|
||||||
|
this.inviterInfo = null;
|
||||||
|
this.inviteCodeError = false;
|
||||||
|
this.saveInviteStateToLocal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 提交申请前确认邀请码(供父组件调用)
|
||||||
|
confirmInviteCodeBeforeSubmit(callback) {
|
||||||
|
this.submitCallback = callback;
|
||||||
|
|
||||||
|
// 如果有已验证的邀请人信息,显示确认弹窗
|
||||||
|
if (this.inviterInfo && this.formData.invite_code_other) {
|
||||||
|
this.showInviteConfirmPopup(this.inviterInfo);
|
||||||
|
} else {
|
||||||
|
// 没有邀请码或未验证,直接提交
|
||||||
|
if (this.submitCallback) {
|
||||||
|
this.submitCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// 获取用户信息(含手机号)
|
// 获取用户信息(含手机号)
|
||||||
getUserInfo() {
|
getUserInfo() {
|
||||||
return request.post('/sj/User/getUser').then(result => {
|
return request.post('/sj/User/getUser').then(result => {
|
||||||
|
|
@ -954,6 +1023,8 @@ export default {
|
||||||
this.inviterInfo = userData;
|
this.inviterInfo = userData;
|
||||||
this.inviteCodeError = false;
|
this.inviteCodeError = false;
|
||||||
console.log('邀请码验证通过,邀请人:', userData);
|
console.log('邀请码验证通过,邀请人:', userData);
|
||||||
|
|
||||||
|
// 不在输入时弹窗,改为在提交申请时弹窗
|
||||||
} else {
|
} else {
|
||||||
// 接口返回数据但没有account字段,说明不是有效邀请人
|
// 接口返回数据但没有account字段,说明不是有效邀请人
|
||||||
console.log('接口返回数据无效,没有account字段:', userData);
|
console.log('接口返回数据无效,没有account字段:', userData);
|
||||||
|
|
@ -2307,6 +2378,7 @@ export default {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 24rpx;
|
gap: 24rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.invite-item {
|
.invite-item {
|
||||||
|
|
@ -2345,6 +2417,7 @@ export default {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
margin: 0 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.invite-btn.cancel {
|
.invite-btn.cancel {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue