<template>
  <div class="page">
    <van-sticky class="sticky">
      <div class="header flex">
        <div class="back">
          <backIcon/>
        </div>
        <!-- 工单详情 -->
        {{ $t('work.l19') }}
        <div></div>
      </div>
    </van-sticky>
    <div class="section" v-if="info.id">
      <div class="box flex">
        <div>
          <!-- 工单 -->
          {{ $t('work.l20') }} {{ info.ordernum }}</div>
        <div :class="{status: info.status == 5}">{{ statusText[info.status] }}</div>
      </div>
      <div class="row">
        <div class="label">
          <!-- 问题类型 -->
          {{ $t('work.l21') }}
        </div>
        <div>{{ typeName[info.type] }}</div>
      </div>
      <div class="row">
        <div class="label">
          <!-- 标题 -->
          {{ $t('work.l11') }}
        </div>
        <div>{{ info.title }}</div>
      </div>
      <div class="row">
        <div class="label">
          <!-- 创建时间 -->
          {{ $t('work.l14') }}
        </div>
        <div>{{ info.insert_datetime }}</div>
      </div>
    </div>
    <div class="section1" v-if="handleList.length">
      <div class="item" v-for="(item, index) in handleList" :key="index">
        <div class="radius" :class="{active: index === 0}"></div>
        <div class="right">
          <!-- 客户服务 -->
          <div class="title">[{{ $t('work.l22') }}]</div>
          <div class="text">{{ item.content }}</div>
          <div class="time">{{ item.insert_datetime }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getWorkOrderList } from "@/api/work";
export default {
  data () {
    return {
      info: {},
      handleList: []
    }
  },
  computed: {
    typeName() {
      return {
        // '1': '账号类',
        // '2': '操作类',
        // '3': '资金类',
        // '4': '其他',
        '1': this.$t('work.l3'),
        '100': this.$t('work.l3'),
        '2': this.$t('work.l4'),
        '3': this.$t('work.l5'),
        '4': this.$t('inform.l22'),
      }
    },
    statusText() {
      return {
        '1': this.$t('ajax.405'),
        '2': this.$t('ajax.406'),
        '3': this.$t('ajax.407'),
        '4': this.$t('ajax.401'),
        '5': this.$t('ajax.403'),
        '6': this.$t('ajax.408'),
        '7': this.$t('ajax.409'),
        '8': this.$t('ajax.410'),
        '9': this.$t('ajax.404'),
      }
    }
  },
  created () {
    this.getWorkOrderList()
  },
  methods: {
    getWorkOrderList() {
      getWorkOrderList({
        id: this.$route.params.id
      }).then(res => {
        var list = res.list || []
        this.info = list[0] || {}
        this.handleList = this.info.handleList || []
      })
    }
  }
}
</script>
<style lang="less" scoped>
.page {
  background-color: #F9FBFF;
}
.sticky {
  background-color: var(--bg-);
}
.header {
  position: relative;
  justify-content: space-between;
  height: 50px;
  font-size: 18px;
  font-weight: 600;
  background-color: var(--bg-);
  padding-left: 9px;
  padding-right: 17px;
}
.section {
  padding: 8px 18px 18px;
  margin-bottom: 10px;
  background-color: var(--bg-);
  .box {
    justify-content: space-between;
    padding-bottom: 15px;
    border-bottom: 1px solid #EDEDED;
  }
  .status {
    color: #22B673;
  }
  .row {
    margin-top: 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    column-gap: 12px;
    .label {
      color: #9A9CA7;
    }
  }
}
.section1 {
  background-color: var(--bg-);
  padding: 3px 18px 18px;
  .item {
    display: flex;
    align-items: flex-start;
    padding-top: 17px;
    column-gap: 11px;
  }
  .radius {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #DEDEE3;
    &.active {
      background-color: var(--color-);
    }
  }
  .right {
    flex: 1;
    min-width: 10%;
    max-width: 100%;
    padding-bottom: 13px;
    border-bottom: 1px solid #EDEDED;
  }
  .title {
    margin-bottom: 9px;
  }
  .text {
    font-size: 13px;
    margin-bottom: 10px;
  }
  .time {
    color: #9A9CA7;
    font-size: 12px;
    line-height: 15px;
  }
}
</style>