<template>
  <view class="pintuanshop">
    <pintuanshopNav v-on:selected="navitem" :navlist="navlist"></pintuanshopNav>
    <pintuanshopLine></pintuanshopLine>
    <view class="shoplist" v-for="(item,index) in shoplist" :key="index" v-show="cupage == index">
     <!-- {{cupage == index ? true : false}} -->
       <view class="shoplistitem" v-for="(i,j) in item.goods_list" :key="j">
        <pintuanshops
          :shoppic="i.imgpaththumb"
          :shopname="i.goods_name"
          :pri="i.price"
          :huaxian="i.price_y"
          :yipin="i.yp_num"
          :shopid="i.goods_pt_id"
        ></pintuanshops>
     </view>
      
      <!-- <view class="shoplistitem">
        <pintuanshops></pintuanshops>
      </view>
      <view class="shoplistitem">
        <pintuanshops></pintuanshops>
      </view>
      <view class="shoplistitem">
        <pintuanshops></pintuanshops>
      </view>
      <view class="shoplistitem">
        <pintuanshops></pintuanshops>
      </view>
      <view class="shoplistitem">
        <pintuanshops></pintuanshops>
      </view>
      <view class="shoplistitem">
        <pintuanshops></pintuanshops>
      </view>-->
    </view>

    <!-- <view class="shoplist" v-if="cupage==2">
      <view class="shoplistitem">
        <pintuanshops></pintuanshops>
      </view>
    </view>

    <view class="shoplist" v-if="cupage==3">
      <view class="shoplistitem">
        <pintuanshops></pintuanshops>
      </view>
      <view class="shoplistitem">
        <pintuanshops></pintuanshops>
      </view>
    </view>-->
  </view>
</template>

<script>
import pintuanshopNav from "../../components/pintuanshop/pintuanshop-nav";
import pintuanshopLine from "../../components/pintuanshop/pintuanshop-line";
import pintuanshops from "../../components/pintuanshop/pintuanshops";
import requestP from "../../static/js/request.js";
export default {
  data() {
    return {
      cupage: 0,
      navlist: [],
      shoplist: []
    };
  },
  components: {
    pintuanshopNav,
    pintuanshopLine,
    pintuanshops
  },
  onLoad() {
    requestP
      .requestP({
        url: "Pintuan/get_list_pintuan"
      })
      .then(res => {
        console.log(res);
        for (let i in res.data.data) {
          this.navlist.push(res.data.data[i].cat_name);
        }
        this.shoplist = res.data.data;
        console.log(this.navlist);
      });
  },
  methods: {
    navitem(e) {
      console.log(e, "aaa");
      this.cupage = e;
    }
  }
};
</script>

<style lang="scss">
Page {
  background-color: #eeeeee;
}
.pintuanshop {
  .shoplist {
    // display: flex;
    flex-wrap: wrap;
    .shoplistitem {
      float: left;
      margin-right: 7upx;
      margin-bottom: 11upx;
    }
  }
}
</style>