doum
8 小时以前 b613bb368d4e678b42d25e94397d0aab3e213438
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<template>
    <view class="points">
        <view class="head" :style="{ backgroundImage: 'url(' + backImage + ')', height: 'calc(' + (navHeight + statusbarHeight + 'px + 376rpx)') }">
            <view :style="{ width: '100%', height: navHeight + statusbarHeight + 'px' }"></view>
            <view class="head-bar" :style="{ height: navHeight + statusbarHeight + 'px' }">
                <view :style="{ width: '100%', height: statusbarHeight + 'px' }"></view>
                <view class="head-bar-nav" :style="{ height: navHeight + 'px' }">
                    <image src="/static/icon/nav_ic_bac@2x.png" mode="widthFix" @click="fanhui"></image>
                    <text>我的积分</text>
                    <image src="/static/icon/nav_ic_bac@2x.png" mode="widthFix" style="opacity: 0;"></image>
                </view>
            </view>
            <view class="info" v-if="info">
                <view class="info-a">当前积分</view>
                <view class="info-b">{{info.surplusIntegral}}</view>
                <view class="info-c">
                    <image src="/static/icon/ic_tixing@2x.png" mode="widthFix"></image>
                    <text>{{info.expiredIntegral}}积分即将过期</text>
                </view>
                <view class="info-d" @click="jump">积分规则</view>
            </view>
            <view class="list">
                <view class="list-title">
                    <view class="list-title-name">积分明细</view>
                    <view class="list-title-cate">
                        <view :class="row.id === type ? 'list-title-cate-row active' : 'list-title-cate-row'" v-for="(row, index) in cate" :key="index" @click="sele(row.id)">{{row.name}}</view>
                    </view>
                </view>
                <view class="list-item" v-for="(item, index) in list" :key="item.id">
                    <view class="list-item-left">
                        <text>{{item.content}}</text>
                        <text>{{item.createDate}}</text>
                    </view>
                    <view class="list-item-num" v-if="item.type == 0">+{{item.num}}</view>
                    <view class="list-item-num" v-else-if="item.type == 1">-{{item.num}}</view>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    import { mapState } from 'vuex'
    export default {
        computed: {
            ...mapState(['navHeight', 'statusbarHeight'])
        },
        data() {
            return {
                info: null,
                list: [],
                page: 1,
                next: true,
                type: '',
                cate: [
                    { name: '全部', id: '' },
                    { name: '收入', id: '0' },
                    { name: '支出', id: '1' }
                ],
                backImage: require('@/static/images/jifen_bg@2x.png')
            };
        },
        onLoad() {
            this.getPoints()
            this.getList()
        },
        onReachBottom() {
            this.getList()
        },
        methods: {
            fanhui() {
                uni.navigateBack({ delta: 1 });
            },
            jump() {
                uni.navigateTo({
                    url: '/pagesA/pages/rich-text-page/rich-text-page?flag=' + 2
                })
            },
            sele(id) {
                this.type = id
                this.next = true
                this.page = 1
                this.list = []
                this.getList()
            },
            getPoints() {
                this.$u.api.getUserIntegralData({})
                    .then(res => {
                        if (res.code === 200) {
                            console.log(res)
                            this.info = res.data
                        }
                    })
            },
            getList() {
                if (!this.next) return;
                this.$u.api.findUserIntegralRecordPage({
                    capacity: 10,
                    page: this.page,
                    model: {
                        type: this.type,
                        userType: 0
                    }
                }).then(res => {
                    if (res.code === 200) {
                        this.list.push(...res.data.records)
                        this.page++
                        if (this.list.length === res.data.total) {
                            this.next = false
                        }
                    }
                })
            }
        }
    }
</script>
 
<style>
    page {
        background-color: #F9F9FB;
    }
</style>
<style lang="scss" scoped>
    .points {
        width: 100%;
        .head {
            width: 100%;
            height: 424rpx;
            padding: 0 30rpx;
            box-sizing: border-box;
            background-repeat: no-repeat;
            background-size: 100% 100%;
            
            .list {
                width: 100%;
                display: flex;
                flex-direction: column;
                background: #FFFFFF;
                border-radius: 16rpx;
                margin-top: 30rpx;
                padding: 34rpx 30rpx;
                box-sizing: border-box;
                .list-title {
                    width: 100%;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    .list-title-name {
                        font-weight: 600;
                        font-size: 32rpx;
                        color: #222222;
                    }
                    .active {
                        color: #004096 !important;
                        background: #F8F9FB !important;
                    }
                    .list-title-cate {
                        display: flex;
                        align-items: center;
                        .list-title-cate-row {
                            width: 96rpx;
                            height: 56rpx;
                            line-height: 56rpx;
                            text-align: center;
                            background: #F8F9FB;
                            border-radius: 28rpx;
                            font-weight: 400;
                            font-size: 24rpx;
                            color: #333333;
                            margin-left: 20rpx;
                        }
                    }
                }
                .list-item {
                    width: 100%;
                    height: 154rpx;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    border-bottom: 1rpx solid #E5E5E5;
                    .list-item-left {
                        flex: 1;
                        height: 100%;
                        display: flex;
                        flex-direction: column;
                        justify-content: space-evenly;
                        text {
                            &:nth-child(1) {
                                font-weight: 400;
                                font-size: 28rpx;
                                color: #222222;
                            }
                            &:nth-child(2) {
                                font-weight: 400;
                                font-size: 24rpx;
                                color: #999999;
                            }
                        }
                    }
                    .list-item-num {
                        flex-shrink: 0;
                        margin-left: 30rpx;
                        font-weight: 500;
                        font-size: 32rpx;
                        color: #222222;
                    }
                }
            }
            
            .info {
                width: 100%;
                padding: 30rpx 0;
                box-sizing: border-box;
                position: relative;
                .info-a {
                    font-weight: 400;
                    font-size: 26rpx;
                    color: #333333;
                }
                .info-b {
                    font-weight: bold;
                    font-size: 72rpx;
                    color: #222222;
                }
                .info-c {
                    width: 100%;
                    display: flex;
                    align-items: center;
                    margin-top: 20rpx;
                    image {
                        width: 28rpx;
                        height: 28rpx;
                        margin-right: 10rpx;
                    }
                    text {
                        font-weight: 400;
                        font-size: 24rpx;
                        color: #777777;
                    }
                }
                .info-d {
                    position: absolute;
                    top: 30rpx;
                    right: -30rpx;
                    width: 140rpx;
                    height: 52rpx;
                    line-height: 52rpx;
                    text-align: center;
                    font-weight: 400;
                    font-size: 24rpx;
                    color: #333333;
                    background: #FFFFFF;
                    border-radius: 36rpx 0rpx 0rpx 36rpx;
                }
            }
        
            .head-bar {
                width: 100%;
                position: fixed;
                padding: 0 30rpx;
                box-sizing: border-box;
                top: 0;
                left: 0;
                z-index: 999;
        
                .head-bar-nav {
                    width: 100%;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
        
                    image {
                        width: 44rpx;
                        height: 44rpx;
                    }
        
                    text {
                        font-weight: 500;
                        font-size: 32rpx;
                        color: #111111;
                    }
                }
            }
        }
    }
</style>