123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- <template>
- <view class="container">
- <view class="topBox">
- <view class="topName">我的资产</view>
- <view class="topMoney">${{money}}</view>
- <view class="flex topInfo">
- <!-- <view class="flex_item infoTpl" @click="navTo('/pages/user/transfer')">
- <image src="/static/image/img27.png" style="width: 48rpx;height: 48rpx;" mode="widthFix"></image>
- <view class="tplName">转账</view>
- </view> -->
- <view class="flex_item infoTpl" @click="navTo('/pages/index/recharge')">
- <image src="/static/image/img28.png" style="width: 44rpx;height: 44rpx;" mode="widthFix"></image>
- <view class="tplName">充值</view>
- </view>
- <view class="flex_item infoTpl" @click="navTo('/pages/user/withdrawal')">
- <image src="/static/image/img29.png" style="width: 45rpx;height: 42rpx;" mode="widthFix"></image>
- <view class="tplName">提币</view>
- </view>
- </view>
- <view class="flex_item moneyBox">
- <image src="/static/image/img26.png" style="width: 30rpx;height:30rpx" mode="scaleToFill"></image>
- <view class="moneyName">资产正在保护中</view>
- </view>
- </view>
- <view class="listBox">
- <view class="listName">我的资产</view>
- <view class="flex listTpl" v-for="(item) in list" @click="navTo(`/pages/user/money?type=${item.name}`)">
- <view class="flex_item TplInfo">
- <image :src="item.LOGO" class="typeLogo" mode="scaleToFill"></image>
- <view class="infoName">{{item.name}}</view>
- </view>
- <view class="flex_item tplTip">
- <view class="tipBox">
- <view>{{item.money.money*1}}</view>
- <view class="tip">≈{{item.rmb*1}}RMB</view>
- </view>
- <image src="/static/image/img31.png" style="width: 18rpx;height: 27rpx;" mode="widthFix"></image>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- // import {
- // getIndex,
- // } from "@/api/index.js";
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- getUserInfo,
- getUser
- } from '@/api/user.js';
- import {
- qianBao
- } from '@/api/wallet.js';
- import {
- saveUrl,
- interceptor
- } from '@/utils/loginUtils.js';
- export default {
- data() {
- return {
- dataMoney: {},
- money: '',
- list: {}
- };
- },
- onShow() {
- // 判断是否已经登录
- if (this.hasLogin) {
- this.loadBaseData();
- this.getUserWallet();
- }
- // this.getIndex()
- },
- computed: {
- ...mapState('user', ['hasLogin', 'userInfo']),
- ...mapState(['baseURL', 'urlFile']),
- },
- methods: {
- ...mapMutations('user', ['setUserInfo']),
- // 获取用户余额信息
- getUserWallet() {
- const that = this;
- qianBao().then((res) => {
- that.dataMoney = res.data.back.USDT.money;
- that.money = +res.data.like_usdt;
- that.list = res.data.back;
- })
- },
- // 加载初始数据
- loadBaseData() {
- const obj = this
- getUserInfo({})
- .then(({
- data
- }) => {
- obj.setUserInfo(data);
- })
- .catch(e => {
- console.log(e);
- });
- },
- /**
- * 统一跳转接口,拦截未登录路由
- * navigator标签现在默认没有转场动画,所以用view
- */
- navTo(url) {
- if (!this.hasLogin) {
- // 保存地址
- saveUrl();
- // 登录拦截
- interceptor();
- } else {
- uni.navigateTo({
- url
- });
- }
- },
- }
- };
- </script>
- <style lang="scss">
- .container {
- padding: 25rpx 25rpx;
- }
- .typeLogo {
- height: 80rpx;
- width: 80rpx;
- }
- .topBox {
- width: 100%;
- background: #1F2A4A;
- border-radius: 15rpx;
- padding: 40rpx 45rpx;
- position: relative;
- .topName {
- font-weight: bold;
- font-size: 27rpx;
- color: #FFFFFF;
- }
- .topMoney {
- font-weight: bold;
- font-size: 60rpx;
- color: #FFFFFF;
- padding: 65rpx 0rpx;
- }
- .topInfo {
- font-size: 27rpx;
- color: #FFFFFF;
- justify-content: space-around;
- .infoTpl {
- .tplName {
- padding-left: 15rpx;
- }
- }
- }
- .moneyBox {
- position: absolute;
- right: 0;
- top: 45rpx;
- background: #F2DA95;
- border-radius: 27rpx 0rpx 0rpx 27rpx;
- font-weight: bold;
- font-size: 24rpx;
- color: #030E16;
- padding: 8rpx 22rpx;
- .moneyName {
- padding-left: 15rpx;
- }
- }
- }
- .listBox {
- padding: 50rpx 0rpx;
- color: #FFFFFF;
- .listName {
- font-family: PingFang SC;
- font-weight: 500;
- font-size: 36rpx;
- color: #FFFFFF;
- }
- .listTpl {
- padding: 35rpx 0rpx;
- .TplInfo {
- .infoName {
- font-family: PingFang SC;
- font-weight: 500;
- font-size: 32rpx;
- color: #FFFFFF;
- padding-left: 31rpx;
- }
- }
- .tplTip {
- .tipBox {
- padding-right: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- font-size: 32rpx;
- color: #FFFFFF;
- .tip {
- font-family: PingFang SC;
- font-weight: 500;
- font-size: 26rpx;
- color: #999999;
- }
- }
- }
- }
- }
- </style>
|