<template>
  <view class="dt-page">
    <block v-if="emptyType == 0">
      <view class="data_wrap">
        <DtGoodsList :dataList="dataList" />
      </view>
      <DtNoMore v-if="isNoMore" />
    </block>
    <DtEmpty :type="emptyType" />
  </view>
</template>
<script>
import DtGoodsList from '../comps/dt_goods_list.vue'
import DtNoMore from '../comps/dt_no_more.vue'
import DtEmpty from '../comps/dt_empty.vue'

export default {
  components: {
    DtGoodsList,
    DtNoMore,
    DtEmpty
  },
  data() {
    return {
      dataList: [],
      memberId: 0
    }
  },
  methods: {

    async queryDataList() {
      if (this.isPull) {
        this.isNoMore = false
        this.pageIndex = 0
        this.dataList.length = 0
      }
      let resp = await this.$api.getMyFavoriteProduct({
        _isShowLoading: true,
        memberId: this.memberId,
        pageNo: this.pageIndex,
        pageSize: this.pageSize
      })
      let list = this.getDataList(resp)
      this.dataList = this.dataList.concat(list)
    },
    onLoadPage() {
	  wx.hideShareMenu();
      this.memberId = this.$auth.getMemberId()
      this.queryDataList()
    },
  },
  onShow() {
    this.onShowPage()
  },
  onReachBottom() {
    this.onReachBottomPage()
  }
}
</script>

<style lang="scss" scoped>
.dt-page {
  min-height: 100vh;
  background-color: #f2f2f2;
}
.data_wrap {
  background: #fff;
}
</style>