<template>
  <view class="package__view">
    <view v-for="packageItem in list" :key="packageItem.id">
      <detectPackageCard :data="packageItem"></detectPackageCard>
    </view>
  </view>
</template>

<script>
  import detectPackageCard from '../detectPackageCard.vue'

  export default {
    components: {
      detectPackageCard,
    },
    data() {
      return {
        list: [],
      }
    },
    created() {
      this.getData()
    },
    methods: {
      async getData() {
        console.log('getData')
        try {
          const queryParams = {
            pageNo: 1,
            // todo: check
            pageSize: 3,
            type: 1, // 产品类型（0营养剂，1预约，2课程）
            isMeal: 'Y',
          }
          this.list = (await this.$fetch('getProductList', queryParams))?.records || []
        } catch (err) {
          console.log('getData err', err)
        }
      },
    },
  }
</script>

<style scoped lang="scss">
.package__view {
  width: 100%;
  padding: 0 32rpx;
  box-sizing: border-box;
}

</style>