<template>
  <div class="assignAwait">
    <van-nav-bar class="navBar" title="待分配客资" left-arrow @click-left="onClickLeft" />
    <div class="container">
      <van-list v-model="loading" :finished="finished" finished-text="--已经到底了--">
        <div class="newCarList" v-for="(item, index) in list" :key="index">
          <van-cell is-link>
            <div class="newlist" @click="approveFn(item)">
              <div class="title">
                <p class="textLeft">{{ item.name }}</p>
              </div>
              <div class="info">
                客资线索：
                <span v-if="item.cid == 7">家装客资</span>
              </div>
              <div class="info">联系电话：{{ item.phone }}</div>
              <div class="info" v-if="item.createTime">首次接入时间：{{ item.createTime }}</div>
              <div class="info" v-if="item.latestClueTime">
                最后一次跟进时间：{{ item.latestClueTime }}
              </div>
            </div>
          </van-cell>
        </div>
        <van-empty description="" v-if="list.length == 0" />
      </van-list>
    </div>
  </div>
</template>

<script>
import { selectNotAllocationList } from '@/api/assignAwait';
export default {
  name: 'assignAwait',
  data() {
    return {
      disabled: false,
      loading: false,
      list: [],
      finished: true,
    };
  },
  activated() {
    this.approveList();
  },
  methods: {
    approveFn(row) {
      this.list = [];
      this.$router.push({
        path: '/assignPage',
        query: { id: row.customerClueInfoId },
      });
    },
    approveList() {
      let loading1 = this.$toast.loading({
        duration: 0,
        message: '数据加载中...',
        forbidClick: true,
      });
      selectNotAllocationList().then((res) => {
        loading1.clear();
        this.disabled = false;
        this.loading = false;
        this.list = res.data;
      });
    },
    onClickLeft() {
      this.$router.push('/My/index');
    },
  },
};
</script>
<style scoped lang="scss">
.assignAwait {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  .header {
    position: sticky;
    top: 0px;
    z-index: 10;
  }
  .newCarList {
    margin: 14px;
    border-radius: 8px;
    overflow: hidden;
  }
  .newCarList .van-cell {
    border-radius: 6px;
    overflow: hidden;
  }
  .newCarList .van-cell__right-icon {
    top: -4px;
  }
  .newCarList .newlist {
    box-sizing: border-box;
  }
  .newCarList .newlist .title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    /* line-height: 14px; */
  }
  .newCarList .newlist .info {
    font-size: 14px;
    color: #999;
    line-height: 26px;
  }
  .newCarList .newlist .title p {
    padding: 0;
    margin: 0;
  }
  .newCarList .newlist .title .textLeft {
    display: inline-block;
    /* padding-bottom: 10px; */
  }
  .newCarList .newlist .title .textRight {
    float: right;
    color: #0057ba;
  }
  .van-tab--active {
    color: #0057ba;
  }
}
</style>
