<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>
|