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