diff --git a/pages/hj-win-records/hj-win-records.vue b/pages/hj-win-records/hj-win-records.vue index 25c85a7..eaa119b 100644 --- a/pages/hj-win-records/hj-win-records.vue +++ b/pages/hj-win-records/hj-win-records.vue @@ -39,21 +39,30 @@ - + 中奖名单 ✕ + + + + 查询 + + - - - {{ w.win_level_name }} + + + 恭喜中奖 {{ w.user_name }} {{ w.user_phone }} - - 暂无中奖名单 + + 名单加载中... + + + {{ (currentItem.searchKey || '').trim() ? '暂无匹配的中奖人' : '暂无中奖名单' }} @@ -72,10 +81,10 @@ data() { return { isLoggedIn: false, - lotteryStarted: false, + lotteryStarted: true, list: [], showWinModal: false, - winList: [], + currentItem: null, bgHeight: 0 } }, @@ -108,8 +117,15 @@ }).then(res => { if (res.code === 0) { const data = res.Data || {} - this.list = data.list || data.records || data || [] - if (!Array.isArray(this.list)) this.list = [] + let arr = data.list || data.records || data || [] + if (!Array.isArray(arr)) arr = [] + arr.forEach(it => { + it.winList = [] + it.winLoading = false + it.winLoaded = false + it.searchKey = '' + }) + this.list = arr } else { uni.showToast({ title: res.msg || '加载失败', icon: 'none' }) } @@ -121,19 +137,38 @@ return String(item.status_desc || '').indexOf('已结束') > -1 }, showWinList(item) { - this.winList = [] + this.currentItem = item 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, - period: item.index - }).then(res => { - if (res.code === 0) { - this.winList = Array.isArray(res.Data) ? res.Data : [] - } else { - uni.showToast({ title: res.msg || '加载失败', icon: 'none' }) + period: item.index, + searchKey: (item.searchKey || '').trim() + } + item.winLoading = true + this.$u.api.getWenjuanWinDetailList(params).then(res => { + 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(() => { - uni.showToast({ title: '网络异常', icon: 'none' }) + item.winList = [] + }).finally(() => { + item.winLoading = false }) }, closeWinModal() { @@ -297,24 +332,6 @@ 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 { position: fixed; top: 0; @@ -366,6 +383,41 @@ 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 { flex: 1; max-height: 60vh; @@ -384,8 +436,8 @@ border-bottom: none; } - .win-level { - width: 120rpx; + .win-congrats { + width: 140rpx; height: 44rpx; line-height: 44rpx; text-align: center; @@ -394,18 +446,8 @@ color: #fff; flex-shrink: 0; margin-right: 16rpx; - } - - .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); + background: linear-gradient(135deg, #FD5401, #FF7A3D); + box-shadow: 0 2rpx 8rpx rgba(253,84,1,0.3); } .win-name { @@ -429,4 +471,22 @@ color: #999; 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); + }