MrShi
2026-06-09 3f9032e92fdd383bfefc87a0bec9b242e1223851
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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<template>
    <view class="reward-page">
        <view class="reward-page__bg"></view>
 
        <view class="reward-page__nav" :style="{ paddingTop: statusBarHeight + 'px' }">
            <view class="reward-page__nav-inner">
                <view class="reward-page__back" @click="goBack">
                    <u-icon name="arrow-left" color="#000000" size="22"></u-icon>
                </view>
                <text class="reward-page__nav-title">奖励大厅</text>
                <view class="reward-page__nav-placeholder"></view>
            </view>
        </view>
 
        <scroll-view class="reward-page__body" scroll-y :style="bodyStyle">
            <view class="reward-page__content">
                <view class="reward-total">
                    <text class="reward-total__label">已领取奖励(元)</text>
                    <text class="reward-total__value">{{ claimedAmount }}</text>
                </view>
 
                <view class="reward-card reward-card--task" style="margin-top: 20rpx;">
                    <text class="reward-card__title">接单得奖励</text>
                    <view class="reward-card__summary">
                        <text class="reward-card__summary-text">您有</text>
                        <text class="reward-card__summary-amount">{{ pendingAmount }}</text>
                        <text class="reward-card__summary-text">元待领取</text>
                    </view>
 
                    <view class="reward-steps">
                        <view v-for="item in taskList" :key="item.step" class="reward-steps__item">
                            <view class="reward-steps__box" :class="{ 'reward-steps__box--done': item.done, 'reward-steps__box--pending': !item.done }">
                                <text class="reward-steps__amount">+{{ item.amount }}</text>
                                <image v-if="item.done" class="reward-steps__icon" src="/static/image/ic_complete@2x.png" mode="aspectFit"></image>
                                <text v-else class="reward-steps__status" @click.stop="handleClaimReward(item)">{{ item.claiming ? '领取中' : '领取' }}</text>
                            </view>
                            <text :class="item.done ? 'reward-steps__label reward-steps__label--done' : 'reward-steps__label'">{{ item.stepLabel }}</text>
                        </view>
                        <view v-if="!taskList.length" class="reward-steps__empty">暂无奖励记录</view>
                    </view>
                </view>
 
                <view class="reward-card reward-card--rules">
                    <text class="reward-card__title">司机奖励规则</text>
 
                    <view v-for="section in ruleSections" :key="section.title" class="rule-section">
                        <text class="rule-section__title">{{ section.title }}</text>
                        <text class="rule-section__content">
                            <text v-for="(part, index) in section.parts" :key="index" :class="part.highlight ? 'rule-section__highlight' : ''">{{ part.text }}</text>
                        </text>
                    </view>
 
                    <text class="reward-card__footer">即刻踊跃接单,轻松赚取额外奖励,期待各位师傅积极参与!</text>
                </view>
            </view>
        </scroll-view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                statusBarHeight: 0,
                navHeight: 0,
                claimedAmount: '0',
                pendingAmount: '0',
                platformRewardAmount: '0',
                platformRewardOrderCount: 0,
                registerRewardAmount: '0',
                registerRewardOrderCount: 0,
                taskList: [],
                ruleSections: [
                    {
                        title: '一、奖励规则',
                        parts: [
                            { text: '本次奖励包含注册奖励与平台奖励两项福利:\n注册奖励:每完成' },
                            { text: '1', highlight: true },
                            { text: '笔有效订单,立得' },
                            { text: '20元', highlight: true },
                            { text: '现金,单人最高可领' },
                            { text: '200元', highlight: true },
                            { text: ';\n平台奖励:每完成' },
                            { text: '1', highlight: true },
                            { text: '笔有效订单,再享' },
                            { text: '10元', highlight: true },
                            { text: '现金,单人最高可领' },
                            { text: '100元', highlight: true },
                            { text: '。' }
                        ]
                    },
                    {
                        title: '二、奖励发放',
                        parts: [
                            { text: '完成注册奖励任务后,将自动解锁平台奖励;每单奖励领取后,自动发放至司机个人账户钱包,支持随时提现,到账快捷无门槛。' }
                        ]
                    },
                    {
                        title: '三、有效订单说明',
                        parts: [
                            { text: '奖励仅针对有效完成订单;若订单出现取消、退款、平台判定无效等情况,将不予发放对应奖励。' }
                        ]
                    },
                    {
                        title: '四、其他须知',
                        parts: [
                            { text: '本活动规则最终解释权归平台所有,活动相关疑问可随时咨询平台客服,我们将竭诚为您解答服务。' }
                        ]
                    }
                ]
            }
        },
        computed: {
            bodyStyle() {
                return {
                    height: 'calc(100vh - ' + this.navHeight + 'px)',
                    marginTop: this.navHeight + 'px'
                }
            }
        },
        onLoad() {
            const systemInfo = uni.getSystemInfoSync()
            this.statusBarHeight = systemInfo.statusBarHeight || 0
            this.navHeight = this.statusBarHeight + uni.upx2px(88)
            this.getRewardHallData()
        },
        methods: {
            fenToYuan(value) {
                const amount = Number(value || 0) / 100
                return amount.toFixed(2).replace(/\.00$/, '').replace(/(\.\d)0$/, '$1')
            },
            formatTaskLabel(item, index) {
                if (item.orderCount || item.orderCount === 0) {
                    return item.orderCount + '单'
                }
                return index + 1 + '单'
            },
            getRewardHallData() {
                this.$u.api.driverRewardHall({}).then(res => {
                    console.log(res)
                    if (res.code === 200 && res.data) {
                        const data = res.data
                        this.claimedAmount = this.fenToYuan(data.claimedAmount)
                        this.pendingAmount = this.fenToYuan(data.pendingAmount)
                        this.platformRewardAmount = this.fenToYuan(data.platformRewardAmount)
                        this.platformRewardOrderCount = data.platformRewardOrderCount || 0
                        this.registerRewardAmount = this.fenToYuan(data.registerRewardAmount)
                        this.registerRewardOrderCount = data.registerRewardOrderCount || 0
                        
                        this.ruleSections[0].parts[1].text = data.registerRewardOrderCount || 0
                        this.ruleSections[0].parts[3].text = this.fenToYuan(data.registerRewardAmount) + '元'
                        this.ruleSections[0].parts[5].text = (this.fenToYuan(data.registerRewardAmount) * (data.registerRewardOrderCount || 0)) + '元'
                        
                        this.ruleSections[0].parts[7].text = data.platformRewardOrderCount || 0
                        this.ruleSections[0].parts[9].text = this.fenToYuan(data.platformRewardAmount) + '元'
                        this.ruleSections[0].parts[11].text = (this.fenToYuan(data.platformRewardAmount) * (data.platformRewardOrderCount || 0)) + '元'
                        
                        this.taskList = (data.records || []).map((item, index) => ({
                            step: index + 1,
                            id: item.id,
                            stepLabel: this.formatTaskLabel(item, index),
                            rewardRecordId: item.rewardRecordId,
                            amount: this.fenToYuan(item.amount),
                            done: Number(item.status) === 1,
                            claiming: false
                        }))
                    }
                })
            },
            handleClaimReward(item) {
                item.claiming = true
                this.$u.api.claimReward({
                    rewardRecordId: item.id
                }).then(res => {
                    if (res.code === 200) {
                        uni.showToast({ title: '领取成功', icon: 'success' })
                        this.getRewardHallData()
                    }
                }).finally(() => {
                    item.claiming = false
                })
            },
            goBack() {
                if (getCurrentPages().length > 1) {
                    uni.navigateBack()
                    return
                }
                uni.switchTab({
                    url: '/pages/mine/mine'
                })
            }
        }
    }
