diff --git a/common/account.js b/common/account.js index b394963..4d6f8c7 100644 --- a/common/account.js +++ b/common/account.js @@ -1,7 +1,9 @@ // xuchao: 账号级本地缓存集中管理。权益页首屏会读这些缓存做兜底展示, // 换账号/退出时漏清就会把上一个账号的中奖状态、卡号、到期时间当成当前账号的数据展示。 +// xuchao: loginWay 记录登录方式(ysf=云闪付免密 / sms=手机验证码)——付款码仅对免密登录开放, +// 换账号/退出后必须清掉,否则会把上个账号的免密状态带给新账号 const ACCOUNT_KEYS = ['token', 'phone', 'isAuth', 'hasWin', 'cardNumber', 'expiresTime', - 'rightsCount', 'totalValueFen', 'authFlowStarted', 'authName', 'authIdNo'] + 'rightsCount', 'totalValueFen', 'authFlowStarted', 'authName', 'authIdNo', 'loginWay'] export default { // 清空当前账号的本地会话与权益缓存(定位 lng/lat 属于设备信息,不在此列) diff --git a/pages/index/index.vue b/pages/index/index.vue index 6ff4557..1271903 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -138,6 +138,8 @@ // 就会变成 Bearer [object Object],把所有鉴权接口全打挂 const issued = typeof res.data.accessToken === 'string' ? res.data.accessToken : '' if (issued) uni.setStorageSync('token', issued) + // xuchao: 标记本次会话为云闪付免密登录——商户详情付款码按此放行 + uni.setStorageSync('loginWay', 'ysf') this.$u.api.getEligibility({ phone: res.data.mobile, identityNo: res.data.idNo || '', name: res.data.name || '' }).then(eRes => { if (eRes.errcode === 0) { uni.setStorageSync('isAuth', eRes.data.isAuth) diff --git a/pages/index/login.vue b/pages/index/login.vue index b20195e..6c54b80 100644 --- a/pages/index/login.vue +++ b/pages/index/login.vue @@ -131,6 +131,8 @@ export default { const issued = [payload.accessToken, payload.token].find(v => typeof v === 'string' && v.length > 0) uni.setStorageSync('token', issued || '') uni.setStorageSync('phone', this.phone) + // xuchao: 标记登录方式为手机验证码——付款码仅放行云闪付免密登录(ysf),验证码登录会被引导 + uni.setStorageSync('loginWay', 'sms') this.$u.api.getEligibility({ phone: this.phone, identityNo: '', name: '' }).then(eRes => { if (eRes.errcode === 0) { uni.setStorageSync('isAuth', eRes.data.isAuth) diff --git a/pages/shop/detail.vue b/pages/shop/detail.vue index 805684f..a0c6ded 100644 --- a/pages/shop/detail.vue +++ b/pages/shop/detail.vue @@ -175,6 +175,21 @@ window.upsdk.pluginReady(() => { bridged = true clearTimeout(timer) + // xuchao: 付款码依赖云闪付账号与社保卡的绑定关系——只对免密登录(ysf)会话开放; + // 验证码登录/未登录时容器钱包账号与本活动身份可能不一致,提示而不是拉起 + const way = uni.getStorageSync('loginWay') + if (way !== 'ysf') { + const logged = !!uni.getStorageSync('phone') + uni.showModal({ + title: '暂无法使用付款码', + content: logged + ? '当前为手机号验证码登录,付款码立减需通过云闪付App的活动入口进入(自动免密登录,与钱包账号一致)后使用。' + : '请在云闪付App中通过本活动入口进入页面(自动免密登录)后,再使用付款码享优惠。', + showCancel: false, + confirmText: '知道了' + }) + return + } try { window.upsdk.qrCodePay() } catch (e) { uni.showToast({ title: '拉起付款码失败,请重试', icon: 'none' }) } })