123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <template>
- <div class="miaoshaPage">
- <!-- 搜索 -->
- <div class="formSearch">
- <!-- 搜索条件 -->
- <el-form :inline="true" :model="query" class="demo-form-inline">
- <el-form-item label="活动名称">
- <el-input v-model="query.currencyName" maxlength="20" placeholder="请输入活动名称" />
- </el-form-item>
- <el-form-item label="活动状态">
- <el-select v-model="query.state" placeholder="请选择活动状态">
- <el-option v-for="item in activityStatusSelect" :key="item.index" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" plain @click="search">查询</el-button>
- <el-button plain @click="clear">重置</el-button>
- <el-button type="primary" plain @click="addActivity">新建活动</el-button>
- </el-form-item>
- </el-form>
- </div>
- <!-- 表格 -->
- <div class="tableBox">
- <el-table
- ref="multipleTable" :data="tableData" border
- :header-cell-style="{ background: '#EEF3FF', color: '#333333' }" tooltip-effect="dark" style="width: 100%"
- >
- <el-table-column prop="currencyName" label="活动名称" width="220" />
- <el-table-column prop="content" label="活动内容" align="center" />
- <el-table-column prop="shops" label="参与商家数" align="center" />
- <el-table-column prop="products" label="商品数量" align="center" />
- <el-table-column label="报名时间" align="center" prop="signTime">
- </el-table-column>
- <el-table-column label="活动起止时间" align="center" prop="time">
- </el-table-column>
- <el-table-column label="活动状态" align="center">
- <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 prop="createTime" label="创建时间" width="220" /> -->
- <el-table-column label="操作" align="center" show-overflow-tooltip>
- <template slot-scope="scope">
- <div class="btnList">
- <el-button type="text" @click="details(scope.row)">详情</el-button>
- <el-button v-if="scope.row.state != 4" type="text" @click="editActivity(scope.row)">编辑</el-button>
- <el-button v-if="scope.row.state != 4" type="text" @click="endActivity(scope.row)">结束</el-button>
- <el-button v-if="scope.row.state == 4" type="text" @click="delActivity(scope.row)">删除</el-button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <div class="fenye">
- <el-pagination
- :current-page="query.page" :page-sizes="[10, 20, 50, 100]" :page-size="10"
- layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- />
- </div>
- </div>
- <el-dialog
- :title="editForm ? '修改限时秒杀活动' : '新增限时秒杀活动'" :visible.sync="activityVisible" width="50%" center
- :close-on-click-modal="false"
- >
- <AddActive
- :activity-form="activityForm" :is-edit="editForm" @cancel="activityVisible = false"
- @refersh="refersh('activityVisible')"
- />
- </el-dialog>
- <el-dialog
- title="秒杀活动详情" :visible.sync="activityDetailVisible" width="74%" center
- :close-on-click-modal="false"
- @close="cleanForm('activityDetailVisible')"
- >
- <ActivityDetail :bee-data="activityForm" :activclean="activityDetailVisible" />
- </el-dialog>
- </div>
- </template>
- <script>
- import AddActive from '@/views/active/beeCoin/component/AddActive.vue'
- import ActivityDetail from '@/views/active/beeCoin/component/ActivityDetail.vue'
- // import {
- // getSeckillData,
- // endSeckillData,
- // delSeckillData
- // } from '@/api/active/active_seckill.js'
- import { getBeeList, stopBee, beeDelete } from '@/api/active/active_bee.js'
- export default {
- components: {
- AddActive,
- ActivityDetail
- },
- data() {
- return {
- query: {
- currencyName: '', // 活动名称
- // 活动状态 0-报名未开始 1-报名进行中 2-活动待开始 3-活动进行中 4-活动已结束
- state: '',
- page: 1,
- pageSize: 10
- },
- total: 1,
- tableData: [],
- activityStatusSelect: [
- {
- index: 0,
- label: '报名未开始',
- value: 0
- },
- {
- index: 1,
- label: '报名进行中',
- value: 1
- },
- {
- index: 2,
- label: '活动待开始',
- value: 2
- },
- {
- index: 3,
- label: '活动进行中',
- value: 3
- },
- {
- index: 4,
- label: '活动已结束',
- value: 4
- }
- ],
- activityVisible: false,
- editForm: 0,
- activityDetailVisible: false,
- activityForm: {
- seckillId: 0
- }
- }
- },
- created() {
- this.getAll()
- },
- methods: {
- async getAll() {
- const res = await getBeeList(this.query)
- this.tableData = res.data.list
- this.total = res.data.total
- },
- handleSizeChange(val) {
- this.query.pageSize = val
- this.getAll()
- },
- handleCurrentChange(val) {
- this.query.page = val
- this.getAll()
- },
- search() {
- this.total = 1
- this.query.page = 1
- this.getAll()
- },
- clear() {
- this.query = {
- currencyName: '', // 活动名称
- // 活动状态 0-报名未开始 1-报名进行中 2-活动待开始 3-活动进行中 4-活动已结束
- state: '',
- page: 1,
- pageSize: 10
- }
- },
- details(row) {
- this.activityForm = row
- this.activityDetailVisible = true
- },
- // 添加活动
- addActivity() {
- this.editForm = 0
- this.activityVisible = true
- },
- // 编辑活动
- editActivity(row) {
- this.editForm = 1
- this.activityForm = row
- this.activityVisible = true
- },
- async endActivity(row) {
- const res = await stopBee({ currencyId: row.currencyId })
- if (res.code === '') {
- this.$message({
- message: '结束成功',
- type: 'success'
- })
- this.getAll()
- }
- },
- async delActivity(row) {
- const res = await beeDelete(row.currencyId)
- if (res.code === '') {
- this.$message({
- message: '删除成功',
- type: 'success'
- })
- this.getAll()
- }
- },
- cleanForm(attr) {
- this[attr] = false
- // console.log(attr);
- },
- refersh(attr) {
- this[attr] = false
- this.getAll()
- this.$confirm('需到【分佣配置】—【等级分佣】进行配置活动分佣规则', '配置分佣', {
- confirmButtonText: '去配置',
- cancelButtonText: '取消'
- })
- .then(() => {
- this.$router.push({
- path: '/commissionAllocation/gradeCommission'
- })
- })
- .catch(() => {})
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .miaoshaPage {
- padding: 30px;
- .tableBox {
- .fenye {
- margin: 20px;
- }
- }
- }
- </style>
|