<template>
  <div class="todoIndex">
      <div class="todoItem" v-for="item in todoList" @tap.stop="toDetail(item)">
        <div class="handleTypeStrTip">{{ item.handleTypeStr }}</div>
         <div class="todoItemTitle">{{ item.title }}</div>
         <div class="submitTime">提交时间：{{ item.createdAt }}</div>
         <div class="submitPerson">提交人：{{ item.srcUserName }}</div>
      </div>
  </div>
</template>

<script>
import { getUserLocalStorageInfo, handleListAll, userHandle, getContractById } from "@/js_sdk/http.js"
export default {
  components: {
  },
  onShow(){
    this.getList()
  },
  data() {
    return {
      getUserLocalStorageInfo: getUserLocalStorageInfo(),
      todoList:[
        // {name:'2024年01月26日~2024年...',handleTypeStr:'企业房源预定'},
        // {name:'空调坏了，不能使用',handleTypeStr:'报事报修-派单'},
        // {name:'上月水费不太对，怀疑水表',handleTypeStr:'报事报修-处理'},
        // {name:'XXXXXXX企业入库审核',handleTypeStr:'企业入库审核'},
        // {name:'2024年01月26日~2024年...',handleTypeStr:'企业房源预定'},
        // {name:'XXXXXXX',handleTypeStr:'资源预约审核'},
      ]
    };
  },
  methods:{
    getList(){
      const data = {
        userId: getUserLocalStorageInfo().userId,
        types: '0,1,8,9,10,11'
      }
      handleListAll(data).then(res=>{
        this.todoList = res
      })
    },
    toDetail(item) {
      if(item.handleTypeStr === '企业房源预定'){
        uni.navigateTo({
          url:'/pages/subPackages/todo/predetermineDetail'
        })
      }else if(item.handleTypeStr.includes('报事报修')){
        uni.navigateTo({
          url:'/pages/subPackages/todo/dispatch?item=' + JSON.stringify({id:item.routeParam.replace('id=','')})
        })
      }else if(item.handleTypeStr.includes('资源预约审核')){
        uni.navigateTo({
          url:'/pages/subPackages/todo/resourceReview?appointId=' + item.routeParam.replace('id=','')
        })
      }else if(item.handleTypeStr.includes('企业审核')){
        // id=5457A19F-9D2B-4027-BA2B-5BA3C665F871&proveType=1
        uni.navigateTo({
          url:'/pages/subPackages/todo/inventoryReview?' + item.routeParam
        })
      }
    }
  }
}
</script>


<style lang="scss">
    .todoIndex{
      .todoItem{
        margin-top: 24rpx;
        width: 686rpx;
        height: 212rpx;
        padding: 32rpx 32rpx;
        position: relative;
        background: white;
        border-radius: 16rpx;
        box-sizing: border-box;
        margin-left: 32rpx;
        .handleTypeStrTip{
          position: absolute;
          right: 0;
          top: 0;
          width: 220rpx;
          height: 56rpx;
          color: rgba(3, 101, 249, 1);
          font-size: 26rpx;
          display: flex;
          align-items: center;
          justify-content: center;
          background: url("https://www.idea-co-sf.com/gardenProduct/image/bj02.png") no-repeat;
          background-size: 100%;
        }
        .todoItemTitle{
          width: 400rpx;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          color: rgba(34, 34, 34, 1);
          font-size: 32rpx;
          line-height: 38rpx;
          font-weight: 600;
        }
        .submitTime{
          color: rgba(102, 102, 102, 1);
          font-size: 28rpx;
          margin-top: 24rpx;
          line-height: 32rpx;
        }
        .submitPerson{
          color: rgba(102, 102, 102, 1);
          font-size: 28rpx;
          margin-top: 16rpx;
          line-height: 32rpx;
        }
      }
    }
</style>


