<!-- 我的 -->
<template>
  <view class="my" :style="{ background: 'url(' + bgImg + ') #F4F5F9' }">
    <view class="title">
      <image :src="logoImg" mode="heightFix"></image>
    </view>
    <view class="news">
      <image :src="avatar"></image>
      <view v-if="userInfo" class="phone">{{ userInfo.realName }}</view>
      <view v-else class="phone" @click="toLogin()">点击登录</view>
    </view>
    <view class="content">
      <view class="order-wrap">
        <!-- <view class="unpay">
          <view class="left">
            <image :src="tongzhi"></image>
            <view class="tip">您有1笔订单待付款<text>09:34</text>后取消</view>
          </view>
          <view class="right">去付款</view>
        </view> -->
        <view class="order">
          <view class="order_top">
            <text class="mytt">我的订单</text>
            <view class="myall" @click="toOrder">
              <text class="all">全部</text>
              <image class="more" :src="moreImg"></image>
            </view>
          </view>
          <view class="order-box">
            <view class="order-box-item" v-for="(item, index) in orderList" :key="index" @click="toOrder(item)">
              <image :src="item.icon"></image>
              <text class="name">{{ item.label }}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="cantact">
        <view class="canl">
          <image :src="cantact"></image>
          <text>联系客服</text>
        </view>
        <image class="more" :src="moreImg"></image>
      </view>
      <view class="outline" @click="outLogin()">退出登录</view>
    </view>
  </view>
</template>

<script>
import {logout} from '@/apis/user.js'

export default {
  components: {},
  data() {
    return {
      userInfo: uni.getStorageSync('userInfo'),
      token: uni.getStorageSync('token'),
      bgImg: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/bg_top%403x.png",
      logoImg: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/img_logo%403x.png",
      tongzhi: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_tongzhi%403x.png",
      moreImg: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_more%403x.png",
      cantact: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_kefurexian%403x.png",
      avatar: '',
      orderList: [
        {
          value: 1,
          label: '全部',
          icon: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_daifukuan%403x.png"
        },
        {
          value: 2,
          label: '待付款',
          icon: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_daifukuan%403x.png"
        },
        {
          value: 3,
          label: '拍摄中',
          icon: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_daifukuan%403x.png"
        },
        {
          value: 4,
          label: '已完成',
          icon: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_diankaguanli%403x.png"
        }
      ]
    };
  },
  computed: {},
  watch: {},
  onLoad() {
    this.changeTabbar()
  },
  onShow() {

  },
  methods: {
    toLogin(){

    },
    changeTabbar() {
      uni.setTabBarStyle({
        color: '#9EA3B1',
        selectedColor: '#0D121A',
        backgroundColor: '#FFF'
      })
    },
    toOrder(item) {
      this.$router.push({
        path: '/pages/order/index?status=' + item.value
      })
    },
    outLogin() {
      logout().then(res => {
        uni.removeStorageSync('token')
        uni.removeStorageSync('userInfo')
        this.name = ''
        this.token = ''
      })
    }
  },
  created() {

  },
  mounted() {

  },
}
</script>
<style lang='scss' scoped>
.my {
  width: 100%;
  // height: 100%;
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 0;
  bottom: 0;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: top;

  .title {
    padding: 16 rpx 32 rpx;

    image {
      height: 56 rpx;
    }
  }

  .news {
    padding: 64 rpx 48 rpx 0;
    display: flex;
    align-items: center;

    image {
      width: 104 rpx;
      height: 104 rpx;
      background-color: aqua;
      border-radius: 50%;
    }

    .phone {
      font-weight: bold;
      font-size: 44 rpx;
      color: #0D121A;
      margin-left: 32 rpx;
    }
  }

  .content {
    padding: 0 24 rpx;
    margin-top: 40 rpx;
    box-sizing: content-box;
  }

  .more {
    width: 32 rpx;
    height: 32 rpx;
  }

  .order-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;

    .unpay {
      // box-sizing: border-box;
      width: 638 rpx;
      background: #FFEEE2;
      border-radius: 24 rpx 24 rpx 0 rpx 0 rpx;
      border: 2 rpx solid #FFFEFD;
      padding: 16 rpx 18 rpx 16 rpx 16 rpx;
      display: flex;
      justify-content: space-between;
      align-items: center;

      .left {
        display: flex;
        align-items: center;

        image {
          width: 48 rpx;
          height: 48 rpx;
        }

        .tip {
          font-size: 24 rpx;
          color: #FF7441;
          margin-left: 14 rpx;

          text {
            font-weight: bold;
          }
        }
      }

      .right {
        width: 120 rpx;
        height: 44 rpx;
        font-weight: 500;
        background: #FF7441;
        border-radius: 24 rpx;
        font-size: 24 rpx;
        color: #FFFFFF;
        text-align: center;
        line-height: 44 rpx;
      }
    }

    .order {
      padding: 32 rpx 32 rpx 40 rpx;
      width: 100%;
      box-sizing: border-box;
      height: 260 rpx;
      background: linear-gradient(180deg, #DEF5FD 0%, #FFFFFF 100%);
      border-radius: 32 rpx;
      border: 2 rpx solid #FFFFFF;

      .order_top {
        display: flex;
        justify-content: space-between;
        align-items: center;

        .mytt {
          font-weight: 500;
          font-size: 32 rpx;
          color: #0D121A;
        }

        .myall {
          font-weight: 400;
          font-size: 26 rpx;
          color: #0D121A;
          display: flex;
          align-items: center;

          .all {
            margin-right: 8 rpx;

          }
        }
      }

      .order-box {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 48 rpx;

        .order-box-item {
          display: flex;
          flex-direction: column;
          align-items: center;
          width: 128 rpx;

          image {
            width: 64 rpx;
            height: 64 rpx;
          }

          .name {
            font-size: 24 rpx;
            color: #0D121A;
            margin-top: 16 rpx;
          }
        }
      }
    }
  }

  .cantact {
    width: 100%;
    height: 112 rpx;
    background: #FFFFFF;
    border-radius: 24 rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24 rpx 32 rpx;
    margin-top: 24 rpx;

    .canl {
      display: flex;
      align-items: center;

      image {
        margin-right: 24 rpx;
        width: 64 rpx;
        height: 64 rpx;
      }
    }
  }

  .outline {
    width: 622 rpx;
    height: 96 rpx;
    border-radius: 36 rpx;
    border: 4 rpx solid #E2E4EB;
    font-size: 28 rpx;
    color: #0D121A;
    text-align: center;
    line-height: 96 rpx;
    margin: 48 rpx auto;
  }
}
</style>