resultStatistics.vue 8.45 KB
<template>
  <div class="help-main">
    <div class="help-tabel scrm-box-f">
      <div class="help-tabel-form">
        <GLCombiForm ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
        <div class="select-panel">
          <div class="help-tabel-name">客户统计</div>
          <div class="help-select-date">
            <el-radio-group class="select-date-input" v-model="dateInterval" size="small" @change="handleSearch">
              <el-radio-button label="1">今日</el-radio-button>
              <el-radio-button label="2">本周</el-radio-button>
              <el-radio-button label="3">本月</el-radio-button>
              <el-radio-button label="4">今年</el-radio-button>
            </el-radio-group>
            <el-button type="primary" plain size="small" @click="handleImport">导出</el-button>
          </div>
        </div>
        <GLTable @setTableFinishFun="setTableFinishFun" :noDataImg="url" ref="taskForm" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
          <div class="table-btns" slot="optionBtns" slot-scope="scope">
            <el-button type="text" @click="goDetail(scope.scope)">客户详情</el-button>
          </div>
        </GLTable>
      </div>
    </div>
  </div>
</template>

<script>
import util from '@/utils/util'
export default {
  name: 'resultStatistics',
  data() {
    return {
      dateInterval: 1,
      value1: [],
      tableSearchForm: {
        customerName: '',
        nickName: '',
        customerPhone: '',
        isFollow: '',
        staffId: '',
        followTime: '',
        createTime: ''
      },
      searchFormData: [
        {
          label: '客户姓名',
          name: 'customerName',
          type: 'input',
          placeholder: ''
        },
        {
          label: '客户昵称',
          name: 'nickName',
          type: 'input',
          placeholder: ''
        },
        {
          label: '联系电话',
          name: 'customerPhone',
          type: 'input',
          placeholder: ''
        },
        {
          label: '发起日期',
          name: 'createTime',
          type: 'datePicker',
          placeholder: '',
          isClear: true,
          pickerOptions: {
            disabledDate: time => {
              return time.getTime() > Date.now()
            }
          }
        },
        {
          label: '跟进日期',
          name: 'followTime',
          type: 'datePicker',
          placeholder: '',
          isClear: true,
          pickerOptions: {
            disabledDate: time => {
              return time.getTime() > Date.now()
            }
          }
        },
        {
          type: 'select',
          // prop: 'isJoin',
          name: 'isFollow',
          label: '是否跟进',
          placeholder: '请选择',
          optionLabel: 'label',
          optionId: 'value',
          optionList: [
            {
              label: '全部',
              value: null
            },
            {
              label: '是',
              value: 0
            },
            {
              label: '否',
              value: -1
            }
          ]
        },
        {
          type: 'select',
          name: 'staffId',
          // prop: 'staffId',
          noFilter: false,
          optionLabel: 'label',
          optionId: 'value',
          label: '跟进员工',
          placeholder: '请输入跟进员工',
          optionList: []
        }
      ],
      pickerOptions: {
        disabledDate: time => {
          return time.getTime() > Date.now()
        }
      },
      createTime: '',
      dialogVisible: true,
      getListApi: this.$apis.helpCard.listCustomer,
      tableParams: {
        tableOption: false,
        checkSelectKey: 'id',
        checkSelectVal: [],
        hasNum: false,
        listName: 'data',
        tableColumns: [
          {
            label: '客户名称',
            prop: 'customerName',
            width: 300,
            line: 1
          },
          {
            label: '客户昵称',
            prop: 'nickName',
            width: 300,
            formatter: cellValue => {
              return cellValue.nickName ? cellValue.nickName + (cellValue.type == 1 ? '@微信' : cellValue.type == 2 ? '@企微' : '') : '--'
            },
            line: 1
          },
          {
            label: '联系电话',
            prop: 'customerPhone',
            width: 200,
            line: 1
          },
          {
            label: '跟进员工',
            prop: 'followStaff',
            width: 120
          },
          {
            label: '是否跟进',
            prop: 'isFollow',
            width: '100px',
            formatter: cellValue => {
              return cellValue.isFollow == 0 ? '是' : '否'
            }
          },
          {
            label: '跟进结果',
            prop: 'followResult',
            width: 150,
            line: 1
          },
          {
            label: '发起时间',
            prop: 'applyTime',
            width: '220px'
          },
          {
            label: '跟进时间',
            prop: 'followTime',
            width: '220px'
          },
          {
            label: '操作',
            prop: 'optionBtns',
            width: '90px',
            addHtml: 'optionBtns',
            fixed: 'right'
          }
        ]
      },
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
      baseData: {
        allMerchantList: [],
        roleList: [],
        staffStatusList: []
      }
    }
  },
  mounted() {
    this.getStaffList()
  },
  methods: {
    handleImport() {
      this.$apis.helpCard.listCustomerExport(this.getParams()).then(res => {
        util.openUrl(res)
      })
    },
    //获取跟进员工
    getStaffList() {
      this.$apis.helpCard.getStaffList({}).then(res => {
        if (res.length == 0) {
          return ''
        }
        const staff = res.map(item => {
          return {
            label: item.staffName,
            value: item.id
          }
        })
        staff.unshift({ label: '全部', value: null })
        this.searchFormData.find(item => item.name == 'staffId').optionList = staff
      })
    },
    handleSearch() {
      this.$refs.taskForm.refreshTable()
    },
    handleReset() {
      this.tableSearchForm = {}
      this.$refs.taskForm.refreshTable()
    },
    getParams() {
      if (this.tableSearchForm.createTime) {
        this.tableSearchForm.beginTime = new Date(this.tableSearchForm.createTime[0]).toLocaleDateString().replace(/\//g, '-')
        this.tableSearchForm.endTime = new Date(this.tableSearchForm.createTime[1]).toLocaleDateString().replace(/\//g, '-')
      } else {
        delete this.tableSearchForm.beginTime
        delete this.tableSearchForm.endTime
      }
      if (this.tableSearchForm.followTime) {
        this.tableSearchForm.followBeginTime = new Date(this.tableSearchForm.followTime[0]).toLocaleDateString().replace(/\//g, '-')
        this.tableSearchForm.followEndTime = new Date(this.tableSearchForm.followTime[1]).toLocaleDateString().replace(/\//g, '-')
      } else {
        delete this.tableSearchForm.followBeginTime
        delete this.tableSearchForm.followEndTime
      }
      this.tableSearchForm.dateInterval = this.dateInterval
      delete this.tableSearchForm.createTime
      delete this.tableSearchForm.followTime
      return this.tableSearchForm
    },
    beforeSearchFn() {
      return new Promise(resolve => {
        this.tableSearchForm = this.getParams()
        resolve()
      })
    },
    setTableFinishFun() {
      this.$refs.taskForm.data.length ? (this.$refs.taskForm.tableHeightValues = '') : this.$refs.taskForm.setTableHeightFun()
    },
    goDetail(scope) {
      util.openTab(location.origin + '/custom/clientManage/clientDetail?id=' + scope.oneId)
    }
  }
}
</script>

<style lang="scss" scoped>
.scrm-box-f {
  padding: 20px;
}
.select-panel {
  display: flex;
  margin-bottom: 10px;
  justify-content: space-between;
  align-items: center;
  .help-tabel-name {
    font-size: 16px;
    color: #333333;
    text-align: left;
    line-height: 16px;
    font-weight: 500;
  }
  .help-select-date {
    display: flex;
    align-items: center;
    .select-date-input {
      margin-right: 10px;
      /deep/ {
        .el-radio-button:focus:not(.is-focus):not(:active):not(.is-disabled) {
          box-shadow: none;
        }
      }
    }
  }
}
</style>