<template>
  <div class="aff_list_com">

    <van-nav-bar title="我的邀请" left-text="返回" @click-left="$route_back" left-arrow>

    </van-nav-bar>
      <div @click="runtoCity">定位城市</div>
    <div class="aff_list_com_body_com has_header">
    
      <scroller ref="my_scroller" :on-refresh="refresh" :on-infinite="infinite">

      <div style="height: 0.16rem;"></div>
              <div class="aff_list_com_box">

<div class="aff_list_item" v-for="(item,index) in list" :key="index" @click="$router.push({name:'chat', query:{touser:item.id}})">
  <div class="info_username">手机：{{item.invited.mobile}}</div>
  <div class="reg_time">注册时间：{{item.createtime | datetime}}</div>
</div>



        </div>
      </scroller>
    </div>
    <!-- sku -->

  </div>
</template>

<script>
  import Vue from 'vue'
  import {Lazyload} from 'vant'
  import {getToken} from '@/utils/auth'
  import moment from 'moment'
  Vue.use(Lazyload)
  import request from '@/utils/request'
  //impor citySearch from '@/components/common/citySearch'

  export default {
    //  components:{
    //    citySearch
    // },
    data: function () {

      let sku = {
        // 所有sku规格类目与其值的从属关系，比如商品有颜色和尺码两大类规格，颜色下面又有红色和蓝色两个规格值。
        // 可以理解为一个商品可以有多个规格类目，一个规格类目下可以有多个规格值。
        tree: [],
        // 所有 sku 的组合列表，比如红色、M 码为一个 sku 组合，红色、S 码为另一个组合
        list: [],
        price: '0', // 默认价格（单位元）
        stock_num: 0, // 商品总库存
        collection_id: 0, // 无规格商品 skuId 取 collection_id，否则取所选 sku 组合对应的 id
        none_sku: true, // 是否无规格商品
        messages: [],
        hide_stock: false // 是否隐藏剩余库存
      }

      return {
        showCustomAction: false,
        initialSku: sku,
        sku: sku,
        goods: {title: '', picture: ''},
        list: [],
        filter: {
          page: 1,
          fliter:{}
        }
      }
    },
    created () {

      this.$nextTick(() => {

        this.$refs.my_scroller.finishInfinite(false)

      })
      if(this.$route.query.category_id > 0){
        this.filter['category_id'] = this.$route.query.category_id
      }
    },

    filters: {
      parsePriceInt (val) {
        return Math.floor(val)
      },
      parsePriceFloat (val) {
        let arr = val.toString().split('.')
        if (arr.length > 1) {
          return '.' + arr[1]
        }
        return ''
      },
      datetime(val){
        return moment(val*1000).format('YYYY-MM-DD HH:mm')
      }
    },

    methods: {
      runtoCity() {
        this.$router.push({
          name:'citySearch'
        })
      },
      get_list (done) {
        let self = this
        request('get','/index/invite/index_ajax.html',this.filter).then((res) => {
          done()
          self.$refs.my_scroller.finishInfinite(res.data.data.data.length == 0)
          for (let i in res.data.data.data) {
            self.list.push(res.data.data.data[i])
          }
          self.filter.page++
        })
      },
      refresh (done) {
        let self = this
        setTimeout(() => {
          this.filter.page = 1
          this.get_list(function () {
            self.list = []
            done()
          })
        }, 100)
      },
      del (id, index) {
        request('get','/public/index.php/index/address/del',{id: id}).then((res) => {
          if (res.data.code == 1) {
            this.$toast(res.data.msg)
            this.list.splice(index, 1)
          } else {
            this.$toast(res.data.msg)
          }
        })
      },
      infinite (done) {
        this.get_list(done)
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss">
  .aff_list_com {
    background-color: #f5f5f5;
  }

  .aff_list_com_box {
    padding: 0 0.08rem;
  }

  .aff_list_com_item_box {
    background-color: #fff;
    border-radius: 0.1rem;
    margin: 0.08rem;
    overflow: hidden;
    margin-top: 0.2rem;
    padding-bottom: 0.2rem;
  }

  .aff_list_com_item .aff_list_com_link {
    display: block;
  }

  .aff_list_com_item .aff_list_com_image {
    max-width: 100%;
  }

  .aff_list_com_text {
    padding: 0 0.16rem;
  }

  .aff_list_com_goods_name {
    line-height: 1.75;
    font-size: 0.32rem;
    font-weight: normal;
    margin: 0;
  }

  .aff_list_com_price {
    color: #ff4a39;
  }

  .aff_list_com_price .aff_list_com_char {
    font-size: 0.2rem;
    margin-right: 0.1rem;
  }

  .aff_list_com_price .aff_list_com_price_number {
    font-size: 0.32rem;
    letter-spacing: 0.03rem;
  }

  .aff_list_com_price .price_small {
    font-size: 0.2rem;
  }

  .aff_list_com_shopping_cart {
    float: right;
    font-size: 0.36rem;
    margin-top: 0.1rem;
    margin-right: 0.1rem;
  }
  .aff_list_com_body_com{height: calc(100vh - 1rem); position: relative;}
  .aff_list_com_body_com.has_header{height: calc(100vh - 0.92rem);}




.aff_list_item{font-size:0.32rem; color:#333; background-color: #fff; padding:0.16rem; margin-bottom:0.16rem;}
 .info_name{}
 .info_username{}
  .info_level_name{}
  .reg_time{color:#999;}
</style>
