MrShi
8 小时以前 bdf43a9baa02560fd2bd47564178c1d5633b04d1
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
<template>
    <view class="box">
        <view class="cate">
            <view class="cate-item" @click="sele(item.id)" v-for="(item, index) in cate" :key="index">
                <text>{{item.name}}</text>
                <view class="cate-item-x" v-if="status === index"></view>
            </view>
        </view>
        <view class="list">
            <view :class="[1,2].includes(status) ? 'item disable' : 'item'" v-for="(item, index) in list" :key="index">
                <view class="item-a">
                    <text class="item-a-num" v-if="item.couponType === 0">{{item.price}}</text>
                    <text class="item-a-num1" v-else-if="item.couponType === 1">{{item.price}}</text>
                    <text>满{{item.limitPrice}}可用</text>
                </view>
                <view class="item-b">
                    <view class="item-b-left">
                        <text>{{item.name}}</text>
                        <text>{{item.endDate.substring(0, 10)}} 日到期</text>
                    </view>
                    <image src="/static/images/ic_yishiyong@2x.png" mode="widthFix" v-if="status === 1"></image>
                    <image src="/static/images/ic_yiguoqi@2x.png" mode="widthFix" v-else-if="status === 2"></image>
                    <view class="item-b-btn" v-else @click="jumpDetails(item.id)">查看详情</view>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                status: 0,
                current: 1,
                list: [],
                next: true,
                cate: [
                    { name: '未使用', id: 0 },
                    { name: '已使用', id: 1 },
                    { name: '已过期', id: 2 }
                ]
            };
        },
        onLoad() {
            this.getList()
        },
        onReachBottom() {
            this.getList()
        },
        methods: {
            jumpDetails(id) {
                uni.navigateTo({
                    url: '/pages/coupon-details/coupon-details?id='+id
                })
            },
            sele(id) {
                this.status = id
                this.current = 1
                this.list = []
                this.next = true
                this.getList()
            },
            getList() {
                if (!this.next) return
                this.$u.api.memberCouponPage({
                    couponType: 1,
                    current: this.current,
                    size: 10,
                    status: this.status
                }).then(res => {
                    if (res.code === 200) {
                        console.log(res)
                        this.current++
                        this.list.push(...res.data.records)
                        if (this.list.length === res.data.total) {
                            this.next = false
                        }
                    }
                })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .box {
        width: 100%;
        .cate {
            width: 100%;
            height: 90rpx;
            display: flex;
            align-items: center;
            border-bottom: 1rpx solid #E5E5E5;
            position: sticky;
            top: 0;
            left: 0;
            z-index: 999;
            .cate-item {
                flex: 1;
                height: 100%;
                display: flex;
                align-items: center;
                justify-content: center;
                position: relative;
                text {
                    font-weight: 400;
                    font-size: 30rpx;
                    color: #666666;
                }
                .cate-item-x {
                    position: absolute;
                    bottom: 0;
                    left: 50%;
                    width: 40rpx;
                    height: 6rpx;
                    background-color: #004096;
                    transform: translate(-50%, 0);
                }
            }
        }
        .list {
            width: 100%;
            padding: 30rpx;
            box-sizing: border-box;
            .disable {
                background: #EFEFEF !important;
                .item-a {
                    .item-a-num {
                        color: #999999 !important;
                        &::before {
                            color: #999999 !important;
                        }
                    }
                    .item-a-num1 {
                        color: #999999 !important;
                        &::after {
                            color: #999999 !important;
                        }
                    }
                    text {
                        color: #999999 !important;
                    }
                }
                .item-b {
                    .item-b-left {
                        text {
                            color: #999999 !important;
                        }
                    }
                    image {
                        width: 92rpx;
                        height: 92rpx;
                    }
                }
            }
            .item {
                width: 100%;
                height: 170rpx;
                display: flex;
                align-items: center;
                background: #FFEFEF;
                border-radius: 16rpx;
                margin-bottom: 20rpx;
                &:last-child {
                    margin: 0 !important;
                }
                .item-a {
                    width: 208rpx;
                    height: 100%;
                    flex-shrink: 0;
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    justify-content: center;
                    border-right: 1rpx dashed #E3C1C1;
                    .item-a-num {
                        font-weight: 600;
                        font-size: 44rpx;
                        color: #E4001D;
                        &::before {
                            content: '¥';
                            font-weight: 600;
                            font-size: 24rpx;
                            color: #E4001D;
                        }
                    }
                    .item-a-num1 {
                        font-weight: 600;
                        font-size: 44rpx;
                        color: #E4001D;
                        &::after {
                            content: '折';
                            font-weight: 600;
                            font-size: 24rpx;
                            color: #E4001D;
                        }
                    }
                    text {
                        font-weight: 400;
                        font-size: 24rpx;
                        color: #E93047;
                        margin-top: 8rpx;
                    }
                }
                .item-b {
                    flex: 1;
                    padding: 0 30rpx;
                    box-sizing: border-box;
                    height: 100%;
                    display: flex;
                    align-items: center;
                    .item-b-left {
                        flex: 1;
                        height: 100%;
                        display: flex;
                        flex-direction: column;
                        justify-content: center;
                        text {
                            &:nth-child(1) {
                                font-weight: 500;
                                font-size: 32rpx;
                                color: #222222;
                            }
                            &:nth-child(2) {
                                font-weight: 400;
                                font-size: 24rpx;
                                color: #777777;
                                margin-top: 12rpx;
                            }
                        }
                    }
                    .item-b-btn {
                        flex-shrink: 0;
                        width: 144rpx;
                        height: 56rpx;
                        line-height: 56rpx;
                        text-align: center;
                        font-weight: 400;
                        font-size: 24rpx;
                        color: #E93047;
                        border-radius: 28rpx;
                        border: 1rpx solid #FF9DA9;
                    }
                }
            }
        }
    }
</style>