Files
hhrs/components/hhrs-winner-sheet/hhrs-winner-sheet.vue
T
jacobxu666andClaude Fable 5 6747501963 feat:首页按设计稿改版 + 新增「查询我的中奖结果」半屏弹层
- 首页重构:KV 头图/金刚区/可领权益包/折扣商户分类宫格,暖米底色与切图规范统一
- 查询弹层 hhrs-winner-sheet:登录→资格→证件两段式查询,六态文案与 CTA;未中奖引导看权益包明细(参加指南内容待运营)
- 底部导航改自定义组件单条呈现,移除 pages.json 原生 tabBar(H5 下双导航叠加问题);我的页换肤对齐首页主色
- 修复内容不足一屏时露 html 白底(html 兜底色 + 我的页撑满屏高);App.vue 修复微信 WebView 导航栏高度误报
- 删除原生 tabBar 遗留的 4 张旧图标,新增 12 张 hhrs2_ 切图

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-23 11:04:52 +08:00

306 lines
11 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<!-- xuchao: 「查询我的中奖结果」半屏弹层。链路:
打开 → getEligibility(phone):已认证直接出结果;未认证 → 输入证件号 →
getWinnerDates 判期次(空=暂无已开奖记录)→ checkWinner(identityNo) 出中奖/未中奖。
证件号仅内存使用不落缓存;CTA 跳转后自关。 -->
<view class="qsm-mask" v-if="visible" @click="close">
<view class="qsm-sheet" @click.stop>
<view class="qsm-head">
<text class="qsm-title">查询我的中奖结果</text>
<view class="qsm-close" @click="close">
<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2 2l10 10M12 2L2 12" stroke="#9A8574" stroke-width="2" stroke-linecap="round"/></svg>
</view>
</view>
<!-- 加载中 -->
<view class="qsm-state" v-if="phase === 'loading'">
<view class="qsm-spin"></view>
<text class="qsm-state-t">正在查询…</text>
</view>
<!-- 未认证:输入证件号 -->
<view v-else-if="phase === 'input'">
<text class="qsm-desc">为保障权益发放安全,请填写办卡登记的身份证号码进行核验</text>
<input class="qsm-input" v-model="idNo" type="idcard" maxlength="18" placeholder="请输入 18 位身份证号码" placeholder-class="qsm-ph" />
<text class="qsm-privacy">证件号码仅用于核对中奖名单,不会保存</text>
<view class="qsm-btn" :class="{ dis: querying }" @click="query">
{{ querying ? '查询中…' : '立即查询' }}
</view>
</view>
<!-- 结果:已开奖期数内查无此证件(未认证查询 / 已认证未中奖共用) -->
<view class="qsm-state" v-else-if="phase === 'lost'">
<view class="qsm-ico gray"><svg width="20" height="20" viewBox="0 0 20 20"><path d="M6 6l8 8M14 6l-8 8" stroke="#fff" stroke-width="2.2" stroke-linecap="round"/></svg></view>
<text class="qsm-state-t">很遗憾,本期未中奖</text>
<text class="qsm-state-s">持社保卡在合作商户消费,下期自动获得抽奖资格</text>
<!-- xuchao: 主 CTA 跳权益包明细长图(有内容);参加指南页内容运营整理中,暂不引导(2026-10-23 定) -->
<view class="qsm-btn" @click="nav('/pages/rights/rights?status=noWin')">看看权益包</view>
<view class="qsm-btn-line">
<text class="qsm-link" @click="nav('/pages/winners/winners')">中奖名单公示</text>
</view>
<text class="qsm-tip" v-if="fromIdQuery">如您在其他手机号下持卡,请切换登录后再查询</text>
</view>
<!-- 结果:中奖未认证 -->
<view class="qsm-state" v-else-if="phase === 'won-auth'">
<view class="qsm-ico gold"><svg width="22" height="22" viewBox="0 0 22 22"><path d="M4.5 11.5l4.5 4.5 8.5-9" stroke="#8A4A06" stroke-width="2.6" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg></view>
<text class="qsm-state-t dark">恭喜您!获得千元权益包</text>
<text class="qsm-state-s">完成实名认证后即可领取使用</text>
<view class="qsm-btn" @click="nav('/pages/rights/rights?status=auth')">立即认证领取</view>
</view>
<!-- 结果:已认证已中奖 -->
<view class="qsm-state" v-else-if="phase === 'won-has'">
<view class="qsm-ico gold"><svg width="22" height="22" viewBox="0 0 22 22"><path d="M4.5 11.5l4.5 4.5 8.5-9" stroke="#8A4A06" stroke-width="2.6" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg></view>
<text class="qsm-state-t dark">您已获得千元权益包</text>
<text class="qsm-state-s" v-if="expires">权益 {{ expires }} 到期,请及时使用</text>
<text class="qsm-state-s" v-else>10 项权益待您使用</text>
<view class="qsm-btn" @click="nav('/pages/rights/rights?status=info')">查看我的权益包</view>
</view>
<!-- 本期暂未开奖(无任何已开奖记录) -->
<view class="qsm-state" v-else-if="phase === 'not-drawn'">
<view class="qsm-ico amber"><svg width="20" height="20" viewBox="0 0 20 20"><circle cx="10" cy="10" r="7.5" stroke="#fff" stroke-width="1.8" fill="none"/><path d="M10 6v4.5l3 1.8" stroke="#fff" stroke-width="1.8" stroke-linecap="round" fill="none"/></svg></view>
<text class="qsm-state-t">本期暂未开奖</text>
<text class="qsm-state-s">中奖名单预计于 2026 年 11 月上旬公布,敬请期待</text>
<view class="qsm-btn line" @click="close">知道了,继续逛</view>
</view>
<!-- 查询失败 -->
<view class="qsm-state" v-else-if="phase === 'error'">
<view class="qsm-ico gray"><svg width="20" height="20" viewBox="0 0 20 20"><path d="M10 5v7M10 15.2v.2" stroke="#fff" stroke-width="2.2" stroke-linecap="round"/></svg></view>
<text class="qsm-state-t">{{ errText }}</text>
<view class="qsm-btn" @click="start">重试</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'HhrsWinnerSheet',
props: {
visible: { type: Boolean, default: false }
},
data() {
return {
phase: 'loading',
idNo: '',
querying: false,
fromIdQuery: false,
expires: '',
errText: '查询失败,请稍后重试'
}
},
watch: {
visible(v) { if (v) this.start() }
},
methods: {
close() { this.$emit('close') },
nav(url) { this.$emit('close'); uni.navigateTo({ url }) },
// xuchao: 打开即查资格。getEligibility 对未认证用户 hasWin 不可信(spec 见需求定稿),
// 故 isAuth=false 一律走证件输入两段式;成功/失败都释放 querying
start() {
this.phase = 'loading'
this.querying = false
this.fromIdQuery = false
this.idNo = ''
const phone = uni.getStorageSync('phone')
if (!phone) { this.phase = 'error'; this.errText = '请先登录'; return }
this.$u.api.getEligibility({ phone }).then(res => {
if (res.errcode !== 0 || !res.data) { this.errText = res.errmsg || '查询失败,请稍后重试'; this.phase = 'error'; return }
this.applyEligibility(res.data)
}).catch(() => { this.errText = '查询失败,请稍后重试'; this.phase = 'error' })
},
applyEligibility(d) {
if (!d.isAuth) { this.phase = 'input'; return }
if (d.hasWin) {
this.expires = d.expiresTime ? String(d.expiresTime).slice(0, 10) : ''
this.phase = 'won-has'
} else {
this.phase = 'lost'
}
},
query() {
if (this.querying) return
if (!/^\d{17}[0-9Xx]$/.test(this.idNo.trim())) {
uni.showToast({ title: '请输入正确的 18 位身份证号码', icon: 'none' })
return
}
const idNo = this.idNo.trim()
this.querying = true
this.$u.api.getWinnerDates().then(dRes => {
// xuchao: 无任何已开奖记录 = 暂未开奖(新轮次排期暂无接口,见交付说明的边界限制)
if (dRes.errcode === 0 && Array.isArray(dRes.data) && dRes.data.length === 0) {
return { skip: 'not-drawn' }
}
return this.$u.api.checkWinner({ identityNo: idNo }).then(r => ({ skip: null, r }))
}).then(out => {
this.querying = false
if (out.skip === 'not-drawn') { this.phase = 'not-drawn'; return }
const res = out.r
if (res.errcode !== 0 || !res.data) {
this.errText = res.errmsg || '查询失败,请稍后重试'
this.phase = 'error'
return
}
this.fromIdQuery = true
this.phase = res.data.isWinner ? 'won-auth' : 'lost'
}).catch(() => {
this.querying = false
this.errText = '查询失败,请稍后重试'
this.phase = 'error'
})
}
}
}
</script>
<style>
.qsm-mask {
position: fixed;
left: 0; right: 0; top: 0; bottom: 0;
background: rgba(40, 20, 10, 0.55);
z-index: 999;
}
.qsm-sheet {
position: absolute;
left: 0; right: 0; bottom: 0;
background: #FFFFFF;
border-radius: 28rpx 28rpx 0 0;
padding: 36rpx 32rpx calc(40rpx + env(safe-area-inset-bottom));
}
.qsm-head {
display: flex;
align-items: center;
justify-content: center;
position: relative;
margin-bottom: 24rpx;
}
.qsm-title {
font-size: 34rpx;
font-weight: 800;
color: #33200F;
}
.qsm-close {
position: absolute;
right: 0;
top: 4rpx;
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
}
.qsm-desc {
display: block;
font-size: 26rpx;
color: #6B5140;
line-height: 1.6;
margin-bottom: 24rpx;
}
.qsm-input {
height: 96rpx;
background: #F8F1E7;
border-radius: 16rpx;
padding: 0 26rpx;
font-size: 30rpx;
color: #33200F;
letter-spacing: 2rpx;
}
.qsm-ph { color: #B8A28E; font-size: 28rpx; letter-spacing: 0; }
.qsm-privacy {
display: block;
font-size: 22rpx;
color: #B8A28E;
margin-top: 14rpx;
text-align: center;
}
/* xuchao: .qsm-state 是 align-items:center 的 flex 列,子项宽度=内容宽会塌陷,
主按钮必须显式撑满(input 态在普通块级流里 100% 同样成立,两态统一) */
.qsm-btn {
width: 100%;
box-sizing: border-box;
margin-top: 32rpx;
height: 92rpx;
border-radius: 46rpx;
background: linear-gradient(90deg, #D8431F, #E8542F 55%, #F0703C);
color: #FFF;
font-size: 32rpx;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
letter-spacing: 2rpx;
box-shadow: 0 8rpx 18rpx rgba(216, 67, 31, 0.25);
}
.qsm-btn.dis { opacity: .6; }
.qsm-btn.line {
background: #FFF;
color: #D8431F;
border: 2rpx solid #F0C6B4;
box-shadow: none;
}
.qsm-btn-line {
display: flex;
align-items: center;
justify-content: center;
gap: 20rpx;
margin-top: 26rpx;
}
.qsm-link { font-size: 26rpx; color: #D8431F; font-weight: 600; }
.qsm-sep { font-size: 22rpx; color: #E6D4C2; }
.qsm-tip {
display: block;
text-align: center;
font-size: 22rpx;
color: #B8A28E;
margin-top: 24rpx;
}
.qsm-state {
display: flex;
flex-direction: column;
align-items: center;
padding: 14rpx 0 4rpx;
}
.qsm-state-t {
font-size: 34rpx;
font-weight: 800;
color: #33200F;
margin-top: 22rpx;
}
.qsm-state-t.dark { color: #33200F; }
.qsm-state-s {
font-size: 26rpx;
color: #8A6E56;
margin-top: 12rpx;
text-align: center;
line-height: 1.6;
padding: 0 20rpx;
}
.qsm-ico {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.qsm-ico.gold {
background: radial-gradient(circle at 32% 28%, #FFEEC0, #F0C267 65%, #D99A31);
box-shadow: 0 8rpx 16rpx rgba(217, 154, 49, 0.35);
}
.qsm-ico.gray { background: linear-gradient(160deg, #B9AEC5, #8E839B); }
.qsm-ico.amber { background: linear-gradient(160deg, #F0B25C, #E79A30); }
.qsm-spin {
width: 56rpx;
height: 56rpx;
border-radius: 50%;
border: 5rpx solid #F2E3CE;
border-top-color: #E8542F;
margin: 20rpx auto;
animation: qsm-rot 0.9s linear infinite;
}
@keyframes qsm-rot { to { transform: rotate(360deg); } }
</style>