month-award.vue 5.41 KB
Newer Older
leiqingsong's avatar
leiqingsong committed
1
<template>
leiqingsong's avatar
leiqingsong committed
2 3 4 5 6 7 8 9 10 11 12
  <div class="month-award">
    <div class="nav">
      <van-icon
        name="arrow-left"
        size="20"
        class="nav-left"
        @click="$router.go(-1)"
      />
      <span class="nav-title">月度奖励</span>
    </div>
    <div class="notice">
leiqingsong's avatar
leiqingsong committed
13 14 15 16 17
      <van-notice-bar
        left-icon="volume-o"
        color="#333333"
        background="transparent"
      >
leiqingsong's avatar
leiqingsong committed
18 19 20 21 22 23 24 25 26
        <div slot="left-icon" style="margin-right: 10px">
          <img class="notice-icon" src="@/assets/images/notice.png" alt />
        </div>
        <van-swipe
          vertical
          class="notice-swipe"
          :autoplay="3000"
          :show-indicators="false"
        >
leiqingsong's avatar
leiqingsong committed
27
          <van-swipe-item> {{ awardInfo.awardTime }}</van-swipe-item>
leiqingsong's avatar
leiqingsong committed
28 29 30 31 32 33 34
          <van-swipe-item>内容 2</van-swipe-item>
          <van-swipe-item>内容 3</van-swipe-item>
        </van-swipe>
      </van-notice-bar>
    </div>
    <div class="content">
      <p style="font-size: 16px; font-weight: bold">本月累计奖金</p>
leiqingsong's avatar
leiqingsong committed
35 36 37 38 39 40 41 42 43
      <countTo
        :startVal="awardInfo.lastToatal"
        :endVal="awardInfo.monthAwardTotal"
        :duration="3000"
        style="font-weight: bold"
      ></countTo>
      <p style="font-size: 14px;color:#333333">
        历史累计奖金:¥{{ awardInfo.awardTotal.toFixed(2) || 0 }}
      </p>
leiqingsong's avatar
leiqingsong committed
44 45 46
    </div>
    <div class="newAdd-my">
      <div class="newAdd">
leiqingsong's avatar
leiqingsong committed
47
        <p>{{ awardInfo.monthIncreased || 0 }}</p>
leiqingsong's avatar
leiqingsong committed
48 49 50 51 52 53
        <div class="bottom">
          <img src="@/assets/images/本月新增.png" alt />
          <span>本月新增</span>
        </div>
      </div>
      <div class="my">
leiqingsong's avatar
leiqingsong committed
54
        <p>{{ awardInfo.userMonthAward }}</p>
leiqingsong's avatar
leiqingsong committed
55 56 57 58 59 60 61 62 63 64
        <div class="bottom">
          <img src="@/assets/images/我的份额.png" alt />
          <span>我的份额</span>
        </div>
      </div>
    </div>
    <div class="level-pool">
      <p class="level-pool-title">各等级本月累计奖励池</p>
      <p class="level-pool-item">
        <span>黄金树等级</span>
leiqingsong's avatar
leiqingsong committed
65
        <span>{{ awardInfo.goldAward || 0 }}</span>
leiqingsong's avatar
leiqingsong committed
66 67 68
      </p>
      <p class="level-pool-item">
        <span>农场主等级</span>
leiqingsong's avatar
leiqingsong committed
69
        <span>{{ awardInfo.farmerAward || 0 }}</span>
leiqingsong's avatar
leiqingsong committed
70 71 72
      </p>
      <p class="level-pool-item">
        <span>森林之星等级</span>
leiqingsong's avatar
leiqingsong committed
73
        <span>{{ awardInfo.forestStartAward || 0 }}</span>
leiqingsong's avatar
leiqingsong committed
74 75
      </p>
      <p class="level-pool-item">
leiqingsong's avatar
leiqingsong committed
76
        <span>西田森合伙人等级</span>
leiqingsong's avatar
leiqingsong committed
77
        <span>{{ awardInfo.partnerAward || 0 }}</span>
leiqingsong's avatar
leiqingsong committed
78 79 80 81 82
      </p>
    </div>
  </div>
</template>

