index.vue 5.74 KB
<template>
  <div>
    <div class="createANewGroupBtn">
      <el-button @click="addSendGroup" :size="size" type="primary" mode="el-button">
        <i class="el-icon-plus"></i>
        新建群发
      </el-button>
    </div>
    <div class="container">
      <GLCombiForm :formObj="searchForm" :rowNumber="1" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset">
        <div slot="optionBtns">
          <div class="sendRecord" @click="traceRecord">发送记录</div>
        </div>
      </GLCombiForm>
      <GLTable ref="groupTable" :noDataImg="url" :getListApi="getListApi" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun"></GLTable>
    </div>
    <el-drawer size="40%" title="发送记录" :visible.sync="sendRecordDrawer.isVisible" :direction="sendRecordDrawer.direction">
      <div class="horizon"></div>
      <div class="sendRecordDrawerbox">
        <div v-for="(item, index) in sendRecordDrawer.traceFailandSuccess" :key="index" class="itemContent">
          <div>
            <p class="title">{{ item.title }}</p>
            <p class="num" :style="{ color: item.color }">{{ item.num }}</p>
          </div>
        </div>
      </div>
      <GLTable ref="sendRecordDrawer.ref" :noDataImg="url" :getListApi="sendRecordDrawer.getListApi" :searchForm="sendRecordDrawer.searchForm" :tableParams="sendRecordDrawer.tableParams" :pageConf="sendRecordDrawer.pageConf"></GLTable>
    </el-drawer>
  </div>
</template>

<script>
import url from '@/assets/empty.png'
export default {
  name: 'collocation',
  data() {
    return {
      url,
      sendRecordDrawer: {
        isVisible: false,
        direction: 'rtl',
        traceFailandSuccess: [
          {
            title: '发送成功',
            id: '1',
            num: 22,
            color: '#2CCA74'
          },
          {
            title: '发送失败',
            id: '2',
            num: 4,
            color: '#EB4E4E '
          }
        ],
        ref: 'sendRecordDrawerRef',
        getListApi: '',
        searchForm: '',
        tableParams: {
          listName: 'list',
          tableColumns: [
            {
              label: '客户',
              prop: 'sendName'
            },
            {
              label: '发送时间',
              prop: 'senaStore'
            },
            {
              label: '发送结果',
              prop: 'customerNum'
            }
          ]
        },
        pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }
      },
      searchForm: {
        sendName: '',
        sendTime: '',
        store: ''
      },
      searchFormData: [
        {
          label: '群发名称',
          name: 'messagingName',
          type: 'input',
          isClear: true
        },
        {
          label: '群发时间',
          name: 'sendTime',
          type: 'datePicker',
          isClear: true
        },
        {
          label: '群发门店',
          name: 'merchantName',
          type: 'input',
          isClear: true
        }
      ],
      tableParams: {
        listName: 'list',
        tableColumns: [
          {
            label: '群发名称',
            prop: 'messagingName'
          },
          {
            label: '群发门店',
            prop: 'messagingMerchant'
          },
          {
            label: '客户数',
            prop: 'customerCount'
          },
          {
            label: '标签/人群',
            prop: 'labelCrowdName'
          },
          {
            label: '创建时间',
            prop: 'createTime'
          },
          {
            label: '发送状态',
            prop: 'sendState'
          },
          {
            label: '发送成功',
            prop: 'successCompletion',
            width: '200'
          },
          {
            label: '发送失败',
            prop: 'failCompletion',
            width: '200'
          },
          {
            label: '操作',
            prop: 'optionBtns',
            width: '66px',
            addHtml: 'optionBtns',
            fixed: 'right'
          }
        ]
      },
      pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
      getListApi: this.$apis.wechatGroup.batchmessagingRecord
    }
  },
  methods: {
    handleSearch() {
      this.$refs.activeTable.refreshTable()
    },
    // 重置搜索框搜索
    handleReset() {
      this.searchForm = {
        isBuyPermit: '',
        merchantId: '',
        merchantName: ''
      }
      this.handleSearch()
    },
    setTableFinishFun() {
      //接收到的数据为空
      this.$refs.activeTable.data.length ? (this.$refs.activeTable.tableHeightValues = '') : this.$refs.activeTable.setTableHeightFun()
    },
    // 跳转新建群发
    addSendGroup() {
      this.$router.push('/wechatGroup/addWechatGroup')
    },
    traceRecord() {
      this.sendRecordDrawer.isVisible = true
    }
  }
}
</script>

<style lang="scss" scoped>
.createANewGroupBtn {
  margin-bottom: 16px;
}
.container {
  padding: 20px;
  background-color: #fff;
  .table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    .header-text {
      font-size: 16px;
      color: #333333;
      font-weight: 600;
    }
  }
  .table-btn {
    color: #5850ff;
    border: 1px solid #5850ff;
  }
  .sendRecord {
    color: #5850ff;
  }
}
.horizon {
  width: 100%;
  height: 1px;
  background: #e8e8ea;
}
.sendRecordDrawerbox {
  padding: 20px;
  display: flex;
  justify-content: space-around;
  .itemContent {
    width: 334px;
    padding: 8px 0 8px 20px;
    border: 1px solid #e8e8ea;
  }
  .title {
    color: #666666;
    font-size: 14px;
    margin-bottom: 8px;
  }
  .num {
    font-size: 20px;
    font-width: 600;
  }
}
</style>