From 1ea0a9f92a01fa727a47e44b4fd58e5d1a03e0a0 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 28 八月 2025 01:04:15 +0800
Subject: [PATCH] 领取记录,跳转
---
pages/tabbar/user/utils/tool.vue | 26 ++++
static/mine/prize-record.png | 0
pages.json | 28 ++++
pages/prizeRecord/prizeRecord.vue | 254 ++++++++++++++++++++++++++++++++++++++++++
api/prize-activity.js | 17 ++
static/mine/prize-activity.png | 0
pages/mine/activity/applyActivityList.vue | 7 -
api/prize-record.js | 15 ++
store/index.js | 1
9 files changed, 341 insertions(+), 7 deletions(-)
diff --git a/api/prize-activity.js b/api/prize-activity.js
new file mode 100644
index 0000000..7423751
--- /dev/null
+++ b/api/prize-activity.js
@@ -0,0 +1,17 @@
+import { http, Method } from "@/utils/request.js";
+
+import api from "@/config/api.js";
+
+
+/**
+ * 鑾峰緱鎶藉娲诲姩
+ *
+ * @param params
+ */
+ export function getONPrizeActivity() {
+ return http.request({
+ url: "/lmk/activity-prize/getONPrizeActivity",
+ method: Method.GET,
+ needToken: true,
+ });
+}
\ No newline at end of file
diff --git a/api/prize-record.js b/api/prize-record.js
new file mode 100644
index 0000000..3d35f83
--- /dev/null
+++ b/api/prize-record.js
@@ -0,0 +1,15 @@
+import {
+ http,
+ Method
+} from "@/utils/request.js";
+
+import api from "@/config/api.js";
+
+export function getPage(param){
+ return http.request({
+ url: "/lmk/prizeRecord",
+ method: Method.GET,
+ needToken: true,
+ params:param
+ });
+}
\ No newline at end of file
diff --git a/pages.json b/pages.json
index f985091..de4ac34 100644
--- a/pages.json
+++ b/pages.json
@@ -35,6 +35,7 @@
"navigationBarTitleText" : ""
}
}
+
// {
// "path": "pages/tabbar/home/index",
// "style": {
@@ -402,6 +403,33 @@
// ]
// },
{
+ "root" : "pages/prizeRecord",
+ "pages": [
+ {
+ "path":"prizeRecord",
+ "style" :
+ {
+ "navigationBarTitleText" : "",
+ "componentPlaceholder": {
+ "u-form": "view",
+ "u-form-item": "view",
+ "u-input": "view",
+ "u-icon": "view",
+ "u-action-sheet": "view",
+ "u-checkbox-group": "view",
+ "u-checkbox": "view",
+ "u-navbar": "view",
+ "u-button": "view",
+ "u-image": "view",
+ "u-empty": "view",
+ "u-loadmore":"view"
+ }
+ }
+ }
+ ]
+
+ },
+ {
"root": "pages/mine",
"pages": [
// {
diff --git a/pages/mine/activity/applyActivityList.vue b/pages/mine/activity/applyActivityList.vue
index cd59efe..48cbb10 100644
--- a/pages/mine/activity/applyActivityList.vue
+++ b/pages/mine/activity/applyActivityList.vue
@@ -65,8 +65,6 @@
data() {
return {
- scrollViewTop: uni.upx2px(50 + 80 + 40), // 50rpx绌虹櫧 + 80rpx鎸夐挳 + 40rpx杈硅窛
- scrollViewBottom: uni.upx2px(120), // 搴曢儴棰勭暀
query: {
pageNumber: 1,
pageSize: 5,
@@ -223,11 +221,6 @@
height: auto;
}
-
- /* 娲诲姩鍒楄〃鏍峰紡 */
- .activity-list {
- padding: 20rpx 24rpx;
- }
.card {
background: #fff;
diff --git a/pages/prizeRecord/prizeRecord.vue b/pages/prizeRecord/prizeRecord.vue
new file mode 100644
index 0000000..fc172cf
--- /dev/null
+++ b/pages/prizeRecord/prizeRecord.vue
@@ -0,0 +1,254 @@
+<template>
+ <view class="container">
+ <view style="height:50rpx"></view>
+
+ <u-empty v-if="mockData.length === 0 && !loading" mode="data"
+ icon="http://cdn.uviewui.com/uview/empty/data.png">
+ </u-empty>
+
+ <!-- 鍏抽敭淇锛氱‘淇漵croll-view楂樺害姝g‘涓斾簨浠剁粦瀹氭湁鏁� -->
+ <scroll-view
+ scroll-y class="scroll-view-container" style="height: 40vh" @scrolltolower="loadMore" :lower-threshold="50"
+ >
+ <view v-for="(item, idx) in mockData" :key="idx" class="prize-record-item card">
+ <view class="prize-record-info">
+ <view class="info-header">
+ <view class="prize-activity-name">{{ item.prizeActivityName }}</view>
+ <view class="prize-status-tag"
+ :class="item.prizeStatus === 'WIN' ? 'tag-winning' : 'tag-not-win'">
+ {{ item.prizeStatus === 'WIN' ? '宸蹭腑濂�' : '鏈腑濂�' }}
+ </view>
+ </view>
+
+ <view class="info-content">
+ <view class="content-label">濂栧搧鍐呭锛�</view>
+ <view class="prize-content">{{ item.prizeContent || '鏆傛棤濂栧搧鎻忚堪' }}</view>
+ </view>
+
+ <view class="prize-record-meta">
+ <view class="meta-item">
+ <u-icon name="clock-o" size="16" color="#999"></u-icon>
+ <text class="meta-text">{{ formatTime(item.createTime) }}</text>
+ </view>
+ <view class="meta-item" v-if="item.activitySource">
+ <u-icon name="map" size="16" color="#999"></u-icon>
+ <text class="meta-text">{{ item.activitySource }}</text>
+ </view>
+ </view>
+ </view>
+ </view>
+
+ <view class="load-more">
+ <u-loadmore v-if="mockData.length > 0" :status="loading ? 'loading' : noMore ? 'nomore' : 'loadmore'"
+ :load-text="{
+ loadmore: '涓婃媺鍔犺浇鏇村',
+ loading: '姝e湪鍔犺浇',
+ nomore: '娌℃湁鏇村浜�'
+ }" />
+ </view>
+ <view style="height:150rpx"></view>
+ </scroll-view>
+ </view>
+</template>
+
+<script>
+ import { getPage } from '@/api/prize-record.js'
+ export default {
+ data() {
+ return {
+ query: {
+ pageNumber: 1,
+ pageSize: 5,
+ },
+ loading: false,
+ total: 0,
+ mockData: [],
+ noMore: false,
+ }
+ },
+ onLoad() {
+ this.getPage();
+ },
+ methods: {
+ onPullDownRefresh() {
+ this.mockData = [];
+ this.query.pageNumber = 1;
+ this.getPage()
+ setTimeout(() => {
+ uni.stopPullDownRefresh();
+ }, 1000);
+ },
+
+ formatTime(timeStr) {
+ if (!timeStr || typeof timeStr !== 'string') return '鏈煡鏃堕棿';
+
+ try {
+ // 鎵嬪姩瑙f瀽鏍煎紡锛岃В鍐冲吋瀹规�ч棶棰�
+ const [datePart, timePart] = timeStr.split('T');
+ if (!datePart || !timePart) return '鏃犳晥鏃堕棿';
+
+ const [year, month, day] = datePart.split('-');
+ const hourMinute = timePart.split('.')[0].slice(0, 5);
+ const [hour, minute] = hourMinute.split(':');
+
+ return `${year}-${month}-${day} ${hour}:${minute}`;
+ } catch (error) {
+ console.warn('鏃ユ湡瑙f瀽澶辫触:', error);
+ return '鏈煡鏃堕棿';
+ }
+ },
+
+ async getPage() {
+ try {
+ const res = await getPage(this.query);
+ if (res.statusCode === 200) {
+ const newData = res.data.data || [];
+ this.total = res.data.total || 0;
+ this.mockData = this.query.pageNumber === 1 ? newData : [...this.mockData, ...newData];
+ this.noMore = newData.length < this.query.pageSize || this.mockData.length >= this.total;
+ }
+ } catch (error) {
+ console.error('鍔犺浇澶辫触:', error);
+ if (this.query.pageNumber > 1) {
+ this.query.pageNumber -= 1;
+ }
+ } finally {
+ this.loading = false;
+ uni.hideLoading();
+ uni.stopPullDownRefresh();
+ }
+ },
+
+ loadMore() {
+ // 澧炲姞鏃ュ織渚夸簬璋冭瘯
+ console.log('瑙﹀彂涓婃媺鍔犺浇', 'loading:', this.loading, 'noMore:', this.noMore);
+
+ if (this.loading || this.noMore) return;
+
+ this.loading = true;
+ // 绉婚櫎涓嶅繀瑕佺殑寤惰繜锛岄伩鍏嶅奖鍝嶄綋楠�
+ this.query.pageNumber += 1;
+ this.getPage();
+ },
+ }
+ }
+</script>
+
+<style>
+ .container {
+ height: 100vh;
+ display: flex;
+ flex-direction: column;
+ background-color: #f7f8fa;
+ }
+
+ /* 鍏抽敭淇锛氫娇鐢╢lex纭繚楂樺害姝g‘璁$畻 */
+ .scroll-view-container {
+ flex: 1;
+ overflow-y: auto; /* 鏄庣‘璁剧疆鍨傜洿婊氬姩 */
+ padding: 0 20rpx;
+ box-sizing: border-box;
+ -webkit-overflow-scrolling: touch; /* 浼樺寲绉诲姩绔粴鍔ㄤ綋楠� */
+ }
+
+ .load-more {
+ padding: 20rpx 0;
+ text-align: center;
+ color: #999;
+ font-size: 26rpx;
+ background-color: #f8f9fa;
+ }
+
+ .card {
+ background: #fff;
+ border-radius: 20rpx;
+ margin: 0 0 24rpx;
+ box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03),
+ 0 6rpx 16rpx rgba(0, 0, 0, 0.04);
+ transition: all 0.25s ease;
+ }
+
+ .prize-record-item {
+ padding: 30rpx 28rpx;
+ }
+
+ .info-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 22rpx;
+ }
+
+ .prize-activity-name {
+ font-size: 34rpx;
+ font-weight: 600;
+ color: #222;
+ line-height: 1.4;
+ max-width: 70%;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .prize-status-tag {
+ padding: 6rpx 18rpx;
+ border-radius: 20rpx;
+ font-size: 24rpx;
+ font-weight: 500;
+ text-align: center;
+ }
+
+ .tag-winning {
+ background-color: #fff1f0;
+ color: #ff4d4f;
+ border: 1px solid #ffccc7;
+ }
+
+ .tag-not-win {
+ background-color: #f5f5f5;
+ color: #888;
+ border: 1px solid #e5e5e5;
+ }
+
+ .info-content {
+ margin-bottom: 24rpx;
+ padding-left: 4rpx;
+ }
+
+ .content-label {
+ font-size: 24rpx;
+ color: #999;
+ margin-bottom: 8rpx;
+ }
+
+ .prize-content {
+ font-size: 28rpx;
+ color: #555;
+ line-height: 1.6;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ overflow: hidden;
+ }
+
+ .prize-record-meta {
+ display: flex;
+ justify-content: flex-start;
+ gap: 24rpx;
+ padding-top: 20rpx;
+ border-top: 1px solid #f8f8f8;
+ }
+
+ .meta-item {
+ display: flex;
+ align-items: center;
+ gap: 8rpx;
+ }
+
+ .meta-text {
+ font-size: 22rpx;
+ color: #888;
+ white-space: nowrap;
+ letter-spacing: 0.5rpx;
+ }
+</style>
diff --git a/pages/tabbar/user/utils/tool.vue b/pages/tabbar/user/utils/tool.vue
index 009080a..f7280c8 100644
--- a/pages/tabbar/user/utils/tool.vue
+++ b/pages/tabbar/user/utils/tool.vue
@@ -136,6 +136,15 @@
<image src="/static/mine/order.png" mode=""></image>
<view>鍟嗘埛璁㈠崟绠$悊</view>
</view>
+
+ <view class="interact-item" v-if="prizeActivityId !== null && prizeActivityId !==''" @click="gotoPrizeActivity()">
+ <image src="/static/mine/prize-activity.png"></image>
+ <view>鎶藉娲诲姩</view>
+ </view>
+ <view class="interact-item" @click="navigateTo('/pages/prizeRecord/prizeRecord')">
+ <image src="/static/mine/prize-record.png"></image>
+ <view>鎶藉璁板綍</view>
+ </view>
</view>
</view>
@@ -145,6 +154,7 @@
<script>
import { getUserInfo } from "@/api/members";
+ import {getONPrizeActivity} from '@/api/prize-activity.js'
import {
distribution
} from "@/api/goods";
@@ -154,6 +164,7 @@
export default {
data() {
return {
+ prizeActivityId:'',
isStoreManger:false,
configs,
storage
@@ -169,8 +180,23 @@
}
}
})
+ this.getONPrizeActivity();
},
+
methods: {
+ getONPrizeActivity(){
+ getONPrizeActivity().then(res =>{
+ if(res.statusCode=== 200){
+ //鍚庣娌℃煡鍒板紑鍚殑鎶藉娲诲姩 res.data.data.id鍊间负null
+ this.prizeActivityId = res.data.data.id;
+ }
+ })
+ },
+ gotoPrizeActivity(){
+ uni.navigateTo({
+ url:'/pages/prize/PrizeDetail/PrizeDetail?id=' + this.prizeActivityId,
+ });
+ },
handleNavigate(url) {
uni.navigateTo({
diff --git a/static/mine/prize-activity.png b/static/mine/prize-activity.png
new file mode 100644
index 0000000..40a2320
--- /dev/null
+++ b/static/mine/prize-activity.png
Binary files differ
diff --git a/static/mine/prize-record.png b/static/mine/prize-record.png
new file mode 100644
index 0000000..1d1b384
--- /dev/null
+++ b/static/mine/prize-record.png
Binary files differ
diff --git a/store/index.js b/store/index.js
index f05a8df..47a92e4 100644
--- a/store/index.js
+++ b/store/index.js
@@ -17,6 +17,7 @@
token: "",
// 娲诲姩寮圭獥鐘舵��
activityPopup: {
+ prizeActivityId:'',
show: false,
title: '',
desc: '',
--
Gitblit v1.8.0