<template>
  <view class="template-course tn-safe-area-inset-bottom">
    <!-- 顶部自定义导航 -->
    <!-- <tn-nav-bar fixed alpha customBack>
      <view slot="back" class='tn-custom-nav-bar__back'
        @click="goBack">
        <text class='icon tn-icon-left'></text>
        <text class='icon tn-icon-home-capsule-fill'></text>
      </view>
    </tn-nav-bar> -->
    
    <swiper class="card-swiper" :circular="true"
      :autoplay="true" duration="500" interval="5000" @change="cardSwiper"> 
      <swiper-item v-for="(item,index) in swiperList" :key="index" :class="cardCur==index?'cur':''">
        <view class="swiper-item image-banner">
          <image :src="item.url" mode="aspectFill" v-if="item.type=='image'"></image>
        </view>
        <view class="swiper-item-text">
          <view class="tn-text-xxl tn-text-bold tn-color-white">{{item.title}}</view>
          <view class="tn-text-bold tn-color-white tn-padding-top-xs" style="font-size: 60rpx;">{{item.name}}</view>
          <view class="tn-text-sm tn-text-bold tn-color-white tn-padding-top-sm tn-padding-bottom-sm">{{item.text}}</view>
        </view>
      </swiper-item>
    </swiper>
    <view class="indication">
        <block v-for="(item,index) in swiperList" :key="index">
            <view class="spot" :class="cardCur==index?'active':''"></view>
        </block>
    </view>
   
    <view class="tn-flex tn-flex-row-between tn-margin tea-user__wrap">
      
      <view class="tn-flex-3 tn-padding tea-radius tn-bg-white tea-shadow" style="margin-right: 30rpx;">
        <view class="tn-flex">
          <view class="tn-flex tn-flex-row-center tn-flex-col-center">
            <view class="user-avatar">
              <view class="tn-icon-logo-tuniao" style="font-size: 90rpx;color: #01BEFF;"></view>
            </view>
            <view class="tn-padding-right tn-text-ellipsis tn-text-left">
              <view class="tn-padding-right tn-padding-left-sm tn-color-black tn-text-bold">
                图鸟小伙伴
              </view>
              <view class="tn-padding-right tn-padding-left-sm tn-padding-top-xs tn-color-gray tn-text-sm">有 6 张优惠券未使用</view>
            </view>
          </view>
        </view>
      </view>
      
      <view class="tn-flex-1 justify-content-item tn-padding tn-text-center tea-radius tn-bg-white tea-shadow">
        <view class="">
          <text class="tn-icon-qr-code tn-text-xl"></text>
        </view>
        <view class=" tn-padding-top-xs">
          会员码
        </view>
      </view>
    </view>
    
    
    <view class="">
      
      <!-- 方式12 start-->
      <view class="tn-flex tn-margin" style="padding-top: 15rpx;">
        <view class="tn-flex-1 tea-shadow tea-radius tn-bg-white" style="margin-right: 15rpx;padding: 40rpx 0;">
          <view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
            <view class="icon12__item--icon tn-flex tn-flex-row-center tn-flex-col-center tn-main-gradient-blue--light tn-color-blue">
              <view class="tn-icon-shop tn-three"></view>
            </view>  
            <view class="tn-text-center">
              <view class="tn-text-ellipsis tn-text-xl tn-text-bold">门店自取</view>
              <view class="tn-text-ellipsis tn-color-gray--dark tn-padding-top-sm">下单免排队</view>
            </view>
          </view>
        </view>
        <view class="tn-flex-1 tea-shadow tea-radius tn-bg-white" style="margin-left: 15rpx;padding: 40rpx 0;">
          <view class="tn-flex tn-flex-direction-column tn-flex-row-center tn-flex-col-center">
            <view class="icon12__item--icon tn-flex tn-flex-row-center tn-flex-col-center tn-main-gradient-blue--light tn-color-blue">
              <view class="tn-icon-electromobile tn-three"></view>
            </view>  
            <view class="tn-text-center">
              <view class="tn-text-ellipsis tn-text-xl tn-text-bold">外卖配送</view>
              <view class="tn-text-ellipsis tn-color-gray--dark tn-padding-top-sm">无接触配送</view>
            </view>
          </view>
        </view>
      </view>
      
      <view class="tn-info__container tn-flex tn-flex-wrap tn-flex-col-center tn-flex-row-between tn-margin" style="padding-top: 15rpx;">
        <block v-for="(item, index) in tuniaoData" :key="index">
          <view class="tn-info__item tn-flex tn-flex-direction-row tn-flex-col-center tn-flex-row-between tn-color-white tea-shadow">
            <view class="tn-info__item__left tn-flex tn-flex-direction-row tn-flex-col-center tn-flex-row-left">
              <view class="tn-info__item__left--icon tn-flex tn-flex-col-center tn-flex-row-center" :class="[`tn-color-${item.color}--disabled`]">
                <view :class="[`tn-icon-${item.icon}`]"></view>
              </view>
              <view class="tn-info__item__left__content">
                <view class="tn-info__item__left__content--title tn-text-bold tn-text-xl tn-color-black">{{ item.title }}</view>
                <!-- <view class="tn-info__item__left__content--data tn-padding-top-xs">
                {{ item.value }}
                <text class="tn-icon-right tn-padding-left-xs"></text>
                </view> -->
              </view>
            </view>
            <!-- <view class="tn-info__item__right">
              <view class="tn-info__item__right--icon">
                <view :class="[`tn-icon-${item.icon}`]"></view>
              </view>
            </view> -->
          </view>
        </block>
      </view>
    </view>
    
    <!-- 底部tabbar start-->
    <view class="tabbar footerfixed">
      <view class="action">
        <view class="bar-icon">
          <!-- <view class="tn-icon-home-smile">
          </view> -->
          <image class="" src='https://resource.tuniaokj.com/images/tabbar/shop-home.png'></image>
        </view>
        <view class="tn-color-black">门店</view>
      </view>
      <view class="action">
        <view class="bar-icon">
          <!-- <view class="tn-icon-watercup tn-color-gray">
          </view> -->
          <image class="" src='https://resource.tuniaokj.com/images/tabbar/shop-buy.png'></image>
        </view>
        <view class="tn-color-gray">点餐</view>
      </view>
      <view class="action">
        <view class="bar-icon">
          <!-- <view class="tn-icon-shop tn-color-gray">
          </view> -->
          <image class="" src='https://resource.tuniaokj.com/images/tabbar/shop-shop.png'></image>
        </view>
        <view class="tn-color-gray">商城</view>
      </view>
      <view class="action">
        <view class="bar-icon">
          <!-- <view class="tn-icon-ticket tn-color-gray">
          </view> -->
          <image class="" src='https://resource.tuniaokj.com/images/tabbar/shop-list.png'></image>
        </view>
        <view class="tn-color-gray">订单</view>
      </view>
      <view class="action">
        <view class="bar-icon">
          <!-- <view class="tn-icon-my tn-color-gray">
          </view> -->
          <image class="" src='https://resource.tuniaokj.com/images/tabbar/shop-my.png'></image>
        </view>
        <view class="tn-color-gray">我的</view>
      </view>
    </view>
    <view class="tn-padding-xl"></view>
    
    <!-- 回到首页悬浮按钮-->
    <nav-index-button></nav-index-button>
    
  </view>
