taskDetail.vue 8.39 KB
<!--  -->
<template>
  <div class="container-detail">
    <div class="ai-main-header">
      <div class="ai-main-title">
        离店客户加企微
      </div>
      <div class="ai-main-desc">系统将通过AI机器人,使用门店的福利官企微号自动添加客户,并自动发放客户福利权益。</div>
    </div>
    <div class="outbound-info">
      <div class="outbound-info-title flex">
        离店客户加好友概览
      </div>
      <div class="outbound-info-wrap">
        <div class="general">
          <div class="general-item" v-for="(item, index) in statisticsList" :key="index">
            <div class="general-item-icon">
              <img :src="item.logo" />
            </div>
            <div>
              <div class="general-item-title">{{ item.describe }}</div>
              <div class="general-item-num">
                {{ item.value(detailData) }}
                <span class="font-14;color3;m-l-4">人</span>
              </div>
            </div>
          </div>
        </div>
        <div class="chart" id="lineRef"></div>
        <GLCombiForm :rowNumber="1" class="searchForm" ref="detailsSearch" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
        <GLTable ref="detailsTable" :searchForm="searchForm" :pageConf="pageConf" :tableParams="tableParams" :getListApi="getListApi">
          <template slot="phoneStatus" slot-scope="scope">
            <div :class="['task_icon', `task_icon${scope.scope.phoneStatus}`]">{{ taskStatus(scope.scope.phoneStatus) }}</div>
          </template>
        </GLTable>
      </div>
    </div>
  </div>
</template>

