index.vue 9.74 KB
<!--  -->
<template>
  <div style="padding: 0 10px;background-color:#f7f7f7;">
    <div class="commonActivityPage">
      <div class="acTab">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="全部" name="1" />
          <el-tab-pane label="我参与的" name="2" />
        </el-tabs>
        <el-radio-group v-model="formInline.signType" @change="signTypeChange">
          <el-radio-button :label="1">平台优惠券</el-radio-button>
          <el-radio-button :label="2">平台秒杀</el-radio-button>
          <el-radio-button :label="3">平台限时折扣</el-radio-button>
        </el-radio-group>
      </div>
      <!-- 搜索 -->
      <FixedNav
        class="toolbar"
        :height="260"
      >
        <div style="width:80%;display:flex;padding:20px 0;">
          <div class="searchItem">
            <span>活动名称:</span>
            <el-input v-model="formInline.activityName" placeholder="请输入活动名称" style="width:168px;margin-right:15px;" />
          </div>
          <div class="searchItem">
            <span>活动状态:</span>
            <el-select v-model="formInline.state" placeholder="请选择活动状态" clearable style="width:168px;margin-right:15px;">
              <el-option label="报名未开始" value="0" />
              <el-option label="报名进行中" value="1" />
              <el-option label="活动待开始" value="2" />
              <el-option label="活动进行中" value="3" />
              <el-option label="活动已结束" value="4" />
            </el-select>
          </div>
          <div class="searchItem">
            <span>审核状态:</span>
            <el-select v-model="formInline.examineState" placeholder="请选择审核状态" clearable style="width:168px;margin-right:15px;">
              <el-option label="待审核" value="0" />
              <el-option label="报名成功" value="1" />
              <el-option label="报名失败" value="2" />
            </el-select>
          </div>
        </div>
    <div>
      <el-button style="background-color: #3F9B6A;color: #fff" @click="search">查询</el-button>
      <el-button class="buttonHover"
              style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" @click="clear">重置</el-button>
    </div>
      </FixedNav>
      <!-- 表格 -->
      <div class="tableBox">
        <el-table
          ref="multipleTable"
          :data="tableData"
        :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
          tooltip-effect="dark"
        >
          <el-table-column prop="activityName" label="活动名称" show-overflow-tooltip />
          <el-table-column prop="bondMoney" label="活动保证金" show-overflow-tooltip />
          <el-table-column prop="signTime" label="报名时间" width="300" />
          <el-table-column prop="activityTime" label="活动时间" width="300" />
          <el-table-column label="活动优惠" show-overflow-tooltip>
            <template slot-scope="scope">
              <div v-if="scope.row.discountProgramme == 1">满减</div>
              <div v-if="scope.row.discountProgramme == 2">优惠券</div>
              <div>{{ scope.row.details }}</div>
            </template>
          </el-table-column>
          <el-table-column prop="activityIntroduce" label="活动简介" show-overflow-tooltip />
          <el-table-column label="活动状态" show-overflow-tooltip>
            <template slot-scope="scope">
              <span v-if="scope.row.state == 0">报名未开始</span>
              <span v-if="scope.row.state == 1">报名进行中</span>
              <span v-if="scope.row.state == 2">活动待开始</span>
              <span v-if="scope.row.state == 3">活动进行中</span>
              <span v-if="scope.row.state == 4">活动已结束</span>
            </template>
          </el-table-column>
          <el-table-column label="报名状态" show-overflow-tooltip>
            <template slot-scope="scope">
              <span v-if="scope.row.signState == 0">待审核</span>
              <span v-if="scope.row.signState == 1">报名成功</span>
              <span v-if="scope.row.signState == 2">报名失败</span>
              <span v-if="scope.row.signState == null">未报名</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" fixed="right" show-overflow-tooltip width="220">
            <template slot-scope="scope">
              <div class="btnList">
                <div
                  v-if="scope.row.operation === 1"
                 class="tableBtn greens"
                  @click="getTotal(scope.row,1)"
                >立即报名</div>
                <div
                  v-if="scope.row.operation === 2"
                 class="tableBtn greens"
                  disabled
                  @click="getTotal(scope.row,1)"
                >立即报名</div>
                <div
                  v-if="scope.row.operation === 4"
                  class="tableBtn greens"
                  @click="getTotal(scope.row,1)"
                >重新报名</div>
                <div
                  v-if="scope.row.operation === 5"
                  class="tableBtn greens"
                  @click="getTotal(scope.row,1)"
                >继续报名</div>
                <div v-if="scope.row.operation === 3" @click="goActiveData(scope.row)" class="tableBtn greens">活动数据</div>
              </div>
            </template>
          </el-table-column>
        </el-table>
        <div class="fenye">
          <el-pagination
            :current-page="formInline.page"
            :page-sizes="[10, 20, 50, 100]"
            :page-size="10"
           background
           small
           layout="prev, pager, next,total"
            :total="total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </div>
      </div>

      <el-dialog
        title="活动报名"
        :visible.sync="signVisible"
        width="80%"
        center
          custom-class="bian_css"
        :close-on-click-modal="false"
        @close="closeDialog"
      >
        <SignActivity
          ref="signActivity"
          :form="form"
          @cancel="goList"
        />
      </el-dialog>

      <el-dialog
        title="活动报名"
        :visible.sync="detailVisible"
        width="80%"
        center
          custom-class="bian_css"
        :close-on-click-modal="false"
      >
        <DataActivity
          :form="form"
          @cancel="detailVisible = false"
        />
      </el-dialog>
    </div>
  </div>
