Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bba52ae1f | ||
|
|
cda36ddc1e |
+19
-12
@@ -212,18 +212,24 @@
|
||||
this.lat = loc.lat
|
||||
}
|
||||
this.checkAuthResult()
|
||||
// xuchao: 本地无认证缓存时自动查询后端恢复已认证状态
|
||||
this.autoRecoverStatus()
|
||||
// xuchao: 权益状态会变化,缓存只作首屏展示,进入页面一律向服务端复查最新状态
|
||||
this.refreshStatus()
|
||||
if (this.status === 'info') {
|
||||
this.loadRightsList()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// xuchao: 已登录但本地无认证缓存时,仅传手机号查询资格以恢复状态(不带证件号,避免触发被动认证)
|
||||
autoRecoverStatus() {
|
||||
if (this.status !== 'auth') return
|
||||
// xuchao: 缓存的权益状态可能过期(中奖/权益包会变化),每次进页面仅凭手机号向服务端
|
||||
// 复查最新状态并覆盖缓存(不带证件号,避免触发被动认证)
|
||||
refreshStatus() {
|
||||
// xuchao: 人脸认证回调场景由 checkAuthResult 负责查询,跳过避免重复请求
|
||||
try {
|
||||
if (new URL(window.location.href).searchParams.get('response')) return
|
||||
} catch (e) {
|
||||
return
|
||||
}
|
||||
// xuchao: 用户主动发起过认证流程时,取消后应停留在认证页,不自动恢复
|
||||
if (uni.getStorageSync('authFlowStarted')) return
|
||||
if (this.status === 'auth' && uni.getStorageSync('authFlowStarted')) return
|
||||
const phone = uni.getStorageSync('phone')
|
||||
if (!phone) return
|
||||
this.$u.api.getEligibility({
|
||||
@@ -234,14 +240,15 @@
|
||||
uni.setStorageSync('hasWin', res.data.hasWin)
|
||||
uni.setStorageSync('cardNumber', res.data.cardNumber)
|
||||
uni.setStorageSync('expiresTime', res.data.expiresTime)
|
||||
// xuchao: 自动恢复成功,清除流程标记
|
||||
uni.removeStorageSync('authFlowStarted')
|
||||
if (res.data.isAuth) {
|
||||
this.status = res.data.hasWin ? 'info' : 'noWin'
|
||||
if (this.status === 'info') {
|
||||
// xuchao: 服务端已认证则清除取消标记,后续按真实状态展示
|
||||
if (res.data.isAuth) uni.removeStorageSync('authFlowStarted')
|
||||
const newStatus = res.data.isAuth ? (res.data.hasWin ? 'info' : 'noWin') : 'auth'
|
||||
const prevStatus = this.status
|
||||
this.status = newStatus
|
||||
// xuchao: 状态刷新为权益页时补拉权益列表,避免与首屏加载重复
|
||||
if (newStatus === 'info' && prevStatus !== 'info') {
|
||||
this.loadRightsList()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// xuchao: 认证取消/未通过:清理旧认证缓存并标记流程已发起,取消后应停留认证页
|
||||
|
||||
@@ -20,6 +20,16 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 原价(内容取商铺门票信息字段) -->
|
||||
<view class="discount-section" v-if="ticketInfoList.length">
|
||||
<view class="section-title">
|
||||
<text class="discount-title">原价</text>
|
||||
</view>
|
||||
<view class="discount-list">
|
||||
<text class="discount-item" v-for="(item, index) in ticketInfoList" :key="index">{{ item }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商户优惠 -->
|
||||
<view class="discount-section">
|
||||
<view class="section-title">
|
||||
@@ -47,6 +57,10 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
ticketInfoList() {
|
||||
if (!this.store || !this.store.ticketInfo) return []
|
||||
return this.store.ticketInfo.split('\n')
|
||||
},
|
||||
discountList() {
|
||||
if (!this.store || !this.store.merchantDiscount) return []
|
||||
return this.store.merchantDiscount.split('\n')
|
||||
|
||||
Reference in New Issue
Block a user