<script>
const TASK_STATUS = [
  {
    label: '该用户不存在',
    value: 1
  },
  {
    label: '待发送好友申请',
    value: 2
  },
  {
    label: '已发送申请',
    value: 3
  },
  {
    label: '申请通过',
    value: 4
  }
]
import * as echarts from 'echarts'
export default {
  data() {
    return {
      id: this.$route.query.id ? this.$route.query.id : '',
      getListApi: this.$apis.aiCard.phoneStatusPage,
      detailData: {},
      myChart: null,
      searchForm: {
        phone: '',
        status: '',
        id: this.$route.query.id ? this.$route.query.id : ''
      },
      outboundParams: [
        {
          label: '任务名称',
          prop: 'taskName',
          span: 12
        },
        {
          label: '选择话术机器人:',
          prop: 'robotName',

          span: 12
        },
        {
          label: '外呼主叫号码:',
          prop: 'callerNums',
          span: 12
        },

        {
          label: '外呼时间:',
          addHtml: 'dialTime',
          span: 12
        },
        {
          label: '重播设置:',
          addHtml: 'retryTimes',
          span: 12
        },
        {
          label: '号码过滤:',
          prop: 'numTypeFilterList',
          span: 12
        }
      ],
      searchFormData: [
        {
          label: '手机号',
          name: 'phone',
          type: 'input'
        }
      ],
      statisticsList: [
        {
          logo: require('../../assets/img/ai/customer.png'),
          describe: '客户总数',
          value: obj => {
            return obj.phoneCount ? obj.phoneCount : 0
          }
        },
        {
          logo: require('../../assets/img/ai/apply.png'),
          describe: '通过申请',
          value: obj => {
            return obj.passNums ? obj.passNums : 0
          }
        },
        {
          logo: require('../../assets/img/ai/user.png'),
          describe: '不存在的手机号用户',
          value: obj => {
            return obj.noneUserNums ? obj.noneUserNums : 0
          }
        }
      ],
      // 表格参数
      tableParams: {
        listName: 'data',
        tableColumns: [
          {
            label: '手机号',
            prop: 'phone'
          },
          {
            label: '状态',
            prop: 'phoneStatus',
            addHtml: 'phoneStatus'
          }
        ]
      },
      pageConf: {
        pageSize: 'pageSize',
        pageNum: 'pageNum',
        totalCount: 'count'
      }
    }
  },
  mounted() {
    this.taskbaseDetails()
    let chartDom = document.getElementById('lineRef')
    this.myChart = echarts.init(chartDom)
    window.addEventListener('resize', () => {
      this.myChart.resize()
    })
  },
  methods: {
    taskStatus(status) {
      const val = TASK_STATUS.find(item => item.value == status)
      return val ? val.label : '--'
    },
    taskbaseDetails() {
      let params = {
        id: this.id
      }
      this.$apis.aiCard.taskDetail(params).then(res => {
        if (res) {
          this.detailData = res
          this.initCanvas(this.detailData.phoneStatusDailyCharts)
        }
      })
    },
    handleSearch() {
      this.$refs.detailsTable.refreshTable()
    },
    handleReset() {
      this.searchForm = {
        phone: '',
        status: '',
        id: this.$route.query.id ? this.$route.query.id : ''
      }
      this.handleSearch()
    },
    initCanvas(lineValue) {
      const x_data = lineValue && lineValue.length ? lineValue.map(item => item.dailyDate) : []
      const y_data = lineValue && lineValue.length ? lineValue.map(item => item.passedCounts) : []
      console.log(x_data, y_data)
      this.option = {
        tooltip: {
          show: true,
          axisPointer: {
            // type: 'cross'
          }
        },
        grid: {
          right: '90x',
          left: '90px'
        },
        minInterval: 1,
        xAxis: {
          type: 'category',
          data: x_data
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            // symbol: 'none',
            data: y_data,
            type: 'line',
            smooth: true,
            areaStyle: {
              color: 'rgba(88,80,255, 0.15)'
            }
          }
        ]
      }

      this.myChart.clear()
      this.myChart.setOption(this.option)
    },
    btnClick() {}
  }
}
</script>
<style scoped lang="scss">
.task_icon {
  position: relative;
  &::after {
    content: '';
    position: absolute;
    top: 4px;
    left: -10px;
    width: 6px;
    height: 6px;
    border-radius: 4px;
  }
  &.task_icon1 {
    &::after {
      background: #999999;
    }
  }
  &.task_icon2 {
    &::after {
      background: #fdb757;
    }
  }
  &.task_icon3 {
    &::after {
      background: #5850ff;
    }
  }
  &.task_icon4 {
    &::after {
      background: #2cca74;
    }
  }
}
.container-detail {
  padding: 20px 0;
  overflow-y: scroll;
  height: 100%;
  .ai-main-header {
    background: #fff;
    padding: 16px 20px;
    margin-bottom: 16px;
    .ai-main-title {
      font-size: 20px;
      color: #333333;
      font-weight: 600;
    }
    .ai-main-desc {
      margin-top: 10px;
      font-size: 14px;
      font-weight: 400;
      color: #666666;
      line-height: 22px;
    }
  }
  .outbound-info {
    width: 100%;
    height: auto;
    background: #ffffff;
    box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
    margin-bottom: 10px;
    &-title {
      line-height: 28px;
      font-size: 16px;
      font-weight: 600;
      color: #333333;
      padding: 15px 0 15px 20px;
      border-bottom: 1px solid #e5e5e5;
    }
    .glsx-rows-wrap {
      padding: 32px 76px;
    }
    &-wrap {
      padding: 20px 16px;
      box-sizing: border-box;
      background: #ffffff;
      .general {
        display: flex;
        align-items: center;
        margin: 0 40px 20px 40px;
        .general-item {
          width: 274px;
          height: 100px;
          background: #f9fafc;
          border-radius: 4px;
          padding: 20px 16px;
          display: flex;
          box-sizing: border-box;
          margin-right: 16px;
          &-icon {
            width: 48px;
            height: 48px;
            margin-right: 16px;
            img {
              width: 100%;
            }
          }
          &-title {
            font-size: 14px;
            color: #333333;
            line-height: 20px;
            margin-bottom: 10px;
          }
          &-num {
            font-size: 26px;
            font-weight: bold;
            color: #333;
            line-height: 31px;
          }
        }
      }
      .chart {
        height: 320px;
      }
    }
  }
  .m-b-7 {
    margin-bottom: 70px;
  }
  .footer-btn {
    position: fixed;
    bottom: 0;
    width: 100%;
    text-align: center;
    background-color: #fff;
  }
}
</style>