<template>
  <view class="mine">
    <mineTop ></mineTop>
    <view class="menu">
      <mineMenu @select="select"></mineMenu>
    </view>
    <view class="btns">
      <view @click="goshopping">
         <mineBtn title="购物车"></mineBtn>
      </view>
     <view @click="yhq1">
         <mineBtn title="优惠券"></mineBtn>
     </view>
    
      <view @click="tocheku">
        <mineBtn title="爱车档案" ></mineBtn>
      </view>
      <view class="youhui" v-if="ifyh" >
      <youhui
        :ifyouhui="ifyh"
        v-on:off="off"
        :yhqall="yhq"
        ifget="true"
        @yhqpri="yhqpri"
        @yhqid="yhqids"
      ></youhui>
    </view>
      <!-- <mineBtn title="联系我们"></mineBtn> -->
      <!-- <mineBtn title="关于我们"></mineBtn>
      <mineBtn title="意见反馈"></mineBtn> -->
    </view>
    	<view class="tabbar">
			<tabbar page=4></tabbar>
		</view>
  </view>
  
</template>

<script>
import mineTop from "../../components/mine/mine-top";
import mineMenu from "../../components/mine/mine-menu";
import mineBtn from "../../components/mine/mine-btn";
  import tabbar from "../../components/tabbar/tabbar";
  import youhui from "../../components/ordersub/ordersub-youhui";
  import requestP from "../../static/js/request.js";
export default {
  components: {
    mineTop,
    mineMenu,
    mineBtn,
    tabbar,
    youhui
  },
  data(){
    return {
       ifyh: false,
      yhq:[]
    }
  },
  onLoad(){
    requestP.requestP({
      url:"youhuiquan/get_list"
    }).then((res)=>{
      this.yhq=res.data.data
      // this.ifyh=true
    })
  },
  methods:{
    select(e){
      console.log(e)
      uni.navigateTo({
        url:"/pages/orderlist/orderlist?kind="+e
      })
    },
    goshopping(){
      uni.navigateTo({
        url:"/pages/shopping/shopping"
      })
    },
    tocheku(){
       uni.navigateTo({
        url:"/pages/mygarage/mygarage"
      })
    },
    yhq1(){
        if (this.yhq.length == 0) {
        uni.showToast({
          title: "您当前没有可以使用的优惠券",
          icon: "none",
          duration: 2000
        });
        this.yhale = "可以使用的优惠券";
      } else {
        this.ifyh = true;
      }
    },
       off(e) {
      this.ifyh = e;
    },
        yhqpri(e) {
      console.log(e, "qweerew3w");
      this.yhqprice = e;
    },
    yhqids(e) {
      console.log(e, "yhqid111");
      this.yhqid = e;
    },
  }
};
</script>

<style lang="scss">
.menu {
  position: relative;
  bottom: 220upx;
  left: 19upx;
}
.btns {
  position: relative;
  bottom: 180upx;
}
.tabbar{
	    width: 100%;
    background-color: white;
    position: fixed;
    bottom: 0;
}
.youhui {
  position: absolute;
  top: -576upx;
  z-index: 999;
}
</style>