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

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

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

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

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