<template>
  <div class="service">
    <image src="https://cdn.sinoecare.com/i/2024/11/27/6746d227e20be.png" class="headerBanner" mode="widthFix"/>
    <div class="service-list" v-if="list.length">
      <div class="service-item" hover-class="bg-hover" @click="toDetail('./detail?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>

    <AiEmpty description="暂无数据" class="emptyWrap" v-else></AiEmpty>

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

<script>
export default {
  name: 'AppProgressNew',
  appName: '办事指南',
  data() {
    return {
      id: '',
      title: '',
      subTitle: '',
      current: 1,
      list: [],
      pages: 2
    }
  },

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

  methods: {
    getList() {
      if (this.current > this.pages) return
      this.$instance.post(`/app/approval-process-def/list-xcx?processType=2`, null, {
        params: {
          size: 20,
          current: this.current
        },
        withoutToken: true,
      }).then((res) => {
        if (res.code === 0) {
          const list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
          this.pages = res.data.pages
          this.list = list
        }
      })
    },

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

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

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

  .headerBanner {
    width: 100vw;
    height: auto;
  }
}

.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>