</template>

<script>
  import template_page_mixin from '@/libs/mixin/template_page_mixin.js'
  import NavIndexButton from '@/libs/components/nav-index-button.vue'
  export default {
    name: 'TemplateCourse',
    mixins: [template_page_mixin],
    components: { NavIndexButton },
    data(){
      return {
        cardCur: 0,
        swiperList: [{
          id: 0,
          type: 'image',
          title: 'BUG再多',
          name: '也别忘了',
          text: '我无限续杯',
          url: 'https://resource.tuniaokj.com/images/shop/cup1.jpg',
        }, {
          id: 1,
          type: 'image',
          title: '图鸟南南',
          name: '欢迎加入东东们',
          text: '如果你也有不错的作品',
          url: 'https://resource.tuniaokj.com/images/swiper/read.jpg',
        }, {
          id: 2,
          type: 'image',
          title: '图鸟西西',
          name: '一起玩转scss',
          text: '用最少的代码做最骚的效果',
          url: 'https://resource.tuniaokj.com/images/swiper/deer.jpg',
        }, {
          id: 3,
          type: 'image',
          title: '图鸟北北',
          name: '微信号 tnkewo',
          text: '商业合作请联系作者',
          url: 'https://resource.tuniaokj.com/images/swiper/swiper3.jpg',
        }, {
          id: 4,
          type: 'image',
          title: '图鸟猪猪',
          name: '努力成为大佬',
          text: '一起加油吖',
          url: 'https://resource.tuniaokj.com/images/shop/banner2.jpg',
        }],
        tuniaoData: [
          {
            title: '开通会员',
            icon: 'vip-fill',
            color: 'red',
            value: '我就看看'
          },
          {
            title: '来场约惠',
            icon: 'tag-fill',
            color: 'blue',
            value: '我就看看'
          },
          {
            title: '放肆开玩',
            icon: 'game-fill',
            color: 'orange',
            value: '我就看看'
          },
          {
            title: '加盟开店',
            icon: 'commissary-fill',
            color: 'green',
            value: '我就看看'
          }
        ]
      }
    },
    methods: {
      // cardSwiper
      cardSwiper(e) {
        this.cardCur = e.detail.current
      },
    }
  }