</script>
 
<style lang="scss">
    .reward-page {
        position: relative;
        min-height: 100vh;
        background: #0c1220;
        overflow: hidden;
 
        &__bg {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
        }
 
        &__bg {
            background: url('/static/image/bg_jiangli@2x.png') center top / cover no-repeat;
        }
 
        &__nav {
            position: fixed;
            left: 0;
            top: 0;
            right: 0;
            z-index: 20;
        }
 
        &__nav-inner {
            height: 88rpx;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 24rpx;
            color: #ffffff;
        }
 
        &__back,
        &__nav-placeholder {
            width: 72rpx;
            height: 72rpx;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
 
        &__back {
        }
 
        &__nav-title {
            font-size: 34rpx;
            font-weight: 700;
            color: #111111;
            letter-spacing: 4rpx;
        }
 
        &__body {
            position: relative;
            z-index: 5;
        }
 
        &__content {
            padding: 38rpx 24rpx 36rpx;
        }
    }
 
    .reward-card {
        background: #ffffff;
        border-radius: 28rpx;
        padding: 28rpx;
        box-shadow: 0 12rpx 36rpx rgba(35, 53, 91, 0.08);
 
        & + & {
            margin-top: 20rpx;
        }
 
        &__title {
            display: block;
            font-size: 38rpx;
            font-weight: 700;
            color: #222222;
            line-height: 1.3;
        }
 
        &__summary {
            display: flex;
            align-items: baseline;
            margin-top: 12rpx;
            margin-bottom: 12rpx;
        }
 
        &__summary-text {
            font-size: 28rpx;
            color: #8b93a6;
        }
 
        &__summary-amount {
            margin: 0 8rpx;
            font-size: 34rpx;
            font-weight: 700;
            color: #ff5a4f;
        }
 
        &__footer {
            display: block;
            margin-top: 20rpx;
            font-size: 28rpx;
            line-height: 1.8;
            font-weight: 600;
            color: #333333;
        }
    }
 
    .reward-total {
        padding: 0 10rpx 32rpx 10rpx;
        box-sizing: border-box;
 
        &__label {
            display: block;
            font-size: 30rpx;
            line-height: 1.5;
            color: #2c3448;
        }
 
        &__value {
            display: block;
            margin-top: 20rpx;
            font-size: 72rpx;
            line-height: 1;
            font-weight: 700;
            color: #111111;
        }
    }
 
    .reward-steps {
        display: flex;
        flex-wrap: wrap;
        gap: 12rpx;
 
        &__item {
            width: 92rpx;
            text-align: center;
        }
 
        &__box {
            height: 120rpx;
            border-radius: 20rpx;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
 
        &__box--done {
            background: #eef5ff;
            border: 2rpx solid #2f93ff;
        }
 
        &__box--pending {
            background: #eef5ff;
        }
 
        &__amount {
            font-size: 34rpx;
            font-weight: 700;
            color: #2f93ff;
            line-height: 1;
        }
 
        &__icon {
            width: 34rpx;
            height: 34rpx;
            margin-top: 10rpx;
        }
 
        &__status {
            margin-top: 12rpx;
            font-size: 28rpx;
            font-weight: 600;
            color: #2f93ff;
        }
 
        &__label {
            display: block;
            margin-top: 16rpx;
            font-size: 28rpx;
            color: #4c5a73;
        }
 
        &__label--done {
            color: #106efa;
        }
 
        &__empty {
            width: 100%;
            padding-top: 20rpx;
            font-size: 26rpx;
            line-height: 1.6;
            text-align: center;
            color: #8b93a6;
        }
    }
 
    .rule-section {
        margin-top: 24rpx;
 
        &:first-of-type {
            margin-top: 18rpx;
        }
 
        &__title {
            display: block;
            font-size: 32rpx;
            font-weight: 700;
            color: #222222;
            line-height: 1.4;
        }
 
        &__content {
            display: block;
            margin-top: 12rpx;
            font-size: 30rpx;
            line-height: 1.8;
            color: #4a4a4a;
            white-space: pre-wrap;
        }
 
        &__highlight {
            color: #ff5a4f;
            font-weight: 700;
        }
    }
</style>