<template>
  <view>
    <view class="box">
      <view class="top">
        <text class="title">业务项</text>
      </view>
    </view>
    <view class="card-box">
      <uni-list>
        <uni-list-item v-for="(item,index) in typeList" link="reLaunch" @click="onClick(item)">
          <template v-slot:body>{{ item.name }}</template>
        </uni-list-item>
      </uni-list>
    </view>
    <noData v-if="typeList.length==0"></noData>
    <u-loadmore style="margin: 30rpx;" :status="status"/>
  </view>

</template>

<script>
export default {
  data() {
    return {
      status: 'loadmore',
      customemrId: '1',
      typeList: [],
      p: {
        pageNo: 1,
        pageSize: 3,
        dataCount: 0
      },
    }
  },
  onShow() {
    this.getGoodsList();
  },
  onBackPress() {
    this.$common.to('/pages/onely-disinfect/Index')
    return true;
  },
  methods: {
    onClick(item) {
      this.$common.to('/pages/onely-disinfect/type-business?goodsJson=' + JSON.stringify(item))
    },
    getGoodsList() {
      this.$api.getGoodsList(this.p).then(resp => {
        this.typeList = resp.data;
      })
    }
  },
  //上拉加载更多，分页模拟数据
  onReachBottom() {
    if (parseInt(this.p.dataCount) > parseInt(this.p.pageSize) * parseInt(this.p.pageNo)) {
      this.status = 'loading';
      this.p.pageSize += 5;
      this.getCarDisinFect();
    } else {
      this.status = 'nomore';
    }
  }

}
</script>

<style lang="scss">
page {
  background-color: #fff;
}

.add {
  position: absolute;
  right: 40 rpx;
  top: -60rpx;
  z-index: 999;
  border: 1 rpx solid #359aff;
  border-radius: 8 rpx;
  color: #c8e4ff;
  padding: 10 rpx 20 rpx;
  font-size: 28 rpx;
}

@import '@/common/common.scss'
</style>