leiqingsong's avatar
leiqingsong committed
83
<script>
leiqingsong's avatar
leiqingsong committed
84
import countTo from "vue-count-to";
leiqingsong's avatar
leiqingsong committed
85 86 87 88 89 90 91 92 93 94
import { monthRewards } from "@/api/reward";
export default {
  name: "MonthAward",
  components: { countTo },
  data() {
    return {
      awardInfo: {
        goldAward: 0,
        farmerAward: 0,
        forestStartAward: 0,
leiqingsong's avatar
leiqingsong committed
95
        partnerAward: 0
leiqingsong's avatar
leiqingsong committed
96
      }
leiqingsong's avatar
leiqingsong committed
97
    };
leiqingsong's avatar
leiqingsong committed
98 99
  },
  created() {
leiqingsong's avatar
leiqingsong committed
100
    this.getData();
leiqingsong's avatar
leiqingsong committed
101 102 103 104
  },
  methods: {
    getData() {
      const params = {
leiqingsong's avatar
leiqingsong committed
105
        userId: this.$userId
leiqingsong's avatar
leiqingsong committed
106
      };
leiqingsong's avatar
leiqingsong committed
107 108
      monthRewards(params).then(res => {
        if (res.code === 0) {
leiqingsong's avatar
leiqingsong committed
109 110 111
          this.awardInfo = res.data;
          this.awardInfo.lastToatal =
            res.data.monthAwardTotal - res.data.growthAward;
leiqingsong's avatar
leiqingsong committed
112
        }
leiqingsong's avatar
leiqingsong committed
113
      });
leiqingsong's avatar
leiqingsong committed
114 115
    }
  }
leiqingsong's avatar
leiqingsong committed
116
};
leiqingsong's avatar
leiqingsong committed
117 118
</script>

leiqingsong's avatar
leiqingsong committed
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
<style lang="scss" scoped>
.month-award {
  width: 100%;
  height: 447px;
  background-image: url("../../assets/images/月度奖励背景图.png");
  background-size: cover;
}
.nav {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 46px;
  .nav-left {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 52px;
    height: 100%;
    line-height: 46px;
    text-align: center;
  }
  .nav-title {
    max-width: 60%;
    margin: 0 auto;
    color: #333333;
    font-weight: bold;
    font-size: 16px;
  }
}
.notice {
  box-sizing: border-box;
  min-width: 345px;
  height: 44px;
  line-height: 44px;
  margin: 28px auto 47px;
  background-image: url("../../assets/images/公告.png");
  background-size: cover;

  .van-notice-bar {
    height: 44px;
    line-height: 0;
  }

  .notice-icon {
    width: 16px;
    height: 14px;
  }
  .notice-swipe {
    height: 44px;
    line-height: 44px;
  }
}
.content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: 120px;
  margin-bottom: 90px;
leiqingsong's avatar
leiqingsong committed
179
  font-family: PingFang-SC;
leiqingsong's avatar
leiqingsong committed
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
  p {
    margin: 0;
  }
}
.newAdd-my {
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  width: 345px;
  margin: 0 auto 15px;
  p {
    margin: 0;
  }
  .newAdd,
  .my {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 169px;
    height: 98px;
    padding: 13px 20px 15px 17px;
    font-size: 14px;
    background-color: #ffffff;
    p {
      font-weight: bold;
    }
    img {
      width: 24px;
      height: 21px;
    }
    .bottom {
      display: flex;
      justify-content: space-between;
leiqingsong's avatar
leiqingsong committed
214 215 216 217
      span {
        font-family: PingFang-SC-Bold;
        color: #666666;
      }
leiqingsong's avatar
leiqingsong committed
218 219 220 221 222 223 224 225 226 227 228 229
    }
  }
}
.level-pool {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 345px;
  height: 170px;
  margin: 0 auto;
  padding: 18px 15px 19px;
leiqingsong's avatar
leiqingsong committed
230
  font-family: PingFang-SC-Medium;
leiqingsong's avatar
leiqingsong committed
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
  background-color: #ffffff;
  p {
    margin: 0;
  }
  &-title {
    font-size: 16px;
    color: #333333;
  }
  &-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #666666;
  }
}
</style>