client.vue 4.39 KB
<template>
  <div class="client">
    <div class="container">
      <GLCombiForm :rowNumber="1" ref="formSearch" :formObj="searchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
      <!-- 表格区域 开始 -->
      <GLTable ref="clientRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
        <template slot="delFlag" slot-scope="scope">
          <div :class="['task_icon', scope.scope.delFlag == 0 ? 'task_icon1' : 'task_icon2']">{{ scope.scope.delFlag == 0 ? '待发送' : '已发送' }}</div>
        </template>
        <div class="table-btns" slot="auth-button" slot-scope="scope">
          <el-button type="text" @click="handleContent(scope.scope)">短信内容</el-button>
        </div>
      </GLTable>
    </div>
    <!-- 外呼短信 -->
    <GLDialog mode="small" title="短信内容" :visible.sync="messageVisible" cancelText="取消" okText="确定" @onCancel="messageVisible = false" @onOk="handleMessageConfirm" >
      <div class="market-note">{{ messageContext }}</div>
    </GLDialog>
  </div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
  data() {
    return {
      messageVisible: false,
      messageContext: '',
      url: url,
      searchForm: {
        phone: '',
        delFlag: '',
        merchantName: '',
        imId: ''
      },
      // 搜索
      searchFormData: [
        {
          label: '手机号',
          name: 'phone ',
          type: 'input'
        },
        {
          label: '状态',
          name: 'delFlag',
          type: 'select',
          optionList: [
            { text: '待发送', id: 0 },
            { text: '已发送', id: 1 }
          ],
          optionId: 'id',
          optionLabel: 'text'
        },

        {
          label: '所属门店',
          name: 'merchantName',
          type: 'input'
        }
      ],
      getListApi: this.$apis.marketing.findAllCustomerByPage,
      tableParams: {
        listName: 'data',
        tableOption: true,
        tableColumns: [
          {
            label: '手机号',
            prop: 'phone'
          },
          {
            label: '客户姓名',
            prop: 'customerName'
          },
          {
            label: '所属门店',
            prop: 'merchantName'
          },
          {
            label: '状态',
            prop: 'delFlag',
            addHtml: 'delFlag'
          },
          {
            label: '发送时间',
            prop: 'sendTime'
          }
        ]
      },
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' }
    }
  },
  props: {
    imId: {
      type: String,
      default: ''
    }
  },
  methods: {
    handleContent(data) {
      this.messageContext = data.messageContext
      this.messageVisible = true
    },
    handleMessageConfirm() {
      this.messageVisible = false
    },
    getParams() {
      var params = JSON.parse(JSON.stringify(this.searchForm))
      params.imId = this.imId
      return params
    },
    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchForm = this.getParams()
        resolve()
      })
    },
    setTableFinishFun() {
      //接收到的数据为空
      this.$refs.clientRef.data.length ? (this.$refs.clientRef.tableHeightValues = '') : this.$refs.clientRef.setTableHeightFun()
    },
    handleSearch() {
      console.log(111)
      this.$refs.clientRef.refreshTable()
    },
    handleReset() {
      this.searchForm = {
        phone: '',
        delFlag: '',
        merchantName: '',
        imId: ''
      }
      this.handleSearch()
    }
  }
}
</script>
<style lang="scss" scoped>
.client {
  margin: 16px 0;
  .task_icon {
    position: relative;
    &::after {
      content: '';
      position: absolute;
      top: 4px;
      left: -10px;
      width: 6px;
      height: 6px;
      border-radius: 4px;
    }

    &.task_icon1 {
      &::after {
        background: #fdb757;
      }
    }

    &.task_icon2 {
      &::after {
        background: #2cca74;
      }
    }
  }
  .market-note {
    font-weight: 400;
    font-size: 16px;
    color: #333333;
    line-height: 24px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    // text-align: center;
    width: 448px;
    white-space: wrap;
  }
}
</style>