<template>
  <scroll-view class="content" scroll-y="true">
    <image src="/static/img/workBac1.png" class="bacImg1"></image>
    <image src="/static/img/workBac2.png" class="bacImg2"></image>
    <view class="conItem" style="margin-top: 100rpx;">
      <view class="conItem-title">房源</view>
      <view class="conItem-cont">
        <view class="conItem-cont-item" v-for="(item, index) in fyList" :key="index" @click="handelFyClick(item)">
          <image :src="item.image" class="itemImg"></image>
          <text class="itemText">{{ item.text }}</text>
        </view>
      </view>
    </view>

    <view class="conItem">
      <view class="conItem-title">巡检</view>
      <view class="conItem-cont">
        <view class="conItem-cont-item" v-for="(item, index) in xjList" :key="index" @click="handelXjClick(item)">
          <image :src="item.image" class="itemImg"></image>
          <text class="itemText">{{ item.text }}</text>
        </view>
      </view>
    </view>

    <view class="conItem">
      <view class="conItem-title">水电</view>
      <view class="conItem-cont">
        <view class="conItem-cont-item" v-for="(item, index) in sdList" :key="index">
          <image :src="item.image" class="itemImg"></image>
          <text class="itemText">{{ item.text }}</text>
        </view>
      </view>
    </view>

    <view class="conItem">
      <view class="conItem-title">报修</view>
      <view class="conItem-cont">
        <view class="conItem-cont-item" v-for="(item, index) in bxList" :key="index">
          <image :src="item.image" class="itemImg"></image>
          <text class="itemText">{{ item.text }}</text>
        </view>
      </view>
    </view>

    <view class="conItem">
      <view class="conItem-title">报事</view>
      <view class="conItem-cont">
        <view class="conItem-cont-item" v-for="(item, index) in bsList" :key="index" @click="handleBsClick(item)">
          <image :src="item.image" class="itemImg"></image>
          <text class="itemText">{{ item.text }}</text>
        </view>
      </view>
    </view>

  </scroll-view>
</template>

<script>
export default {
  data () {
    return {
      fyList: [
        { image: '/static/img/看房.png', text: '看房确认' },
        { image: '/static/img/退房检查.png', text: '退房检查' },
        { image: '/static/img/释放.png', text: '释放房源检查' },
        { image: '/static/img/预约.png', text: '预约看房' },
        { image: '/static/img/强制清退.png', text: '强制清退' },
      ],
      xjList: [
        { image: '/static/img/巡查.png', text: '巡检' },
        { image: '/static/img/记录.png', text: '记录' },
      ],
      sdList: [
        { image: '/static/img/水费.png', text: '水费上报' },
        { image: '/static/img/电费.png', text: '电费上报' },
      ],
      bxList: [
        { image: '/static/img/上报.png', text: '上报' },
        { image: '/static/img/处理.png', text: '处理' },
      ],
      bsList: [
        { image: '/static/img/上报.png', text: '上报' },
        { image: '/static/img/处理.png', text: '处理' },
      ],

    }
  },
  onLoad () {

  },
  methods: {
    handelFyClick (item) {
      if (item.text == "退房检查") {
        uni.navigateTo({
          url: '/pagesA/checkout/list/list'
        })
      } else if (item.text == "释放房源检查") {
        uni.navigateTo({
          url: '/pagesA/release/list/list'
        })
      }
    },
    handleBsClick (item) {
      if (item.text === '处理') {
        // 记录
        uni.navigateTo({
          url: '/pages/tabBar/bsPage/bsRecord'
        })
      } else {
        // 上报
        uni.navigateTo({
          url: '/pages/tabBar/bsPage/bsReport'
        })
      }
    },
    handelXjClick (item) {
      if (item.text === '巡检') {
        // 列表
        uni.navigateTo({
          url: '/pages/tabBar/xjPage/xj'
        })
      } else {
        uni.navigateTo({
          url: '/pages/tabBar/xjPage/xjRecord'
        })
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.content {
  width: 100%;
  height: 100vh;
}

.conItem {
  width: calc(100% - 40rpx);
  border-radius: 10rpx;
  margin-left: 20rpx;
  background-color: rgba(255, 255, 255, 1);
  box-shadow: 2rpx 2rpx 4rpx rgba(0, 0, 0, 0.2);
  margin-bottom: 20rpx;
  padding: 20rpx;
  box-sizing: border-box;
}

.conItem-title {
  color: rgb(64, 64, 64);
  font-size: 30rpx;
  text-align: left;
}

.conItem-cont {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 20rpx;
}

.conItem-cont-item {
  width: 23%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  margin-right: 2%;
  margin-bottom: 20rpx;

  .itemImg {
    width: 80rpx;
    height: 80rpx;
  }

  .itemText {
    color: rgb(64, 64, 64);
    font-size: 20rpx;
    margin-top: 5rpx;
  }
}

.conItem-cont-item:nth-child(4n) {
  margin-right: 0;
}

.bacImg1 {
  width: 100%;
  height: 20%;
  position: absolute;
  top: 0;
  z-index: -1;
}

.bacImg2 {
  width: 100%;
  height: 80%;
  position: absolute;
  top: 30%;
  z-index: -1;
}
</style>
