<template>
  <div :class="roleIdStr==21?'div' :''">
    <div class="list" v-for="item in historyList" :key="item.id" @click="$router.push({path:'/specialServices/details',query:{id:item.historyId}})">
      <div class="img">
        <van-image fit="cover" :src="getpics(item.imgUrl)" alt="" />
      </div>
      <div class="text">
        <div class="num title">
          <div class="over">服务内容：{{item.content}}</div>
        </div>
        <div class="num">
          <div class="over">服务对象：{{item.serviceTarget}}</div>
        </div>
        <div class="num">
          <div class="over">服务时间：{{item.servicetTimeDesc}}</div>
        </div>
        <div class="num">
          <div class="over">服务地址：{{item.streetName}}{{item.address}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['historyList'],
  data() {
    return {
      bgimg: require('../../assets/newsbg.png'),
      roleIdStr: JSON.parse(sessionStorage.getItem('userInfo')).roleIdStr,
    }
  },
  methods: {
    getpics(item) {
      if (!item) return this.bgimg
      var url = ''
      var arr = item.split(',')
      arr.forEach((item, index) => {
        if (item.indexOf('.jpg') || item.indexOf('.png')) {
          url = arr[index]
          return
        }
      })
      return url
    },
  },
}
</script>
<style lang="scss" scoped>
.div {
  padding-top: 120px;
}
.list {
  display: flex;
  align-items: center;
  margin-bottom: 26px;
  padding: 0 30px;
  .img {
    .van-image {
      width: 260px;
      height: 160px;
    }
  }
  .text {
    text-align: left;
    margin-left: 26px;
    width: calc(100% - 300px);
    .title {
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      font-size: 30px !important;
    }
    .mes {
      font-size: 26px;
      margin-left: 10px;
    }
    .zero {
      color: #ff3b30;
    }
    .num {
      font-size: 26px;
      display: flex;
      //   justify-content: space-between;
      align-items: center;
      line-height: 40px;
      span {
        width: 150px;
        flex-shrink: 0;
      }
      .over {
        width: 540px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
    p {
      margin: 0;
      margin-bottom: 16px;
    }
  }
}
</style>
