<template>
  <div class="my-promotion">
    <NavBar title="推广中心"></NavBar>
    <div class="header">
      <div class="name acea-row row-center-wrapper">
        <div>当前佣金</div>
        <router-link class="record" :to="'/user/cashrecord'">
          提现记录<span class="iconfont icon-xiangyou"></span>
        </router-link>
      </div>
      <div class="num">{{ userInfo.brokerage_price || 0 }}</div>
      <div class="profit acea-row row-between-wrapper">
        <div class="item">
          <div>昨日收益</div>
          <div class="money">{{ userInfo.yesterDay || 0 }}</div>
        </div>
        <div class="item">
          <div>累积已提</div>
          <div class="money">{{ userInfo.extractTotalPrice || 0 }}</div>
        </div>
      </div>
    </div>
    <div class="bnt bg-color-red" @click="toCash">立即提现</div>
    <div class="tips">升级到下级可领取 10000 元</div>
    <div class="list acea-row row-between-wrapper">
      <router-link
        class="item acea-row row-center-wrapper row-column"
        :to="'/user/poster'"
      >
        <span class="iconfont icon-erweima"></span>
        <div>推广名片</div>
      </router-link>
      <router-link
        class="item acea-row row-center-wrapper row-column"
        :to="'/user/promoter_list'"
      >
        <span class="iconfont icon-tongji"></span>
        <div>推广人统计</div>
      </router-link>
      <router-link
        class="item acea-row row-center-wrapper row-column"
        :to="'/user/commission'"
      >
        <span class="iconfont icon-qiandai"></span>
        <div>佣金记录</div>
      </router-link>
      <router-link
        class="item acea-row row-center-wrapper row-column"
        :to="'/user/promoter_order'"
      >
        <span class="iconfont icon-dingdan"></span>
        <div>推广人订单</div>
      </router-link>
      <!-- <router-link
        class="item acea-row row-center-wrapper row-column"
        :to="'/user/promoter_rank'"
      >
        <span class="iconfont icon-paihang1"></span>
        <div>推广人排行</div>
      </router-link>
      <router-link
        class="item acea-row row-center-wrapper row-column"
        :to="'/user/commission/rank'"
      >
        <span class="iconfont icon-paihang"></span>
        <div>佣金排行</div>
      </router-link> -->
    </div>
  </div>
</template>
<style>
.my-promotion .tips {
  width: 100%;
  text-align: center;
  margin-top: 0.25rem;
  margin-left: 0.2rem;
  color: red;
  border-radius: 0.2rem;
  background-color: white;
  width: 7.1rem;
  height: 1rem;
  line-height: 1rem;
  color: #ff1f44;
  font-weight: bold;
}
</style>
<script>
import { getUser } from "../../../api/user";
import NavBar from "@components/NavBar";

export default {
  name: "UserPromotion",
  components: {
    NavBar
  },
  props: {},
  data: function() {
    return {
      userInfo: {}
    };
  },
  mounted: function() {
    this.getInfo();
  },
  methods: {
    getInfo: function() {
      let that = this;
      getUser().then(
        res => {
          that.userInfo = res.data;
          console.log(that.userInfo);
        },
        function(err) {
          that.$dialog.message(err.msg);
        }
      );
    },
    toCash: function() {
      this.$router.push({ path: "/user/user_cash" });
    }
  }
};
</script>
