<!-- 我的 -->
<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="realName" class="phone">{{ 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(orderList[0])">
              <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" @click="serviceVisible=true">
        <view class="canl">
          <image :src="cantact"></image>
          <text>联系客服</text>
        </view>
        <image class="more" :src="moreImg"></image>
      </view>
      <view class="outline" @click="outLogin()">退出登录</view>
    </view>
    <u-modal :show="serviceVisible" title="联系客服" :closeOnClickOverlay="true" @confirm="serviceVisible=false">
      <view class="slot-content">
        <view class="flex-center service-box">
          <img src="" alt="">
        </view>
      </view>
    </u-modal>
  </view>
</template>

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

export default {
  components: {},
  data() {
    return {
      serviceVisible: false,
      realName: uni.getStorageSync('realName'),
      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: '',
          label: '全部',
          index: 0,
          icon: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_diankaguanli%403x.png"
        },
        {
          value: 'WAIT_PAYMENT',
          label: '待付款',
          index: 1,
          icon: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_daifukuan%403x.png"
        },
        {
          value: 'SHOOTING',
          label: '拍摄中',
          index: 3,
          icon: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_daifukuan%403x.png"
        },
        {
          value: 'DELIVERED',
          label: '已交付',
          index: 5,
          icon: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_daifukuan%403x.png"
        }
      ]
    };
  },
  computed: {},
  watch: {},
  onLoad() {

  },
  onShow() {
    this.changeTabbar()
  },
  methods: {
    changeTabbar() {
      uni.setTabBarStyle({
        color: '#9EA3B1',
        selectedColor: '#0D121A',
        backgroundColor: '#FFF'
      })
    },
    toOrder(item) {
      this.$router.push({
        path: '/pages/order/index?status='+item.value+'&current='+item.index
      })
    },
    outLogin() {
      logout().then(res => {
        uni.removeStorageSync('token')
        uni.removeStorageSync('realName')
        this.$router.push({
          path: '/pages/index/index'
        })
      })
    }
  },
  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: 16rpx 32rpx;

    image {
      height: 56rpx;
    }
  }

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

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

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

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

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

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

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

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

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

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

          text {
            font-weight: bold;
          }
        }
      }

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

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

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

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

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

          .all {
            margin-right: 8rpx;

          }
        }
      }

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

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

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

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

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

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

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

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

.service-box {
  padding: 32rpx;
}

.service-box img {
  width: 300rpx;
  height: 300rpx;
}
</style>