</template>

<script>
import FixedNav from '@/components/FixedNav/index.vue'
import SignActivity from '@/views/active/getActive.vue'
import DataActivity from '@/views/active/activeData.vue'

import { activityGetAll } from '@/api/active'
export default {
  components: {
    FixedNav,
    SignActivity,
    DataActivity
  },
  data() {
    return {
      activeName: '1',
      formInline: {
        type: 1, // 查询类型 1-全部 2-我参与的
        activityName: '', // 活动名称
        state: '',
        examineState: '',
        page: 1,
        pageSize: 10,
        signType: 1
      },
      total: 1,
      tableData: [],
      signVisible: false,
      form: {},
      detailVisible: false,
      active: 1
    }
  },
  mounted() {
    this.getAll(this.formInline)
  },
  methods: {
    closeDialog() {
      console.log(this.$refs.signActivity, 'this.$refs.signActivity')
      this.$refs.signActivity.reset()
    },
    goList() {
      console.log('122121212')
      this.signVisible = false
      this.getAll(this.formInline)
    },
    //
    signTypeChange() {
      this.getAll(this.formInline)
    },
    handleSizeChange(val) {
      this.formInline.pageSize = val
      this.getAll(this.formInline)
    },
    handleCurrentChange(val) {
      this.formInline.page = val
      this.getAll(this.formInline)
    },
    // 活动切换
    handleClick(tab, event) {
      this.formInline.type = parseInt(tab.name)
      if (tab.name === '2') {
        this.getAll(this.formInline)
      } else {
        this.getAll(this.formInline)
      }
    },
    // 查询
    search() {
      this.total = 1
      this.formInline.page = 1
      this.getAll(this.formInline)
    },
    // 清除
    clear() {
      this.activeName = '1'
      this.formInline = {
        activityName: '', // 活动名称
        state: '',
        examineState: '',
        page: 1,
        pageSize: 10
      }
      this.getAll(this.formInline)
    },
    // 立即报名
    getTotal(row, index) {
      this.active = 1
      this.signVisible = true
      this.form = {
        activityId: row.activityId,
        bondMoney: row.bondMoney,
        type: index,
        ifBond: row.ifBond,
        signType: row.signType
      }
    },
    // 活动数据
    goActiveData(row) {
      this.form = {
        activityName: row.activityName,
        activityId: row.activityId,
        signId: row.signId
      }
      this.detailVisible = true
    },
    // 初始化查询所有数据
    async getAll(formInline) {
      const res = await activityGetAll(formInline)
      this.tableData = res.data.list
      this.total = res.data.total
    },
    // 查看
    seeMore() {},
    // 编辑
    edit() {},
    // 删除
    del() {}
  }
}
</script>
<style lang='scss' scoped>
//@import url(); 引入公共css类
@import url("../../styles/elDialog.scss");
.commonActivityPage{
   padding: 0 20px 20px 20px;
   background-color:#fff;
   }
 .toolbar {
      display: flex;
      width: 100%;
      font-size: 14px;
      justify-content: space-between;
    }
    ::v-deep .el-pagination__total {
      position: absolute;
      left: 10px;
    }
    .fenye{
          display: flex;
          justify-content: flex-end;
    }
</style>