wallet.vue 4.08 KB
Newer Older
1 2 3 4
<template>
  <div class="wallet">
    <div class="content">
      <img class="balance-img" src="@/assets/images/余额.png" alt />
leiqingsong's avatar
leiqingsong committed
5
      <p class="currentprofitlabel">当月收益</p>
leiqingsong's avatar
leiqingsong committed
6
      <div class="currentprofit" @click="jumpToIncomeDetail">
leiqingsong's avatar
leiqingsong committed
7
        <span class="month-income">{{ walletInfo.moneyIncome }}</span>
leiqingsong's avatar
leiqingsong committed
8
        <img src="@/assets/images/右箭头.png" alt class="month-income-arrow" />
9 10 11 12 13
      </div>
      <div class="bottom-box">
        <div class="income-item">
          <img src="@/assets/images/待结算.png" alt />
          <p>累计收益</p>
14
          <div @click="jumpToAll">
leiqingsong's avatar
leiqingsong committed
15
            <span class="money">{{ walletInfo.totalIncome }}</span>
leiqingsong's avatar
leiqingsong committed
16
            <img src="@/assets/images/右箭头.png" alt class="arrow" />
17 18 19 20
          </div>
        </div>
        <div class="income-item">
          <img src="@/assets/images/累计收入.png" alt />
leiqingsong's avatar
leiqingsong committed
21
          <p>未提余额</p>
22
          <div @click="jumpToCanCashOut">
leiqingsong's avatar
leiqingsong committed
23
            <span class="money">{{ walletInfo.currentMoneyCan }}</span>
leiqingsong's avatar
leiqingsong committed
24
            <img src="@/assets/images/右箭头.png" alt class="arrow" />
25 26 27
          </div>
        </div>
      </div>
leiqingsong's avatar
leiqingsong committed
28 29 30 31 32 33
      <div class="cash-out-btn">
        <van-button type="primary" color="#88c678" @click="onToCashOut"
          >提现</van-button
        >
        <p @click="onToRecord">查看提现记录</p>
      </div>
34 35 36 37
    </div>
  </div>
</template>

leiqingsong's avatar
leiqingsong committed
38
<script>
leiqingsong's avatar
leiqingsong committed
39
import { getMoneyPackage } from "@/api/wallet";
leiqingsong's avatar
leiqingsong committed
40 41
export default {
  name: "Wallet",
leiqingsong's avatar
leiqingsong committed
42 43 44
  data() {
    return {
      walletInfo: {
45 46 47
        currentMoneyCan: 0, // 本月可提现
        moneyIncome: 0, // 本月收益
        totalIncome: 0 // 累计收益
leiqingsong's avatar
leiqingsong committed
48 49 50 51 52 53
      }
    };
  },
  mounted() {
    this.getWalletInfo();
  },
leiqingsong's avatar
leiqingsong committed
54
  methods: {
leiqingsong's avatar
leiqingsong committed
55
    // 跳转到可提现界面
56 57 58 59 60 61 62 63 64 65 66
    jumpToCanCashOut() {
      this.$router.push("/canCashOut");
    },
    // 跳转至收益明细
    jumpToIncomeDetail() {
      this.$router.push("/income/detail");
    },
    // 跳转至累计收益
    jumpToAll() {
      this.$router.push("/income/all");
    },
leiqingsong's avatar
leiqingsong committed
67 68 69 70 71
    onToCashOut() {
      this.$router.push("/cash-out");
    },
    onToRecord() {
      this.$router.push("/cash-out-record");
leiqingsong's avatar
leiqingsong committed
72 73 74 75
    },
    // 获取用户钱包展示信息
    getWalletInfo() {
      const params = {
leiqingsong's avatar
leiqingsong committed
76
        userId: JSON.parse(localStorage.getItem("user")).userId
leiqingsong's avatar
leiqingsong committed
77
      };
leiqingsong's avatar
leiqingsong committed
78 79 80 81 82 83 84 85 86
      getMoneyPackage(params)
        .then(res => {
          if (res.code === 0) {
            this.walletInfo = res.data;
          } else {
            this.$toast.fail(res.message);
          }
        })
        .catch(error => {
xulili's avatar
xulili committed
87
          console.log("catch", error);
leiqingsong's avatar
leiqingsong committed
88
        });
leiqingsong's avatar
leiqingsong committed
89 90 91 92 93
    }
  }
};
</script>

94 95 96
<style lang="scss" scoped>
.wallet {
  box-sizing: border-box;
xulili's avatar
xulili committed
97 98
  height: calc(100vh - 48px);
  overflow: hidden;
leiqingsong's avatar
leiqingsong committed
99
  padding: 15px;
xulili's avatar
xulili committed
100
  box-sizing: border-box;
101
  .content {
leiqingsong's avatar
leiqingsong committed
102 103 104 105
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
106
    width: 345px;
xulili's avatar
xulili committed
107
    height: 100%;
108 109
    text-align: center;
    background-color: #ffffff;
leiqingsong's avatar
leiqingsong committed
110 111 112 113
    .currentprofitlabel {
      width: 100%;
      font-size: 18px;
      color: #333333;
xulili's avatar
xulili committed
114
    }
leiqingsong's avatar
leiqingsong committed
115
    .currentprofit {
xulili's avatar
xulili committed
116 117 118
      width: 100%;
      top: 178px;
    }
119 120 121 122 123 124 125 126 127 128
    .balance-img {
      width: 34px;
      height: 34px;
    }

    .month-income {
      margin-right: 10px;
      font-size: 28px;
      color: #333333;
    }
leiqingsong's avatar
leiqingsong committed
129
    .month-income-arrow {
xulili's avatar
xulili committed
130 131 132
      width: 11px;
      height: 18px;
    }
133 134 135 136 137 138

    .bottom-box {
      display: flex;
      justify-content: space-around;
      align-items: center;
      width: 100%;
leiqingsong's avatar
leiqingsong committed
139
      margin: 20px 0;
140 141 142 143 144
      font-size: 14px;
      color: #666666;
      img {
        width: 30px;
        height: 29px;
leiqingsong's avatar
leiqingsong committed
145
        &.arrow {
xulili's avatar
xulili committed
146 147 148
          width: 12px;
          height: 18px;
        }
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
      }
      .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 {
leiqingsong's avatar
leiqingsong committed
165 166 167 168 169 170 171 172
      .van-button {
        width: 160px;
      }
      p {
        margin-top: 20px;
        font-size: 14px;
        color: #88c678;
      }
173 174 175 176
    }
  }
}
</style>