2025-06-06 03:08:19 +08:00
|
|
|
<template>
|
|
|
|
<view class="page">
|
2025-06-10 00:51:49 +08:00
|
|
|
<uni-nav-bar @clickLeft="goto(1, 1)" left-icon="back" :border="false" :shadow="false" :fixed="true"
|
|
|
|
:title="$t('recharge.title')" backgroundColor="#fff">
|
|
|
|
<template v-slot:right>
|
|
|
|
<image style="width: 40rpx; height: 40rpx;" src="/static/images/r2.png" mode="cover" @click="onTokenJump('/pages/wallet/fundrecords?id=2')"></image>
|
|
|
|
</template>
|
|
|
|
</uni-nav-bar>
|
2025-06-07 23:12:35 +08:00
|
|
|
<view class="rechargeTitle">{{$t('recharge.text1')}}</view>
|
2025-06-06 03:08:19 +08:00
|
|
|
<view class="rechargeNet" @click="onPageJump('/pages/wallet/switchnetwork')">{{rechargeModel.name}}
|
2025-06-10 00:51:49 +08:00
|
|
|
<uni-icons size="20" type="down" style="margin-left: 20rpx;"></uni-icons></view>
|
2025-06-06 03:08:19 +08:00
|
|
|
<view v-if="show==1" style="width: 80vw; margin: 40rpx auto 20rpx auto;">
|
|
|
|
<uni-forms :modelValue="rechargeModel" label-position="left">
|
2025-06-09 00:34:46 +08:00
|
|
|
<uni-forms-item :label="$t('recharge.text2')" labelWidth="280rpx">
|
2025-06-06 03:08:19 +08:00
|
|
|
<view>
|
2025-06-07 23:12:35 +08:00
|
|
|
<uni-easyinput type="number" v-model="rechargeModel.amount" :placeholder="$t('putforward.text10', {par: init.recharge_minimum})">
|
2025-06-06 03:08:19 +08:00
|
|
|
<template #right>
|
2025-06-10 00:51:49 +08:00
|
|
|
<view style="float: left; font-size: 24rpx; margin-right: 20rpx;">USDT</view>
|
2025-06-06 03:08:19 +08:00
|
|
|
</template>
|
|
|
|
</uni-easyinput>
|
|
|
|
</view>
|
|
|
|
</uni-forms-item>
|
2025-06-07 23:12:35 +08:00
|
|
|
<button type="primary" round style="width: 100%;" @click="submit">{{$t('recharge.title')}}</button>
|
2025-06-06 03:08:19 +08:00
|
|
|
</uni-forms>
|
|
|
|
</view>
|
|
|
|
<view v-if="show==2">
|
2025-06-10 00:51:49 +08:00
|
|
|
<view style="text-align: center; margin-top: 20rpx;">
|
2025-06-09 00:34:46 +08:00
|
|
|
<view v-if="show=2" style="text-align: center; width: 260rpx; margin: auto;">
|
2025-06-06 03:08:19 +08:00
|
|
|
<tki-qrcode ref="qrcode" :val="qrcode" :size="size" :unit="unit" :onval="onval" :load-make="load_make" :show-loading="show_loading" :lv="lv" :background="background" :foreground="foreground" :pdground="pdground" :icon='icon' :iconsize='iconsize' />
|
|
|
|
</view>
|
|
|
|
</view>
|
2025-06-10 00:51:49 +08:00
|
|
|
<view style="font-size: 32rpx; color: #999; text-align: center;">{{$t('recharge.text3')}} {{init.recharge_minimum}} USDT</view>
|
|
|
|
<view style="width: 92%; margin: 20rpx auto; background-color: #F8F8F8; padding: 30rpx 20rpx;">
|
2025-06-06 03:08:19 +08:00
|
|
|
<view style="width: 70%; float: left;">
|
2025-06-10 00:51:49 +08:00
|
|
|
<view style="color: #999; font-size: 28rpx;">{{$t('recharge.text4')}}</view>
|
|
|
|
<view style="width: 100%; font-size: 32rpx; color: #333; font-weight: 600; margin-top: 20rpx; white-space: pre-wrap; word-break: break-all;">{{qrcode}}</view>
|
2025-06-06 03:08:19 +08:00
|
|
|
</view>
|
|
|
|
<view>
|
2025-06-10 00:51:49 +08:00
|
|
|
<button type="primary" @click="copy(qrcode)" style="background-color: #1D61E7; margin-top: 50rpx; padding: 0rpx 40rpx; line-height: 70rpx; border-radius: 20rpx; color: #fff; float: right;">{{$t('copy')}}</button>
|
2025-06-06 03:08:19 +08:00
|
|
|
</view>
|
|
|
|
<view style="clear: both;"></view>
|
|
|
|
</view>
|
|
|
|
</view>
|
2025-06-10 00:51:49 +08:00
|
|
|
<view style="width: 92%; margin: 20rpx auto;">
|
2025-06-06 03:08:19 +08:00
|
|
|
<view class="cell_list">
|
2025-06-10 00:51:49 +08:00
|
|
|
<view style="color: #333; font-size: 36rpx; font-weight: 600;">{{$t('recharge.text5')}}</view>
|
2025-06-06 03:08:19 +08:00
|
|
|
</view>
|
2025-06-10 00:51:49 +08:00
|
|
|
<view style="color: #999; line-height: 60rpx; font-size: 32rpx; font-weight: 400; padding: 10rpx 20rpx;">
|
2025-06-07 23:12:35 +08:00
|
|
|
1. {{$t('recharge.text6')}}<br>
|
|
|
|
2. {{$t('recharge.text7')}}<br>
|
|
|
|
3. {{$t('recharge.text8')}}<br>
|
|
|
|
4. {{$t('recharge.text9')}}
|
2025-06-06 03:08:19 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import tkiQrcode from "tki-qrcode"
|
|
|
|
import {
|
|
|
|
mapState,
|
|
|
|
mapMutations
|
|
|
|
} from 'vuex';
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
tkiQrcode
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
show:1,
|
|
|
|
rechargeModel:{
|
|
|
|
name:"Tron(TRC20)",
|
|
|
|
network: 'TRC-20',
|
|
|
|
amount: '',
|
|
|
|
address:"",
|
2025-06-09 00:34:46 +08:00
|
|
|
images:""
|
2025-06-06 03:08:19 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
init: {},
|
|
|
|
qrcode: '', //二维码的内容链接
|
|
|
|
size: 260, //二维码的大小
|
|
|
|
unit: 'upx', //大小单位 !!! rpx单位有误
|
|
|
|
load_make: true, //组件加载完成后自动生成二维码
|
|
|
|
show_loading: false, //是否添加loading
|
|
|
|
onval: true, //val值变化时自动重新生成二维码
|
|
|
|
background: '#ffffff', //背景色
|
|
|
|
foreground: '#000',//点色
|
|
|
|
pdground: '#000', //角标色
|
|
|
|
icon: '', //二维码图标
|
|
|
|
iconsize: 30, //二维码图标大小
|
|
|
|
lv: 3, //二维码容错级别
|
|
|
|
loadingText: '加载中', //loading内容
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(['userInfo'])
|
|
|
|
},
|
|
|
|
//第一次加载
|
|
|
|
onLoad(e) {
|
|
|
|
this.$http.get('/api/common/init?lang='+this.$i18n.locale).then(res => {
|
|
|
|
this.init = res.data;
|
|
|
|
});
|
|
|
|
if(e.network != typeof(undefined) && e.neetwork != undefined){
|
|
|
|
if(e.network != this.rechargeModel.neetwork){
|
|
|
|
this.rechargeModel.network=e.network;
|
|
|
|
if(this.rechargeModel.network=='TRC-20'){
|
|
|
|
this.rechargeModel.name = "Tron(TRC20)";
|
|
|
|
this.rechargeModel.network = "TRC-20";
|
|
|
|
}else{
|
|
|
|
this.rechargeModel.name="BSC-BNB(BEP20)";
|
|
|
|
this.rechargeModel.network = "BEP-20";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
//页面显示
|
|
|
|
onShow() {},
|
|
|
|
//方法
|
|
|
|
methods: {
|
|
|
|
onPageJump(url) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: url.indexOf('switchnetwork') > 0 ? url + "?page=recharge&network="+this.network : url+"?page=recharge"
|
|
|
|
});
|
|
|
|
},
|
2025-06-10 00:51:49 +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
|
|
|
onTokenJump(url) {
|
|
|
|
this.judgeLogin(() => {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: url
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
submit(){
|
|
|
|
if(this.rechargeModel.amount == ''){
|
|
|
|
uni.showToast({
|
|
|
|
icon: 'error',
|
2025-06-07 23:12:35 +08:00
|
|
|
title: this.$t('recharge.text10')
|
2025-06-06 03:08:19 +08:00
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (parseFloat(this.rechargeModel.amount) < parseFloat(this.init.recharge_minimum)) {
|
|
|
|
uni.showToast({
|
|
|
|
icon: 'error',
|
2025-06-07 23:12:35 +08:00
|
|
|
title: this.$t('recharge.text11') + this.init.recharge_minimum
|
2025-06-06 03:08:19 +08:00
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let data = {
|
|
|
|
amount: this.rechargeModel.amount,
|
|
|
|
network: this.rechargeModel.network,
|
|
|
|
lang: this.$i18n.locale
|
|
|
|
}
|
|
|
|
this.$http.post('/api/recharge/create', data).then(res => {
|
|
|
|
if(res.code == 0){
|
|
|
|
this.show = 2;
|
|
|
|
this.qrcode = res.data.order.address;
|
|
|
|
this.icon = this.rechargeModel.network == 'TRC-20' ? '/static/images/s1.png' : '/static/images/s2.png'
|
|
|
|
}else{
|
|
|
|
uni.showToast({
|
|
|
|
title: res.msg
|
|
|
|
})
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
copy(val = ''){
|
|
|
|
const textArea = document.createElement('textarea');
|
|
|
|
textArea.value = val;
|
|
|
|
document.body.appendChild(textArea);
|
|
|
|
textArea.select();
|
|
|
|
try {
|
|
|
|
document.execCommand('copy');
|
|
|
|
uni.showToast({
|
|
|
|
title: this.$t('copySuccess')
|
|
|
|
});
|
|
|
|
} catch (err) {
|
|
|
|
console.error('Could not copy text: ', err);
|
|
|
|
}
|
|
|
|
document.body.removeChild(textArea);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//页面隐藏
|
|
|
|
onHide() {},
|
|
|
|
//页面卸载
|
|
|
|
onUnload() {},
|
|
|
|
//页面下来刷新
|
|
|
|
onPullDownRefresh() {},
|
|
|
|
//页面上拉触底
|
|
|
|
onReachBottom() {},
|
|
|
|
//用户点击分享
|
|
|
|
onShareAppMessage(e) {
|
|
|
|
return this.wxShare();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import '@/style/mixin.scss';
|
|
|
|
body{background-color: #fff;}
|
|
|
|
.rechargeTitle{
|
2025-06-10 00:51:49 +08:00
|
|
|
font-weight: 400;font-size: 32rpx;color: #999999;line-height: 46rpx; text-align: center; margin-top: 60rpx;
|
2025-06-06 03:08:19 +08:00
|
|
|
}
|
|
|
|
.rechargeNet{
|
2025-06-10 00:51:49 +08:00
|
|
|
font-weight: 600;font-size: 40rpx;color: #333;line-height: 46rpx; text-align: center; margin-top: 40rpx;
|
2025-06-06 03:08:19 +08:00
|
|
|
}
|
|
|
|
</style>
|