<template>
<div class="mine" >
  <div class="content1">
    <div class="wrap1">
      <div class="wrap1_1">{{orderTotal}}</div>
      <div class="wrap1_2">画作寄存量</div>
    </div>
    <div class="wrap2"></div>
    <div class="wrap3">
      <div class="wrap3_1">{{validContractDays}}</div>
      <div class="wrap3_2">寄存即将到期画作</div>
    </div>
  </div>
  <div class="content2">
    <div class="wrap1">
      <div class="wrap1_1">
        <image :src="avatar"></image>
      </div>
      <div class="wrap1_2">
        <div class="wrap1_2_1">
          <div class="wrap1_2_1_1">{{nickName}}</div>
          <div class="wrap1_2_1_2">已实名</div>
        </div>
        <div class="wrap1_2_2">{{telNum}}</div>
      </div>
    </div>
    <div class="wrap2" @click="goSet" >
      <div class="wrap2_1">
        <image src="../../static/zu609@3x.png"></image>
      </div>
      <div class="wrap2_2">设置</div>
    </div>
  </div>
  <tabbar :current="3"></tabbar>
</div>
</template>
<script>
import tabbar from "../../components/uiq-tabbar/uiq-tabbar.vue";

export default {
  name: "index",
  onLoad() {
    uni.hideTabBar()
  },
  components: {tabbar},
  data() {
    return {
      orderTotal:0,
      validContractDays:0,
      nickName:'',
      telNum:'',
      avatar:''
    }
  },
  onLoad(){
    this.infoOrders()
    this.info()
  },
  onShow() {
    this.infoOrders()
  },
  methods: {
    async infoOrders(){
      const res = await this.$api.mine.infoOrders()
      if(res.status === 0){
        this.orderTotal = res.data.totalCount
        this.validContractDays = res.data.nearCount
      }else{
        this.$common.msgToast(res.msg);
      }
    },
    async info(){
      const res = await this.$api.mine.info()
      if(res.status === 0){
        this.nickName = res.data.user.nickName
        this.telNum = res.data.user.telNum
        this.avatar = res.data.user.avatar
      }else{
        this.$common.msgToast(res.msg);
      }
    },
    goSet(){
      uni.navigateTo({
         url: '/pages/mine/set-up'
      });
    }
  },
}
</script>
<style scoped lang="scss">
.mine{
  box-sizing: border-box;
  padding-top: 46rpx;
  padding-left: 30rpx;
  padding-right: 30rpx;
  background-size: cover;
  width: 100vw;
  height: 100vh;
  background-image: url("https://cdns.fontree.cn/fonchain-main/prod/image/default/artwork/4fdc9a0f-d72a-46b6-a04d-ed56d5465213.png");

  .content2{
    margin-top: 30rpx;
    display: flex;
    .wrap2{
      margin-left: auto;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: 182rpx;
      height: 204rpx;
      background: #4E964D;
      border-radius: 40rpx;
      .wrap2_1{
        image{
          width: 40.88rpx;
          height: 40.88rpx;

        }
      }
      .wrap2_2{
        font-size: 20rpx;
        color: #fff;
      }
    }
    .wrap1{
      width: 480rpx;
      height:204rpx;
      border-radius: 40rpx;
      background: #fff;
      display: flex;
      align-items: center;
      .wrap1_2{
        margin-left: 30rpx;
        display: flex;
        flex-direction: column;
        .wrap1_2_2{
          color: #626262;
          font-size: 24rpx;
        }
        .wrap1_2_1{
          margin-bottom: 6rpx;
          display: flex;
          align-items: center;
          .wrap1_2_1_1{
            margin-right: 6rpx;
            font-size: 28rpx;
          }
          .wrap1_2_1_2{
            width: 76rpx;
            height: 26rpx;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #fff;
            background:#76C458 ;
            font-size: 16rpx;
          }
        }
      }
.wrap1_1{
  margin-left: 68rpx;
  image{
    width: 126rpx;
    height: 126rpx;

  }
}
    }
  }
  .content1{
display: flex;
    height: 134rpx;
    background: #fff;
    border-radius: 40rpx;
    align-items: center;
    .wrap1{
      width:344rpx;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      .wrap1_1{
        font-size: 28rpx;
      }
      .wrap1_2{
        color: #979798;
        font-size: 20rpx;
      }

    }
    .wrap2{
      width: 1px;
      height: 70rpx;
      background:#D3E6F2 ;
    }
    .wrap3{
      width:344rpx;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      .wrap3_1{
        font-size: 28rpx;
      }
      .wrap3_2{
        color: #979798;
        font-size: 20rpx;
      }
    }
  }
}
</style>
