diff --git a/pages/profile/authentication/index.js b/pages/profile/authentication/index.js index 8d6b6c5..a036515 100644 --- a/pages/profile/authentication/index.js +++ b/pages/profile/authentication/index.js @@ -136,7 +136,7 @@ Page({ /** * 提交认证 */ - async submitAuth() { + submitAuth() { // 验证是否上传了身份证正反面或营业执照 const hasIdCard = this.data.idCardFront && this.data.idCardBack; const hasBusinessLicense = this.data.businessLicense; @@ -161,6 +161,31 @@ Page({ return; } + // 检查当前认证状态 + const currentStatus = this.data.idcardstatus; + + // 如果当前状态是已通过或已拒绝,显示确认对话框 + if (currentStatus === 1 || currentStatus === 2) { + wx.showModal({ + title: '确认重新提交', + content: '您的认证信息已审核,确定要重新提交审核吗?', + success: (res) => { + if (res.confirm) { + // 用户确认后执行提交操作 + this.doSubmitAuth(openid, userId); + } + } + }); + } else { + // 否则直接提交 + this.doSubmitAuth(openid, userId); + } + }, + + /** + * 执行认证提交操作 + */ + async doSubmitAuth(openid, userId) { wx.showLoading({ title: '正在提交认证信息...', mask: true }); try { @@ -191,7 +216,8 @@ Page({ // 准备提交数据 const submitData = { openid: openid, - userId: userId + userId: userId, + idcardstatus: 0 // 设置认证状态为待审核 }; // 只提交已上传的认证材料 @@ -218,6 +244,9 @@ Page({ console.log('认证提交结果:', result); if (result && result.success) { + // 更新本地idcardstatus为0 + this.setData({ idcardstatus: 0 }); + // 认证成功后,获取最新的用户信息,包括认证状态 API.getUserInfo(openid).then(userInfoRes => { if (userInfoRes.success && userInfoRes.data) { @@ -227,6 +256,7 @@ Page({ const updatedUserInfo = { ...userInfo, ...latestUserInfo, + idcardstatus: 0, // 确保本地存储的状态也是待审核 idcard1: idcard1Url, idcard2: idcard2Url, businesslicenseurl: businessLicenseUrl, @@ -243,6 +273,7 @@ Page({ const userInfo = wx.getStorageSync('userInfo') || {}; const updatedUserInfo = { ...userInfo, + idcardstatus: 0, // 确保本地存储的状态也是待审核 idcard1: idcard1Url, idcard2: idcard2Url, businesslicenseurl: businessLicenseUrl,