123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- <template>
- <view class="">
- <!-- 头部 -->
- <headContent>
- <template #left>
- <reverse-back path="pages/content/top-up" />
- </template>
- <template #content>
- <view class="haed-title">
- 充币
- </view>
- </template>
- <template #right>
- <view @click.stop="lookRecord()" class="head-record iconfont"></view>
- </template>
- </headContent>
- <view class="currency-box">
- <view class="currency-item">
- <view class="currency-info">
- <template v-if="biInfo">
- <image class="currency-icon" :src="biInfo.logo" mode="aspectFit"></image>
- <text class="currency-name">{{ biInfo.name }}</text>
- </template>
- </view>
- <view class="select-currency" @click.stop="selectCurrency">
- <text>请选择币种</text>
- <text class="iconfont"></text>
- </view>
- </view>
- <view class="link-name">
- <view class="link-lable">链名称</view>
- <view class="link-btns">
- <text @click.stop="setCode('erc20')"
- :class="['link-btn' , linkLable === 'erc20' ? 'active-link-btn' : '']">ERC20</text>
- <text @click.stop="setCode('trc20')"
- :class="['link-btn' , linkLable === 'trc20' ? 'active-link-btn' : '']">TRC20</text>
- </view>
- </view>
- <view class="currency-code">
- <!-- https://ext.dcloud.net.cn/plugin?id=39 -->
- <tki-qrcode ref="qrcode" :size="350" :showLoading="false" :val="linkVal[linkLable]" />
- </view>
- <view class="currency-btn" @click.stop="saveCode()">保存二维码</view>
- <view class="link-val">
- {{ linkVal[linkLable] }}
- </view>
- <view class="currency-btn currency-copy" @click.stop="setCopy(linkVal[linkLable])">复制地址</view>
- </view>
- </view>
- </template>
- <script>
- import {
- Api_getTopUp
- } from "@/api/index.js"
- import reverseBack from "@/components/headModules/reverse-back.vue"
- export default {
- name: 'top-up',
- components: {
- reverseBack
- },
- data() {
- return {
- biInfo: null,
- linkLable: 'erc20',
- linkVal: {
- erc20: '',
- trc20: ''
- }
- };
- },
- onLoad(opt) {
- const key = opt?.key || '';
- this.biInfo = this.$getStorageSync('select')[key];
- this.getTopUp()
- },
- methods: {
- getTopUp() {
- Api_getTopUp({
- currency: this.biInfo.id
- }).then(res => {
- this.linkVal = res;
- this.makeCode()
- }).catch(err => {
- }).finally(() => {
- })
- },
- setCode(item) {
- this.linkLable = item;
- this.makeCode()
- },
- makeCode() {
- this.$nextTick(() => {
- this.$refs.qrcode._makeCode()
- })
- },
- saveCode() {
- // #ifndef H5
- this.$nextTick(() => {
- this.$refs.qrcode._saveCode()
- })
- // #endif
- },
- setCopy(val) {
- if (val) {
- uni.setClipboardData({
- data: val,
- success: function() {
- uni.showToast({
- icon:"none",
- title: '复制成功'
- })
- }
- });
- }
- },
- // pages/content/top-up
- selectCurrency() {
- const pages = getCurrentPages()
- console.log('pages = ', pages)
- if (pages.length > 1 && pages[pages.length - 1].route === 'pages/content/select-currency') {
- uni.navigateBack()
- } else {
- uni.navigateTo({
- url: '/pages/content/select-currency'
- });
- }
- },
- // 查看充值记录
- lookRecord() {
- const pages = getCurrentPages()
- if (pages.length > 2 && pages[pages.length - 2].route === 'pages/content/charge-record') {
- uni.navigateBack({
- delta: 1
- })
- } else {
- uni.navigateTo({
- url: "/pages/content/charge-record"
- });
- };
- }
- }
- }
- </script>
- <style>
- page {
- background-color: #F6F7FB;
- }
- </style>
- <style lang="scss" scoped>
- .head-record {
- font-size: 60rpx;
- }
- .currency-box {
- width: 100%;
- padding: 30rpx 40rpx;
- .currency-item {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .currency-info {
- flex-shrink: 0;
- display: flex;
- align-items: center;
- .currency-icon {
- width: 46rpx;
- height: 46rpx;
- flex-shrink: 0;
- }
- .currency-name {
- font-size: 28rpx;
- padding-left: 7px;
- font-weight: 700;
- }
- }
- .select-currency {
- flex-shrink: 0;
- display: flex;
- align-items: center;
- font-size: 24rpx;
- .iconfont {
- color: #ccc;
- }
- }
- }
- .currency-code {
- margin: 36rpx auto 0;
- width: 350rpx;
- height: 350rpx;
- background-color: #fff;
- }
- .currency-btn {
- width: 360rpx;
- height: 80rpx;
- background-color: $Theme-Color;
- margin: 54rpx auto 0;
- border-radius: 6rpx;
- text-align: center;
- line-height: 80rpx;
- font-size: 30rpx;
- color: #fff;
- }
- .link-val {
- width: 100%;
- min-height: 103rpx;
- padding: 35rpx 0;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: center;
- color: #1a1a1a;
- line-height: 33rpx;
- }
- .currency-copy {
- color: $Theme-Color;
- background-color: #fff;
- margin: 0 auto;
- border: 1rpx solid $Theme-Color;
- line-height: 78rpx;
- }
- }
- .link-name {
- width: 100%;
- padding-top: 40rpx;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- .link-lable {
- // width: 72px;
- // height: 33px;
- color: #1a1a1a;
- line-height: 1.2;
- }
- .link-btns {
- width: 100%;
- padding-top: 16rpx;
- .link-btn {
- display: inline-block;
- width: 180rpx;
- height: 72rpx;
- background: #f6f5f3;
- border-radius: 8px;
- text-align: center;
- line-height: 70rpx;
- font-size: 28rpx;
- font-weight: 400;
- color: #666666;
- border-radius: 8rpx;
- border: 1rpx solid #f6f5f3;
- &:nth-child(n + 2) {
- margin-left: 20rpx;
- }
- }
- .active-link-btn {
- background: #ffffff;
- border-color: #05c175;
- color: #FFBA6A;
- }
- }
- }
- // <view class="link-name">
- // <view class="link-lable">链名称</view>
- // <view class="link-btns">
- // <text class="link-btn">ERC20</text>
- // <text class="link-btn">TRC20</text>
- // </view>
- // </view>
- </style>
|