<template>
  <view class="pintuanorder">
    <view class="ordertop">
      <orderTab tabtittle="全部,待成团,已成团,拼团失败" v-on:tabchange="change1"></orderTab>
    </view>

    <view class="orders" v-if="state==3">
        <view class="orderitem" v-for="(i,j) in orderlist" :key="j">
          <pintuanorderitem
            :shoppic="i.imgpaththumb"
            :shopname="i.goods_name"
            :num="i.rs_num"
            :money="i.price"
            :state="i.state"
             :sid="i.pintuan_order_id"
            :is_tuikuan="i.is_tuikuan"
    :shopid="i.goods_id"

          ></pintuanorderitem>
        </view>
    </view>
    <view class="orders" v-if="state==0">
         <view class="orderitem" v-for="(i,j) in orderlist" :key="j">
          <pintuanorderitem
            :shoppic="i.imgpaththumb"
            :shopname="i.goods_name"
            :num="i.rs_num"
            :money="i.price"
              :state="i.state"
             :sid="i.goods_pt_id"
            :is_tuikuan="i.is_tuikuan"
    :shopid="i.goods_id"
          ></pintuanorderitem>
        </view>
    </view>
    <view class="orders" v-if="state==1">
         <view class="orderitem" v-for="(i,j) in orderlist" :key="j">
          <pintuanorderitem
            :shoppic="i.imgpaththumb"
            :shopname="i.goods_name"
            :num="i.rs_num"
            :money="i.price"
             :state="i.state"
             :sid="i.goods_pt_id"
            :is_tuikuan="i.is_tuikuan"

    :shopid="i.goods_id"
          ></pintuanorderitem>
        </view>
    </view>
    <view class="orders" v-if="state==2">
      <view class="orderitem">
        <view class="ordernull" v-if="ifnull">
          <!-- <offerList picurl="../../static/img/offer-none.png" desc="亲，你还没有订单哦～"></offerList> -->
        </view>
           <view class="orderitem" v-for="(i,j) in orderlist" :key="j">
          <pintuanorderitem
            :shoppic="i.imgpaththumb"
            :shopname="i.goods_name"
            :num="i.rs_num"
            :money="i.price"
              :state="i.state"
             :sid="i.goods_pt_id"
    :shopid="i.goods_id"
            :is_tuikuan="i.is_tuikuan"

          ></pintuanorderitem>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import orderTab from "../../components/order/order-tab";
import orderItem from "../../components/order/orderitem";
import pintuanorderitem from "../../components/order/pintuanorderitem";
import { requestP } from "../../static/js/request";
export default {
  components: {
    orderTab,
    orderItem,
    pintuanorderitem
  },
  data() {
    return {
      state: 3,
      orderlist:[]
    };
  },
  methods: {
    change1(data) {
      console.log(data, 42);
      this.state = data;
      if(data==3){
            requestP({
        url: "pintuan/get_list_my_pintuan",
        data: {
          
        }
      }).then((res)=>{
        console.log(res)
        this.orderlist=res.data.data
      })
      }else{
        requestP({
        url: "pintuan/get_list_my_pintuan",
        data: {
          type:data
        }
      }).then((res)=>{
        console.log(res)
        this.orderlist=res.data.data

      })
      }
      
    }
  },
  onLoad() {
         requestP({
        url: "pintuan/get_list_my_pintuan",
        data: {
    
        }
      }).then((res)=>{
        console.log(res)
        this.orderlist=res.data.data
      })
  }
};
</script>

<style lang="scss">
Page {
  background-color: #f0f2f5;
}
.pintuanorder {
  .orderitem {
    margin-top: 21upx;
  }
}
</style>