<template>
  <div class="service">
    <div class="service-list">
      <div class="service-item" hover-class="bg-hover" @click="toDetail('./notice?id=' + item.id)" v-for="(item, index) in list" :key="index">
        <div class="service-item__wrapper">
          <h2>{{ item.processName }}</h2>
          <i class="iconfont">&#xe6ae;</i>
        </div>
      </div>
    </div>

    <!-- <u-loadmore :status="loadingStatus" :margin-top="30" :margin-bottom="30" color="#999" font-size="26" /> -->
  </div>
</template>

<script>
export default {
  appName:"网上办事",
  data() {
    return {
      id: '',
      title: '',
      subTitle: '',
      current: 0,
      list: [],
      // loadingStatus: 'loadmore',
    }
  },

  onLoad(query) {
    this.id = query.id
    this.getList()
    uni.setNavigationBarTitle({
      title: query.title,
    })
  },

  methods: {
    getList() {
      // this.loadingStatus = 'loading'
      this.$instance
        .post(`/app/approval-process-def/list-xcx?processType=0`, null, {
          params: {
            size: 10000,
            classificationId: this.id,
          },
          withoutToken: true,
        })
        .then((res) => {
          if (res.code === 0) {
            // if (!res.data.records.length) {
            //   this.loadingStatus = 'nomore'
            //   return false
            // }

            const data = res.data.records.map((item) => {
              return item
            })
            if (this.current === 0) this.list = []

            this.list.push(...data)
            this.current = this.current + 1
            // this.loadingStatus = 'loadmore'

            // if (this.list.length < 10) {
            //   this.loadingStatus = 'nomore'
            // }
          }
        })
    },

    toDetail(url) {
      this.$linkTo(url)
    },
  },

  onReachBottom() {
    this.getList()
  },
}
</script>

<style scoped lang="scss">
.service {
  padding-bottom: 40px;
}

.service-list {
  background-color: #fff;

  .service-item {
    height: 116px;
    padding: 0 32px;

    &:last-child {
      .service-item__wrapper {
        border-bottom: none;
      }
    }

    .service-item__wrapper {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 116px;
      border-bottom: 1px solid #d8dde6;

      h2 {
        color: #333333;
        font-size: 32px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      i {
        position: relative;
        right: -4px;
        font-size: 36px;
        color: #c9c9cd;
      }
    }
  }
}
</style>
