question_uniapp/pages/mine/upgrade.vue

211 lines
6.5 KiB
Vue
Raw Normal View History

2025-06-06 03:08:19 +08:00
<template>
<view class="minebg">
2025-06-10 02:14:24 +08:00
<uni-nav-bar @clickLeft="goto(1, 1)" left-icon="back" :border="false" :shadow="false" :fixed="true"
:title="$t('upgrade.title')" backgroundColor="rgba(0,0,0,0,1)"></uni-nav-bar>
2025-06-06 03:08:19 +08:00
<view style="font-size: 56rpx; color: #333; font-weight: 700; width: 80%;margin: 30rpx auto; text-align: center;">
2025-06-08 02:12:24 +08:00
{{$t('upgrade.text1')}}
2025-06-06 03:08:19 +08:00
</view>
<view class="v4">
<uni-row :gutter="10">
<uni-col :span="24">
2025-06-10 02:14:24 +08:00
<view class="wallet" style="padding: 20rpx ;">
2025-06-06 03:08:19 +08:00
<image class="i" src="/static/images/u4.png" mode="cover"></image>
2025-06-08 02:12:24 +08:00
<span class="s">{{$t('upgrade.text2')}}</span>
2025-06-06 03:08:19 +08:00
<view style="clear: both;"></view>
</view>
</uni-col>
<uni-col :span="24">
2025-06-10 02:14:24 +08:00
<view class="wallet" style="padding: 20rpx;">
2025-06-06 03:08:19 +08:00
<image class="i" src="/static/images/u4.png" mode="cover"></image>
2025-06-08 02:12:24 +08:00
<view class="s" style="line-height: 50rpx; width: 90%;">{{$t('upgrade.text3')}}</view>
2025-06-06 03:08:19 +08:00
<view style="clear: both;"></view>
</view>
</uni-col>
<uni-col :span="24">
2025-06-10 02:14:24 +08:00
<view class="wallet" style="padding: 20rpx;">
2025-06-06 03:08:19 +08:00
<image class="i" src="/static/images/u4.png" mode="cover"></image>
2025-06-08 02:12:24 +08:00
<span class="s">{{$t('upgrade.text4')}}</span>
2025-06-06 03:08:19 +08:00
<view style="clear: both;"></view>
</view>
</uni-col>
<uni-col :span="24">
2025-06-10 02:14:24 +08:00
<view class="wallet" style="padding: 20rpx;">
2025-06-06 03:08:19 +08:00
<image class="i" src="/static/images/u4.png" mode="cover"></image>
2025-06-08 02:12:24 +08:00
<span class="s">{{$t('upgrade.text5')}}</span>
2025-06-06 03:08:19 +08:00
<view style="clear: both;"></view>
</view>
</uni-col>
<uni-col :span="24" v-for="item in list" :key='item.id'>
<view :class="role_id==item.id?'u u1':'u'" @click="role_id=item.id">
<uni-row>
<uni-col :span="5">
<image v-if="item.id==2" style="width: 80rpx; height: 80rpx;" src="/static/images/u3.png" mode="cover"></image>
<image v-if="item.id==3" style="width: 80rpx; height: 80rpx;" src="/static/images/u1.png" mode="cover"></image>
</uni-col>
<uni-col :span="12">
2025-06-10 02:14:24 +08:00
<view v-if="item.id==2" style="font-weight: 600;font-size: 30rpx;color: #3D3D3D;line-height: 80rpx;">upgrade VIP</view>
<view v-if="item.id==3" style="font-weight: 600;font-size: 30rpx;color: #3D3D3D;line-height: 40rpx;">upgrade <br>channel partner</view>
2025-06-06 03:08:19 +08:00
</uni-col>
<uni-col :span="7">
<view style="font-weight: 600;font-size: 36rpx;color: #3D3D3D;line-height: 80rpx;">{{item.price}} USDT</view>
</uni-col>
</uni-row>
</view>
</uni-col>
</uni-row>
<view style="font-weight: 400; font-size: 30rpx; color: #3d3d3d; text-align: right; padding: 40rpx;">
2025-06-08 02:12:24 +08:00
{{$t('upgrade.text6')}}: <span style="color: #1D61E7;">{{parseFloat(user.money).toFixed(4)}}</span> USDT
2025-06-06 03:08:19 +08:00
</view>
2025-06-08 02:12:24 +08:00
<button style="background-color: #333333; color: #fff;" @click="open">{{$t('upgrade.text7')}}</button>
2025-06-06 03:08:19 +08:00
</view>
<uni-popup ref="popup" type="dialog" :is-mask-click="true" background-color="#fff" borderRadius="40rpx">
<view style="width: 80vw; padding: 20rpx 30rpx; border-radius: 40rpx; line-height: 50rpx;">
2025-06-08 02:12:24 +08:00
<view style="font-size: 36rpx; font-weight: bold; text-align: center; margin-bottom: 30rpx;">{{$t('signup.text6')}}</view>
<uni-easyinput type="password" :passwordIcon="true" v-model="pingcode" :placeholder="$t('signup.text7')" />
<button style="background-color: #1D61E7; color: #fff; margin: 40rpx auto;" @click="submit">{{$t('buttonConfirm')}}</button>
2025-06-06 03:08:19 +08:00
</view>
</uni-popup>
</view>
</template>
<script>
import {
mapState,
mapMutations
} from 'vuex';
2025-06-10 02:14:24 +08:00
import { getUserInfo } from '@/config/utils';
2025-06-06 03:08:19 +08:00
export default {
data() {
return {
user:{},
list:[],
pingcode: '',
role_id: 3,
}
},
computed: {
...mapState(['userInfo'])
},
//第一次加载
onLoad(e) {
2025-06-10 02:14:24 +08:00
getUserInfo(this.$i18n.locale).then(res => {
this.user = res;
2025-06-06 03:08:19 +08:00
});
this.$http.get('/api/role/list?lang='+this.$i18n.locale).then(res => {
if(res.code == 0){
this.list = res.data.data;
}
});
},
onShow(){
},
methods: {
...mapMutations(['setUserInfo']),
open(){
2025-06-10 02:14:24 +08:00
let roleMoney = 0;
this.list.forEach(item => {
if(item.id == this.role_id){
roleMoney = item.price;
}
})
if(this.user.role_id > this.role_id){
uni.showToast({
title:this.$t('upgrade.text9'),
icon:'error'
});
return
}
if(parseFloat(this.user.money) < roleMoney){
2025-06-06 03:08:19 +08:00
uni.showToast({
2025-06-08 02:12:24 +08:00
title:this.$t('upgrade.text8'),
2025-06-06 03:08:19 +08:00
icon:'error'
});
return
}
this.$refs.popup.open('dialog');
},
2025-06-10 02:14:24 +08:00
goto(url, type) {
if (type == 2) {
return uni.switchTab({ url: url })
}
if (type == 1) {
return uni.navigateBack({ delta: url });
}
uni.navigateTo({
url: url
})
},
2025-06-06 03:08:19 +08:00
submit(){
let data = {
role_id: this.role_id,
trade_password: this.pingcode,
lang: this.$i18n.locale
};
this.$http.post('/api/role/buy', data).then(res => {
if(res.code == 0){
uni.showToast({
title:'Success'
});
2025-06-10 02:14:24 +08:00
this.$refs.popup.close();
this.pingcode = '';
this.user.role_id = this.role_id;
this.setUserInfo(this.user);
2025-06-06 03:08:19 +08:00
setTimeout(() => {
uni.switchTab({
url: '/pages/mine/index'
});
2025-06-10 02:14:24 +08:00
}, 1000);
2025-06-06 03:08:19 +08:00
}
});
},
onTokenJump(url) {
this.judgeLogin(() => {
uni.navigateTo({
url: url
});
});
},
}
}
</script>
<style scoped>
.uni-page-body{background-color: #fff !important;}
.page{min-height: 93vh;position: relative; background-color: #fff;}
.minebg{
width: 100vw;
min-height: 93vh;
background: url('/static/images/u2.png') #fff;
background-size: 100%;
background-repeat: repeat-x;
font-family: Poppins, Poppins;
}
.minebg .v4{
width: 94vw;margin: 20upx auto; border-radius: 30upx;
}
.minebg .v4 .wallet{
2025-06-10 02:14:24 +08:00
border-radius: 20rpx; padding: 20rpx 30rpx;
2025-06-06 03:08:19 +08:00
}
.minebg .v4 .wallet .title{
2025-06-10 02:14:24 +08:00
font-weight: 500; font-size: 28rpx; color: #999999; line-height: 36rpx;
2025-06-06 03:08:19 +08:00
}
.minebg .v4 .wallet .s{
2025-06-10 02:14:24 +08:00
font-weight: 500;font-size: 32rpx;color: #666666;line-height: 40rpx; float: left; margin-left: 20rpx;
display: block; width: 90%;
2025-06-06 03:08:19 +08:00
}
.minebg .v4 .wallet .i{
2025-06-10 02:14:24 +08:00
width: 40rpx; height: 40rpx; float: left;
2025-06-06 03:08:19 +08:00
}
.minebg .v4 .u{
2025-06-10 02:14:24 +08:00
padding: 40rpx 20rpx; border: 2rpx solid #eee; margin: 40rpx auto 0rpx auto; width: 94%;
2025-06-06 03:08:19 +08:00
}
.minebg .v4 .u1{
background: url('/static/images/u5.png') #F5F8FC;
2025-06-10 02:14:24 +08:00
background-size: 60rpx;
2025-06-06 03:08:19 +08:00
background-repeat: no-repeat;
background-position-x: right;
background-position-y: bottom;
}
</style>