feat: hj中奖记录改为每轮弹窗展示中奖名单,弹窗内searchKey服务端搜索(默认传空串),恭喜中奖徽章,名单懒加载缓存
This commit is contained in:
@@ -39,21 +39,30 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="modal-mask" v-if="showWinModal" @tap="closeWinModal"></view>
|
<view class="modal-mask" v-if="showWinModal" @tap="closeWinModal"></view>
|
||||||
<view class="modal win-modal" v-if="showWinModal">
|
<view class="modal win-modal" v-if="showWinModal && currentItem">
|
||||||
<view class="modal-header">
|
<view class="modal-header">
|
||||||
<text class="modal-title">中奖名单</text>
|
<text class="modal-title">中奖名单</text>
|
||||||
<text class="modal-close" @tap="closeWinModal">✕</text>
|
<text class="modal-close" @tap="closeWinModal">✕</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="win-search">
|
||||||
|
<input class="win-search-input" v-model="currentItem.searchKey" placeholder="搜索中奖人姓名或手机号" confirm-type="search" @confirm="searchWinList" />
|
||||||
|
<view class="win-search-btn" @tap="searchWinList">
|
||||||
|
<text class="win-search-btn-txt">查询</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="win-list">
|
<view class="win-list">
|
||||||
<view class="win-item" v-for="(w, wi) in winList" :key="wi">
|
<view class="win-item" v-for="(w, wi) in currentItem.winList" :key="wi">
|
||||||
<view class="win-level" :class="'win-level-' + w.win_level">
|
<view class="win-congrats">
|
||||||
<text>{{ w.win_level_name }}</text>
|
<text>恭喜中奖</text>
|
||||||
</view>
|
</view>
|
||||||
<text class="win-name">{{ w.user_name }}</text>
|
<text class="win-name">{{ w.user_name }}</text>
|
||||||
<text class="win-phone">{{ w.user_phone }}</text>
|
<text class="win-phone">{{ w.user_phone }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="win-empty" v-if="winList.length === 0">
|
<view class="win-empty" v-if="currentItem.winLoading">
|
||||||
<text>暂无中奖名单</text>
|
<text>名单加载中...</text>
|
||||||
|
</view>
|
||||||
|
<view class="win-empty" v-else-if="currentItem.winList.length === 0">
|
||||||
|
<text>{{ (currentItem.searchKey || '').trim() ? '暂无匹配的中奖人' : '暂无中奖名单' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -72,10 +81,10 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isLoggedIn: false,
|
isLoggedIn: false,
|
||||||
lotteryStarted: false,
|
lotteryStarted: true,
|
||||||
list: [],
|
list: [],
|
||||||
showWinModal: false,
|
showWinModal: false,
|
||||||
winList: [],
|
currentItem: null,
|
||||||
bgHeight: 0
|
bgHeight: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -108,8 +117,15 @@
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
const data = res.Data || {}
|
const data = res.Data || {}
|
||||||
this.list = data.list || data.records || data || []
|
let arr = data.list || data.records || data || []
|
||||||
if (!Array.isArray(this.list)) this.list = []
|
if (!Array.isArray(arr)) arr = []
|
||||||
|
arr.forEach(it => {
|
||||||
|
it.winList = []
|
||||||
|
it.winLoading = false
|
||||||
|
it.winLoaded = false
|
||||||
|
it.searchKey = ''
|
||||||
|
})
|
||||||
|
this.list = arr
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
|
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
|
||||||
}
|
}
|
||||||
@@ -121,19 +137,38 @@
|
|||||||
return String(item.status_desc || '').indexOf('已结束') > -1
|
return String(item.status_desc || '').indexOf('已结束') > -1
|
||||||
},
|
},
|
||||||
showWinList(item) {
|
showWinList(item) {
|
||||||
this.winList = []
|
this.currentItem = item
|
||||||
this.showWinModal = true
|
this.showWinModal = true
|
||||||
this.$u.api.getWenjuanWinDetailList({
|
if (!item.winLoaded && !item.winLoading) {
|
||||||
|
this.fetchWinList(item)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
searchWinList() {
|
||||||
|
if (this.currentItem) {
|
||||||
|
this.fetchWinList(this.currentItem)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fetchWinList(item) {
|
||||||
|
const params = {
|
||||||
wenjuan_id: 1007,
|
wenjuan_id: 1007,
|
||||||
period: item.index
|
period: item.index,
|
||||||
}).then(res => {
|
searchKey: (item.searchKey || '').trim()
|
||||||
if (res.code === 0) {
|
}
|
||||||
this.winList = Array.isArray(res.Data) ? res.Data : []
|
item.winLoading = true
|
||||||
} else {
|
this.$u.api.getWenjuanWinDetailList(params).then(res => {
|
||||||
uni.showToast({ title: res.msg || '加载失败', icon: 'none' })
|
let arr = []
|
||||||
|
if (res && res.code === 0) {
|
||||||
|
if (Array.isArray(res.Data)) arr = res.Data
|
||||||
|
else if (res.Data && Array.isArray(res.Data.list)) arr = res.Data.list
|
||||||
|
} else if (res && res.code !== 0) {
|
||||||
|
uni.showToast({ title: res.msg || '查询失败', icon: 'none' })
|
||||||
}
|
}
|
||||||
|
item.winList = arr
|
||||||
|
item.winLoaded = true
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
uni.showToast({ title: '网络异常', icon: 'none' })
|
item.winList = []
|
||||||
|
}).finally(() => {
|
||||||
|
item.winLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
closeWinModal() {
|
closeWinModal() {
|
||||||
@@ -297,24 +332,6 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-box {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 80rpx 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-icon {
|
|
||||||
font-size: 80rpx;
|
|
||||||
margin-bottom: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-text {
|
|
||||||
font-size: 26rpx;
|
|
||||||
color: rgba(255,255,255,0.7);
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-mask {
|
.modal-mask {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -366,6 +383,41 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.win-search {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 30rpx 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.win-search-input {
|
||||||
|
flex: 1;
|
||||||
|
height: 68rpx;
|
||||||
|
line-height: 68rpx;
|
||||||
|
background: #F5F5F5;
|
||||||
|
border-radius: 34rpx;
|
||||||
|
padding: 0 28rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #333;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.win-search-btn {
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
line-height: 68rpx;
|
||||||
|
padding: 0 28rpx;
|
||||||
|
border-radius: 34rpx;
|
||||||
|
background: linear-gradient(135deg, #FD5401, #FF7A3D);
|
||||||
|
box-shadow: 0 4rpx 12rpx rgba(253,84,1,0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.win-search-btn-txt {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
.win-list {
|
.win-list {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
max-height: 60vh;
|
max-height: 60vh;
|
||||||
@@ -384,8 +436,8 @@
|
|||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.win-level {
|
.win-congrats {
|
||||||
width: 120rpx;
|
width: 140rpx;
|
||||||
height: 44rpx;
|
height: 44rpx;
|
||||||
line-height: 44rpx;
|
line-height: 44rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -394,18 +446,8 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
margin-right: 16rpx;
|
margin-right: 16rpx;
|
||||||
}
|
background: linear-gradient(135deg, #FD5401, #FF7A3D);
|
||||||
|
box-shadow: 0 2rpx 8rpx rgba(253,84,1,0.3);
|
||||||
.win-level-1 {
|
|
||||||
background: linear-gradient(135deg, #F8D65E, #D9A400);
|
|
||||||
}
|
|
||||||
|
|
||||||
.win-level-2 {
|
|
||||||
background: linear-gradient(135deg, #F0C85A, #C9962E);
|
|
||||||
}
|
|
||||||
|
|
||||||
.win-level-3 {
|
|
||||||
background: linear-gradient(135deg, #D98E4A, #B87333);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.win-name {
|
.win-name {
|
||||||
@@ -429,4 +471,22 @@
|
|||||||
color: #999;
|
color: #999;
|
||||||
padding: 60rpx 0;
|
padding: 60rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.empty-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 80rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-icon {
|
||||||
|
font-size: 80rpx;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: rgba(255,255,255,0.7);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user