<template>
  <div class="ActiveData">
    <div class="head-title">
      活动数据
    </div>
    <div class="content">
      <div>
        <el-tabs v-model="msg.status" @tab-click="handleClick">
          <el-tab-pane label="全部" name="-1"></el-tab-pane>
          <el-tab-pane label="进行中" name="1"></el-tab-pane>
          <el-tab-pane label="拼团成功" name="2"></el-tab-pane>
          <el-tab-pane label="拼团失败" name="3"></el-tab-pane>
        </el-tabs>
      </div>
      <div>
        <el-form size="small" :inline="true">
            <el-form-item label="开团时间">
                <el-date-picker v-model="dateList" @change="msg.pageIndex=1,getList()" size="small" type="datetimerange"
                range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期">
                </el-date-picker>
            </el-form-item>
            <el-form-item>
                <div class="input-item">
                    <el-input @keyup.enter.native="getList" size="small" class="input-with-select" placeholder="请输入内容"
                                v-model="msg.keyword" clearable @clear='getList'>
                        <el-select v-model="msg.keyword_name" slot="prepend" placeholder="请选择">
                            <el-option :label="item.label"  v-for="(item,index) in search_list" :key="index" :value="item.value"></el-option>
                        </el-select>
                        <el-button  slot="append" icon="el-icon-search" @click="getList"></el-button>
                    </el-input>
                </div>
            </el-form-item>
        </el-form>
      </div>
      <el-table :data="tableData" v-loading="loading" border
        style="width: 100%;margin:20px 0">
        <el-table-column label="商品信息">
        </el-table-column>
        <el-table-column label="开团时间" width="250">
        </el-table-column>
        <el-table-column label="拼团信息" width="350">
        </el-table-column>
        <el-table-column label="团长信息" width="250">
        </el-table-column>
        <el-table-column label="活动状态" width="180">
        </el-table-column>
        <el-table-column label="操作" width="100">
            <el-tooltip class="item" effect="dark" content="编辑" placement="top">
              <img style="width:32px;height:32px;margin:0 10px" src="../../assets/img/userman/edit.png" alt="">
            </el-tooltip>
        </el-table-column>
      </el-table>
      <el-pagination style="text-align:right" background @current-change="handleCurrentChange" :page-size="msg.pageSize"
        layout="prev, pager, next" :current-page.sync="msg.pageIndex" :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
  export default {
    name: "ActiveData",
    data() {
      return {
        //日期数组
        dateList: [],
        msg: {
          pageIndex: 1,
          pageSize: 15,
          status:'-1', //状态
          date_start:'', //开始日期
          date_end:'',  //结束日期
          keyword_name:'', //商品名称
          keyword:'' //关键字
        },
        search_list:[], //商品名称下拉
        tableData:[],//列表数据
        total: 0,
        loading: false,
      }
    },
    created() {
      this.getList();
    },
    methods: {
      //获取数据
      getList() {
        if (this.dateList && this.dateList.length > 0) {
          this.msg.date_start = this.dateList[0];
          this.msg.date_end = this.dateList[1];
        } else {
          this.msg.date_start = '';
          this.msg.date_end = '';
        }
        // this.loading = true;
        // this.apipost("/api/GroupBuy/GetGroupbuyActivityPageList", this.msg, res => {
        //   this.loading = false;
        //   if (res.data.resultCode == 1) {
        //     this.total = res.data.data.count;
        //     let pageData = res.data.data.pageData;
        //     this.tableData = pageData;
        //   }
        // })
      },
      //切换活动状态
      handleClick(val) {
        this.msg.pageIndex = 1
        this.getList();
      },
      handleCurrentChange(val) {
        this.msg.pageIndex = val;
        this.getList();
      },
    },
  };

</script>
<style>
  .ActiveData .content {
    background: #fff;
    margin-top: 10px;
    padding: 20px;
    box-sizing: border-box;
  }
</style>
