<!-- #ifdef H5 -->
<template >
  <view class="wallet_received" :style="colorStyle">
    <view class="tota_income">
      <text class="t-t"> {{ moneyObj.receiveItemAmount }}</text>
      <text class="t-b"> 总收益</text>
    </view>

    <view class="tota_history">
      <view class="h-item" v-for="(src, i) in historyList" :key="src.id">
        <view class="h-l">
          <text>{{ src.createTime }}</text>
          <text>{{ ["随机红包", "专属红包","收益红包"][src.type] }}</text>
        </view>
        <view class="h-r">
          <text class="exr">领取了</text>
          <text class="imp">{{ src.grabAmount }}元</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>	import {
  logListByUserId,
  todayStatistics
} from '@/api/home.js';
export default {
  components: {

  },
  data () {
    return {
      historyList: [],
      moneyObj: {
        lossTotalAmount: "0",
        receiveItemAmount: "0",
        receiveItemCount: 0,
        redEnvelopeItemCount: 0,
        remainItemCount: 0,
        totalReceivedRedEnvelopeAmount: "0",
        totalRedEnvelopeAmount: "0",
        totalRemainItemAmount: "0"
      },
    };
  },
  onPullDownRefresh () {
		this.logListByUserId()
    this.todayStatistics()
  },
  onLoad (options) {

  },
  created () {
    this.logListByUserId()
    this.todayStatistics()
  },
  methods: {
    todayStatistics () {
      todayStatistics().then(res => {
        this.moneyObj = res.data
      })
    },
    logListByUserId () {
      let that = this
      logListByUserId().then(res => {
        if (res.data.length > 0) {
          that.$set(that, "historyList", res.data)
        } else {
          that.$set(that, "historyList", [])
        }
				uni.stopPullDownRefresh();
      })
    },
  }
}
</script>

<style scoped lang="scss">
.wallet_received {
  .tota_income {
    height: 250rpx;
    background: rgb(250, 250, 250);
    box-sizing: border-box;
    padding-top: 20px;
    padding-bottom: 20px;
    .t-t {
      display: block;
      text-align: center;
      width: 100%;
      font-size: 30px;
    }
    .t-b {
      display: block;
      text-align: center;
      font-size: 15px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
    }
  }

  .tota_history {
    .h-item {
      display: flex;
      padding: 10px;
      height: 150rpx;
      background: white;
      border-bottom: 3px solid rgb(250, 250, 250);
      .h-l {
        display: flex;
        flex-direction: column;
        text-align: left;
        flex: 1;
        &:nth-child(0) {
          height: 21px;
          font-size: 15px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 500;
          color: #333333;
          line-height: 21px;
        }
        &:nth-child(1) {
          height: 20px;
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #666666;
          line-height: 20px;
        }
      }
      .h-r {
				display: flex;
        text-align: right;
        flex: 1;
        font-size: 12px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #666666;
        line-height: 100rpx;

				.exr{
					flex-grow: 1;
				}
        .imp {
          font-size: 16px;
          font-family: DINAlternate-Bold, DINAlternate;
          color: #eb4c63;
        }
      }
    }
  }
}
</style>
<!-- #endif -->