</script>

<style lang="scss" scoped>
  @import '@/static/css/templatePage/custom_nav_bar.scss';
 
  /* 头像 start*/
  .user-avatar{
    width: 90rpx;
    height: 90rpx;
    border-radius: 50%;
    overflow: hidden;
  }
  /* 内容布局 start*/
  .tea-shadow{
    box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.07);
  }
  .tea-user {
    
    &__wrap {
      position: relative;
      z-index: 1;
      margin: 20rpx 30rpx;
      margin-top: -80rpx;
    }
  }
  .tea-radius{
    border-radius: 15rpx;
  }
  
  /* 轮播视觉差 start */
  .card-swiper {
    height: 800rpx !important;
  }
    
  .card-swiper swiper-item {
    width: 750rpx !important;
    left: 0rpx;
    box-sizing: border-box;
    // padding: 0rpx 30rpx 90rpx 30rpx;
    overflow: initial;
  }
    
  .card-swiper swiper-item .swiper-item {
    width: 100%;
    display: block;
    height: 100%;
    transform: scale(1);
    transition: all 0.2s ease-in 0s;
    overflow: hidden;
  }
    
  .card-swiper swiper-item.cur .swiper-item {
    transform: none;
    transition: all 0.2s ease-in 0s;
  }
    
  .card-swiper swiper-item .swiper-item-text {
    margin-top: -320rpx;
    width: 100%;
    display: block;
    height: 50%;
    border-radius: 10rpx;
    transform: translate(100rpx, -60rpx) scale(0.9, 0.9);
    transition: all 0.6s ease 0s;
    overflow: hidden;
  }
    
  .card-swiper swiper-item.cur .swiper-item-text {
    margin-top: -380rpx;
    width: 100%;
    transform: translate(0rpx, 0rpx) scale(0.9, 0.9);
    transition: all 0.6s ease 0s;
  }
  
  .image-banner{
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .image-banner image{
    width: 100%;
    height: 100%;
  }
  
  /* 轮播指示点 start*/
  .indication{
    z-index: 9999;
    width: 100%;
    height: 36rpx;
    position: absolute;
    display:flex;
    flex-direction:row;
    align-items:center;
    justify-content:center;
  }
  
  .spot{
    background-color: #FFFFFF;
    opacity: 0.6;
    width: 10rpx;
    height: 10rpx;
    border-radius: 20rpx;
    top: -130rpx;
    margin: 0 8rpx !important;
    position: relative;
  }
  
  .spot.active{
    opacity: 1;
    width: 30rpx;
    background-color: #FFFFFF;
  }
  
  /* 图标容器12 start */
  .tn-three{
      position: absolute;
      top: 48%;
      right: 50%;
      bottom: 50%;
      left: 52%;
      transform: translate(-38rpx, -16rpx) rotateX(0deg) rotateY(10deg) rotateZ(-20deg);
      text-shadow: -1rpx 2rpx 0 #f0f0f0, -2rpx 4rpx 0 #f0f0f0, -10rpx 20rpx 30rpx rgba(0, 0, 0, 0.2);
  }
  .icon12 {
    &__item {
      width: 30%;
      background-color: #FFFFFF;
      border-radius: 10rpx;
      padding: 30rpx;
      margin: 20rpx 10rpx;
      transform: scale(1);
      transition: transform 0.3s linear;
      transform-origin: center center;
      
      &--icon {
        width: 100rpx;
        height: 100rpx;
        font-size: 60rpx;
        border-radius: 50%;
        margin-bottom: 18rpx;
        position: relative;
        z-index: 1;
        
        &::after {
          content: " ";
          position: absolute;
          z-index: -1;
          width: 100%;
          height: 100%;
          left: 0;
          bottom: 0;
          border-radius: inherit;
          opacity: 1;
          transform: scale(1, 1);
          background-size: 100% 100%;
          background-image: url(https://resource.tuniaokj.com/images/cool_bg_image/icon_bg.png);
  
            
        }
      }
    }
  }
  /* 业务展示 start */
  .tn-info {
    
    &__container {
      margin-top: 10rpx;
      margin-bottom: 50rpx;
    }
    
    &__item {
      width: 48%;
      margin: 15rpx 0rpx;
      padding: 40rpx 30rpx;
      border-radius: 15rpx;
      
  
        position: relative;
        z-index: 1;
        
        &::after {
          content: " ";
          position: absolute;
          z-index: -1;
          width: 100%;
          height: 100%;
          left: 0;
          bottom: 0;
          border-radius: inherit;
          opacity: 1;
          transform: scale(1, 1);
          background-size: 100% 100%;
          background-image: url(https://resource.tuniaokj.com/images/cool_bg_image/6.png);
        }
      
      &__left {
        
        &--icon {
          width: 80rpx;
          height: 80rpx;
          border-radius: 50%;
          font-size: 70rpx;
          margin-right: 20rpx;
          position: relative;
          z-index: 1;
        }
        
        &__content {
          font-size: 30rpx;
          
          &--data {
            margin-top: 5rpx;
            font-weight: bold;
          }
        }
      }
      
      &__right {
        &--icon {
          position: absolute;
          right: 0upx;
          top: 50upx;
          font-size: 100upx;
          width: 108upx;
          height: 108upx;
          text-align: center;
          line-height: 60upx;
          opacity: 0.1;  
        }
      }
    }
  }
  /* 业务展示 end */
  
  /* 底部tabbar start*/
  .footerfixed{
   position: fixed;
   width: 100%;
   bottom: 0;
   z-index: 999;
   background-color: #FFFFFF;
   box-shadow: 0rpx 0rpx 30rpx 0rpx rgba(0, 0, 0, 0.07);
  }
  
  .tabbar {
    display: flex;
    align-items: center;
    min-height: 110rpx;
    justify-content: space-between;
  	padding: 0;
  	height: calc(110rpx + env(safe-area-inset-bottom) / 2);
  	padding-bottom: calc(env(safe-area-inset-bottom) / 2);
  }
  
  .tabbar .action {
  	font-size: 22rpx;
  	position: relative;
  	flex: 1;
  	text-align: center;
  	padding: 0;
  	display: block;
  	height: auto;
  	line-height: 1;
  	margin: 0;
  	overflow: initial;
  }
  
  .tabbar .action .bar-icon {
  	width: 100rpx;
  	position: relative;
  	display: block;
  	height: auto;
  	margin: 0 auto 10rpx;
  	text-align: center;
  	font-size: 42rpx;
  }
  
  .tabbar .action .bar-icon image {
  	width: 50rpx;
  	height: 50rpx;
  	display: inline-block;
  }
  
</style>
