feat: 权益详情页到期时间/总权益价值/可用权益数改为接口数据展示
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
1521129d87
commit
80838143fb
+31
-12
@@ -63,9 +63,9 @@
|
|||||||
<view style="background: #fff;">
|
<view style="background: #fff;">
|
||||||
<view class="banner-area">
|
<view class="banner-area">
|
||||||
<text class="banner-title">恭喜您!获得怀化市社保卡权益包</text>
|
<text class="banner-title">恭喜您!获得怀化市社保卡权益包</text>
|
||||||
<view class="banner-expire">
|
<view class="banner-expire" v-if="expiresTime">
|
||||||
<text class="expire-icon">!</text>
|
<text class="expire-icon">!</text>
|
||||||
<text class="expire-text">2026年12月31日</text>
|
<text class="expire-text">{{ expiresTime }}</text>
|
||||||
<text class="expire-label">到期</text>
|
<text class="expire-label">到期</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
<text class="stats-label">总权益价值</text>
|
<text class="stats-label">总权益价值</text>
|
||||||
<view class="stats-value-row">
|
<view class="stats-value-row">
|
||||||
<text class="stats-currency">¥</text>
|
<text class="stats-currency">¥</text>
|
||||||
<text class="stats-number">1500</text>
|
<text class="stats-number">{{ totalValueText }}</text>
|
||||||
<text class="stats-unit">元</text>
|
<text class="stats-unit">元</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
<view class="stats-item">
|
<view class="stats-item">
|
||||||
<text class="stats-label">可用权益数</text>
|
<text class="stats-label">可用权益数</text>
|
||||||
<view class="stats-value-row">
|
<view class="stats-value-row">
|
||||||
<text class="stats-number-large">10</text>
|
<text class="stats-number-large">{{ rightsCount }}</text>
|
||||||
<text class="stats-unit">个</text>
|
<text class="stats-unit">个</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -172,6 +172,10 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
status: 'auth',
|
status: 'auth',
|
||||||
|
// xuchao: 权益概览三字段,首屏用缓存兜底,随后由服务端复查刷新
|
||||||
|
expiresTime: uni.getStorageSync('expiresTime') || '',
|
||||||
|
rightsCount: uni.getStorageSync('rightsCount') || 0,
|
||||||
|
totalValueFen: uni.getStorageSync('totalValueFen') || 0,
|
||||||
form: {
|
form: {
|
||||||
realName: '',
|
realName: '',
|
||||||
phone: '',
|
phone: '',
|
||||||
@@ -199,6 +203,13 @@
|
|||||||
checkLoading: false
|
checkLoading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
// xuchao: 总权益价值分转元,整除去小数,否则保留两位
|
||||||
|
totalValueText() {
|
||||||
|
const yuan = this.totalValueFen / 100
|
||||||
|
return Number.isInteger(yuan) ? String(yuan) : yuan.toFixed(2)
|
||||||
|
}
|
||||||
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
if (options.status) {
|
if (options.status) {
|
||||||
this.status = options.status
|
this.status = options.status
|
||||||
@@ -238,10 +249,7 @@
|
|||||||
phone: phone
|
phone: phone
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.errcode !== 0 || !res.data) return
|
if (res.errcode !== 0 || !res.data) return
|
||||||
uni.setStorageSync('isAuth', res.data.isAuth)
|
this.applyEligibility(res.data)
|
||||||
uni.setStorageSync('hasWin', res.data.hasWin)
|
|
||||||
uni.setStorageSync('cardNumber', res.data.cardNumber)
|
|
||||||
uni.setStorageSync('expiresTime', res.data.expiresTime)
|
|
||||||
// xuchao: 服务端已认证则清除取消标记,后续按真实状态展示
|
// xuchao: 服务端已认证则清除取消标记,后续按真实状态展示
|
||||||
if (res.data.isAuth) uni.removeStorageSync('authFlowStarted')
|
if (res.data.isAuth) uni.removeStorageSync('authFlowStarted')
|
||||||
const newStatus = res.data.isAuth ? (res.data.hasWin ? 'info' : 'noWin') : 'auth'
|
const newStatus = res.data.isAuth ? (res.data.hasWin ? 'info' : 'noWin') : 'auth'
|
||||||
@@ -253,12 +261,26 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// xuchao: 资格查询结果统一写入缓存并回填页面(到期时间/总权益价值/可用权益数)
|
||||||
|
applyEligibility(data) {
|
||||||
|
uni.setStorageSync('isAuth', data.isAuth)
|
||||||
|
uni.setStorageSync('hasWin', data.hasWin)
|
||||||
|
uni.setStorageSync('cardNumber', data.cardNumber)
|
||||||
|
uni.setStorageSync('expiresTime', data.expiresTime)
|
||||||
|
uni.setStorageSync('rightsCount', data.rightsCount || 0)
|
||||||
|
uni.setStorageSync('totalValueFen', data.totalValueFen || 0)
|
||||||
|
this.expiresTime = data.expiresTime || ''
|
||||||
|
this.rightsCount = data.rightsCount || 0
|
||||||
|
this.totalValueFen = data.totalValueFen || 0
|
||||||
|
},
|
||||||
// xuchao: 认证取消/未通过:清理旧认证缓存并标记流程已发起,取消后应停留认证页
|
// xuchao: 认证取消/未通过:清理旧认证缓存并标记流程已发起,取消后应停留认证页
|
||||||
markAuthCanceled() {
|
markAuthCanceled() {
|
||||||
uni.removeStorageSync('isAuth')
|
uni.removeStorageSync('isAuth')
|
||||||
uni.removeStorageSync('hasWin')
|
uni.removeStorageSync('hasWin')
|
||||||
uni.removeStorageSync('cardNumber')
|
uni.removeStorageSync('cardNumber')
|
||||||
uni.removeStorageSync('expiresTime')
|
uni.removeStorageSync('expiresTime')
|
||||||
|
uni.removeStorageSync('rightsCount')
|
||||||
|
uni.removeStorageSync('totalValueFen')
|
||||||
uni.setStorageSync('authFlowStarted', true)
|
uni.setStorageSync('authFlowStarted', true)
|
||||||
},
|
},
|
||||||
checkAuthResult() {
|
checkAuthResult() {
|
||||||
@@ -301,10 +323,7 @@
|
|||||||
}).then(eRes => {
|
}).then(eRes => {
|
||||||
console.log('eligibility res:', eRes)
|
console.log('eligibility res:', eRes)
|
||||||
if (eRes.errcode === 0) {
|
if (eRes.errcode === 0) {
|
||||||
uni.setStorageSync('isAuth', eRes.data.isAuth)
|
this.applyEligibility(eRes.data)
|
||||||
uni.setStorageSync('hasWin', eRes.data.hasWin)
|
|
||||||
uni.setStorageSync('cardNumber', eRes.data.cardNumber)
|
|
||||||
uni.setStorageSync('expiresTime', eRes.data.expiresTime)
|
|
||||||
// xuchao: 认证成功,清除流程标记
|
// xuchao: 认证成功,清除流程标记
|
||||||
uni.removeStorageSync('authFlowStarted')
|
uni.removeStorageSync('authFlowStarted')
|
||||||
if (eRes.data.isAuth) {
|
if (eRes.data.isAuth) {
|
||||||
|
|||||||
Reference in New Issue
Block a user