index.vue 4.55 KB
<template>
  <div class="task-contentbox">
   <div>
      <el-form :inline="true" :model="searchForm">
        <el-form-item label="商户:">
          <el-input v-model="searchForm.name" size="small" placeholder="请输入商户名称"></el-input>
        </el-form-item>
        <el-form-item label="活动/产品:">
          <el-input v-model="searchForm.code" size="small" placeholder="请输入活动/产品名称"></el-input>
        </el-form-item>
        <el-form-item label="状态:">
          <el-select v-model="searchForm.status" size="small">
      <el-option label="全部" value=""></el-option>
      <el-option label="启用" value="0"></el-option>
      <el-option label="禁用" value="1"></el-option>
    </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="small" @click="handleSearch">查询</el-button>
          <el-button plain size="small" @click="handleReset">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="table-top">
      <div>订单列表</div>
      <el-button class="output-btn" size="small" style="margin-bottom: 20px" @click="handleEdit">添加任务</el-button>
    </div>
    <div>
      <d2-table
            ref="taskTable"
            :searchForm="searchForm"
            :getListApi="getListApi"
            :tableParams="tableParams"
            :pageConf="pageConf"
            >
              <template slot="auth-button" slot-scope="scope">
                  <el-button type="text" @click="handleEdit(scope.scope)">编辑</el-button>
                  <el-button type="text" @click="handleViewDetail(scope.scope)">任务分析</el-button>
                  <el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
                  <el-button type="text" @click="handleActive(scope.scope)">发布</el-button>
                  <el-button type="text" @click="handleInactive(scope.scope)">复制</el-button>
                  <el-button type="text" @click="handleClone(scope.scope)">克隆</el-button>
              </template>
        </d2-table>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      searchForm: {
        name: '',
        code: '',
        status: ''
      },
      // 表格参数
      tableParams: {
        // btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'data.list',
        tableOption: true,
        tableColumns: [
          {
            label: '模板名称',
            prop: 'templateName',
            width: 200
          },
          {
            label: '模板编码',
            prop: 'templateCode',
            width: 250
          },
          {
            label: '任务数',
            prop: 'taskNum'
          },
          {
            label: '总收益',
            prop: 'income'
          },
          {
            label: '使用门店',
            prop: 'merchantNumber'
          },
          {
            label: '使用活动',
            prop: 'activity',
            width: 150
          },
          {
            label: '创建人',
            prop: 'creatPerson'
          },
          {
            label: '创建时间',
            prop: 'creatTime'
          },
          {
            label: '状态',
            prop: 'status'
          }
        ]
      },
      pageConf: {
        pageSize: 'pageSize',
        pageNum: 'pageNum',
        totalCount: 'data.total'
      }
      // 获取订单列表
      // getListApi: customerApi.getOrderList
    }
  },
  methods: {
    // 搜索框搜索
    handleSearch() {
      console.log(this.searchForm)
      this.$refs.taskTable.refreshTable()
    },
    // 重置搜索框搜索
    handleReset() {
      this.searchForm = {
        name: '',
        code: '',
        status: ''
      }
      this.$nextTick(() => {
        this.$refs.taskTable.refreshTable()
      })
    },
    // 编辑
    handleEdit(scope, type) {
      if (!type) {
        this.$root.to([
          '任务中心',
          '任务平台',
          '任务管理',
          '任务模板管理',
          '*添加任务模板'
        ])
      }
      // this.$root.close('任务模板管理列表')
    },
    // 删除
    handleDelete() {},
    // 启用
    handleActive() {},
    // 禁用
    handleInactive() {},
    // 克隆
    handleClone() {},
    // 跳转查看详情
    handleViewDetail(scope) {
      console.log(scope)
      // this.$root.to(
      //   ['UBI续保', '续保', '保险渠道管理', '订单管理', '*订单管理详情'],
      //   scope.id
      // )
    }
  }
}
</script>
<style scoped>
</style>