You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

395 lines
8.7 KiB

<template>
<view style="background: #F5F5F5;">
<!-- <view class="bg" style="margin: 12upx;border-radius: 16upx;position: absolute;width: 96%;height: 380upx"></view> -->
<view style="color: #FFFFFF;position: relative;width: 100%;height: 200upx;display: block;">
<view class="user-box">
<view class="user-info-box">
<view class="avatar" @tap="checkLogin()">
<image :src="avatar"></image>
</view>
<view class="user-info">
<view class="nick-wrap">
<text class="nick">{{ nickName }}</text>
</view>
<text class="code" v-if="zhifubao === ''">支付宝未实名</text>
</view>
<view class="user-info">
<view class="nick-wrap" style="widh:100%;text-align: right;display: block">
<view class="nick">{{total}}</view>
</view>
<text class="code"
style="widh:100%;text-align: right;display: block;line-height: 50upx;">可用积分</text>
</view>
</view>
</view>
</view>
<view style="padding: 32upx;background: #fff;border-radius: 30upx 30upx 0 0;">
<view>兑换金额</view>
<view class="main"
style="position: relative;padding: 20upx 0;border-bottom: 1px solid #ccc;align-items: center;">
<view style="position: absolute;font-weight: 600;font-size: 30upx;">¥</view>
<input style="margin-left: 40upx;width: 60%;position: absolute;" v-model="jifen" type="number"
maxlength="11" placeholder="请输入要兑换的积分" />
<view style="margin-left: 65%;text-align: right;" @click="dhBtn">全部兑换</view>
</view>
<button style="background: #FF4701;color: #FFFFFF;border-radius: 16rpx;margin-top: 47rpx;"
@click="duihuan">立即兑换</button>
<view class="duihuan_title">积分兑换规则</view>
<view style="margin-top: 30upx;font-size: 26upx;color: #999;">1.{{bili}}积分=1元,最低可提现积分为{{zuidi}}积分</view>
<view style="margin-top: 30upx;font-size: 26upx;color: #999;">2.申请兑换后3-7个工作日内到账</view>
<view style="margin-top: 30upx;font-size: 26upx;color: #999;">3.仅支持整数兑换,兑换手续费{{shouxufei * 100}}%</view>
</view>
<view class="footer">
<view class="bottom_view" @click="goDetail">
<image src="../../static/img/my/bangding.png"></image>
<view class="text">兑换记录</view>
</view>
<view class="payinfo" style="font-size: 50upx;color: #e6e6e6;width: 2%;">|</view>
<view class="bottom_view" @click="duihuanjilu">
<image src="../../static/img/my/duihuan.png"></image>
<view class="text">积分明细</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
contents: [],
modalName: '',
fen: 0,
zuidi:0,
jifen: '',
isRotate: false, //是否加载旋转
isLogin: false,
page: 1,
bili: 100,
shouxufei: 0.01,
percent: 0,
total: 0,
isStudent: 1,
sex: 0,
avatar: '',
nickName: '',
zhifubao: ''
};
},
onLoad() {
let avatar = this.$queue.getData('avatar');
if (avatar && avatar !== 'undefined') {
this.avatar = avatar;
} else {
this.avatar = '/static/img/logo.jpg';
}
let nickName = this.$queue.getData('nickName');
if (nickName && nickName !== 'undefined') {
this.nickName = nickName;
} else {
this.nickName = '';
}
this.$Request.getT('/common/type/87').then(res => {
if (res.code == 0) {
if (res.data && res.data.value) {
this.zuidi = res.data.value;
}
}
})
this.$Request.getT('/common/type/116').then(res => {
if (res.code == 0) {
if (res.data && res.data.value) {
this.bili = res.data.value;
}
}
})
this.$Request.getT('/common/type/114').then(res => {
if (res.code == 0) {
if (res.data && res.data.value) {
this.shouxufei = res.data.value;
}
}
})
this.$Request.getT('/common/type/102').then(res => {
if (res.code == 0) {
if (res.data && res.data.value) {
this.fen = res.data.value;
}
}
})
},
onShow() {
let userId = this.$queue.getData('userId');
if (userId) {
this.getUserInfodetail(userId);
this.getUserInfointegral(userId);
}
},
methods: {
getUserInfodetail(userId) {
this.$Request.postT("/app/selectUserById?userId=" + userId).then(res => {
if (res.code === 0) {
this.zhifubao = res.data.zhifubao;
}
uni.hideLoading();
});
},
//获取用户积分信息
getUserInfointegral(userId) {
this.$Request.getT('/userMoney/selectUserMoney?userId=' + userId).then(res => {
if (res.code === 0) {
this.total = res.data.money;
}
});
},
duihuan() {
if (!this.jifen) {
this.$queue.showToast('请输入要兑换的积分');
} else if (this.jifen > this.total) {
uni.showModal({
title: '积分提醒',
content: '积分不足,当前可用积分为' + this.total + '!',
showCancel: false
});
} else if (this.jifen < this.zuidi) {
this.$queue.showToast('最低可兑换积分为' + this.zuidi);
} else if (this.zhifubao) {
let userId = this.$queue.getData('userId');
this.$Request.postT('/userMoney/cashMoney?userId=' + userId + '&money=' + this.jifen).then(res => {
if (res.code === 0) {
this.getUserInfointegral(userId)
uni.showModal({
title: '积分提醒',
content: '兑换成功!',
showCancel: false
});
} else {
this.$queue.showToast(res.msg);
}
});
} else {
this.bangding();
}
},
duihuanjilu() {
uni.navigateTo({
url: '/pages/member/jifen'
});
},
goBack() {
uni.navigateBack({});
},
getToatal(userId) {
this.$Request.postT('/user/getUserJifenList/' + userId).then(res => {
if (res.status === 0) {
this.contents = res.data;
} else {
this.contents = [];
}
});
},
// 全部兑换
dhBtn() {
this.jifen = this.total
},
// 绑定支付宝
bangding() {
uni.navigateTo({
url: '/pages/member/zhifubao'
});
},
goDetail() {
uni.navigateTo({
url: '/pages/member/cashList'
});
}
}
};
</script>
<style lang="scss" scoped>
.duihuan_title {
font-size: 34upx;
color: #333;
margin-top: 47rpx;
font-weight: 600;
}
.news_content {
display: flex;
text-align: left;
padding: 8px 16px 8px 16px;
background: #ffffff;
margin-top: 1px;
}
.news_content_text {
margin-top: 8px;
width: 200px;
overflow: hidden;
font-size: 16px;
white-space: nowrap;
text-overflow: ellipsis;
}
/* */
.user-box {
width: 100%;
height: 200upx;
/* position: absolute; */
z-index: 15;
padding: 30upx 30upx 0;
display: flex;
align-items: center;
}
.user-info-box {
flex: 1;
height: 100%;
display: flex;
align-items: center;
}
.info-icon {
width: 46upx;
height: 48upx;
image {
width: 100%;
height: 100%;
display: block;
}
}
.avatar {
width: 110upx;
height: 110upx;
border-radius: 50%;
overflow: hidden;
image {
width: 100%;
height: 100%;
display: block;
}
}
.noLogin {
display: flex;
display: flex;
flex-direction: column;
margin-left: 20upx;
font-size: 40upx;
font-weight: 800;
color: #FEFEFE;
}
.user-info {
display: flex;
display: flex;
flex-direction: column;
margin-left: 20upx;
width: 260upx;
}
.nick-wrap {
display: flex;
align-items: center;
height: 45upx;
}
.nick {
font-size: 38upx;
height: 38upx;
line-height: 38upx;
font-weight: 800;
color: #333;
}
.nick_image {
width: 38upx;
height: 38upx;
margin-left: 20upx;
}
.activation {
width: 100upx;
height: 38upx;
line-height: 38upx;
text-align: center;
background: #FFFFFF;
border-radius: 19upx;
margin-left: 20upx;
font-size: 24upx;
font-weight: bold;
color: #FF332F;
}
.code {
display: flex;
align-items: center;
height: 45upx;
font-size: 24upx;
font-family: PingFang SC;
font-weight: 500;
color: #999;
}
.bottom_view {
display: flex;
text-align: center;
width: 49%;
justify-content: center;
align-items: center;
image {
width: 43rpx;
height: 43rpx;
}
.text {
margin-left: 15rpx
}
}
/* 底部按钮 */
// 底部按钮
.footer {
width: 100%;
height: calc(98upx + env(safe-area-inset-bottom));
height: calc(98upx + constant(safe-area-inset-bottom));
padding-bottom: env(safe-area-inset-bottom);
/*兼容IOS>11.2*/
padding-bottom: constant(safe-area-inset-bottom);
/*兼容IOS<11.2*/
background: #FFFFFF;
position: fixed;
bottom: 0;
padding: 0 30upx;
z-index: 10;
display: flex;
align-items: center;
justify-content: space-between;
}
.payinfo {
display: flex;
width: 48%;
color: #333333;
font-size: 28rpx;
text-align: center;
align-items: center;
}
.payinfo image {
width: 32upx;
position: absolute;
left: 20%;
}
</style>