allIncome.vue 1.2 KB
Newer Older
leiqingsong's avatar
leiqingsong committed
1
<template>
leiqingsong's avatar
leiqingsong committed
2
  <div class="all-income">
leiqingsong's avatar
leiqingsong committed
3 4 5 6 7 8 9 10 11
    <template v-if="incomeList.length > 0">
      <div v-for="item in incomeList" :key="item.id" class="list-item">
        <span style="color:#333333">{{ item.yearMonth }}</span>
        <span>{{ item.income }}</span>
      </div>
    </template>
    <p v-else class="no-data">
      暂无数据~
    </p>
leiqingsong's avatar
leiqingsong committed
12
  </div>
leiqingsong's avatar
leiqingsong committed
13 14
</template>

15 16 17 18 19 20 21 22 23 24
<script>
import { showIncomeRecord } from "@/api/wallet";

export default {
  name: "AllIncome",
  data() {
    return {
      incomeList: []
    };
  },
leiqingsong's avatar
leiqingsong committed
25
  mounted() {
26 27 28 29 30
    this.getAllRecord();
  },
  methods: {
    getAllRecord() {
      const params = {
leiqingsong's avatar
leiqingsong committed
31
        userId: JSON.parse(localStorage.getItem("user")).userId
32 33 34 35 36 37 38 39 40 41 42
      };
      showIncomeRecord(params).then(res => {
        if (res.code === 0) {
          this.incomeList = res.data;
        }
      });
    }
  }
};
</script>

leiqingsong's avatar
leiqingsong committed
43 44
<style lang="scss" scoped>
.all-income {
leiqingsong's avatar
leiqingsong committed
45 46
  box-sizing: border-box;
  padding: 10px 16px;
leiqingsong's avatar
leiqingsong committed
47 48
}
.list-item {
leiqingsong's avatar
leiqingsong committed
49 50 51 52 53 54 55 56 57
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
  margin-bottom: 10px;
  padding: 0 15px;
  font-size: 16px;
  background-color: #ffffff;
leiqingsong's avatar
leiqingsong committed
58
}
leiqingsong's avatar
leiqingsong committed
59 60 61 62
.no-data {
  text-align: center;
  font-size: 12px;
}
leiqingsong's avatar
leiqingsong committed
63
</style>