余额相关更新

This commit is contained in:
GaoHao 2024-12-05 17:21:14 +08:00
parent 30ceee0f2b
commit 400126ffeb
6 changed files with 480 additions and 5 deletions

View File

@ -55,6 +55,8 @@ const install = (Vue, vm) => {
let moneyDet = (params = {}) => vm.$u.get('app/cash/queryUserMoneyDetails', params); //钱包明细
let type = (params = {}) => vm.$u.get('app/common/type', params); //钱包明细
let myPurseDet = (params = {}) => vm.$u.get('app/moneyDetails/queryUserMoneyDetails', params); //我的钱包
let myPurse = (params = {}) => vm.$u.get('app/moneyDetails/selectUserMoney', params); //钱包明细
let help = (params = {}) => vm.$u.get('app/helpWord/selectHelpList', params); //帮助中心
let helpDet = (params = {}) => vm.$u.get('app/helpWord/selectHelpWordDetails', params); //帮助中心 详情

191
me/balance/duihuan.vue Normal file
View File

@ -0,0 +1,191 @@
<template>
<view>
<view class="jf flex align-center justify-between">
<view class="jf-l">
<view class="jf-l-t">
当前积分
</view>
<view class="jf-l-b">
{{num}}
</view>
</view>
<view class="jf-r">
<view class="jf-r-t">
兑换说明
</view>
<view class="jf-r-b">
{{bili}}:1兑换最少{{bili}}积分
</view>
</view>
</view>
<view class="listTitle flex align-center">
<u-icon name="order" color="#2e2f33" size="50"></u-icon>
<text>
兑换数量
</text>
</view>
<view class="list">
<view class="list-input">
<u-input v-model="value" placeholder="请输入兑换数量" type="number" :border="true" />
</view>
<view class="list-btn">
<view @click="userIntegral()" class="list-btn-s flex align-center justify-center">
提交兑换
</view>
</view>
</view>
</view>
</template>
<script>
import empty from '../../components/empty.vue'
export default {
components: {
empty
},
data() {
return {
num: 0,
value: '',
bili: 0,
};
},
onShow() {
this.getNum()
this.getBili()
},
methods: {
//
userIntegral() {
if (!this.value) {
uni.showToast({
title: '请输入兑换的积分数量',
icon: 'none'
})
return
}
if (Number(this.value) < Number(this.bili)) {
uni.showToast({
title: '兑换的积分数量不能小于' + this.bili + '积分',
icon: 'none'
})
return
}
let data = {
integral: this.value
}
this.$Request.postT('/app/integral/creditsExchange', data).then(res => {
if (res.code == 0) {
uni.showToast({
title: '积分兑换成功'
})
this.getNum()
this.value = ''
setTimeout(() => {
uni.navigateBack()
}, 1500)
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
},
//
getBili() {
this.$u.get('/app/common/type/104').then(res => { // 104
if (res.code == 0 && res.data) {
this.bili = res.data.value
}
});
},
//
getNum() {
this.$Request.getT('/app/integral/selectByUserId').then(res => {
uni.stopPullDownRefresh()
if (res.code == 0) {
this.num = res.data.integralNum
} else {
this.num = 0
}
})
},
}
}
</script>
<style lang="scss">
page {
background-color: #ffffff;
}
.jf {
width: 100%;
height: 252rpx;
background: linear-gradient(90deg, rgba(255, 117, 129, 0.6) 0%, #ff7581 100%);
padding: 0 40rpx;
.jf-l-t {
color: #ffffff;
font-size: 28rpx;
}
.jf-l-b {
font-size: 40rpx;
color: #ffffff;
font-weight: 600;
margin-top: 30rpx;
}
.jf-r {
color: #ffffff;
font-size: 28rpx;
.jf-r-b {
margin-top: 20rpx;
}
}
}
.listTitle {
width: 100%;
height: 110rpx;
margin-top: -40rpx;
background-color: #ffffff;
border-radius: 30rpx 30rpx 0 0;
padding-left: 20rpx;
text {
color: #2e2f33;
font-size: 32rpx;
font-weight: bold;
margin-left: 20rpx;
padding-top: 8rpx;
}
}
.list {
width: 100%;
.list-input {
padding: 20rpx;
}
.list-btn {
padding: 40rpx;
}
.list-btn-s {
width: 100%;
height: 88rpx;
color: #ffffff;
background-color: #ff7581;
border-radius: 8rpx;
}
}
</style>

265
me/balance/index.vue Normal file
View File

@ -0,0 +1,265 @@
<template>
<view>
<view class="jf flex align-center justify-between">
<view class="jf-l">
<view class="jf-l-t">
当前余额
</view>
<view class="jf-l-b">
{{amount || '0.00'}}
</view>
</view>
<view class="jf-r" @click="withdraw()">
提现
</view>
</view>
<view class="listTitle flex align-center">
<u-icon name="order" color="#2e2f33" size="50"></u-icon>
<text>
余额明细
</text>
</view>
<view class="list">
<scroll-view @scrolltolower="scrolltolower" :refresher-enabled="refresherTriggered"
@scrolltoupper="scrolltoupper" scroll-y="true"
style="width: 100%;height: 100%;background-color: #ffffff;padding-bottom: 30rpx;">
<view class="list-item flex align-center justify-center" v-for="(item,index) in list" :key="index">
<view class="list-item-box flex align-center justify-between">
<view class="list-item-box-l">
<view class="list-item-box-l-t">
{{item.content}}
</view>
<view class="list-item-box-l-b">
{{item.createTime}}
</view>
</view>
<view class="list-item-box-r" v-if="item.type == 1">
+{{item.num}}
</view>
<view class="list-item-box-r" v-else>
-{{item.num}}
</view>
</view>
</view>
<view class="" style="width: 100%;height: 30rpx;" v-if="list.length>0"></view>
<u-loadmore v-if="list.length>0" :status="status" />
<empty :isShow="true" title="暂无明细" v-if="list.length == 0" />
</scroll-view>
</view>
</view>
</template>
<script>
import empty from '../../components/empty.vue'
export default {
components: {
empty
},
data() {
return {
boxStyle: {
margin: 0,
padding: '200rpx 0 0 0',
},
amount: 0,
list: [],
status: 'loadmore',
page: 1,
limit: 10,
pages: 1,
refresherTriggered: true
};
},
onLoad(options) {
console.log(options)
if ( options && options.amount) {
this.amount = options.amount
}
},
onShow() {
this.getAmount()
this.getList()
},
onPullDownRefresh() {
this.getAmount()
},
methods: {
/**
* 获取当前钱包信息
*/
getAmount() {
this.$Request.getT('app/moneyDetails/selectUserMoney').then(res => {
uni.stopPullDownRefresh()
if (res.code == 0) {
this.amount = res.data.amount || 0
} else {
this.amount = '0.00'
}
})
},
withdraw() {
let params = {
amount: this.amount
}
this.$Request.getT('app/cash/withdraw', params).then(res => {
console.log(res)
if (res.code == 0) {
// this.amount = res.data.amount
} else {
// this.amount = '0.00'
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
},
/**
* 获取余额明细
*/
getList() {
let data = {
page: this.page,
limit: this.limit
}
this.$Request.getT('app/moneyDetails/queryUserMoneyDetails', data).then(res => {
setTimeout(() => {
this.refresherTriggered = false
}, 1500)
if (res.code == 0) {
this.pages = res.data.pages
if (this.page < this.pages) {
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
if (this.page == 1) {
this.list = res.data.records
} else {
this.list = [...this.list, ...res.data.records]
}
}
})
},
goNav(url) {
uni.navigateTo({
url: url
})
},
//
scrolltoupper() {
this.page = 1
this.refresherTriggered = true
this.getList()
},
//
scrolltolower() {
if (this.page < this.pages) {
this.status = 'loading'
this.page += 1
this.getList()
} else {
this.status = 'nomore'
}
},
}
}
</script>
<style lang="scss">
page {
background-color: #ffffff;
}
.jf {
width: 100%;
height: 252rpx;
background: linear-gradient(90deg, rgba(255, 117, 129, 0.6) 0%, #ff7581 100%);
padding: 0 40rpx;
.jf-l-t {
color: #ffffff;
font-size: 28rpx;
}
.jf-l-b {
font-size: 40rpx;
color: #ffffff;
font-weight: 600;
margin-top: 30rpx;
}
.jf-r {
padding: 20rpx 40rpx;
border-radius: 40rpx;
color: #ff7581;
background-color: #ffffff;
font-size: 28rpx;
font-weight: 500;
}
}
.listTitle {
width: 100%;
height: 110rpx;
margin-top: -40rpx;
background-color: #ffffff;
border-radius: 30rpx 30rpx 0 0;
border-bottom: 1px solid hsla(0, 0%, 90.2%, .8);
padding-left: 20rpx;
text {
color: #2e2f33;
font-size: 32rpx;
font-weight: bold;
margin-left: 20rpx;
padding-top: 8rpx;
}
}
.list {
width: 100%;
/* #ifdef H5 */
height: calc(100vh - 252rpx - 70rpx - 88rpx);
/* #endif */
/* #ifndef H5 */
height: calc(100vh - 252rpx - 70rpx);
/* #endif */
background-color: #ffffff;
.list-item {
width: 100%;
}
.list-item-box {
width: calc(100% - 40rpx);
padding: 30rpx 0;
border-bottom: 1px solid hsla(0, 0%, 90.2%, .8);
.list-item-box-l-t {
color: #2e2f33;
font-size: 28rpx;
}
.list-item-box-l-b {
font-size: 24rpx;
color: #aeb2c1;
margin-top: 30rpx;
}
.list-item-box-r {
color: #2e2f33;
font-weight: 600;
font-size: 36rpx;
}
}
}
</style>

View File

@ -237,6 +237,11 @@
"navigationBarTitleText": "意见反馈",
"navigationBarBackgroundColor": "#FFFFFF"
}
},{
"path": "balance/index",
"style": {
"navigationBarTitleText": "我的余额"
}
}, {
"path": "feedbackIndex/feedbackIndex",
"style": {

View File

@ -1,6 +1,6 @@
<template>
<view style="padding-bottom: 100rpx;">
<view class="title flex align-center justify-center">
<!-- <view class="title flex align-center justify-center">
<view class="title-box">
<view class="title-box-title flex align-center justify-between">
<view class="title-box-title-l">
@ -45,7 +45,7 @@
</view>
</view>
</view>
</view>
</view> -->
<view v-if="list.length>0" class="itemTitle flex align-center justify-center">
<view class="itemTitle-box flex align-center justify-between">
<view class="itemTitle-box-l">

View File

@ -45,13 +45,21 @@
我的追剧
</view>
</view>
<view class="statistics-box-item" @click="goNav('/me/jifen/jifen')">
<!-- <view class="statistics-box-item" @click="goNav('/me/jifen/jifen')">
<view class="statistics-box-item-top">
{{jifen}}
</view>
<view class="statistics-box-item-btn">
我的积分
</view>
</view> -->
<view class="statistics-box-item" @click="goNav('/me/balance/index',{amount: userInfo.amount})">
<view class="statistics-box-item-top">
{{userInfo.amount || '0.00'}}
</view>
<view class="statistics-box-item-btn">
我的余额
</view>
</view>
</view>
</view>
@ -270,6 +278,7 @@
rate: 0,
kmPaySel: '否',
isWxIosPay: true, //
userInfo: null,
}
},
onLoad() {
@ -447,6 +456,7 @@
this.$Request.getT('/app/moneyDetails/selectUserMoney').then(res => {
if (res.code == 0) {
this.moneyNum = res.data.money
this.userInfo = res.data
// this.$Request.getT('/app/invite/selectInviteMoney').then(ret => {
// if (ret.code == 0) {
// if (ret.data.inviteMoney && ret.data.inviteMoney.money) {
@ -535,10 +545,12 @@
// #endif
}
},
goNav(e) {
console.log(e)
goNav(e,options) {
let token = uni.getStorageSync('token')
if (token) {
if (options&&options.amount) {
e = `${e}?amount=${options.amount}`
}
uni.navigateTo({
url: e
})