index.vue 7.32 KB
<template>
  <div class="send-assistant">
    <div class="menu-sub">
      <div class="menu-sub-item" :class="[activeIndex == '1' ? 'active' : '']" @click="switchMenu(1)">客户群发</div>
      <div class="menu-sub-item" :class="[activeIndex == '2' ? 'active' : '']" @click="switchMenu(2)">客户群群发</div>
    </div>
    <div v-show="activeIndex == 1" class="container">
      <div class="container-header">
        <div class="text">企业统一选择要发送的客户,由添加客户的成员确认后发送给客户,消息内容仅管理员和负责人可创建。</div>
        <el-button type="primary" icon="el-icon-plus" @click="btnClick('create', 1)">新建群发</el-button>
      </div>
      <!-- 表格区域 开始 -->
      <GLTable ref="gueast" :tableData="gueastTableData" :tableParams="gueastTableParams" :pageConf="gueastPageConf">
        <!-- <div slot="entmicro-name" class="entmicro" slot-scope="scope">
          <span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span>
        </div> -->
        <div class="table-btns" slot="optionBtns" slot-scope="scope">
          <el-button type="text" :disabled="scope.scope.isRemind == 1" @click="btnClick('edit', 1, scope.scope)">提醒发送</el-button>
          <el-button type="text" @click="btnClick('detail', 2, scope.scope)">详情</el-button>
        </div>
      </GLTable>
      <!-- 表格区域 end -->
    </div>
    <div v-show="activeIndex == 2" class="container">
      <div class="container-header">
        <div class="text">管理员或负责人统一创建内容,群主收到通知后,可选择他管理的客户群并群发。</div>
        <el-button type="primary" icon="el-icon-plus" @click="btnClick('create', 2)">新建群发</el-button>
      </div>
      <!-- 表格区域 开始 -->
      <GLTable ref="gueast" :tableData="gueastTableData" :tableParams="gueastGroupTableParams" :pageConf="gueastPageConf">
        <!-- <div slot="entmicro-name" class="entmicro" slot-scope="scope">
          <span v-for="(i, index) in scope.scope.userList" :key="index">{{ i.name }}({{ i.tips }});</span>
        </div> -->
        <div class="table-btns" slot="optionBtns" slot-scope="scope">
          <el-button type="text" :disabled="scope.scope.isRemind == 1" @click="btnClick('edit', 2, scope.scope)">提醒发送</el-button>
          <el-button type="text" @click="btnClick('detail', 2, scope.scope)">详情</el-button>
        </div>
      </GLTable>
      <!-- 表格区域 end -->
    </div>
  </div>
</template>
<script>
export default {
  name: 'SendAssistant',
  data() {
    return {
      activeIndex: '1',
      gueastTableParams: {
        listName: 'data',
        tableOption: false,
        tableColumns: [
          {
            label: '群发类型',
            prop: 'sendType',
            formatter: cellValue => {
              return {
                1: '立即发送',
                2: '定时发送'
              }[cellValue.sendType]
            }
          },
          {
            label: '群发内容',
            prop: 'massName',
            line: 2,
            minWidth: '100px'
            // addHtml: 'entmicro-name'
          },
          {
            label: '发送时间',
            prop: 'sendTime',
            line: 2
          },
          {
            label: '已发送员工',
            prop: 'sendUserNum',
            line: 2
          },
          {
            label: '已送达客户',
            prop: 'sendCustomerNum',
            line: 2
          },
          {
            label: '未发送员工',
            prop: 'unsendUserNum',
            line: 2
          },
          {
            label: '未送达客户',
            prop: 'unsendCustomerNum',
            line: 2
          },
          {
            label: '操作',
            prop: 'optionBtns',
            width: '140px',
            addHtml: 'optionBtns',
            fixed: 'right'
          }
        ]
      },
      gueastPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
      gueastTableData: [
        {
          id: 1,
          massName: '守候专用服务一组dfajkfhakjdfhak[土盘]',
          sendTime: '2021-11-05',
          name: '群发任务命名',
          sendType: 1,
          sendUserNum: 1,
          sendCustomerNum: 1,
          unsendUserNum: 2,
          unsendCustomerNum: 3,
          isRemind: 1 // 1已提醒2 未提醒
        },
        {
          id: 2,
          massName: '守候专用服务一组dfajkfhakjdfhak[土盘]',
          sendTime: '2021-11-05',
          name: '群发任务命名',
          sendType: 1,
          sendUserNum: 1,
          sendCustomerNum: 1,
          unsendUserNum: 2,
          unsendCustomerNum: 3,
          isRemind: 2 // 1已提醒2 未提醒
        }
      ],
      gueastGroupTableParams: {
        listName: 'data',
        tableOption: false,
        tableColumns: [
          {
            label: '群发名称',
            prop: 'name'
          },
          {
            label: '群发内容',
            prop: 'massName',
            line: 2,
            minWidth: '100px'
            // addHtml: 'entmicro-name'
          },
          {
            label: '发送时间',
            prop: 'sendTime',
            line: 2
          },
          {
            label: '已发送群主',
            prop: 'sendUserNum',
            line: 2
          },
          {
            label: '已送达群聊',
            prop: 'sendCustomerNum',
            line: 2
          },
          {
            label: '未发送群主',
            prop: 'unsendUserNum',
            line: 2
          },
          {
            label: '未送达群聊',
            prop: 'unsendCustomerNum',
            line: 2
          },
          {
            label: '操作',
            prop: 'optionBtns',
            width: '140px',
            addHtml: 'optionBtns',
            fixed: 'right'
          }
        ]
      }
    }
  },
  methods: {
    switchMenu(val) {
      this.activeIndex = val
    },
    /**
     * name: 按钮名称
     * type: 1 客户 2 客户群
     * rowData: 行数据
     */
    btnClick(name, type, rowData) {
      switch (name) {
        case 'create':
          if (type == 1) {
            this.$router.push('/customerTransform/addCustomer')
          } else {
            this.$router.push('/customerTransform/addCustomerGroup')
          }
          break
        case 'detail':
          if (type == 1) {
            this.$router.push('/customerTransform/detailCustomer')
          } else {
            this.$router.push('/customerTransform/detaiCustomeGroup')
          }
          break
        default:
          console.log(11)
      }
    }
  }
}
</script>

<style lang="scss" scope>
.send-assistant {
  .menu-sub {
    .menu-sub-item {
      display: inline-block;
      text-align: center;
      color: #666;
      width: 180px;
      height: 32px;
      line-height: 32px;
      cursor: pointer;
      &.active {
        background-color: #fff;
        color: #5850ff;
      }
    }
  }
  .container {
    margin-bottom: 20px;
    background: #ffffff;
    box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.1);
    padding: 20px;
    margin-top: 2px;
    &-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-bottom: 25px;
      .text {
        font-size: 14px;
        color: #999;
      }
    }
  }
}
</style>