|
@ -9,21 +9,38 @@ |
|
|
<!-- 时间奖励值 --> |
|
|
<!-- 时间奖励值 --> |
|
|
<view class="time-reward" @click="showExchangeModal"> |
|
|
<view class="time-reward" @click="showExchangeModal"> |
|
|
<view class="reward-icon"> |
|
|
<view class="reward-icon"> |
|
|
<nmr-icon name="jifenduihuan" style="margin-right: 10rpx;margin-top: 3rpx;" size="40" |
|
|
<nmr-icon |
|
|
color="white"></nmr-icon>兑换奖励 |
|
|
name="jifenduihuan" |
|
|
|
|
|
style="margin-right: 10rpx; margin-top: 3rpx" |
|
|
|
|
|
size="40" |
|
|
|
|
|
color="white" |
|
|
|
|
|
></nmr-icon |
|
|
|
|
|
>兑换奖励 |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<!-- 筛选选项 --> |
|
|
<!-- 筛选选项 --> |
|
|
<view class="filter-tabs"> |
|
|
<view class="filter-tabs"> |
|
|
<view class="tab-item" :class="[{ active: currentTab === 'all' }]" @click="switchTab('all')"> |
|
|
<view |
|
|
|
|
|
class="tab-item" |
|
|
|
|
|
:class="[{ active: currentTab === 'all' }]" |
|
|
|
|
|
@click="switchTab('all')" |
|
|
|
|
|
> |
|
|
全部 |
|
|
全部 |
|
|
</view> |
|
|
</view> |
|
|
<view class="tab-item" :class="[{ active: currentTab === 'in' }]" @click="switchTab('in')"> |
|
|
<view |
|
|
|
|
|
class="tab-item" |
|
|
|
|
|
:class="[{ active: currentTab === 'in' }]" |
|
|
|
|
|
@click="switchTab('in')" |
|
|
|
|
|
> |
|
|
收入 |
|
|
收入 |
|
|
</view> |
|
|
</view> |
|
|
<view class="tab-item" :class="[{ active: currentTab === 'out' }]" @click="switchTab('out')"> |
|
|
<view |
|
|
|
|
|
class="tab-item" |
|
|
|
|
|
:class="[{ active: currentTab === 'out' }]" |
|
|
|
|
|
@click="switchTab('out')" |
|
|
|
|
|
> |
|
|
支出 |
|
|
支出 |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
@ -31,9 +48,16 @@ |
|
|
<!-- 积分记录列表 --> |
|
|
<!-- 积分记录列表 --> |
|
|
<scroll-view class="points-list" scroll-y="true" @scrolltolower="loadMore"> |
|
|
<scroll-view class="points-list" scroll-y="true" @scrolltolower="loadMore"> |
|
|
<template v-if="pointsList.length"> |
|
|
<template v-if="pointsList.length"> |
|
|
<view class="record-item" v-for="(item, index) in pointsList" :key="index"> |
|
|
<view |
|
|
|
|
|
class="record-item" |
|
|
|
|
|
v-for="(item, index) in pointsList" |
|
|
|
|
|
:key="index" |
|
|
|
|
|
> |
|
|
<view class="record-left"> |
|
|
<view class="record-left"> |
|
|
<view class="record-icon" :class="item.fromType === 'in' ? 'income' : 'expense'"> |
|
|
<view |
|
|
|
|
|
class="record-icon" |
|
|
|
|
|
:class="item.fromType === 'in' ? 'income' : 'expense'" |
|
|
|
|
|
> |
|
|
<nmr-icon name="jifen" size="60" color="#333"></nmr-icon> |
|
|
<nmr-icon name="jifen" size="60" color="#333"></nmr-icon> |
|
|
</view> |
|
|
</view> |
|
|
<view class="record-info"> |
|
|
<view class="record-info"> |
|
@ -43,7 +67,10 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="record-right"> |
|
|
<view class="record-right"> |
|
|
<view class="record-points" :class="item.fromType === 'in' ? 'income' : 'expense'"> |
|
|
<view |
|
|
|
|
|
class="record-points" |
|
|
|
|
|
:class="item.fromType === 'in' ? 'income' : 'expense'" |
|
|
|
|
|
> |
|
|
{{ item.points }} |
|
|
{{ item.points }} |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
@ -64,9 +91,11 @@ |
|
|
|
|
|
|
|
|
<!-- 空状态 --> |
|
|
<!-- 空状态 --> |
|
|
<view class="empty-state" v-if="pointsList.length === 0 && !loading"> |
|
|
<view class="empty-state" v-if="pointsList.length === 0 && !loading"> |
|
|
<image class="empty-icon" |
|
|
<image |
|
|
|
|
|
class="empty-icon" |
|
|
src="https://epic.js-dyyj.com/uploads/20250808/c16267f9cc2b7a68bf23713b5847987e.png" |
|
|
src="https://epic.js-dyyj.com/uploads/20250808/c16267f9cc2b7a68bf23713b5847987e.png" |
|
|
mode="aspectFit"></image> |
|
|
mode="aspectFit" |
|
|
|
|
|
></image> |
|
|
<text class="empty-text">暂无积分记录</text> |
|
|
<text class="empty-text">暂无积分记录</text> |
|
|
</view> |
|
|
</view> |
|
|
</scroll-view> |
|
|
</scroll-view> |
|
@ -84,21 +113,29 @@ |
|
|
<view class="modal-content"> |
|
|
<view class="modal-content"> |
|
|
<view class="current-reward"> |
|
|
<view class="current-reward"> |
|
|
<text class="reward-label">当前时间奖励值:</text> |
|
|
<text class="reward-label">当前时间奖励值:</text> |
|
|
<text class="reward-value">{{ userInfo&&userInfo.hourValue||0 }}</text> |
|
|
<text class="reward-value">{{ |
|
|
|
|
|
(userInfo && userInfo.hourValue) || 0 |
|
|
|
|
|
}}</text> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="exchange-form"> |
|
|
<view class="exchange-form"> |
|
|
<view class="form-item"> |
|
|
<view class="form-item"> |
|
|
<text class="form-label">兑换数量:</text> |
|
|
<text class="form-label">兑换数量:</text> |
|
|
<input class="form-input" v-model="exchangeAmount" type="number" placeholder="请输入兑换数量" /> |
|
|
<input |
|
|
|
|
|
class="form-input" |
|
|
|
|
|
v-model="exchangeAmount" |
|
|
|
|
|
type="number" |
|
|
|
|
|
placeholder="请输入兑换数量" |
|
|
|
|
|
/> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="exchange-rules"> |
|
|
<view class="exchange-rules"> |
|
|
<text class="rules-title">兑换规则:</text> |
|
|
<text class="rules-title">兑换规则:</text> |
|
|
<view class="rules-list"> |
|
|
<view class="rules-list"> |
|
|
<text class="rule-item">• 1个时间奖励值 = {{pointInfo.points||0}}积分</text> |
|
|
<text class="rule-item" |
|
|
|
|
|
>• 1个时间奖励值 = {{ pointInfo.points || 0 }}积分</text |
|
|
|
|
|
> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
@ -126,14 +163,12 @@ |
|
|
refreshing: false, |
|
|
refreshing: false, |
|
|
userInfo: null, |
|
|
userInfo: null, |
|
|
timeReward: 0, |
|
|
timeReward: 0, |
|
|
exchangeAmount: '', |
|
|
exchangeAmount: "", |
|
|
exchangeResult: 0, |
|
|
exchangeResult: 0, |
|
|
pointInfo: null |
|
|
pointInfo: null, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onLoad() { |
|
|
onLoad() { |
|
|
this.getUserInfo(); |
|
|
this.getUserInfo(); |
|
|
this.loadPointsData(); |
|
|
this.loadPointsData(); |
|
@ -142,12 +177,12 @@ |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
getUserInfo() { |
|
|
getUserInfo() { |
|
|
|
|
|
|
|
|
this.Post({}, "/framework/user/getInfo", "DES").then((res) => { |
|
|
this.Post({}, "/framework/user/getInfo", "DES").then((res) => { |
|
|
this.userInfo = |
|
|
this.userInfo = |
|
|
(uni.getStorageSync("userInfo") && |
|
|
(uni.getStorageSync("userInfo") && |
|
|
JSON.parse(uni.getStorageSync("userInfo"))) || |
|
|
JSON.parse(uni.getStorageSync("userInfo"))) || |
|
|
this.$store.state.user.userInfo || {}; |
|
|
this.$store.state.user.userInfo || |
|
|
|
|
|
{}; |
|
|
res.data.token = this.userInfo.token; |
|
|
res.data.token = this.userInfo.token; |
|
|
uni.setStorageSync("userInfo", JSON.stringify(res.data)); |
|
|
uni.setStorageSync("userInfo", JSON.stringify(res.data)); |
|
|
this.userInfo = res.data; |
|
|
this.userInfo = res.data; |
|
@ -176,13 +211,12 @@ |
|
|
// 获取总积分 |
|
|
// 获取总积分 |
|
|
async getTotalPoints() { |
|
|
async getTotalPoints() { |
|
|
try { |
|
|
try { |
|
|
this.Post({}, '/framework/points/getLastBalance', 'DES').then(res => { |
|
|
this.Post({}, "/framework/points/getLastBalance", "DES").then((res) => { |
|
|
if (res.code === 200) { |
|
|
if (res.code === 200) { |
|
|
this.pointInfo = res.data |
|
|
this.pointInfo = res.data; |
|
|
this.totalPoints = res.data.balance || 0; |
|
|
this.totalPoints = res.data.balance || 0; |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error("获取总积分失败:", error); |
|
|
console.error("获取总积分失败:", error); |
|
|
} |
|
|
} |
|
@ -204,9 +238,8 @@ |
|
|
params.fromType = this.currentTab; |
|
|
params.fromType = this.currentTab; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.Post(params, '/framework/points/list', 'DES') |
|
|
this.Post(params, "/framework/points/list", "DES").then((res) => { |
|
|
.then(res => { |
|
|
console.log(res); |
|
|
console.log(res) |
|
|
|
|
|
if (res.code === 200) { |
|
|
if (res.code === 200) { |
|
|
const newData = res.rows || []; |
|
|
const newData = res.rows || []; |
|
|
|
|
|
|
|
@ -227,9 +260,7 @@ |
|
|
icon: "none", |
|
|
icon: "none", |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error("加载积分记录失败:", error); |
|
|
console.error("加载积分记录失败:", error); |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
@ -257,10 +288,6 @@ |
|
|
this.getTotalPoints(); |
|
|
this.getTotalPoints(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 显示兑换弹窗 |
|
|
// 显示兑换弹窗 |
|
|
showExchangeModal() { |
|
|
showExchangeModal() { |
|
|
this.$refs.exchangePopup.open(); |
|
|
this.$refs.exchangePopup.open(); |
|
@ -269,27 +296,27 @@ |
|
|
// 关闭兑换弹窗 |
|
|
// 关闭兑换弹窗 |
|
|
closeExchangeModal() { |
|
|
closeExchangeModal() { |
|
|
this.$refs.exchangePopup.close(); |
|
|
this.$refs.exchangePopup.close(); |
|
|
this.exchangeAmount = ''; |
|
|
this.exchangeAmount = ""; |
|
|
this.exchangeResult = 0; |
|
|
this.exchangeResult = 0; |
|
|
}, |
|
|
}, |
|
|
async confirmExchange() { |
|
|
async confirmExchange() { |
|
|
if (parseInt(this.exchangeAmount) > this.userInfo.hourValue) { |
|
|
if (parseInt(this.exchangeAmount) > this.userInfo.hourValue) { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: '兑换值大于可用值', |
|
|
title: "兑换值大于可用值", |
|
|
icon: 'none' |
|
|
icon: "none", |
|
|
}) |
|
|
}); |
|
|
return |
|
|
return; |
|
|
} |
|
|
} |
|
|
try { |
|
|
try { |
|
|
const params = { |
|
|
const params = { |
|
|
hour: parseInt(this.exchangeAmount), |
|
|
hour: parseInt(this.exchangeAmount), |
|
|
method: 'post' |
|
|
method: "post", |
|
|
}; |
|
|
}; |
|
|
this.Post(params, '/framework/points/hourChange', 'DES').then(res => { |
|
|
this.Post(params, "/framework/points/hourChange", "DES").then((res) => { |
|
|
if (res.code === 200) { |
|
|
if (res.code === 200) { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: '兑换成功', |
|
|
title: "兑换成功", |
|
|
icon: 'success' |
|
|
icon: "success", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 刷新数据 |
|
|
// 刷新数据 |
|
@ -300,16 +327,16 @@ |
|
|
this.closeExchangeModal(); |
|
|
this.closeExchangeModal(); |
|
|
} else { |
|
|
} else { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: res.msg || '兑换失败', |
|
|
title: res.msg || "兑换失败", |
|
|
icon: 'none' |
|
|
icon: "none", |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('兑换失败:', error); |
|
|
console.error("兑换失败:", error); |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: '网络错误,请重试', |
|
|
title: "网络错误,请重试", |
|
|
icon: 'none' |
|
|
icon: "none", |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|