<template>
  <view>
    <swipers :list="lb"></swipers>
    <search text="超级秒杀！轮胎99元起"></search>
    <view class="baoyang">
      <indexSelect></indexSelect>
      <view class="box">
        <view @click="baoyang">
          <indexIcon imgurl="../../static/img/fdj.png" desc="发动机养护" choosecolor="1"></indexIcon>
        </view>
        <view @click="baoyang">
          <indexIcon imgurl="../../static/img/ranyou.png" desc="燃油系统养护" choosecolor="2"></indexIcon>
        </view>
        <view @click="baoyang">
          <indexIcon imgurl="../../static/img/fdjyh.png" desc="发动机舱清洗" choosecolor="3"></indexIcon>
        </view>
        <view @click="baoyang">
          <indexIcon imgurl="../../static/img/qys.png" desc="前雨刷" choosecolor="4"></indexIcon>
        </view>
      </view>
      <view class="box">
        <view @click="baoyang">
          <indexIcon imgurl="../../static/img/kt.png" desc="空调系统养护" choosecolor="4"></indexIcon>
        </view>
        <view @click="baoyang">
          <indexIcon imgurl="../../static/img/lq.png" desc="冷却系统养护" choosecolor="5"></indexIcon>
        </view>
        <view @click="baoyang">
          <indexIcon imgurl="../../static/img/yq.png" desc="引擎系统养护" choosecolor="6"></indexIcon>
        </view>
        <view @click="baoyang">
          <indexIcon imgurl="../../static/img/daolu.png" desc="道路救援 " choosecolor="7"></indexIcon>
        </view>
      </view>
    </view>
    <view class="tianjia" @click="addcar">
      <indexAddcar></indexAddcar>
    </view>
    <view @click="ad1">
      <indexAd :ad="ad"></indexAd>
    </view>

    <view class="miaosha">
      <view class="title">
        <indexSpike title="天天秒杀"></indexSpike>
      </view>
      <scroll-view :scroll-x="true">
        <view class="body">
          <view class="miaoshabox" v-for="(item,index) in ms" :key="index">
            <indexMiaosha1
              :huaxian="item.price_y"
              :imgpic="item.imgpaththumb"
              :msid="item.id"
              :price="item.price"
              :xiangou="item.ms_num"
            ></indexMiaosha1>
          </view>
          <!-- <view class="miaoshabox">
            <indexMiaosha1></indexMiaosha1>
          </view>
          <view class="miaoshabox">
            <indexMiaosha1></indexMiaosha1>
          </view>
          <view class="miaoshabox">
            <indexMiaosha1></indexMiaosha1>
          </view>

          <view class="miaoshabox">
            <indexMiaosha1></indexMiaosha1>
          </view>
          <view class="miaoshabox">
            <indexMiaosha1></indexMiaosha1>
          </view>
          <view class="miaoshabox">
            <indexMiaosha1></indexMiaosha1>
          </view>
          <view class="miaoshabox">
            <indexMiaosha1></indexMiaosha1>
          </view>-->
          <!-- <indexMiaosha class="box" choose="3" price="0.01"></indexMiaosha> -->
        </view>
      </scroll-view>
    </view>
    <view class="miaosha">
      <view class="title">
        <indexSpike title="拼团购"></indexSpike>
      </view>
      <view class="box">
        <view @click="gotodetail" v-for="(item,index) in pintuan" :key="index" :data-id="item.id">
          <indexShopdetail
            :picurl="item.imgpaththumb"
            :ifbk="item.isbk"
            :shopname="item.goods_name"
            :pri="item.price"
            :sale="item.yp_num"
            :ptid="item.id"
          ></indexShopdetail>
        </view>

        <!-- <view @click="gotodetail">
          <indexShopdetail
            picurl="/static/img/shoppic.png"
            ifbk="true"
            shopname="轮胎/汽车轮胎 205/55R16 91V 韧悦 ENERGY XM2"
            pri="520"
            sale="200"
          ></indexShopdetail>
        </view>

        <view @click="gotodetail">
          <indexShopdetail
            picurl="/static/img/shoppic.png"
            ifbk="true"
            shopname="轮胎/汽车轮胎 205/55R16 91V 韧悦 ENERGY XM2"
            pri="520"
            sale="200"
          ></indexShopdetail>
        </view>

        <view @click="gotodetail">
          <indexShopdetail
            picurl="/static/img/shoppic.png"
            ifbk="true"
            shopname="轮胎/汽车轮胎 205/55R16 91V 韧悦 ENERGY XM2"
            pri="520"
            sale="200"
          ></indexShopdetail>
        </view>

        <view @click="gotodetail">
          <indexShopdetail
            picurl="/static/img/shoppic.png"
            ifbk="true"
            shopname="轮胎/汽车轮胎 205/55R16 91V 韧悦 ENERGY XM2"
            pri="520"
            sale="200"
          ></indexShopdetail>
        </view>

        <view @click="gotodetail">
          <indexShopdetail
            picurl="/static/img/shoppic.png"
            ifbk="true"
            shopname="轮胎/汽车轮胎 205/55R16 91V 韧悦 ENERGY XM2"
            pri="520"
            sale="200"
          ></indexShopdetail>
        </view>-->
      </view>
    </view>
    <view class="tabbar">
      <tabbar></tabbar>
    </view>
  </view>
