diff --git a/pages/ruzhu/ruzhu.vue b/pages/ruzhu/ruzhu.vue
index 39f2433..86104a5 100644
--- a/pages/ruzhu/ruzhu.vue
+++ b/pages/ruzhu/ruzhu.vue
@@ -742,8 +742,16 @@
console.log('商家门店信息数据:', this.storeInfoData);
}
- // 执行提交逻辑
- this.completeRegistration();
+ // 提交前确认邀请码
+ if (this.$refs.storeInfo && this.$refs.storeInfo.confirmInviteCodeBeforeSubmit) {
+ this.$refs.storeInfo.confirmInviteCodeBeforeSubmit(() => {
+ // 确认后执行提交逻辑
+ this.completeRegistration();
+ });
+ } else {
+ // 不支持邀请码确认,直接提交
+ this.completeRegistration();
+ }
},
goPrev() {
diff --git a/pages/ruzhu/sj-info.vue b/pages/ruzhu/sj-info.vue
index 449e093..6c4bc55 100644
--- a/pages/ruzhu/sj-info.vue
+++ b/pages/ruzhu/sj-info.vue
@@ -6,29 +6,6 @@
门店信息
-
-
-
-
-
@@ -325,6 +302,29 @@
+
+
+
+
+
@@ -592,8 +592,7 @@ export default {
this.saveInviteStateToLocal();
this.saveFormDataToLocal();
- // 弹窗提示
- this.showExistingInviteTipPopup();
+ // 不在页面加载时弹窗,改为在提交申请时弹窗
return true;
} else {
console.error('获取邀请人信息失败,邀请码可能无效');
@@ -612,29 +611,31 @@ export default {
// 显示已有邀请人确认弹窗(复用原有方法,但内容更准确)
showExistingInviteTipPopup() {
- if (this.$refs.existingInvitePopup) {
- this.$refs.existingInvitePopup.open();
- } else {
- uni.showModal({
- title: '请确认邀请信息',
- content: `邀请码:${this.existingInviterInfo?.invite_code}\n邀请人:${this.existingInviterInfo?.name || this.existingInviterInfo?.nick_name}`,
- confirmText: '确认',
- cancelText: '关闭',
- success: (res) => {
- if (res.confirm) {
- this.useExistingInviteCode();
- } else {
- // 用户关闭弹窗:清空邀请码,允许手动输入(与铁军端行为一致)
- this.formData.invite_code_other = '';
- this.hasExistingInviter = false;
- this.hasAutoReplacedInvite = false;
- this.inviterInfo = null;
- this.existingInviterInfo = null;
- this.saveFormDataToLocal();
+ this.$nextTick(() => {
+ if (this.$refs.existingInvitePopup) {
+ this.$refs.existingInvitePopup.open();
+ } else {
+ uni.showModal({
+ title: '请确认邀请信息',
+ content: `邀请码:${this.existingInviterInfo?.invite_code}\n邀请人:${this.existingInviterInfo?.name || this.existingInviterInfo?.nick_name}`,
+ confirmText: '确认',
+ cancelText: '关闭',
+ success: (res) => {
+ if (res.confirm) {
+ this.useExistingInviteCode();
+ } else {
+ // 用户关闭弹窗:清空邀请码,允许手动输入(与铁军端行为一致)
+ this.formData.invite_code_other = '';
+ this.hasExistingInviter = false;
+ this.hasAutoReplacedInvite = false;
+ this.inviterInfo = null;
+ this.existingInviterInfo = null;
+ this.saveFormDataToLocal();
+ }
}
- }
- });
- }
+ });
+ }
+ });
},
// 确认使用已有邀请码(用户点击确认)
@@ -650,6 +651,12 @@ export default {
this.saveFormDataToLocal();
}
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() {
return request.post('/sj/User/getUser').then(result => {
@@ -954,6 +1023,8 @@ export default {
this.inviterInfo = userData;
this.inviteCodeError = false;
console.log('邀请码验证通过,邀请人:', userData);
+
+ // 不在输入时弹窗,改为在提交申请时弹窗
} else {
// 接口返回数据但没有account字段,说明不是有效邀请人
console.log('接口返回数据无效,没有account字段:', userData);
@@ -2307,6 +2378,7 @@ export default {
display: flex;
flex-direction: column;
gap: 24rpx;
+ margin-top: 20rpx;
}
.invite-item {
@@ -2345,6 +2417,7 @@ export default {
justify-content: center;
font-size: 32rpx;
font-weight: 500;
+ margin: 0 10rpx;
}
.invite-btn.cancel {