feat: implement mobile number binding via WeChat and enforce phone verification for venue entry, booking, and card purchases

This commit is contained in:
2026-04-18 18:32:30 +08:00
parent 7552f9946b
commit 5236fabc83
11 changed files with 139 additions and 19 deletions

View File

@@ -93,6 +93,37 @@ Page({
});
},
// 绑定手机号
onBindPhone(e) {
if (e.detail.errMsg === 'getPhoneNumber:fail user deny') {
wx.showToast({ title: '已取消绑定', icon: 'none' });
return;
}
let that = this;
wx.login({
success: function (r) {
wx.showLoading({ title: '绑定中...', mask: true });
// 复用微信授权一键登录/绑定接口
app.$api.memberLoginWXPhone({
loginCode: r.code,
phoneCode: e.detail.code
}).then(res => {
wx.hideLoading();
if (res.authorization) {
wx.setStorageSync('accessToken', res.authorization.accessToken);
}
if (res.information) {
wx.setStorageSync('information', res.information);
}
wx.showToast({ title: '绑定成功', icon: 'success' });
that.getData(); // 重新加载信息刷新页面
}).catch(err => {
wx.hideLoading();
});
}
});
},
// 没有修改次数时点击头像
onAvatarNoCount() {
wx.showToast({

View File

@@ -31,7 +31,8 @@
</view>
<view class='cell unLine'>
<text class='title'>手机号</text>
<text class='message'>{{members.mobile}}</text>
<button wx:if="{{!members.mobile}}" class='message bind-phone-btn' open-type="getPhoneNumber" bindgetphonenumber="onBindPhone">微信授权绑定</button>
<text wx:else class='message'>{{members.mobile}}</text>
</view>
</view>

View File

@@ -92,4 +92,18 @@
.list .cell .nickname-input {
text-align: right;
width: 100%;
}
.list .cell .bind-phone-btn {
flex: 1;
text-align: right;
color: #ffda2e;
font-size: 24rpx;
background: transparent;
padding: 0;
margin: 0;
}
.list .cell .bind-phone-btn::after {
border: none;
}