1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<template>
<view>
<dHeader :title="$lang.lang.log.logExchange"></dHeader>
<view class="container">
<view class="item" v-for="item in list" :key="item.id" @click="toDetail(item.id)">
<div class="item-title">{{ $lang.lang.log.redeemGifts }}</div>
<div class="item-box">
<div class="box-img">
<image class="imgs" :src="locale === 'zh' ? item.imgZh : item.imgEn"></image>
</div>
<div class="box-content">
<div class="content-text">
{{ locale === 'zh' ? item.rewardTitleZh : item.rewardTitleEn }}
</div>
<div class="content-time">{{ formatDate(item.createTime) }}</div>
</div>
<div class="box-right">
<view class="box-right-num">X{{ item.rewardCount }}</view>
<view class="box-right-text">-{{ item.scoreCount }}</view>
</div>
</div>
</view>
</view>
</view>
</template>
<script>
import dHeader from '../../components/dHeader/index.vue'
export default {
components: {
dHeader
},
data() {
return {
list: []
}
},
created() {
this.getList()
},
computed: {
locale() {
return this.$lang.locale
}
},
methods: {
toDetail(id) {
uni.navigateTo({
url: '/pages/exchange_detail/exchange_detail?id=' + id
})
},
// 获取礼品列表
async getList() {
try {
const memberId = this.$store.getters.id
const { code, data } = await this.$request.post('/app-api/reward/redeem/record/list', {
memberId
})
if (code == 0 && data) {
this.list = data
}
} catch (error) {
console.log(error)
}
},
// 时间戳转换为YYYY-MM-DD HH:mm:ss
formatDate(time) {
const date = new Date(time)
const Y = date.getFullYear() + '-'
const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
const D = `${date.getDate()}`.padStart(2, '0') + ' '
const h = `${date.getHours()}`.padStart(2, '0') + ':'
const m = `${date.getMinutes()}`.padStart(2, '0') + ':'
const s = `${date.getSeconds()}`.padStart(2, '0')
return Y + M + D + h + m + s
}
}
}
</script>
<style lang="scss">
page {
overflow: auto;
/* height: 100%; */
/* #ifdef H5 */
padding-top: 140upx;
/* #endif */
/* #ifdef APP-PLUS */
padding-top: calc(var(--status-bar-height) + 100upx);
/* #endif */
background-color: #edf2fa;
}
.container {
padding: 20upx;
box-sizing: border-box;
.item {
padding: 20upx 30upx 30upx 30upx;
margin-bottom: 20upx;
width: 100%;
box-sizing: border-box;
border-radius: 16upx;
background: #ffffff;
box-shadow: 0 2upx 12upx 0 rgba(0, 0, 0, 0.1);
}
}
.item-title {
font-size: 24upx;
margin-bottom: 20upx;
}
.item-box {
width: 100%;
display: flex;
box-sizing: border-box;
}
.box-img {
width: 100upx;
height: 120upx;
margin-right: 20upx;
display: flex;
align-items: center;
justify-content: center;
.imgs {
width: 100upx;
height: 100upx;
object-fit: cover;
}
}
.box-content {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
.content-text {
font-size: 24upx;
color: #7f7f7f;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
overflow: hidden;
}
.content-time {
font-size: 20upx;
color: #7f7f7f;
}
}
.box-right {
margin-left: 10upx;
width: 120upx;
height: 120upx;
display: flex;
align-items: flex-end;
flex-direction: column;
justify-content: space-between;
border-radius: 50%;
font-size: 24upx;
color: #333333;
}
.box-right-img {
transform: translate(20upx, -60upx);
width: 120upx;
height: 120upx;
image {
width: 100%;
height: 100%;
object-fit: cover;
}
}
</style>