<template> <div class="wallet"> <div class="content"> <img class="balance-img" src="@/assets/images/余额.png" alt /> <p style="position:absolute;top:136px;width:100%;font-size:18px;color:#333333" > 当月收益 </p> <div style="position:absolute;top:178px;width:100%" @click="jumpToIncomeDetail" > <span class="month-income">{{ walletInfo.moneyIncome }}</span> <img src="@/assets/images/右箭头.png" alt style="width:11px;height:18px" /> </div> <div class="bottom-box"> <div class="income-item"> <img src="@/assets/images/待结算.png" alt /> <p>累计收益</p> <div @click="jumpToAll"> <span class="money">{{ walletInfo.totalIncome }}</span> <img src="@/assets/images/右箭头.png" alt style="width:8px;height:15px" /> </div> </div> <div class="income-item"> <img src="@/assets/images/累计收入.png" alt /> <p>未提余额</p> <div @click="jumpToCanCashOut"> <span class="money">{{ walletInfo.currentMoneyCan }}</span> <img src="@/assets/images/右箭头.png" alt style="width:8px;height:15px" /> </div> </div> </div> <div class="cash-out-btn"> <van-button type="primary" color="#88c678" @click="onToCashOut" >提现</van-button > <p @click="onToRecord">查看提现记录</p> </div> </div> </div> </template> <script> import { getAuthToken } from "@/utils/bridgeToAppFun"; import { getMoneyPackage } from "@/api/wallet"; export default { name: "Wallet", data() { return { walletInfo: { currentMoneyCan: 0, // 本月可提现 moneyIncome: 0, // 本月收益 totalIncome: 0 // 累计收益 } }; }, mounted() { this.getWalletInfo(); getAuthToken() .then(res => { console.log(res); }) .catch(err => { console.log(err); }); }, methods: { // 跳转到可提现界面 jumpToCanCashOut() { this.$router.push("/canCashOut"); }, // 跳转至收益明细 jumpToIncomeDetail() { this.$router.push("/income/detail"); }, // 跳转至累计收益 jumpToAll() { this.$router.push("/income/all"); }, onToCashOut() { this.$router.push("/cash-out"); }, onToRecord() { this.$router.push("/cash-out-record"); }, // 获取用户钱包展示信息 getWalletInfo() { const params = { userId: "13100911369" }; getMoneyPackage(params) .then(res => { if (res.code === 0) { // console.log("res", res); this.walletInfo = res.data; } else { this.$toast.fail(res.message); } }) .catch(error => { console.log(error); }); } } }; </script> <style lang="scss" scoped> .wallet { box-sizing: border-box; height: 100vh; padding: 10px 16px; p { margin: 0; } .content { position: relative; width: 345px; height: 90%; text-align: center; background-color: #ffffff; .balance-img { position: absolute; top: 72px; left: 157px; width: 34px; height: 34px; } .month-income { margin-right: 10px; font-size: 28px; color: #333333; } .bottom-box { position: absolute; top: 263px; display: flex; justify-content: space-around; align-items: center; width: 100%; font-size: 14px; color: #666666; img { width: 30px; height: 29px; } .income-item { display: flex; flex-direction: column; align-items: center; justify-content: space-around; height: 120px; } .money { font-size: 20px; color: #333333; margin-right: 10px; } } .cash-out-btn { position: absolute; bottom: 63px; left: 50%; transform: translateX(-50%); .van-button { width: 160px; } p { margin-top: 20px; font-size: 14px; color: #88c678; } } } } </style>