</template>
<style lang="scss">
.baoyang {
  width: 720upx;
  // height: 643upx;
  border-radius: 14upx 14upx 0 0;
  margin-left: 15upx;
  position: relative;
  top: -54upx;
  background-color: #fff;
  box-shadow: 0px 0px 18upx 2upx rgba(49, 49, 49, 0.13);
  .box {
    padding-top: 43upx;
    padding-bottom: 33upx;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
  }
}
.tianjia {
  margin-left: 15upx;
  margin-top: -15upx;
}
.miaosha {
  width: 710upx;
  // height: 643upx;
  border-radius: 14upx 14upx 0 0;
  margin-left: 20upx;
  // position: relative;
  // top: -54upx;
  background-color: #fff;
  box-shadow: 0px 0px 18upx 2upx rgba(49, 49, 49, 0.13);
  margin-bottom: 31upx;
  padding-bottom: 20upx;
  .title {
    padding-left: 16upx;
    padding-top: 31upx;
  }
  .body {
    padding: 27upx 16upx 43upx 16upx;
    display: flex;
    height: 195upx;
    .box {
      padding-right: 49upx;
    }
    .miaoshabox {
      margin-right: 41upx;
    }
  }
  .box {
    width: 640upx;
    // padding: 42upx 0 0 39upx;
  }
}
.tabbar {
  width: 100%;
  background-color: white;
  position: fixed;
  bottom: 0;
}
</style> 
<script>
import search from "../../components/index/index-search";
import swipers from "../../components/index/index-swiper";
import indexShopdetail from "../../components/index/index-shopdetail";
import indexMiaosha from "../../components/index/index-miaosha";
import indexAd from "../../components/index/index-ad";
import indexAddcar from "../../components/index/index-addcar";
import indexIcon from "../../components/index/index-icon";
import indexSelect from "../../components/index/index-select";
import indexSpike from "../../components/index/index-spike";
import tabbar from "../../components/tabbar/tabbar";
import indexMiaosha1 from "../../components/index/index-miaosha1";
import requestP from "../../static/js/request.js";
export default {
  data() {
    return {
      lb: [
        "../../static/img/swiper.png",
        "../../static/img/swiper.png",
        "../../static/img/swiper.png"
      ],
      ad: "",
      ms: [],
      pintuan: []
    };
  },
  components: {
    search,
    swipers,
    indexShopdetail,
    indexMiaosha,
    indexAd,
    indexAddcar,
    indexIcon,
    indexSelect,
    indexSpike,
    tabbar,
    indexMiaosha1
  },
  onLoad() {
    // requestP.requestP({
    //   url:"baoyang/get_baoyang_list"
    // }).then((res)=>{
    //   console.log(res)
    // })
    requestP
      .requestP({
        url: "Index/index"
      })
      .then(res => {
        console.log(res);
        // console.log(res.data.data.lunbotu)
        this.lb = res.data.data.lunbotu;
        this.ad = res.data.data.guanggao.imgpath;
        this.ms = res.data.data.miaosha_goods;
        this.pintuan = res.data.data.pintuan_goods;
        console.log(this.ad);
        this.list = res.data.data;
      });
  },
  methods: {
    addcar() {
      console.log(900);
      uni.navigateTo({
        url: "/pages/ceshi/ceshi"
      });
    },
    gotodetail(e) {
      console.log(e);
      uni.navigateTo({
        url:
          "/pages/pintuanshopdetail/pintuanshopdetail?shopid=" +
          e.currentTarget.dataset.id
      });
    },
    ad1() {
      uni.navigateTo({
        url:
          "/pages/shopdetail/shopdetail?shopid=" + this.list.guanggao.goods_id
      });
    },
    baoyang(){
           uni.navigateTo({
                        url:"/pages/choosebaoyang/choosebaoyang"
                    })
    }
  }
};
</script>